C# Class ScreenToGif.Webcam.DirectX.CaptureWebcam

Gets the video output of a webcam or other video device.
Inheritance: EditStreaming.ISampleGrabberCB, IDisposable
Afficher le fichier Open project: dbremner/ScreenToGif Class Usage Examples

Protected Properties

Свойство Type Description
ActualGraphState GraphState
CaptureGraphBuilder ExtendStreaming.ICaptureGraphBuilder2
GraphBuilder ExtendStreaming.IGraphBuilder
IsPreviewRendered bool
MediaControl ControlStreaming.IMediaControl
SampGrabber EditStreaming.ISampleGrabber
VideoCompressor Filter
VideoCompressorFilter CoreStreaming.IBaseFilter
VideoDeviceFilter CoreStreaming.IBaseFilter
VideoStreamConfig ExtendStreaming.IAMStreamConfig
VideoWindow ControlStreaming.IVideoWindow
WantPreviewRendered bool

Méthodes publiques

Méthode Description
BufferCB ( double SampleTime, IntPtr pBuffer, int BufferLen ) : int
CaptureWebcam ( Filter videoDevice ) : System

Default constructor of the Capture class.

Dispose ( ) : void

Closes and cleans the video previewing.

GetFrame ( ) : Bitmap

Gets the current frame from the buffer.

PrepareCapture ( ) : void

Prepares the capture of frames.

SampleCB ( double SampleTime, CoreStreaming pSample ) : int
StartPreview ( ) : void

Starts the video preview from the video source.

StopPreview ( ) : void

Stops the video previewing.

Méthodes protégées

Méthode Description
CreateGraph ( ) : void

Create a new filter graph and add filters (devices, compressors, misc), but leave the filters unconnected. Call RenderGraph() to connect the filters.

DerenderGraph ( ) : void

Disconnect and remove all filters except the device and compressor filters. This is the opposite of renderGraph(). Soem properties such as FrameRate can only be set when the device output pins are not connected.

DestroyGraph ( ) : void

Completely tear down a filter graph and release all associated resources.

OnPreviewWindowResize ( object sender, EventArgs e ) : void

Resize the preview when the PreviewWindow is resized

RemoveDownstream ( CoreStreaming filter, bool removeFirstFilter ) : void

Removes all filters downstream from a filter from the graph. This is called only by DerenderGraph() to remove everything from the graph except the devices and compressors. The parameter "removeFirstFilter" is used to keep a compressor (that should be immediately downstream of the device) if one is begin used.

RenderGraph ( ) : void

Connects the filters of a previously created graph (created by CreateGraph()). Once rendered the graph is ready to be used. This method may also destroy streams if we have streams we no longer want.

StartPreviewIfNeeded ( ) : void

Setup and start the preview window if the user has requested it (by setting PreviewWindow).

Method Details

BufferCB() public méthode

public BufferCB ( double SampleTime, IntPtr pBuffer, int BufferLen ) : int
SampleTime double
pBuffer System.IntPtr
BufferLen int
Résultat int

CaptureWebcam() public méthode

Default constructor of the Capture class.
If no video device is provided.
public CaptureWebcam ( Filter videoDevice ) : System
videoDevice Filter The video device to be the source.
Résultat System

CreateGraph() protected méthode

Create a new filter graph and add filters (devices, compressors, misc), but leave the filters unconnected. Call RenderGraph() to connect the filters.
protected CreateGraph ( ) : void
Résultat void

DerenderGraph() protected méthode

Disconnect and remove all filters except the device and compressor filters. This is the opposite of renderGraph(). Soem properties such as FrameRate can only be set when the device output pins are not connected.
protected DerenderGraph ( ) : void
Résultat void

DestroyGraph() protected méthode

Completely tear down a filter graph and release all associated resources.
protected DestroyGraph ( ) : void
Résultat void

Dispose() public méthode

Closes and cleans the video previewing.
public Dispose ( ) : void
Résultat void

GetFrame() public méthode

Gets the current frame from the buffer.
public GetFrame ( ) : Bitmap
Résultat System.Drawing.Bitmap

OnPreviewWindowResize() protected méthode

Resize the preview when the PreviewWindow is resized
protected OnPreviewWindowResize ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
Résultat void

PrepareCapture() public méthode

Prepares the capture of frames.
public PrepareCapture ( ) : void
Résultat void

RemoveDownstream() protected méthode

Removes all filters downstream from a filter from the graph. This is called only by DerenderGraph() to remove everything from the graph except the devices and compressors. The parameter "removeFirstFilter" is used to keep a compressor (that should be immediately downstream of the device) if one is begin used.
protected RemoveDownstream ( CoreStreaming filter, bool removeFirstFilter ) : void
filter CoreStreaming
removeFirstFilter bool
Résultat void

RenderGraph() protected méthode

Connects the filters of a previously created graph (created by CreateGraph()). Once rendered the graph is ready to be used. This method may also destroy streams if we have streams we no longer want.
protected RenderGraph ( ) : void
Résultat void

SampleCB() public méthode

public SampleCB ( double SampleTime, CoreStreaming pSample ) : int
SampleTime double
pSample CoreStreaming
Résultat int

StartPreview() public méthode

Starts the video preview from the video source.
public StartPreview ( ) : void
Résultat void

StartPreviewIfNeeded() protected méthode

Setup and start the preview window if the user has requested it (by setting PreviewWindow).
protected StartPreviewIfNeeded ( ) : void
Résultat void

StopPreview() public méthode

Stops the video previewing.
public StopPreview ( ) : void
Résultat void

Property Details

ActualGraphState protected_oe property

State of the internal filter graph.
protected GraphState ActualGraphState
Résultat GraphState

CaptureGraphBuilder protected_oe property

DShow Filter: building graphs for capturing video.
protected ExtendStreaming.ICaptureGraphBuilder2 CaptureGraphBuilder
Résultat ExtendStreaming.ICaptureGraphBuilder2

GraphBuilder protected_oe property

DShow Filter: Graph builder.
protected ExtendStreaming.IGraphBuilder GraphBuilder
Résultat ExtendStreaming.IGraphBuilder

IsPreviewRendered protected_oe property

When graphState==Rendered, have we rendered the preview stream?
protected bool IsPreviewRendered
Résultat bool

MediaControl protected_oe property

DShow Filter: Start/Stop the filter graph -> copy of graphBuilder.
protected ControlStreaming.IMediaControl MediaControl
Résultat ControlStreaming.IMediaControl

SampGrabber protected_oe property

protected EditStreaming.ISampleGrabber SampGrabber
Résultat EditStreaming.ISampleGrabber

VideoCompressor protected_oe property

Property Backer: Video compression filter.
protected Filter,ScreenToGif.Webcam.DirectX VideoCompressor
Résultat Filter

VideoCompressorFilter protected_oe property

DShow Filter: selected video compressor.
protected CoreStreaming.IBaseFilter VideoCompressorFilter
Résultat CoreStreaming.IBaseFilter

VideoDeviceFilter protected_oe property

DShow Filter: selected video device.
protected CoreStreaming.IBaseFilter VideoDeviceFilter
Résultat CoreStreaming.IBaseFilter

VideoStreamConfig protected_oe property

DShow Filter: configure frame rate, size.
protected ExtendStreaming.IAMStreamConfig VideoStreamConfig
Résultat ExtendStreaming.IAMStreamConfig

VideoWindow protected_oe property

DShow Filter: Control preview window -> copy of graphBuilder.
protected ControlStreaming.IVideoWindow VideoWindow
Résultat ControlStreaming.IVideoWindow

WantPreviewRendered protected_oe property

Do we need the preview stream rendered (VideoDevice and PreviewWindow != null)
protected bool WantPreviewRendered
Résultat bool