fourcc.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. //------------------------------------------------------------------------------
  2. // File: FourCC.h
  3. //
  4. // Desc: DirectShow base classes.
  5. //
  6. // Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
  7. //------------------------------------------------------------------------------
  8. // FOURCCMap
  9. //
  10. // provides a mapping between old-style multimedia format DWORDs
  11. // and new-style GUIDs.
  12. //
  13. // A range of 4 billion GUIDs has been allocated to ensure that this
  14. // mapping can be done straightforwardly one-to-one in both directions.
  15. //
  16. // January 95
  17. #ifndef __FOURCC__
  18. #define __FOURCC__
  19. // Multimedia format types are marked with DWORDs built from four 8-bit
  20. // chars and known as FOURCCs. New multimedia AM_MEDIA_TYPE definitions include
  21. // a subtype GUID. In order to simplify the mapping, GUIDs in the range:
  22. // XXXXXXXX-0000-0010-8000-00AA00389B71
  23. // are reserved for FOURCCs.
  24. class FOURCCMap : public GUID
  25. {
  26. public:
  27. FOURCCMap();
  28. FOURCCMap(DWORD Fourcc);
  29. FOURCCMap(const GUID *);
  30. DWORD GetFOURCC(void);
  31. void SetFOURCC(DWORD fourcc);
  32. void SetFOURCC(const GUID *);
  33. private:
  34. void InitGUID();
  35. };
  36. #define GUID_Data2 0
  37. #define GUID_Data3 0x10
  38. #define GUID_Data4_1 0xaa000080
  39. #define GUID_Data4_2 0x719b3800
  40. inline void
  41. FOURCCMap::InitGUID()
  42. {
  43. Data2 = GUID_Data2;
  44. Data3 = GUID_Data3;
  45. ((DWORD *)Data4)[0] = GUID_Data4_1;
  46. ((DWORD *)Data4)[1] = GUID_Data4_2;
  47. }
  48. inline
  49. FOURCCMap::FOURCCMap()
  50. {
  51. InitGUID();
  52. SetFOURCC( DWORD(0));
  53. }
  54. inline
  55. FOURCCMap::FOURCCMap(DWORD fourcc)
  56. {
  57. InitGUID();
  58. SetFOURCC(fourcc);
  59. }
  60. inline
  61. FOURCCMap::FOURCCMap(const GUID * pGuid)
  62. {
  63. InitGUID();
  64. SetFOURCC(pGuid);
  65. }
  66. inline void
  67. FOURCCMap::SetFOURCC(const GUID * pGuid)
  68. {
  69. FOURCCMap * p = (FOURCCMap*) pGuid;
  70. SetFOURCC(p->GetFOURCC());
  71. }
  72. inline void
  73. FOURCCMap::SetFOURCC(DWORD fourcc)
  74. {
  75. Data1 = fourcc;
  76. }
  77. inline DWORD
  78. FOURCCMap::GetFOURCC(void)
  79. {
  80. return Data1;
  81. }
  82. #endif /* __FOURCC__ */