home *** CD-ROM | disk | FTP | other *** search
/ The Net: Ultimate Internet Guide / WWLCD1.ISO / mac / SiteBldr / AMOVIE / SDK / _SETUP / COMMON.Z / fourcc.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-01  |  2.2 KB  |  104 lines

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