Merge remote-tracking branch 'gst-omx/tizen_gst_1.19.2' into tizen_gst_1.19.2_mono
[platform/upstream/gstreamer.git] / omx / gstomxh264dec.h
1 /*
2  * Copyright (C) 2011, Hewlett-Packard Development Company, L.P.
3  *   Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>, Collabora Ltd.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation
8  * version 2.1 of the License.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
18  *
19  */
20
21 #ifndef __GST_OMX_H264_DEC_H__
22 #define __GST_OMX_H264_DEC_H__
23
24 #include <gst/gst.h>
25 #include "gstomxvideodec.h"
26
27 G_BEGIN_DECLS
28
29 #define GST_TYPE_OMX_H264_DEC \
30   (gst_omx_h264_dec_get_type())
31 #define GST_OMX_H264_DEC(obj) \
32   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_OMX_H264_DEC,GstOMXH264Dec))
33 #define GST_OMX_H264_DEC_CLASS(klass) \
34   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_OMX_H264_DEC,GstOMXH264DecClass))
35 #define GST_OMX_H264_DEC_GET_CLASS(obj) \
36   (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_OMX_H264_DEC,GstOMXH264DecClass))
37 #define GST_IS_OMX_H264_DEC(obj) \
38   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_OMX_H264_DEC))
39 #define GST_IS_OMX_H264_DEC_CLASS(obj) \
40   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_OMX_H264_DEC))
41
42 typedef struct _GstOMXH264Dec GstOMXH264Dec;
43 typedef struct _GstOMXH264DecClass GstOMXH264DecClass;
44
45 #ifdef TIZEN_FEATURE_OMX
46 #define GST_OMX_H264_NAL_START_LEN 4
47 #define GST_OMX_H264_SPSPPS_LEN 2
48
49 #define GST_OMX_H264_RB16(x) ((((const unsigned char*)(x))[0] << 8) | ((const unsigned char*)(x))[1])
50 #define GST_OMX_H264_RB32(x) ((((const unsigned char*)(x))[0] << 24) | \
51                                    (((const unsigned char*)(x))[1] << 16) | \
52                                    (((const unsigned char*)(x))[2] <<  8) | \
53                                    ((const unsigned char*)(x))[3])
54 #define GST_OMX_H264_WB32(p, d) \
55   do { \
56       ((unsigned char*)(p))[3] = (d); \
57       ((unsigned char*)(p))[2] = (d)>>8; \
58       ((unsigned char*)(p))[1] = (d)>>16; \
59       ((unsigned char*)(p))[0] = (d)>>24; \
60   } while(0);
61
62 typedef enum
63 {
64   GST_OMX_H264_NUT_UNKNOWN = 0,
65   GST_OMX_H264_NUT_SLICE = 1,
66   GST_OMX_H264_NUT_DPA = 2,
67   GST_OMX_H264_NUT_DPB = 3,
68   GST_OMX_H264_NUT_DPC = 4,
69   GST_OMX_H264_NUT_IDR = 5,
70   GST_OMX_H264_NUT_SEI = 6,
71   GST_OMX_H264_NUT_SPS = 7,
72   GST_OMX_H264_NUT_PPS = 8,
73   GST_OMX_H264_NUT_AUD = 9,
74   GST_OMX_H264_NUT_EOSEQ = 10,
75   GST_OMX_H264_NUT_EOSTREAM = 11,
76   GST_OMX_H264_NUT_FILL = 12,
77   GST_OMX_H264_NUT_PREFIX = 14,
78   GST_OMX_H264_NUT_MIXED = 24,
79 } GSTOMX_H264_NAL_UNIT_TYPE;
80
81 typedef enum
82 {
83   GST_OMX_H264_FORMAT_UNKNOWN,
84   GST_OMX_H264_FORMAT_PACKETIZED,
85   GST_OMX_H264_FORMAT_BYTE_STREAM,
86 } GST_OMX_H264_STREAM_FORMAT;
87 #endif
88
89 struct _GstOMXH264Dec
90 {
91   GstOMXVideoDec parent;
92 #ifdef TIZEN_FEATURE_OMX
93   GST_OMX_H264_STREAM_FORMAT h264_format;
94   unsigned int h264_nal_length_size;
95 #endif
96 };
97
98 struct _GstOMXH264DecClass
99 {
100   GstOMXVideoDecClass parent_class;
101 };
102
103 GType gst_omx_h264_dec_get_type (void);
104
105 G_END_DECLS
106
107 #endif /* __GST_OMX_H264_DEC_H__ */
108