Exemplo n.º 1
0
 protected override DirectShow.Binding.IGraph Open(Uri.Locator locator)
 {
     Timeshift.Graph.NonLive result = null;
     if (locator.Scheme == "elecard+udp" && locator.Query["video"].NotNull())
     {
         string filename = locator.Query["video"];
         locator        = locator.Copy();
         locator.Scheme = "udp";
         locator.Query.Remove("video");
         result          = new Graph.NonLive();
         result.Recorder = new DirectShow.Binding.Graph();
         if (result.Recorder.Open(new Filters.Net.SourcePlus(locator, new Filters.File.Sink(filename))))
         {
             result.Recorder.Play();
             System.Threading.Thread.Sleep(1000);
             DirectShow.Binding.Filters.SampleGrabber.All samplegrabber = new DirectShow.Binding.Filters.SampleGrabber.All()
             {
                 FuzzyMatch = this.Fuzzy
             };
             bool built = result.Open(new Filters.File.Source(filename, new Filters.Demultiplexer.Mpeg(new Filters.Decoder.All(samplegrabber))
             {
                 Output = 0
             })) ||
                          result.Open(new Filters.File.Source(filename, new Filters.Demultiplexer.Mpeg(new Filters.Decoder.All(samplegrabber))
             {
                 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);
 }
Exemplo n.º 2
0
		protected override DirectShow.Binding.IGraph Open(Uri.Locator locator)
		{
			Timeshift.Graph.NonLive result = null;
			if (locator.Scheme == "elecard+udp" && locator.Query["video"].NotNull())
			{
				string filename = locator.Query["video"];
				locator = locator.Copy();
				locator.Scheme = "udp";
				locator.Query.Remove("video");
				result = new Graph.NonLive();
				result.Recorder = new DirectShow.Binding.Graph();
				if (result.Recorder.Open(new Filters.Net.SourcePlus(locator, new Filters.File.Sink(filename))))
				{
					result.Recorder.Play();
					System.Threading.Thread.Sleep(1000);
					DirectShow.Binding.Filters.SampleGrabber.All samplegrabber = new DirectShow.Binding.Filters.SampleGrabber.All() { FuzzyMatch = this.Fuzzy };
					bool built = result.Open(new Filters.File.Source(filename, new Filters.Demultiplexer.Mpeg(new Filters.Decoder.All(samplegrabber)) { Output = 0 })) ||
					 result.Open(new Filters.File.Source(filename, new Filters.Demultiplexer.Mpeg(new Filters.Decoder.All(samplegrabber)) { 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;
		}