Beispiel #1
0
 private void OnApplicationQuit()
 {
     if (_encoder == null)
     {
         return;
     }
     _encoder.Reset();
     _encoder = null;
 }
Beispiel #2
0
 private void OnDisable()
 {
     if (_encoder == null)
     {
         return;
     }
     _encoder.Reset();
     _encoder = null;
 }
Beispiel #3
0
    private void OnApplicationQuit()
    {
        _rawFrames.Clear();
        _insertFrames.Clear();
#if !UNITY_EDITOR
        insertFrames.ForEach(DestroyImmediate);
#endif
        insertFrames.Clear();
        if (_encoder == null)
        {
            return;
        }
        _encoder.Reset();
        _encoder = null;
    }
Beispiel #4
0
 public IObservable <string> GetGifAsFile(string filePath, bool debug = false)
 {
     if (_rawFrames.Count != 0)
     {
         return(Observable.Start(() =>
         {
             var gifFrames = ReorderFrames(_rawFrames);
             var qVal = (float)quality;
             var q = Mathf.RoundToInt(qVal.FromTo(1, 100, 30, 1));
             _encoder = new RGifEncoder(repeat ? 0 : -1, q, gifFrames, targetFps, chunkSize, width, height);
             return RGifEncoder.SaveToFile(_encoder.GetGifStream(debug), filePath)
             .DoOnTerminate(() => _encoder.Reset())
             .DoOnError(err =>
             {
                 Debug.Log(err);
                 _encoder.Reset();
             }).DoOnCancel(() => _encoder.Reset())
             .DoOnCompleted(() => _encoder.Reset());
         }, Scheduler.ThreadPool).Merge());
     }
     Debug.LogError("cannot process if frame count 0");
     throw new Exception("cannot process if frame count 0");
 }