媒体结构(AM_MEDIA_TYPE structure)摘自MSDN

The AM_MEDIA_TYPE structure describes the format of a media sample.

  • 头文件
HeaderStrmif.h (include Dshow.h)
  • Syntax
typedef struct _MediaType {
      GUID     majortype;
      GUID     subtype;
      BOOL     bFixedSizeSamples;
      BOOL     bTemporalCompression;
      ULONG    lSampleSize;
      GUID     formattype;
      IUnknown *pUnk;
      ULONG    cbFormat;
      BYTE     *pbFormat;
    } AM_MEDIA_TYPE;

  • Members
    • majortype
      主类型:Globally unique identifier (GUID) that specifies the major type of the media sample.
    • subtype
      辅助说明类型:GUID that specifies the subtype of the media sample.For some formats, the value might be MEDIASUBTYPE_None, which means the format does not require a subtype.
    • bFixedSizeSamples (可选参数)
      If TRUE, samples are of a fixed size. This field is informational only. For audio, it is generally set to TRUE. For video, it is usually TRUE for uncompressed video and FALSE for compressed video.
    • bTemporalCompression (可选参数)
      If TRUE, samples are compressed using temporal (interframe) compression. A value of TRUE indicates that not all frames are key frames. This field is informational only.
    • lSampleSize (可选参数)
      Size of the sample in bytes. For compressed data, the value can be zero.
    • formattype
      GUID that specifies the structure used for the format block. The pbFormat member points to the corresponding format structure. Format types include the following:
    • pUnk (未用)Set to NULL.
    • cbFormat
      Size of the format block, in bytes.
    • pbFormat
      Pointer to the format block. The structure type is specified by the formattype member. The format structure must be present, unless formattype is GUID_NULL or FORMAT_None.The pbFormat buffer must be allocated by calling CoTaskMemAlloc. To release the format block, call FreeMediaType.

majortype
MEDIATYPE_Video纯视频(数字)
MEDIATYPE_Audio纯音频(数字)
MEDIATYPE_AnalogVideo模拟视频,一般是视频采集卡输入的数据类型
MEDIATYPE_AnalogAudio模拟音频,一般是声卡采集输入的数据类型
MEDIATYPE_Text文字
MEDIATYPE_MidiMidi音乐
MEDIATYPE_Stream字节流,如(Pull模式)文件源的输出数据类型

subtype
MEDIASUBTYPE_YUY2各种YUV格式
MEDIASUBTYPE_YVYU
MEDIASUBTYPE_YUYV
MEDIASUBTYPE_UYVY
MEDIASUBTYPE_YVU9
MEDIASUBTYPE_Y411
MEDIASUBTYPE_RGB4各种RGB模式
MEDIASUBTYPE_RGB4
MEDIASUBTYPE_RGB8
MEDIASUBTYPE_RGB565
MEDIASUBTYPE_RGB555
MEDIASUBTYPE_RGB24
MEDIASUBTYPE_RGB32

Format typeFormat structure
FORMAT_DvInfoDVINFO
FORMAT_MPEG2VideoMPEG2VIDEOINFO
FORMAT_MPEGStreamsAM_MPEGSYSTEMTYPE
FORMAT_MPEGVideoMPEG1VIDEOINFO
FORMAT_NoneNone.
FORMAT_VideoInfoVIDEOINFOHEADER
FORMAT_VideoInfo2VIDEOINFOHEADER2
FORMAT_WaveFormatExWAVEFORMATEX
GUID_NULLNone

//directshow指南
当使用一个AM_MEDIA_TYPE数据结构描述媒体类型时,如果majortype、subtype和formattype都指定了一个特定的GUID值,那么称这种媒体类型为“完全指定的媒体类型”;这3个部分只要有一个指定为GUID_NULL,则称为“不完全指定的媒体类型”。GUID_NULL具有通配符的作用。
另外,为了方便使用,DirectShow提供了另一个C++类CMediaType(mtype.cpp)来操作媒体类型。该类从AM_MEDIA_TYPE数据结构中public派生出来。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值