共用方式為


IMediaDet Interface

 
Microsoft DirectShow 9.0

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 individual 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 MediaDet object by calling CoCreateInstance. The class ID is CLSID_MediaDet.
  2. Call IMediaDet::put_Filename to specify the name of the source file.
  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:

To retrieve a video frame, call IMediaDet::GetBitmapBits or IMediaDet::WriteBitmapBits. The returned frame is always in 24-bit RGB format.

  • Note   Do not use the same MediaDet object with multiple files. To get information or video frames from more than one file, use separate MediaDet instances.

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. Also, the IMediaDet interface ignores any streams in the file that are not video or audio. For example, if the file contains an audio stream, a data stream, and a video stream, the get_OutputStreams method will report only two streams (the audio and video).

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 audio and video 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 video 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 video frame at the specified media time and writes it to a file.

Requirements

Header: Include Qedit.h. This header file is not compatible with Microsoft® Direct3D® headers later than version 7.

Library: Use strmiids.lib.