This documentation is for the old version. Go to the latest Graphics Mill docs

DSReader Class

This class is used to read frames from video files using DirectShow framework.

Namespace: Aurigma.GraphicsMill.Codecs
Assembly: Aurigma.GraphicsMill.Codecs.MediaProcessor (in Aurigma.GraphicsMill.Codecs.MediaProcessor.dll)

Syntax

Visual Basic
Public NotInheritable Class DSReader _
	Inherits FormatReader _
	Implements IFrameEnumerator, ITimeReader
C#
public sealed class DSReader : FormatReader, IFrameEnumerator, ITimeReader

Remarks

DirectShow opens all files that can be played with Windows Media Player plus files in several more formats. This framework is recommended to use when reading MPEG, MPEG-2 and AVI. For the list of supported file formats, see the System Requirements section of the manual.

Video files are represented as a sequence of images which are called frames. The DSReader class allows extracting frames using the LoadFrame(Int32) method. Also, the reader object can be interpreted as a collection of frames, and therefore the frames can be enumerated using the foreach statement.

A DSReader object can be used not only to read video data, but also to extract some information about the opened file. For example, you can get:

In general the reader usage workflow should be as follows:

  1. Create a DSReader instance.
  2. Open the reader using the Open(String) method.
    Note

    You cannot get any data from the reader until you open it on some file.

  3. If necessary, read the Duration and FramesPerSecond properties.
  4. Iterate through each frame in the reader using the LoadFrame(Int32) method. It will return a DSFrame class instance. To extract the image from the frame, use the GetBitmap(Bitmap) method.

    To get the total number of the frames in the reader, read the FrameCount property.

Examples

This example shows the general pattern of working with the reader.
Visual Basic
Private Sub DSReaderUsage(ByVal aPath As String)
    Dim aReader As DSReader = New DSReader(aPath)
    'Work with the reader
    aReader.Dispose()
End Sub
C#
private void DSReaderUsage(String aPath)
{
    DSReader aReader = new DSReader(aPath);
    //Work with the reader
    aReader.Dispose();
}

Inheritance Hierarchy

Thread Safety

Static members of this type are safe for multi-threaded operations. Instance members of this type are safe for multi-threaded operations.

Object Model






See Also

Reference