Merge tizen patch based on 1.12.2
[platform/upstream/gstreamer.git] / omx / gstomxvideodec.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_VIDEO_DEC_H__
22 #define __GST_OMX_VIDEO_DEC_H__
23
24 #ifdef HAVE_CONFIG_H
25 #include "config.h"
26 #endif
27
28 #include <gst/gst.h>
29 #include <gst/video/video.h>
30 #include <gst/video/gstvideodecoder.h>
31
32 #include "gstomx.h"
33
34 G_BEGIN_DECLS
35
36 #define GST_TYPE_OMX_VIDEO_DEC \
37   (gst_omx_video_dec_get_type())
38 #define GST_OMX_VIDEO_DEC(obj) \
39   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_OMX_VIDEO_DEC,GstOMXVideoDec))
40 #define GST_OMX_VIDEO_DEC_CLASS(klass) \
41   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_OMX_VIDEO_DEC,GstOMXVideoDecClass))
42 #define GST_OMX_VIDEO_DEC_GET_CLASS(obj) \
43   (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_OMX_VIDEO_DEC,GstOMXVideoDecClass))
44 #define GST_IS_OMX_VIDEO_DEC(obj) \
45   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_OMX_VIDEO_DEC))
46 #define GST_IS_OMX_VIDEO_DEC_CLASS(obj) \
47   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_OMX_VIDEO_DEC))
48
49 #define EXTRA_DECODER_OUTPUT_BUF 4
50
51 typedef struct _GstOMXVideoDec GstOMXVideoDec;
52 typedef struct _GstOMXVideoDecClass GstOMXVideoDecClass;
53
54 struct _GstOMXVideoDec
55 {
56   GstVideoDecoder parent;
57
58   /* < protected > */
59   GstOMXComponent *dec;
60   GstOMXPort *dec_in_port, *dec_out_port;
61
62   GstBufferPool *in_port_pool, *out_port_pool;
63
64   /* < private > */
65   GstVideoCodecState *input_state;
66   GstBuffer *codec_data;
67   /* TRUE if the component is configured and saw
68    * the first buffer */
69   gboolean started;
70
71   GstClockTime last_upstream_ts;
72
73   /* Draining state */
74   GMutex drain_lock;
75   GCond drain_cond;
76   /* TRUE if EOS buffers shouldn't be forwarded */
77   gboolean draining;
78
79   GstFlowReturn downstream_flow_ret;
80 #ifdef TIZEN_FEATURE_OMX
81   gint drm_fd;
82   tbm_bufmgr bufmgr;
83 #endif
84 #ifdef USE_OMX_TARGET_RPI
85   GstOMXComponent *egl_render;
86   GstOMXPort *egl_in_port, *egl_out_port;
87   gboolean eglimage;
88 #endif
89 };
90
91 struct _GstOMXVideoDecClass
92 {
93   GstVideoDecoderClass parent_class;
94
95   GstOMXClassData cdata;
96
97   gboolean (*is_format_change) (GstOMXVideoDec * self, GstOMXPort * port, GstVideoCodecState * state);
98   gboolean (*set_format)       (GstOMXVideoDec * self, GstOMXPort * port, GstVideoCodecState * state);
99   GstFlowReturn (*prepare_frame)   (GstOMXVideoDec * self, GstVideoCodecFrame *frame);
100 };
101
102 GType gst_omx_video_dec_get_type (void);
103
104 G_END_DECLS
105
106 #endif /* __GST_OMX_VIDEO_DEC_H__ */