MythTV  master
fourcc.h
Go to the documentation of this file.
1 #ifndef FOURCC_H
2 #define FOURCC_H
3 /******************************************************************************
4  * fourcc.h - Four Character Constants
5  *
6  * Ever since the early days of the Macintosh clipboard and AmigaDOS,
7  * little 32 bit strings have been used to identify the contents of a file.
8  * TIFF, AIFF, JPEG, MPEG - they have spread everywhere.
9  * Including the MythTV source code.
10  *
11  * Time to define them in one file.
12  *
13  * $Id$
14  *****************************************************************************/
15 
16 #include "libmythbase/mythconfig.h"
17 #include <string>
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #include "libavutil/common.h" // for MKTAG
22 }
23 #endif
24 
25 /* Probably not thread safe */
26 static inline const char * fourcc_str(int i)
27 {
28  static std::string str(5,'\0');
29 
30  str[0] = ((char) (i & 0xFF));
31  str[1] = ((char) ((i >> 8) & 0xFF));
32  str[2] = ((char) ((i >> 16) & 0xFF));
33  str[3] = ((char) ((i >> 24) & 0xFF));
34  return str.c_str();
35 }
36 
37 
38 /******************************************************************************
39  * Bitmap formats:
40  *
41  * Note: V4L2 also defines several of these FourCCs in videodev2.h
42  * (e.g. V4L2_PIX_FMT_YUV420, V4L2_PIX_FMT_MPEG).
43  * Use those only where data is being read from a tuner card
44  *****************************************************************************/
45 /* See http://www.fourcc.org/yuv.php for more info on formats */
46 
47 #define FOURCC_422P MKTAG('4','2','2','P')
48 #define FOURCC_AI44 MKTAG('A','I','4','4')
49 #define FOURCC_I420 MKTAG('I','4','2','0')
50 #define FOURCC_IA44 MKTAG('I','A','4','4')
51 #define FOURCC_IYUV MKTAG('I','Y','U','V')
52 #define FOURCC_RGB2 MKTAG('R','G','B','2')
53 #define FOURCC_RGBX MKTAG('R','G','B','X')
54 #define FOURCC_RV15 MKTAG('R','V','1','5')
55 #define FOURCC_RV16 MKTAG('R','V','1','6')
56 #define FOURCC_RV24 MKTAG('R','V','2','4')
57 #define FOURCC_RV32 MKTAG('R','V','3','2')
58 #define FOURCC_YU12 MKTAG('Y','U','1','2')
59 #define FOURCC_YUNV MKTAG('Y','U','N','V')
60 #define FOURCC_YUY2 MKTAG('Y','U','Y','2')
61 #define FOURCC_YUYV MKTAG('Y','U','Y','V')
62 #define FOURCC_YV12 MKTAG('Y','V','1','2')
63 
64 
65 /* These should probably all be defined by */
66 /* MAKEFOURCC(), MKTAG() or v4l2_fourcc() */
67 
68 static constexpr uint32_t GUID_I420_PLANAR { 0x30323449 };
69 static constexpr uint32_t GUID_IYUV_PLANAR { 0x56555949 };
70 static constexpr uint32_t GUID_YV12_PLANAR { 0x32315659 };
71 static constexpr uint32_t GUID_IA44_PACKED { 0x34344941 };
72 static constexpr uint32_t GUID_AI44_PACKED { 0x34344149 };
73 static constexpr uint32_t GUID_YUY2_PACKED { 0x32595559 }; /* same as YUYV */
74 static constexpr uint32_t GUID_UYVY_PACKED { 0x59565955 };
75 
76 
77 /******************************************************************************
78  * Common audio codec IDs:
79  *****************************************************************************/
80 
81 #define FOURCC_LAME MKTAG('L','A','M','E')
82 #define FOURCC_RAWA MKTAG('R','A','W','A')
83 #define FOURCC_AC3 MKTAG('A','C','3',' ')
84 
85 
86 /******************************************************************************
87  * Common video codec IDs:
88  *****************************************************************************/
89 
90 #define FOURCC_DIV3 MKTAG('D','I','V','3') /* MPEG4 v3 */
91 #define FOURCC_DIVX MKTAG('D','I','V','X') /* MPEG4 */
92 #define FOURCC_dvsd MKTAG('d','v','s','d') /* DV cameras (FireWire/IEEE1394) */
93 #define FOURCC_H263 MKTAG('H','2','6','3')
94 #define FOURCC_H264 MKTAG('H','2','6','4')
95 #define FOURCC_HFYU MKTAG('H','F','Y','U')
96 #define FOURCC_I263 MKTAG('I','2','6','3')
97 #define FOURCC_MJPG MKTAG('M','J','P','G')
98 #define FOURCC_MP42 MKTAG('M','P','4','2') /* MPEG4 v2 */
99 #define FOURCC_MPEG MKTAG('M','P','E','G') /* MPEG1 */
100 #define FOURCC_MPG2 MKTAG('M','P','G','2') /* MPEG2 */
101 #define FOURCC_MPG4 MKTAG('M','P','G','4') /* MPEG4 v1 */
102 #define FOURCC_RJPG MKTAG('R','J','P','G')
103 #define FOURCC_WMV1 MKTAG('W','M','V','1')
104 
105 
106 /*****************************************************************************/
107 #endif // ifndef FOURCC_H
GUID_AI44_PACKED
static constexpr uint32_t GUID_AI44_PACKED
Definition: fourcc.h:72
GUID_I420_PLANAR
static constexpr uint32_t GUID_I420_PLANAR
Definition: fourcc.h:68
GUID_IYUV_PLANAR
static constexpr uint32_t GUID_IYUV_PLANAR
bit equivalent to I420
Definition: fourcc.h:69
GUID_YV12_PLANAR
static constexpr uint32_t GUID_YV12_PLANAR
Definition: fourcc.h:70
GUID_YUY2_PACKED
static constexpr uint32_t GUID_YUY2_PACKED
Definition: fourcc.h:73
GUID_IA44_PACKED
static constexpr uint32_t GUID_IA44_PACKED
Definition: fourcc.h:71
GUID_UYVY_PACKED
static constexpr uint32_t GUID_UYVY_PACKED
Definition: fourcc.h:74
fourcc_str
static const char * fourcc_str(int i)
Definition: fourcc.h:26