JPEG video source.

The video source constantly downloads JPEG files from the specified URL.

Sample usage:

// create JPEG video source JPEGStream stream = new JPEGStream( "some url" ); // set NewFrame event handler stream.NewFrame += new NewFrameEventHandler( video_NewFrame ); // start the video source stream.Start( ); // ... // signal to stop stream.SignalToStop( ); // ... private void video_NewFrame( object sender, NewFrameEventArgs eventArgs ) { // get new frame Bitmap bitmap = eventArgs.Frame; // process the frame }

Some cameras produce HTTP header, which does not conform strictly to standard, what leads to .NET exception. To avoid this exception the useUnsafeHeaderParsing configuration option of httpWebRequest should be set, what may be done using application configuration file.

<configuration> <system.net> <settings> <httpWebRequest useUnsafeHeaderParsing="true" /> </settings> </system.net> </configuration>
Inheritance: IVideoSource
Example #1
0
        // Open JPEG URL
        private void openJPEGURLToolStripMenuItem_Click(object sender, EventArgs e)
        {
            URLForm form = new URLForm();

            form.Description = "Enter URL of an updating JPEG from a web camera:";
            form.URLs = new string[]
			{
				"http://195.243.185.195/axis-cgi/jpg/image.cgi?camera=1",
			};

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                // create video source
                JPEGStream jpegSource = new JPEGStream(form.URL);

                // open it
                OpenVideoSource(jpegSource);
            }
        }