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