Tizen 2.1 base
[profile/ivi/gst-openmax0.10.git] / omx / gstomx_h264.h
1 /*
2  * Copyright (C) 2012 Samsung Electronics Co., Ltd. All rights reserved.
3  *
4  * Author: Sunghyun Eum <sunghyun.eum@samsung.com>
5  *
6  * This library is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU Lesser General Public License as published by the
8  * Free Software Foundation; either version 2.1 of the License, or (at your option)
9  * any later version.
10  *
11  * This library is distributed in the hope that it will be useful, but WITHOUT ANY
12  * WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14  * License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this library; if not, write to the Free Software Foundation, Inc., 51
18  * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  *
20  */
21
22 #ifndef GSTOMX_H264_H
23 #define GSTOMX_H264_H
24
25 G_BEGIN_DECLS
26
27 /* modification: byte-stream(nal) - packetized (3gpp) converting (h264dec, h264enc) */
28 #define GSTOMX_H264_MDATA 6 /* packtized meta data size. (ver, profile...) */
29 #define GSTOMX_H264_A_DCI_LEN 4 /* 4-byte sps, pps size field in append dci*/
30 #define GSTOMX_H264_C_DCI_LEN 2 /* 2-byte sps, pps size field in codec data*/
31 #define GSTOMX_H264_CNT_LEN 1 /* 1-byte sps, pps count field */
32
33 #define GSTOMX_H264_NAL_START_LEN 4
34 #define GSTOMX_H264_SPSPPS_LEN 2
35
36 typedef enum
37 {
38     GSTOMX_H264_NUT_UNKNOWN = 0,
39     GSTOMX_H264_NUT_SLICE = 1,
40     GSTOMX_H264_NUT_DPA = 2,
41     GSTOMX_H264_NUT_DPB = 3,
42     GSTOMX_H264_NUT_DPC = 4,
43     GSTOMX_H264_NUT_IDR = 5,
44     GSTOMX_H264_NUT_SEI = 6,
45     GSTOMX_H264_NUT_SPS = 7,
46     GSTOMX_H264_NUT_PPS = 8,
47     GSTOMX_H264_NUT_AUD = 9,
48     GSTOMX_H264_NUT_EOSEQ = 10,
49     GSTOMX_H264_NUT_EOSTREAM = 11,
50     GSTOMX_H264_NUT_FILL = 12,
51     GSTOMX_H264_NUT_MIXED = 24,
52 } GSTOMX_H264_NAL_UNIT_TYPE;
53
54 typedef enum
55 {
56     GSTOMX_H264_FORMAT_UNKNOWN,
57     GSTOMX_H264_FORMAT_PACKETIZED,
58     GSTOMX_H264_FORMAT_BYTE_STREAM,
59 } GSTOMX_H264_STREAM_FORMAT;
60
61 #define GSTOMX_H264_WB32(p, d) \
62     do { \
63         ((unsigned char*)(p))[3] = (d); \
64         ((unsigned char*)(p))[2] = (d)>>8; \
65         ((unsigned char*)(p))[1] = (d)>>16; \
66         ((unsigned char*)(p))[0] = (d)>>24; \
67     } while(0);
68
69 #define GSTOMX_H264_WB16(p, d) \
70     do { \
71         ((unsigned char*)(p))[1] = (d); \
72         ((unsigned char*)(p))[0] = (d)>>8; \
73     } while(0);
74
75 #define GSTOMX_H264_RB16(x) ((((const unsigned char*)(x))[0] << 8) | ((const unsigned char*)(x))[1])
76
77 #define GSTOMX_H264_RB32(x) ((((const unsigned char*)(x))[0] << 24) | \
78                                    (((const unsigned char*)(x))[1] << 16) | \
79                                    (((const unsigned char*)(x))[2] <<  8) | \
80                                    ((const unsigned char*)(x))[3])
81
82 G_END_DECLS
83 #endif /* GSTOMX_H264_H */