2 -------------------------------------------------------------------
3 AM_MEDIA_TYPE service functions declarations
4 -------------------------------------------------------------------
7 #ifndef MPLAYER_MEDIATYPE_H
8 #define MPLAYER_MEDIATYPE_H
12 typedef struct __attribute__((__packed__
)) MediaType
16 int bFixedSizeSamples
; //0x20
17 int bTemporalCompression
; //0x24
18 unsigned long lSampleSize
; //0x28
19 GUID formattype
; //0x2c
20 IUnknown
* pUnk
; //0x3c
21 unsigned long cbFormat
; //0x40
22 char* pbFormat
; //0x44
26 * \brief print info from AM_MEDIA_TYPE structure
27 * =param[in] label short lable for media type
28 * \param[in] pmt pointer to AM_MEDIA_TYPE
30 * routine used for debug purposes
33 void DisplayMediaType(const char * label
,const AM_MEDIA_TYPE
* pmt
);
35 * \brief frees memory, pointed by pbFormat and pUnk members of AM_MEDIA_TYPE structure
37 * \param[in] pmt pointer to structure
40 * routine does not frees memory allocated for AM_MEDIA_TYPE, so given pointer will be
41 * valid after this routine call.
44 void FreeMediaType(AM_MEDIA_TYPE
* pmt
);
46 * \brief frees memory allocated for AM_MEDIA_TYPE structure, including pbFormat and pUnk
49 * \param[in] pmt pointer to structure
52 * after call to this routine, pointer to AM_MEDIA_TYPE will not be valid anymore
55 void DeleteMediaType(AM_MEDIA_TYPE
* pmt
);
57 * \brief copyies info from source to destination AM_MEDIA_TYPE structures
59 * \param[in] pSrc pointer to AM_MEDIA_TYPE structure to copy data from
60 * \param[out] pDst pointer to AM_MEDIA_TYPE structure to copy data to
62 * \return S_OK - success
63 * \return E_POINTER - pSrc or pDst is NULL or (pSrc->cbFormat && !pSrc->pbFormat)
64 * \return E_INVALIDARG - (pSrc == pDst)
65 * \return E_OUTOFMEMORY - Insufficient memory
68 * - pDst must point to existing AM_MEDIA_TYPE structure (all data will be overwritten)
69 * - if pDst->pbFormat!=NULL this will cause memory leak (as described in Directshow SDK)!
72 HRESULT
CopyMediaType(AM_MEDIA_TYPE
* pDst
,const AM_MEDIA_TYPE
* pSrc
);
74 * \brief allocates new AM_MEDIA_TYPE structure and fills it with info from given one
76 * \param[in] pSrc pointer to AM_MEDIA_TYPE structure to copy data from
78 * \return result code, returned from CopyMediaType
81 AM_MEDIA_TYPE
* CreateMediaType(const AM_MEDIA_TYPE
* pSrc
);
84 * \brief compares two AM_MEDIA_TYPE structures for compatibility
86 * \param[in] pmt1 first AM_MEDIA_TYPE structure for compare
87 * \param[in] pmt2 second AM_MEDIA_TYPE structure for compare
88 * \param[in] bWildcards 1 means that GUID_NULL of one structure will be compatible with any value of another structure
90 * \return 1 if structures are compatible
91 * \return 0 if structures are not compatible
94 int CompareMediaTypes(const AM_MEDIA_TYPE
* pmt1
, const AM_MEDIA_TYPE
* pmt2
, int bWildcards
);
96 #endif /* MPLAYER_MEDIA_TYPE_H */