Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

89 lines
2.9 KiB

  1. //==========================================================================;
  2. //
  3. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  4. // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  5. // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  6. // PURPOSE.
  7. //
  8. // Copyright (c) 1992 - 2000 Microsoft Corporation. All Rights Reserved.
  9. //
  10. //--------------------------------------------------------------------------;
  11. // Class that holds and manages media type information, December 1994
  12. #ifndef __MTYPE__
  13. #define __MTYPE__
  14. /* Helper class that derived pin objects can use to compare media
  15. types etc. Has same data members as the struct AM_MEDIA_TYPE defined
  16. in the streams IDL file, but also has (non-virtual) functions */
  17. class CMediaType : public _AMMediaType {
  18. public:
  19. ~CMediaType();
  20. CMediaType();
  21. CMediaType(const GUID * majortype);
  22. CMediaType(const AM_MEDIA_TYPE&);
  23. CMediaType(const CMediaType&);
  24. CMediaType& operator=(const CMediaType&);
  25. CMediaType& operator=(const AM_MEDIA_TYPE&);
  26. BOOL operator == (const CMediaType&) const;
  27. BOOL operator != (const CMediaType&) const;
  28. BOOL IsValid() const;
  29. const GUID *Type() const { return &majortype;} ;
  30. void SetType(const GUID *);
  31. const GUID *Subtype() const { return &subtype;} ;
  32. void SetSubtype(const GUID *);
  33. BOOL IsFixedSize() const {return bFixedSizeSamples; };
  34. BOOL IsTemporalCompressed() const {return bTemporalCompression; };
  35. ULONG GetSampleSize() const;
  36. void SetSampleSize(ULONG sz);
  37. void SetVariableSize();
  38. void SetTemporalCompression(BOOL bCompressed);
  39. // read/write pointer to format - can't change length without
  40. // calling SetFormat, AllocFormatBuffer or ReallocFormatBuffer
  41. BYTE* Format() const {return pbFormat; };
  42. ULONG FormatLength() const { return cbFormat; };
  43. void SetFormatType(const GUID *);
  44. const GUID *FormatType() const {return &formattype; };
  45. BOOL SetFormat(BYTE *pFormat, ULONG length);
  46. void ResetFormatBuffer();
  47. BYTE* AllocFormatBuffer(ULONG length);
  48. BYTE* ReallocFormatBuffer(ULONG length);
  49. void InitMediaType();
  50. BOOL MatchesPartial(const CMediaType* ppartial) const;
  51. BOOL IsPartiallySpecified(void) const;
  52. };
  53. /* General purpose functions to copy and delete a task allocated AM_MEDIA_TYPE
  54. structure which is useful when using the IEnumMediaFormats interface as
  55. the implementation allocates the structures which you must later delete */
  56. void WINAPI DeleteMediaType(AM_MEDIA_TYPE *pmt);
  57. AM_MEDIA_TYPE * WINAPI CreateMediaType(AM_MEDIA_TYPE const *pSrc);
  58. void WINAPI CopyMediaType(AM_MEDIA_TYPE *pmtTarget, const AM_MEDIA_TYPE *pmtSource);
  59. void WINAPI FreeMediaType(AM_MEDIA_TYPE& mt);
  60. // Initialize a media type from a WAVEFORMATEX
  61. STDAPI CreateAudioMediaType(
  62. const WAVEFORMATEX *pwfx,
  63. AM_MEDIA_TYPE *pmt,
  64. BOOL bSetFormat);
  65. #endif /* __MTYPE__ */