You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.1 KiB
55 lines
1.1 KiB
2 years ago
|
using UnityEngine;
|
||
|
using UnityEngine.UI;
|
||
|
|
||
|
namespace FFmpeg.Demo
|
||
|
{
|
||
|
public class CompressView : MonoBehaviour
|
||
|
{
|
||
|
CompressionData config = new CompressionData();
|
||
|
public InputField crfField;
|
||
|
public Slider amountSlider;
|
||
|
const int MIN_CRF = 0;
|
||
|
const int MAX_CRF = 51;
|
||
|
|
||
|
//------------------------------
|
||
|
|
||
|
public void Open()
|
||
|
{
|
||
|
gameObject.SetActive(true);
|
||
|
}
|
||
|
|
||
|
//------------------------------
|
||
|
|
||
|
public void OnInputPath(string fullPath)
|
||
|
{
|
||
|
config.inputPath = fullPath;
|
||
|
}
|
||
|
|
||
|
public void OnCRF(string crf)
|
||
|
{
|
||
|
config.crf = int.Parse(crf);
|
||
|
amountSlider.value = (float)config.crf / MAX_CRF;
|
||
|
}
|
||
|
|
||
|
public void OnOutputPath(string fullPath)
|
||
|
{
|
||
|
config.outputPath = fullPath;
|
||
|
}
|
||
|
|
||
|
public void OnAmount(float amount)
|
||
|
{
|
||
|
config.crf = (int)Mathf.Lerp(MIN_CRF, MAX_CRF, amount);
|
||
|
crfField.text = config.crf.ToString();
|
||
|
}
|
||
|
|
||
|
//------------------------------
|
||
|
|
||
|
public void OnCompress()
|
||
|
{
|
||
|
FFmpegCommands.Compress(config);
|
||
|
gameObject.SetActive(false);
|
||
|
}
|
||
|
|
||
|
//------------------------------
|
||
|
}
|
||
|
}
|