Пример #1
0
 protected override DirectShow.Binding.IGraph Open(Uri.Locator name)
 {
     Graph.Live result = null;
     if (name.Scheme == "directshow+capture" && name.Authority.NotNull() && name.Query.NotNull() && name.Query["video"].NotNull())
     {
         string filename = name.Query["video"];
         result          = new Graph.Live();
         result.Recorder = new DirectShow.Binding.Graph();
         if (result.Recorder.Open(new DirectShow.Binding.Filters.Capture.All(name.Authority, new DirectShow.Binding.Filters.SampleGrabber.Yuyv(new Filters.Encoder.Mpeg2(new Filters.Multiplexer.Mpeg2(new DirectShow.Binding.Filters.File.Sink(filename)))))))
         {
             result.Recorder.Play();
             System.Threading.Thread.Sleep(2000);
             bool built = result.Open(new Filters.IO.Reader(filename, new Filters.Demultiplexer.Mpeg2(new Filters.Decoder.Mpeg2(new DirectShow.Binding.Filters.SampleGrabber.All())
             {
                 Output = -1
             })));
             if (built)
             {
                 System.Threading.Thread.Sleep(1000);
                 result.Play();
             }
             else
             {
                 result.Close();
                 result = null;
             }
         }
         else
         {
             result.Close();
             result = null;
         }
     }
     return(result as DirectShow.Binding.IGraph);
 }
Пример #2
0
		protected override DirectShow.Binding.IGraph Open(Uri.Locator name)
		{
			Graph.Live result = null;
			if (name.Scheme == "directshow+capture" && name.Authority.NotNull() && name.Query.NotNull() && name.Query["video"].NotNull())
			{
				string filename = name.Query["video"];
				result = new Graph.Live();
				result.Recorder = new DirectShow.Binding.Graph();
				if (result.Recorder.Open(new DirectShow.Binding.Filters.Capture.All(name.Authority, new DirectShow.Binding.Filters.SampleGrabber.Yuyv(new Filters.Encoder.Mpeg2(new Filters.Multiplexer.Mpeg2(new DirectShow.Binding.Filters.File.Sink(filename)))))))
				{
					result.Recorder.Play();
					System.Threading.Thread.Sleep(2000);
					bool built = result.Open(new Filters.IO.Reader(filename, new Filters.Demultiplexer.Mpeg2(new Filters.Decoder.Mpeg2(new DirectShow.Binding.Filters.SampleGrabber.All()) { Output = -1 })));
					if (built)
					{
						System.Threading.Thread.Sleep(1000);
						result.Play();
					}
					else
					{
						result.Close();
						result = null;
					}
				}
				else
				{
					result.Close();
					result = null;
				}
			}
			return result as DirectShow.Binding.IGraph;
		}