private void Segment() { if (!IsOpen) { return; } if (_currSegment == null) { StartRecording(); } else { _currSegment.Dispose(); } _currSegment = new AviWriterSegment(); _nameProvider.MoveNext(); _currSegment.OpenFile(_nameProvider.Current, _parameters, _currVideoCodecToken); try { _currSegment.OpenStreams(); } catch // will automatically try again with 32 bit { _currSegment.OpenStreams(); } }
/// <summary> /// Acquires a video codec configuration from the user. you may save it for future use, but you must dispose of it when you're done with it. /// returns null if the user canceled the dialog /// </summary> public IDisposable AcquireVideoCodecToken(IDialogParent parent, Config config) { var tempParams = new Parameters { height = 256, width = 256, fps = 60, fps_scale = 1, a_bits = 16, a_samplerate = 44100, a_channels = 2 }; var temp = new AviWriterSegment(); string tempfile = Path.GetTempFileName(); File.Delete(tempfile); tempfile = Path.ChangeExtension(tempfile, "avi"); temp.OpenFile(tempfile, tempParams, null); var ret = temp.AcquireVideoCodecToken(parent.SelfAsHandle.Handle, _currVideoCodecToken); CodecToken token = (CodecToken)ret; config.AviCodecToken = token?.Serialize(); temp.CloseFile(); File.Delete(tempfile); return(token); }
public void CloseFile() { _threadQ.Add(new object()); // acts as stop message _workerT.Join(); _currSegment?.Dispose(); _currSegment = null; }
public void CloseFile() { threadQ.Add(new Object()); // acts as stop message workerT.Join(); if (currSegment != null) { currSegment.Dispose(); } currSegment = null; }
/// <summary> /// Acquires a video codec configuration from the user. you may save it for future use, but you must dispose of it when youre done with it. /// returns null if the user canceled the dialog /// </summary> public IDisposable AcquireVideoCodecToken(System.Windows.Forms.IWin32Window hwnd) //, CodecToken lastToken) { var temp_params = new Parameters(); temp_params.height = 256; temp_params.width = 256; temp_params.fps = 60; temp_params.fps_scale = 1; temp_params.a_bits = 16; temp_params.a_samplerate = 44100; temp_params.a_channels = 2; var temp = new AviWriterSegment(); string tempfile = Path.GetTempFileName(); File.Delete(tempfile); tempfile = Path.ChangeExtension(tempfile, "avi"); temp.OpenFile(tempfile, temp_params, null); //lastToken); CodecToken token = (CodecToken)temp.AcquireVideoCodecToken(hwnd.Handle); temp.CloseFile(); File.Delete(tempfile); return(token); }
/// <summary> /// Acquires a video codec configuration from the user. you may save it for future use, but you must dispose of it when you're done with it. /// returns null if the user canceled the dialog /// </summary> public IDisposable AcquireVideoCodecToken(IWin32Window hwnd) { var tempParams = new Parameters { height = 256, width = 256, fps = 60, fps_scale = 1, a_bits = 16, a_samplerate = 44100, a_channels = 2 }; var temp = new AviWriterSegment(); string tempfile = Path.GetTempFileName(); File.Delete(tempfile); tempfile = Path.ChangeExtension(tempfile, "avi"); temp.OpenFile(tempfile, tempParams, null); CodecToken token = (CodecToken)temp.AcquireVideoCodecToken(hwnd.Handle, _currVideoCodecToken); temp.CloseFile(); File.Delete(tempfile); return(token); }
/// <summary> /// Acquires a video codec configuration from the user. you may save it for future use, but you must dispose of it when youre done with it. /// returns null if the user canceled the dialog /// </summary> public IDisposable AcquireVideoCodecToken(System.Windows.Forms.IWin32Window hwnd) //, CodecToken lastToken) { var temp_params = new Parameters(); temp_params.height = 256; temp_params.width = 256; temp_params.fps = 60; temp_params.fps_scale = 1; temp_params.a_bits = 16; temp_params.a_samplerate = 44100; temp_params.a_channels = 2; var temp = new AviWriterSegment(); string tempfile = Path.GetTempFileName(); File.Delete(tempfile); tempfile = Path.ChangeExtension(tempfile, "avi"); temp.OpenFile(tempfile, temp_params, null); //lastToken); CodecToken token = (CodecToken)temp.AcquireVideoCodecToken(hwnd.Handle); temp.CloseFile(); File.Delete(tempfile); return token; }
void Segment() { if (!IsOpen) return; if (currSegment == null) StartRecording(); else currSegment.Dispose(); currSegment = new AviWriterSegment(); nameProvider.MoveNext(); currSegment.OpenFile(nameProvider.Current, parameters, currVideoCodecToken); try { currSegment.OpenStreams(); } catch // will automatically try again with 32 bit { currSegment.OpenStreams(); } }
public void CloseFile() { threadQ.Add(new Object()); // acts as stop message workerT.Join(); if (currSegment != null) currSegment.Dispose(); currSegment = null; }