This section describes the Microsoft® DirectShow™ structures.
Structure | Description |
ALLOCATOR_PROPERTIES | Contains the allocator's count, size, alignment, and prefix properties. |
AM_DVD_RENDERSTATUS | Provides status (failure) codes for IDvdGraphBuilder::RenderDvdVideoVolume. |
AM_MEDIA_TYPE | Describes a media sample type. |
AM_SAMPLE2_PROPERTIES | Generic media sample properties structure. |
AMOVIESETUP_FILTER | Contains filter information for registering a filter. |
AMOVIESETUP_MEDIATYPE | Contains media type information for registering a filter. |
AMOVIESETUP_PIN | Contains pin information for registering a filter. |
AM_STREAM_INFO | Contains information about start and stop commands given a pin through the IAMStreamControl interface. |
AMVPDATAINFO | Specifies the data specific characteristics of the VP input stream. |
AMVPDIMINFO | Specifies the dimensional characteristics of the VP input stream. |
AMVPSIZE | Specifies the width and height for a VP image. |
DVD_ATR | DVD attributes. |
DVD_TIMECODE | DVD timecode in hours, minutes, seconds, and frames. |
FILTER_INFO | Contains information about a filter. |
PIN_INFO | Contains information about a pin. |
POSITION | Placeholder for linked lists. |
Quality | Describes a quality message by indicating Flood or Famine in the renderer and specifying the percentage of frames to drop or add to optimize the renderer's performance. |
REGFILTER | Describes a filter in the registry. |
REGFILTER2 | Describes filter for registration through the IFilterMapper2 interface. |
REGFILTERPINS2 | Pin information for registering a filter the the IFilterMapper2 interface. |
REGPINMEDIUM | Describes a pin medium (as defined in the Windows NT DDK) for registration through the IFilterMapper2 interface. |
REGFILTERPINS | Pin information for registering a filter. |
REGPINTYPES | Media type information for registering a filter. |
The following structure maintains information about graphics device interface (GDI) bitmaps and device-independent bitmaps (DIBs). This is used solely by the CImageAllocator, CImageSample, and CDrawImage window utility classes.
Structure | Description |
DIBDATA | Contains information about each DIB. |
The following structures maintain information about video, as well as video capture and compression.
Structure | Description |
TRUECOLORINFO | Maintains color information. |
ANALOGVIDEOINFO | Maintains information about the format of the analog video signal. |
AUDIO_STREAM_CONFIG_CAPS | Contains information about all possible audio formats supported. |
COLORKEY | Communicates color key information between the renderer and another filter. |
MPEG1VIDEOINFO | Contains additional MPEG-1 video system information. |
MPEG2VIDEOINFO | Contains additional MPEG-2 video system information. |
TIMECODE | Contains basic timecode frame count information. |
TIMECODE_SAMPLE | Contains complete timecode information. |
VIDEO_STREAM_CONFIG_CAPS | Contains information about possible connections. |
VIDEOINFO | Contains information that specifies a video image and its color palette and bitmasks. |
VIDEOINFOHEADER | Describes the bitmap and color information for a video image. |
VIDEOINFOHEADER2 | Describes the bitmap and color information for a video image, including interlace, copy protection, and pixel aspect ratio information. |
Contains the allocator's count, size, alignment, and prefix properties.
typedef struct _AllocatorProperties { long cBuffers; long cbBuffer; long cbAlign; long cbPrefix; } ALLOCATOR_PROPERTIES;
The CMediaSample::GetPointer member function points to the beginning of the buffer, not including the prefix bytes designated by cbPrefix.
The alignment is applied to the prefix data, if any. If a nonzero prefix is used, the beginning of the prefix is aligned according to cbAlign. Since the buffer pointer returned by IMediaSample::GetPointer points to the area immediately following the prefix, the cbPrefix address (the value returned by IMediaSample::GetPointer minus cbPrefix) should be aligned on an address that is a multiple of cbAlign bytes.
Provides status (failure) codes for IDvdGraphBuilder::RenderDvdVideoVolume.
typedef struct { BOOL bVPEFailed; BOOL bDVDVolInvalid; BOOL bDVDVolUnknown; BOOL bNoLine21; int iNumStreams; int iNumStreamsFailed; DWORD dwFailedStreamsFlag; } AM_DVD_RENDERSTATUS;
IDvdGraphBuilder::RenderDvdVideoVolume
Describes a media sample type.
typedef struct _MediaType { GUID majortype; GUID subtype; BOOL bFixedSizeSamples; BOOL bTemporalCompression; ULONG lSampleSize; GUID formattype; IUnknown *pUnk; ULONG cbFormat; /* [size_is] */ BYTE __RPC_FAR *pbFormat; } AM_MEDIA_TYPE;
Format type | Structure pointed to |
FORMAT_MPEGVideo | MPEG1VIDEOINFO |
FORMAT_VideoInfo | VIDEOINFOHEADER |
FORMAT_WaveFormatEx | WAVEFORMATEX |
FORMAT_MPEG2Video | MPEG2VIDEOINFO |
FORMAT_VideoInfo2 | VIDEOINFOHEADER2 |
Generic media sample properties structure.
typedef struct tagAM_SAMPLE2_PROPERTIES { DWORD cbData; DWORD dwTypeSpecificFlags; DWORD dwSampleFlags; LONG lActual; REFERENCE_TIME tStart; REFERENCE_TIME tStop; DWORD dwStreamId; AM_MEDIA_TYPE *pMediaType; BYTE *pbBuffer; LONG cbBuffer; } AM_SAMPLE2_PROPERTIES;
The IMediaSample2 interface uses this structure.
Contains filter information for registering a filter.
typedef struct _AMOVIESETUP_FILTER { const CLSID * clsID; LPWSTR strName; DWORD dwMerit; UINT nPins; LPAMOVIESETUP_PIN lpPin; } AMOVIESETUP_FILTER
Media type information for registering a filter.
typedef struct _AMOVIESETUP_MEDIATYPE { const CLSID * clsMajorType; const CLSID * clsMinorType; } AMOVIESETUP_MEDIATYPE;
Pin information for registering a filter.
typedef struct _AMOVIESETUP_PIN { LPWSTR strName; BOOL bRendered; BOOL bOutput; BOOL bZero; BOOL bMany; const CLSID * clsConnectsToFilter; LPWSTR strConnectsToPin; UINT nMediaTypes; LPAMOVIESETUP_MEDIATYPE lpMediaType; } AMOVIESETUP_PIN;
Contains information about start and stop commands given a pin through the IAMStreamControl interface.
typedef struct { REFERENCE_TIME tStart; REFERENCE_TIME tStop; DWORD dwStartCookie; DWORD dwStopCookie; DWORD dwFlags; } AM_STREAM_INFO;
Access this structure through the IAMStreamControl interface.
Specifies the data specific characteristics of the VP input stream.
typedef struct _AMVPDATAINFO{ DWORD dwSize; DWORD dwMicrosecondsPerField; AMVPDIMINFO amvpDimInfo; DWORD dwPictAspectRatioX; DWORD dwPictAspectRatioY; BOOL bEnableDoubleClock; BOOL bEnableVACT; BOOL bDataIsInterlaced; BOOL bWritesHalfline; BOOL bFieldPolarityInverted; DWORD dwReserved1; DWORD dwReserved2; DWORD dwReserved3; } AMVPDATAINFO, *LPAMVPDATAINFO;
Specifies the dimensional characteristics of the VP input stream.
typedef struct _AMVPDIMINFO{ DWORD dwFieldWidth; DWORD dwFieldHeight; DWORD dwVBIWidth; DWORD dwVBIHeight; RECT rcValidRegion; } AMVPDIMINFO, *LPAMVPDIMINFO;
Specifies the width and height for a VP image.
typedef struct _AMVPSIZE{ DWORD dwWidth; DWORD dwHeight; } AMVPSIZE, *LPAMVPSIZE;
The context could be anything such as scaling, cropping, and so on.
Maintains information about the format of the analog video signal.
typedef struct tagAnalogVideoInfo { RECT rcSource; RECT rcTarget; DWORD dwActiveWidth; DWORD dwActiveHeight; REFERENCE_TIME AvgTimePerFrame; } ANALOGVIDEOINFO;
Filters using this format usually pass the video signal using a hardware-based connection rather than using memory-based transports.
An example of a definition of an analog video media type connection would be a connection of NTSC video using "M" color encoding. This would use a major media type of MEDIATYPE_AnalogVideo, a subtype of MEDIASUBTYPE_AnalogVideo_NTSC_M, and a format type of FORMAT_AnalogVideo.
Contains information about all possible audio formats supported.
typedef struct _AUDIO_STREAM_CONFIG_CAPS { GUID guid; ULONG MinimumChannels; ULONG MaximumChannels; ULONG ChannelsGranularity; ULONG MinimumBitsPerSample; ULONG MaximumBitsPerSample; ULONG BitsPerSampleGranularity; ULONG MinimumSampleFrequency; ULONG MaximumSampleFrequency; ULONG SampleFrequencyGranularity; } AUDIO_STREAM_CONFIG_CAPS;
This structure is returned by an audio capture or compression filter.
IAMStreamConfig::GetStreamCaps
Communicates color key information between the renderer and another filter.
typedef struct tagCOLORKEY { DWORD KeyType; DWORD PaletteIndex; COLORREF LowColorValue; COLORREF HighColorValue; } COLORKEY;
The video renderer supports a data transport accessed through the IOverlay interface. This will typically be used by hardware decoder filters that need the renderer to communicate where to put the data rather than requiring the renderer to draw the data. One mechanism for communicating where to put the images is by using a color key. This structure is used by a filter (typically a hardware decoder) to describe color key requirements to the video renderer.
Maintains information about each GDI DIB.
typedef struct tagDIBDATA { LONG PaletteVersion; DIBSECTION DibSection; HBITMAP hBitmap; HANDLE hMapping; BYTE *pBase; } DIBDATA;
When the allocator creates a sample, it allocates a DIBSECTION to the sample. When a window receives a sample, it can call the Win32 BitBlt function to pass the sample from one device context to another device context. This is a mechanism for the image allocator, an image sample, and the draw class to pass bitmap information to each other.
DVD attributes.
typedef struct tagDVD_ATR { ULONG ulCAT; BYTE pbATRI[768]; } DVD_ATR;
Refer to the DVD-Video 1.0 specification to parse these structures.
DVD timecode in hours, minutes, seconds, and frames.
typedef struct tagDVD_TIMECODE") { ULONG Hours1 :4; ULONG Hours10 :4; ULONG Minutes1 :4; ULONG Minutes10:4; ULONG Seconds1 :4; ULONG Seconds10:4; ULONG Frames1 :4; ULONG Frames10 :2; ULONG FrameRateCode:2; } DVD_TIMECODE;
DVD Timecode is binary coded decimal (BCD) encoded in the format 0xHhMmSsFf, where
H is tens of hours |
h is hours |
M is tens of minutes |
m is minutes |
S is tens of seconds |
s is seconds |
F is tens of frames |
f is frames |
Contains information about a filter.
typedef struct _FilterInfo { WCHAR achName[ 128 ]; IFilterGraph __RPC_FAR *pGraph; } FILTER_INFO;
Describes an MPEG-1 video stream.
typedef struct tagMPEG1VIDEOINFO { VIDEOINFOHEADER hdr; DWORD dwStartTimeCode; DWORD cbSequenceHeader; BYTE bSequenceHeader[1]; } MPEG1VIDEOINFO;
Describes an MPEG-2 video stream.
tagMPEG2VIDEOINFO {
VIDEOINFOHEADER2 hdr;
DWORD dwStartTimeCode;
DWORD cbSequenceHeader;
DWORD dwProfile;
DWORD dwLevel;
DWORD dwFlags;
DWORD dwSequenceHeader[1];
} MPEG2VIDEOINFO;
Value | Description |
AMMPEG2_DoPanScan | If set, the MPEG-2 video decoder should crop the output image based on pan-scan vectors in picture_display_extension and change the picture aspect ratio accordingly. |
AMMPEG2_DVDLine21Field1 | If set, the MPEG-2 decoder must be able to produce an output pin for DVD style closed-captioned data found in the GOP layer of field 1. |
AMMPEG2_DVDLine21Field2 | If set, the MPEG-2 decoder must be able to produce an output pin for DVD style closed-captioned data found in the GOP layer of field 2. |
AMMPEG2_SourceIsLetterboxed | If set, indicates that black bars have been encoded in the top and bottom of the video. |
AMMPEG2_FilmCameraMode | If set, indicates "film mode" used for 625/50 content. If cleared, indicates that "camera mode" was used. |
Contains information about a pin.
typedef struct _PinInfo { IBaseFilter *pFilter; PIN_DIRECTION dir; WCHAR achName[ 128 ]; } PIN_INFO;
Placeholder for a linked list.
struct __POSITION { int unused; }; typedef __POSITION* POSITION;
This structure can point to any element in a linked list, including null elements (such as an end-of-list marker). This structure will, however, become invalid if you delete the item it points to.
When you perform operations that return a POSITION pointer on a single list element, a successful operation sets it to an appropriate non-null value, while null indicates that the items position could not be found. When you perform operations on the entire list, the pointer represents a Win32 BOOLEAN value, where TRUE indicates success and FALSE indicates failure.
CBaseList::GetHeadPositionI, CBaseList::GetTailPositionI
Describes a quality message by indicating Flood or Famine in the renderer and specifying the percentage of frames to drop or add to optimize the renderer's performance.
typedef struct{ QualityMessageType Type; long Proportion; REFERENCE_TIME Late; REFERENCE_TIME TimeStamp; } Quality;
Identifies a filter in the registry.
typedef struct { CLSID Clsid; LPWSTR Name; } REGFILTER;
Contains basic timecode frame count information.
typedef struct tagTIMECODE { WORD wFrameRate; WORD wFrameFract; DWORD dwFrames; }TIMECODE;
Setting | Description |
ED_FORMAT_SMPTE_30 | 30 frames per second. |
ED_FORMAT_SMPTE_30DROP | 30 frames per second drop frame (actual rate 29.97 fps). |
ED_FORMAT_SMPTE_25 | 25 frames per second. |
ED_FORMAT_SMPTE_24 | 24 frames per second. |
Fractional frame may be used to indicate temporal offset into frame when timecode was actually read from an external device, e.g., wFrameFract=0x7ff means the timecode value was read from the device at the end of the first video field.
Note Since timecode commonly enters or leaves computer systems as ASCII values, conversion helper method which convert the ASCII values to and from binary framecounts are supplied in the sample filter.
Contains complete timecode information.
typedef struct tagTIMECODE_SAMPLE { LONGLONG qwTick; TIMECODE timecode; DWORD dwUser; DWORD dwFlags; } TIMECODE_SAMPLE;
Value | Meaning |
AM_TIMECODE_FLAG_FCM | Frame code mode. 0=nondrop; 1=drop. |
AM_TIMECODE_FLAG_CF | Color frame flag. |
AM_TIMECODE_FLAG_FIELD | Field flag. |
AM_TIMECODE_FLAG_DF | Drop frame flag (from flags in actual timecode on external media). |
AM_TIMECODE_COLORFRAME | Which frame in color sequence. |
AM_TIMECODE_COLORSEQUENCE | Duration in frames of complete sequence. |
AM_TIMECODE_FILMSEQUENCE_TYPE | One of FILM_SEQUENCE_XXX defines. |
Upper 16 bits in dwFlags are reserved for future use - set to 0.
Contains color palette and bitmask information for a video image.
typedef struct tag_TRUECOLORINFO { DWORD dwBitMasks[iMASK_COLORS]; RGBQUAD bmiColors[iPALETTE_COLORS]; } TRUECOLORINFO;
This structure is not used for some RGB formats. For more information about which fields are valid under different circumstances, see the Microsoft Win32® documentation for BITMAPINFO.
Contains information about possible connections.
typedef struct _VIDEO_STREAM_CONFIG_CAPS { GUID guid; ULONG VideoStandard; SIZE InputSize; SIZE MinCroppingSize; SIZE MaxCroppingSize; int CropGranularityX; int CropGranularityY; int CropAlignX; int CropAlignY; SIZE MinOutputSize; SIZE MaxOutputSize; int OutputGranularityX; int OutputGranularityY; int StretchTapsX; int StretchTapsY; int ShrinkTapsX; int ShrinkTapsY; LONGLONG MinFrameInterval; LONGLONG MaxFrameInterval; LONG MinBitsPerSecond; LONG MaxBitsPerSecond; } VIDEO_STREAM_CONFIG_CAPS;
For example, assume the following values for some of the structure members.
These values indicate that valid cropping sizes begin at MinCroppingSize and increase in steps in the x-direction by CropGranularityX and in the y-direction by CropGranularityY. In this case the x-value can be anywhere from 160 to 320 pixels in steps of 4 and the y-value can be anywhere from 120 to 240 pixels in steps of 8.
In this scenario a few of the valid sizes are:
CropAlignX and CropAlignY indicate where the cropping rectangle can be inside the input size rectangle. Given a 160 x 120 sized cropping rectangle and the following:
Some of the valid values for the VIDEOINFOHEADER structure's rcSource member are:
For a 320 x 240 cropping rectangle and the same cropping alignment values, (2, 4, 322, 244) is one example of the many legal rectangles.
The structure members discussed in this section work together to specify what values of rcSource are valid for the VIDEOINFOHEADER structure that describes the output pin's media type. Of the remaining structure members, MinOutputSize, MaxOutputSize, OutputGranularityX, and OutputGranularityY describe the biWidth and biHeight members of the BITMAPINFOHEADER structure contained in the output pin's media type VIDEOINFOHEADER structure.
Describes the bitmap and color information for a video image.
typedef struct tagVIDEOINFO { RECT rcSource, RECT rcTarget, DWORD dwBitRate, DWORD dwBitErrorRate, REFERENCE_TIME AvgTimePerFrame; BITMAPINFOHEADER bmiHeader; union { RGBQUAD bmiColors[iPALETTE_COLORS]; DWORD dwBitMasks[iMASK_COLORS]; TRUECOLORINFO TrueColorInfo; }; } VIDEOINFO;
Never use this structure unless you are sure that you will use it only to store standard RGB formats. If you store anything other than standard RGB, the variable size of the bmiHeader structure will almost certainly cause problems. You should use the VIDEOINFOHEADER structure instead. If for some reason you find it absolutely necessary to use the VIDEOINFO structure, do not access TrueColorInfo, dwBitMasks, and bmiColors directly; use the TRUECOLORINFO, COLORS, and BITMASKS macros to return the pointers to the color information.
The first five data members are equivalent to a VIDEOINFOHEADER structure. They are expanded in full simply to reduce the amount of dereferencing needed when dealing with a pointer to a VIDEOINFO structure.
Which of the TrueColorInfo, dwBitMasks, and bmiColors fields is valid depends on the contents of the BITMAPINFOHEADER structure.
Describes the bitmap and color information for a video image.
typedef struct tagVIDEOINFOHEADER { RECT rcSource, RECT rcTarget; DWORD dwBitRate; DWORD dwBitErrorRate; REFERENCE_TIME AvgTimePerFrame; BITMAPINFOHEADER bmiHeader; } VIDEOINFOHEADER;
Describes the bitmap and color information for a video image, including interlace, copy protection, and pixel aspect ratio information.
typedef struct tagVIDEOINFOHEADER2 { RECT rcSource; RECT rcTarget; DWORD dwBitRate; DWORD dwBitErrorRate; REFERENCE_TIME AvgTimePerFrame; DWORD dwInterlaceFlags; // use AMINTERLACE_* defines. Reject connection if undefined bits are not 0 DWORD dwCopyProtectFlags; // use AMCOPYPROTECT_* defines. Reject connection if undefined bits are not 0 DWORD dwPictAspectRatioX; DWORD dwPictAspectRatioY; DWORD dwReserved1; DWORD dwReserved2; BITMAPINFOHEADER bmiHeader; } VIDEOINFOHEADER2;
Setting | Description |
AMINTERLACE_IsInterlaced | Indicates an interlace stream. If 0, other interlace bits are irrelevent. |
AMINTERLACE_1FieldPerSample | Indicates one field per media sample. If 0, indicates 2 fields per media sample. |
AMINTERLACE_Field1First | Indicates Field 1 is first. If 0, indicates Field 2 is first. Top field in PAL is field 1, top field in NTSC is field 2. |
AMINTERLACE_UNUSED | Unused. |
AMINTERLACE_FieldPatternMask | Bits used to indicate field pattern. |
AMINTERLACE_FieldPatField1Only | Stream never contains a Field2. |
AMINTERLACE_FieldPatField2Only | Stream never contains a Field1. |
AMINTERLACE_FieldPatBothRegular | There will be a Field2 for every Field1. |
AMINTERLACE_FieldPatBothIrregular | Random pattern of Field1s and Field2s. |
AMINTERLACE_DisplayModeMask | Bits used to indicate display mode. |
AMINTERLACE_DisplayModeBobOnly | Indicates Bob display mode only. |
AMINTERLACE_DisplayModeWeaveOnly | Indicates Weave display mode only. |
AMINTERLACE_DisplayModeBobOrWeave | Indicates either Bob or Weave display mode. |
Media type information for registering a filter.
typedef struct { const CLSID * clsMajorType; const CLSID * clsMinorType; } REGPINTYPES;
This structure is used by the IFilterMapper and IFilterMapper2 interfaces to identify media types a pin handles and to register filters.
This structure is equivalent to the AMOVIESETUP_MEDIATYPE structure.
Pin information for registering a filter.
typedef struct { LPWSTR strName; BOOL bRendered; BOOL bOutput; BOOL bZero; BOOL bMany; const CLSID * clsConnectsToFilter; const WCHAR * strConnectsToPin; UINT nMediaTypes; const REGPINTYPES * lpMediaType; } REGFILTERPINS;
This structure is used by the IFilterMapper and IFilterMapper2 interfaces for filter registration. It is used if the dwVersion member in REGFILTER2 is 1.
This structure is equivalent to the AMOVIESETUP_PIN structure.
Describes a pin medium (as defined in the Windows NT DDK) for registration through the IFilterMapper2 interface.
typedef struct { CLSID clsMedium; DWORD dw1; DWORD dw2; } REGPINMEDIUM;
A medium defines a method of communication (e.g., the bus over which the communication occurs). Each Id within that set is used to represent the form of communication. Register medums for your filter if you need to search for DirectShow filters built on Kernel Streaming (KS) pins which can connect to each other.
Pin information for registering a filter the the IFilterMapper2 interface.
typedef struct { DWORD dwFlags; UINT cInstances; UINT nMediaTypes; [size_is(nMediaTypes)] const REGPINTYPES * lpMediaType; UINT nMediums; [size_is(nMediums)] const REGPINMEDIUM *lpMedium; const CLSID *clsPinCategory; } REGFILTERPINS2;
Describes filter for registration through the IFilterMapper2 interface.
typedef struct { DWORD dwVersion; // 1 or 2 DWORD dwMerit; /* unnamed union */ [switch_is(dwVersion)] [switch_type(DWORD)] union { [case(1)] struct { ULONG cPins; [size_is(cPins)] const REGFILTERPINS *rgPins; }; [case(2)] struct { ULONG cPins2; [size_is(cPins2)] const REGFILTERPINS2 *rgPins2; }; [default] ; } ; } REGFILTER2;
This structure is passed in to the IFilterMapper2::RegisterFilter method.
Set dwVersion to 1 if you are using the old format or set dwVersion to 2 if you need mediums and pin categories.
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.