Leaked source code of windows server 2003
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.

101 lines
2.0 KiB

  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. Data2 = GUID_Data2;
  43. Data3 = GUID_Data3;
  44. ((DWORD *)Data4)[0] = GUID_Data4_1;
  45. ((DWORD *)Data4)[1] = GUID_Data4_2;
  46. }
  47. inline
  48. FOURCCMap::FOURCCMap() {
  49. InitGUID();
  50. SetFOURCC( DWORD(0));
  51. }
  52. inline
  53. FOURCCMap::FOURCCMap(DWORD fourcc)
  54. {
  55. InitGUID();
  56. SetFOURCC(fourcc);
  57. }
  58. inline
  59. FOURCCMap::FOURCCMap(const GUID * pGuid)
  60. {
  61. InitGUID();
  62. SetFOURCC(pGuid);
  63. }
  64. inline void
  65. FOURCCMap::SetFOURCC(const GUID * pGuid)
  66. {
  67. FOURCCMap * p = (FOURCCMap*) pGuid;
  68. SetFOURCC(p->GetFOURCC());
  69. }
  70. inline void
  71. FOURCCMap::SetFOURCC(DWORD fourcc)
  72. {
  73. Data1 = fourcc;
  74. }
  75. inline DWORD
  76. FOURCCMap::GetFOURCC(void)
  77. {
  78. return Data1;
  79. }
  80. #endif /* __FOURCC__ */