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;
 }
示例#4
0
 public void CloseFile()
 {
     threadQ.Add(new Object());             // acts as stop message
     workerT.Join();
     if (currSegment != null)
     {
         currSegment.Dispose();
     }
     currSegment = null;
 }
示例#5
0
        /// <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);
        }
示例#6
0
        /// <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);
        }
示例#7
0
		/// <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;
		}
示例#8
0
		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();
			}
		}
示例#9
0
		public void CloseFile()
		{
			threadQ.Add(new Object()); // acts as stop message
			workerT.Join();
			if (currSegment != null)
				currSegment.Dispose();
			currSegment = null;
		}