AForge.Video
    
    
        
            
            Proxy video source for asynchronous processing of another nested video source.
            
            
            The class represents a simple proxy, which wraps the specified 
            with the aim of asynchronous processing of received video frames. The class intercepts 
            event from the nested video source and fires it to clients from its own thread, which is different from the thread
            used by nested video source for video acquisition. This allows clients to perform processing of video frames
            without blocking video acquisition thread, which continue to run and acquire next video frame while current is still
            processed.
            
            For example, let’s suppose that it takes 100 ms for the nested video source to acquire single frame, so the original
            frame rate is 10 frames per second. Also let’s assume that we have an image processing routine, which also takes
            100 ms to process a single frame. If the acquisition and processing are done sequentially, then resulting
            frame rate will drop to 5 frames per second. However, if doing both in parallel, then there is a good chance to
            keep resulting frame rate equal (or close) to the original frame rate.
            
            The class provides a bonus side effect - easer debugging of image processing routines, which are put into
             event handler. In many cases video source classes fire their 
            event from a try/catch block, which makes it very hard to spot error made in user's code - the catch block simply
            hides exception raised in user’s code. The  does not have any try/catch blocks around
            firing of  event, so always user gets exception in the case it comes from his code. At the same time
            nested video source is not affected by the user's exception, since it runs in different thread.
            
            Sample usage:
            
            // usage of AsyncVideoSource is the same as usage of any
            // other video source class, so code change is very little
            
            // create nested video source, for example JPEGStream
            JPEGStream stream = new JPEGStream( "some url" );
            // create async video source
            AsyncVideoSource asyncSource = new AsyncVideoSource( stream );
            // set NewFrame event handler
            asyncSource.NewFrame += new NewFrameEventHandler( video_NewFrame );
            // start the video source
            asyncSource.Start( );
            // ...
            
            private void video_NewFrame( object sender, NewFrameEventArgs eventArgs )
            {
                // get new frame
                Bitmap bitmap = eventArgs.Frame;
                // process the frame
            }
            
            
            
        
        
            
            New frame event.
            
            
            Notifies clients about new available frame from video source.
            
            This event is fired from a different thread other than the video acquisition thread created
            by . This allows nested video frame to continue acquisition of the next
            video frame while clients perform processing of the current video frame.
            
            Since video source may have multiple clients, each client is responsible for
            making a copy (cloning) of the passed video frame, because the video source disposes its
            own original copy after notifying of clients.
            
            
        
        
             
             Video source error event.
             
             
             This event is used to notify clients about any type of errors occurred in
             video source object, for example internal exceptions.
             
             Unlike  event, this event is simply redirected to the corresponding
             event of the , so it is fired from the thread of the nested video source.
             
            
        
        
            
            Video playing finished event.
            
            
            This event is used to notify clients that the video playing has finished.
            
            Unlike  event, this event is simply redirected to the corresponding
            event of the , so it is fired from the thread of the nested video source.
            
            
        
        
            
            Nested video source which is the target for asynchronous processing.
            
            
            The property is set through the class constructor.
            
            All calls to this object are actually redirected to the nested video source. The only
            exception is the  event, which is handled differently. This object gets
             event from the nested class and then fires another
             event, but from a different thread.
            
            
        
        
            
            Specifies if the object should skip frames from the nested video source when it is busy. 
            
            
            Specifies if the object should skip frames from the nested video source
            in the case if it is still busy processing the previous video frame in its own thread.
            
            Default value is set to .
            
        
        
            
            Video source string.
            
            
            The property is redirected to the corresponding property of ,
            so check its documentation to find what it means.
            
        
        
            
            Received frames count.
            
            
            Number of frames the nested video source received from
            the moment of the last access to the property.
            
            
        
        
             
             Received bytes count.
             
             
             Number of bytes the nested video source received from
             the moment of the last access to the property.
            
        
        
            
            Processed frames count.
            
            
            The property keeps the number of processed video frames since the last access to this property. 
            
            
            The value of this property equals to  in most cases if the
             property is set to  - every received frame gets processed
            sooner or later. However, if the  property is set to ,
            then value of this property may be lower than the value of the  property, which
            means that nested video source performs acquisition faster than client perform processing of the received frame
            and some frame are skipped from processing.
            
            
        
        
            
            State of the video source.
            
            
            Current state of the video source object - running or not.
            
        
        
            
            Initializes a new instance of the  class.
            
            
            Nested video source which is the target for asynchronous processing.
            
        
        
            
            Initializes a new instance of the  class.
            
            
            Nested video source which is the target for asynchronous processing.
            Specifies if the object should skip frames from the nested video source
            in the case if it is still busy processing the previous video frame.
            
        
        
            
            Start video source.
            
            
            Starts the nested video source and returns execution to caller. This object creates
            an extra thread which is used to fire  events, so the image processing could be
            done on another thread without blocking video acquisition thread.
            
        
        
             
             Signal video source to stop its work.
             
             
             Signals video source to stop its background thread, stop to
             provide new frames and free resources.
            
        
        
             
             Wait for video source has stopped.
             
             
             Waits for video source stopping after it was signalled to stop using
              method.
            
        
        
            
            Stop video source.
            
            
            Stops nested video source by calling its  method.
            See documentation of the particular video source for additional details.
            
        
        
            
            Some internal utilities for handling arrays.
            
            
        
        
            
            Check if the array contains needle at specified position.
            
            
            Source array to check for needle.
            Needle we are searching for.
            Start index in source array.
            
            Returns true if the source array contains the needle at
            the specified index. Otherwise it returns false.
            
        
        
            
            Find subarray in the source array.
            
            
            Source array to search for needle.
            Needle we are searching for.
            Start index in source array.
            Number of bytes in source array, where the needle is searched for.
            
            Returns starting position of the needle if it was found or -1 otherwise.
            
        
        
            
            Video related exception.
            
            
            The exception is thrown in the case of some video related issues, like
            failure of initializing codec, compression, etc.
            
        
        
            
            Initializes a new instance of the  class.
            
            
            Exception's message.
            
        
        
            
            Video source interface.
            
            
            The interface describes common methods for different type of video sources.
            
        
        
            
            New frame event.
            
            
            This event is used to notify clients about new available video frame.
            
            Since video source may have multiple clients, each client is responsible for
            making a copy (cloning) of the passed video frame, but video source is responsible for
            disposing its own original copy after notifying of clients.
            
            
        
        
            
            Video source error event.
            
            
            This event is used to notify clients about any type of errors occurred in
            video source object, for example internal exceptions.
            
        
        
            
            Video playing finished event.
            
            
            This event is used to notify clients that the video playing has finished.
            
            
        
        
            
            Video source.
            
            
            The meaning of the property depends on particular video source.
            Depending on video source it may be a file name, URL or any other string
            describing the video source.
            
        
        
            
            Received frames count.
            
            
            Number of frames the video source provided from the moment of the last
            access to the property.
            
            
        
        
            
            Received bytes count.
            
            
            Number of bytes the video source provided from the moment of the last
            access to the property.
            
            
        
        
            
            State of the video source.
            
            
            Current state of video source object - running or not.
            
        
        
            
            Start video source.
            
            
            Starts video source and return execution to caller. Video source
            object creates background thread and notifies about new frames with the
            help of  event.
            
        
        
            
            Signal video source to stop its work.
            
            
            Signals video source to stop its background thread, stop to
            provide new frames and free resources.
            
        
        
            
            Wait for video source has stopped.
            
            
            Waits for video source stopping after it was signalled to stop using
             method.
            
        
        
            
            Stop video source.
            
            
            Stops video source aborting its thread.
            
        
        
            
            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>
            
            
            
        
        
            
            New frame event.
            
            
            Notifies clients about new available frame from video source.
            
            Since video source may have multiple clients, each client is responsible for
            making a copy (cloning) of the passed video frame, because the video source disposes its
            own original copy after notifying of clients.
            
            
        
        
            
            Video source error event.
            
            
            This event is used to notify clients about any type of errors occurred in
            video source object, for example internal exceptions.
            
        
        
            
            Video playing finished event.
            
            
            This event is used to notify clients that the video playing has finished.
            
            
        
        
            
            Use or not separate connection group.
            
            
            The property indicates to open web request in separate connection group.
            
        
        
            
            Use or not caching.
            
            
            If the property is set to true, then a fake random parameter will be added
            to URL to prevent caching. It's required for clients, who are behind proxy server.
            
        
        
            
            Frame interval.
            
            
            The property sets the interval in milliseconds betwen frames. If the property is
            set to 100, then the desired frame rate will be 10 frames per second. Default value is 0 -
            get new frames as fast as possible.
            
        
        
            
            Video source.
            
            
            URL, which provides JPEG files.
            
        
        
            
            Login value.
            
            
            Login required to access video source.
            
        
        
            
            Password value.
            
            
            Password required to access video source.
            
        
        
            
            Gets or sets proxy information for the request.
            
            
            The local computer or application config file may specify that a default
            proxy to be used. If the Proxy property is specified, then the proxy settings from the Proxy
            property overridea the local computer or application config file and the instance will use
            the proxy settings specified. If no proxy is specified in a config file
            and the Proxy property is unspecified, the request uses the proxy settings
            inherited from Internet Explorer on the local computer. If there are no proxy settings
            in Internet Explorer, the request is sent directly to the server.
            
            
        
        
            
            Received frames count.
            
            
            Number of frames the video source provided from the moment of the last
            access to the property.
            
            
        
        
            
            Received bytes count.
            
            
            Number of bytes the video source provided from the moment of the last
            access to the property.
            
            
        
        
            
            Request timeout value.
            
            
            The property sets timeout value in milliseconds for web requests.
            
            Default value is set 10000 milliseconds.
            
        
        
            
            State of the video source.
            
            
            Current state of video source object - running or not.
            
        
        
            
            Force using of basic authentication when connecting to the video source.
            
            
            For some IP cameras (TrendNET IP cameras, for example) using standard .NET's authentication via credentials
            does not seem to be working (seems like camera does not request for authentication, but expects corresponding headers to be
            present on connection request). So this property allows to force basic authentication by adding required HTTP headers when
            request is sent.
            
            Default value is set to .
            
            
        
        
            
            Initializes a new instance of the  class.
            
            
        
        
            
            Initializes a new instance of the  class.
            
            
            URL, which provides JPEG files.
            
        
        
            
            Start video source.
            
            
            Starts video source and return execution to caller. Video source
            object creates background thread and notifies about new frames with the
            help of  event.
            
            Video source is not specified.
            
        
        
            
            Signal video source to stop its work.
            
            
            Signals video source to stop its background thread, stop to
            provide new frames and free resources.
            
        
        
            
            Wait for video source has stopped.
            
            
            Waits for source stopping after it was signalled to stop using
             method.
            
        
        
            
            Stop video source.
            
            
            Stops video source aborting its thread.
            
            Since the method aborts background thread, its usage is highly not preferred
            and should be done only if there are no other options. The correct way of stopping camera
            is signaling it stop and then
            waiting for background thread's completion.
            
            
        
        
            
            Free resource.
            
            
        
        
            
            MJPEG video source.
            
            
            The video source downloads JPEG images from the specified URL, which represents
            MJPEG stream.
            
            Sample usage:
            
            // create MJPEG video source
            MJPEGStream stream = new MJPEGStream( "some url" );
            // set event handlers
            stream.NewFrame += new NewFrameEventHandler( video_NewFrame );
            // start the video source
            stream.Start( );
            // ...
            
            
            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>
            
            
            
        
        
            
            New frame event.
            
            
            Notifies clients about new available frame from video source.
            
            Since video source may have multiple clients, each client is responsible for
            making a copy (cloning) of the passed video frame, because the video source disposes its
            own original copy after notifying of clients.
            
            
        
        
            
            Video source error event.
            
            
            This event is used to notify clients about any type of errors occurred in
            video source object, for example internal exceptions.
            
        
        
            
            Video playing finished event.
            
            
            This event is used to notify clients that the video playing has finished.
            
            
        
        
            
            Use or not separate connection group.
            
            
            The property indicates to open web request in separate connection group.
            
        
        
            
            Video source.
            
            
            URL, which provides MJPEG stream.
            
        
        
            
            Login value.
            
            
            Login required to access video source.
            
        
        
            
            Password value.
            
            
            Password required to access video source.
            
        
        
            
            Gets or sets proxy information for the request.
            
            
            The local computer or application config file may specify that a default
            proxy to be used. If the Proxy property is specified, then the proxy settings from the Proxy
            property overridea the local computer or application config file and the instance will use
            the proxy settings specified. If no proxy is specified in a config file
            and the Proxy property is unspecified, the request uses the proxy settings
            inherited from Internet Explorer on the local computer. If there are no proxy settings
            in Internet Explorer, the request is sent directly to the server.
            
            
        
        
            
            User agent to specify in HTTP request header.
            
            
            Some IP cameras check what is the requesting user agent and depending
            on it they provide video in different formats or do not provide it at all. The property
            sets the value of user agent string, which is sent to camera in request header.
            
            
            Default value is set to "Mozilla/5.0". If the value is set to ,
            the user agent string is not sent in request header.
            
            
        
        
            
            Received frames count.
            
            
            Number of frames the video source provided from the moment of the last
            access to the property.
            
            
        
        
            
            Received bytes count.
            
            
            Number of bytes the video source provided from the moment of the last
            access to the property.
            
            
        
        
            
            Request timeout value.
            
            
            The property sets timeout value in milliseconds for web requests.
            Default value is 10000 milliseconds.
            
        
        
            
            State of the video source.
            
            
            Current state of video source object - running or not.
            
        
        
            
            Force using of basic authentication when connecting to the video source.
            
            
            For some IP cameras (TrendNET IP cameras, for example) using standard .NET's authentication via credentials
            does not seem to be working (seems like camera does not request for authentication, but expects corresponding headers to be
            present on connection request). So this property allows to force basic authentication by adding required HTTP headers when
            request is sent.
            
            Default value is set to .
            
            
        
        
            
            Initializes a new instance of the  class.
            
            
        
        
            
            Initializes a new instance of the  class.
            
            
            URL, which provides MJPEG stream.
            
        
        
            
            Start video source.
            
            
            Starts video source and return execution to caller. Video source
            object creates background thread and notifies about new frames with the
            help of  event.
            
            Video source is not specified.
            
        
        
            
            Signal video source to stop its work.
            
            
            Signals video source to stop its background thread, stop to
            provide new frames and free resources.
            
        
        
            
            Wait for video source has stopped.
            
            
            Waits for source stopping after it was signalled to stop using
             method.
            
        
        
            
            Stop video source.
            
            
            Stops video source aborting its thread.
            
            Since the method aborts background thread, its usage is highly not preferred
            and should be done only if there are no other options. The correct way of stopping camera
            is signaling it stop and then
            waiting for background thread's completion.
            
            
        
        
            
            Free resource.
            
            
        
        
            
            Screen capture video source.
            
            
            The video source constantly captures the desktop screen.
            
            Sample usage:
            
            // get entire desktop area size
            Rectangle screenArea = Rectangle.Empty;
            foreach ( System.Windows.Forms.Screen screen in 
                      System.Windows.Forms.Screen.AllScreens )
            {
                screenArea = Rectangle.Union( screenArea, screen.Bounds );
            }
                
            // create screen capture video source
            ScreenCaptureStream stream = new ScreenCaptureStream( screenArea );
            
            // 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
            }
            
            
            
        
        
            
            New frame event.
            
            
            Notifies clients about new available frame from video source.
            
            Since video source may have multiple clients, each client is responsible for
            making a copy (cloning) of the passed video frame, because the video source disposes its
            own original copy after notifying of clients.
            
            
        
        
            
            Video source error event.
            
            
            This event is used to notify clients about any type of errors occurred in
            video source object, for example internal exceptions.
            
        
        
            
            Video playing finished event.
            
            
            This event is used to notify clients that the video playing has finished.
            
            
        
        
            
            Video source.
            
            
        
        
            
            Gets or sets the screen capture region.
            
            
            This property specifies which region (rectangle) of the screen to capture. It may cover multiple displays
            if those are available in the system.
            
            The property must be set before starting video source to have any effect.
            
            
        
        
            
            Time interval between making screen shots, ms.
            
            
            The property specifies time interval in milliseconds between consequent screen captures.
            Expected frame rate of the stream should be approximately 1000/FrameInteval.
            
            If the property is set to 0, then the stream will capture screen as fast as the system allows.
            
            Default value is set to 100.
            
            
        
        
            
            Received frames count.
            
            
            Number of frames the video source provided from the moment of the last
            access to the property.
            
            
        
        
            
            Received bytes count.
            
            
            The property is not implemented for this video source and always returns 0.
            
            
        
        
            
            State of the video source.
            
            
            Current state of video source object - running or not.
            
        
        
            
            Initializes a new instance of the  class.
            
            
            Screen's rectangle to capture (the rectangle may cover multiple displays).
            
        
        
            
            Initializes a new instance of the  class.
            
            
            Screen's rectangle to capture (the rectangle may cover multiple displays).
            Time interval between making screen shots, ms.
            
        
        
            
            Start video source.
            
            
            Starts video source and return execution to caller. Video source
            object creates background thread and notifies about new frames with the
            help of  event.
            
            Video source is not specified.
            
        
        
            
            Signal video source to stop its work.
            
            
            Signals video source to stop its background thread, stop to
            provide new frames and free resources.
            
        
        
            
            Wait for video source has stopped.
            
            
            Waits for source stopping after it was signalled to stop using
             method.
            
        
        
            
            Stop video source.
            
            
            Stops video source aborting its thread.
            
            Since the method aborts background thread, its usage is highly not preferred
            and should be done only if there are no other options. The correct way of stopping camera
            is signaling it stop and then
            waiting for background thread's completion.
            
            
        
        
            
            Free resource.
            
            
        
        
            
            Delegate for new frame event handler.
            
            
            Sender object.
            Event arguments.
            
        
        
            
            Delegate for video source error event handler.
            
            
            Sender object.
            Event arguments.
            
        
        
            
            Delegate for playing finished event handler.
            
            
            Sender object.
            Reason of finishing video playing.
            
        
        
            
            Reason of finishing video playing.
            
            
            When video source class fire the  event, they
            need to specify reason of finishing video playing. For example, it may be end of stream reached.
            
        
        
            
            Video playing has finished because it end was reached.
            
        
        
            
            Video playing has finished because it was stopped by user.
            
        
        
            
            Video playing has finished because the device was lost (unplugged).
            
        
        
            
            Video playing has finished because of some error happened the video source (camera, stream, file, etc.).
            A error reporting event usually is fired to provide error information.
            
        
        
            
            Arguments for new frame event from video source.
            
            
        
        
            
            Initializes a new instance of the  class.
            
            
            New frame.
            
        
        
            
            New frame from video source.
            
            
        
        
            
            Arguments for video source error event from video source.
            
            
        
        
            
            Initializes a new instance of the  class.
            
            
            Error description.
            
        
        
            
            Video source error description.