/// <summary> /// Start parsing. WARNING: this blocks until the stream is disconnected or end stream:stream is received. /// </summary> public void Start() { try { IXmlReader reader = new AElfred.SaxDriver(); reader.SetFeature(Constants.NamespacesFeature, true); reader.SetFeature(AElfred.SaxDriver.FEATURE + "external-parameter-entities", false); reader.SetFeature(AElfred.SaxDriver.FEATURE + "external-general-entities", false); reader.ErrorHandler = this; reader.ContentHandler = this; InputSource inSource = new StreamInputSource(m_stream); inSource.Encoding = "UTF-8"; reader.Parse(inSource); } catch (Exception e) { FireOnError(e); } }
static void Main(string[] args) { if (!Directory.Exists("frames")) { Directory.CreateDirectory("frames"); } //var inputSource = new WebcamInputSource("Microsoft® LifeCam HD-3000"); //var inputSource = new FileInputSource("myvideo.mp4"); var inputSource = new StreamInputSource("rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov"); var cancellationTokenSource = new CancellationTokenSource(); _ = Task.Run(async() => await StartStreamProcessingAsync(inputSource, cancellationTokenSource.Token)); Console.WriteLine("Press any key for stop"); Console.ReadKey(); cancellationTokenSource.Cancel(); Console.WriteLine("Press any key for quit"); Console.ReadKey(); }
static void Main(string[] args) { if (!Directory.Exists("frames")) { Directory.CreateDirectory("frames"); } //var inputSource = new WebcamInputSource("Microsoft® LifeCam HD-3000"); var inputSource = new StreamInputSource("rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov"); var cancellationTokenSource = new CancellationTokenSource(); var client = new VideoStreamClient(); client.NewImageReceived += NewImageReceived; var task = client.StartFrameReaderAsync(inputSource, OutputImageFormat.Bmp, cancellationTokenSource.Token); Console.WriteLine("Video Stream Frame handling started"); Task.WaitAll(task); client.NewImageReceived -= NewImageReceived; cancellationTokenSource.Cancel(); Console.WriteLine("Video Stream Frame handling stopped"); Console.ReadLine(); }