示例#1
0
 private void CloseOutput(FractionUInt32?averageFrameRate, bool disposing)
 {
     if (_videoWriter != null)
     {
         _videoWriter.Finish(averageFrameRate ?? new FractionUInt32(25, 1));
         if (disposing && _videoWriter.Path != null)
         {
             try { File.Delete(_videoWriter.Path); }
             catch { }
         }
         _videoWriter = null;
     }
     if (_audioWriter != null)
     {
         _audioWriter.Finish();
         if (disposing && _audioWriter.Path != null)
         {
             try { File.Delete(_audioWriter.Path); }
             catch { }
         }
         _audioWriter = null;
     }
     if (_timeCodeWriter != null)
     {
         _timeCodeWriter.Finish();
         if (disposing && _timeCodeWriter.Path != null)
         {
             try { File.Delete(_timeCodeWriter.Path); }
             catch { }
         }
         _timeCodeWriter = null;
     }
 }
示例#2
0
        private async Task CloseOutput(bool disposing)
        {
            if (_audioWriter != null)
            {
                var isFinish = await _audioWriter.Finish();

                if (disposing && (_audioWriter.FileName != null))
                {
                    try
                    {
                        if (_fs != null)
                        {
                            _fs.Dispose();
                            _fs = null;
                        }
                    }
                    catch { }
                }
                _audioWriter = null;
            }
        }