Microsoft DirectX 8.1 (C++)

IMediaDet Interface

The IMediaDet interface retrieves information about a media file, such as the number of streams, and the media type, duration, and frame rate of each stream. It also contains methods for retrieving poster frames from a video stream.

The Media Detector (MediaDet) object exposes this interface.

To obtain information about a file using this interface, perform the following steps:

  1. Create an instance of the Media Detector by calling CoCreateInstance. The class ID is CLSID_MediaDet.
  2. Call IMediaDet::put_Filename to specify the name of the source file. (Alternatively, call IMediaDet::put_Filter.)
  3. Call IMediaDet::get_OutputStreams to obtain the number of output streams in the source.
  4. Call IMediaDet::put_CurrentStream to specify a particular stream.
  5. Call any of the following methods: IMediaDet::get_StreamType, IMediaDet::get_StreamMediaType, IMediaDet::get_StreamLength, or IMediaDet::get_FrameRate.

To retrieve poster frames, call IMediaDet::GetBitmapBits or IMediaDet::WriteBitmapBits. Alternatively, call IMediaDet::EnterBitmapGrabMode and then IMediaDet::GetSampleGrabber to obtain a pointer to the ISampleGrabber interface. All three of these methods put the media detector into a new mode, called bitmap grab mode. The informational methods described previously do not work in this mode. Therefore, obtain any information you need before retrieving poster frames, or else create new instances of the media detector for each stream.

The IMediaDet interface does not support VIDEOINFOHEADER2 formats, so you cannot use this interface to get interlaced fields or information about interlacing. Also, if the upstream decoder supports only VIDEOINFOHEADER2, you cannot use IMediaDet. This might be the case with an MPEG-2 decoder, for example.

Requirements

Requires Qedit.h.

In addition to the methods inherited from IUnknown, the IMediaDet interface exposes the following methods.

Method Description
EnterBitmapGrabMode Switches the media detector to bitmap grab mode and seeks the filter graph to a specified time.
get_CurrentStream Retrieves the stream number currently used by the media detector.
get_Filename Retrieves the name of the source file currently used by the media detector.
get_Filter Retrieves a pointer to the source filter currently used by the media detector.
get_FrameRate Retrieves the frame rate of the current stream.
get_OutputStreams Retrieves the number of output streams contained in the media source.
get_StreamLength Retrieves the duration of the current stream.
get_StreamMediaType Retrieves the media type of the current stream.
get_StreamType Retrieves the globally unique identifier (GUID) for the media type of the current stream.
get_StreamTypeB Retrieves a string representing the GUID of the media type for the current stream.
GetBitmapBits Retrieves a poster frame at the specified media time.
GetSampleGrabber Retrieves a pointer to the ISampleGrabber interface.
put_CurrentStream Specifies the stream number for the media detector to use.
put_Filename Specifies the name of the source file for the media detector to use.
put_Filter Specifies a source filter for the media detector to use.
WriteBitmapBits Retrieves a poster frame at the specified media time and writes it to a file.