Merge tizen patch based on 1.12.2
[platform/upstream/gstreamer.git] / omx / gstomxbufferpool.h
1 /*
2  * Copyright 2014 Advanced Micro Devices, Inc.
3  *   Author: Christian König <christian.koenig@amd.com>
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_BUFFER_POOL_H__
22 #define __GST_OMX_BUFFER_POOL_H__
23
24 #ifdef HAVE_CONFIG_H
25 #include "config.h"
26 #endif
27
28 #include <gst/gst.h>
29 #include <gst/video/gstvideometa.h>
30 #include <gst/video/gstvideopool.h>
31
32 #include "gstomx.h"
33
34 G_BEGIN_DECLS
35
36 #define GST_TYPE_OMX_BUFFER_POOL \
37   (gst_omx_buffer_pool_get_type())
38 #define GST_OMX_BUFFER_POOL(obj) \
39   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_OMX_BUFFER_POOL,GstOMXBufferPool))
40 #define GST_IS_OMX_BUFFER_POOL(obj) \
41   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_OMX_BUFFER_POOL))
42
43 typedef struct _GstOMXBufferPool GstOMXBufferPool;
44 typedef struct _GstOMXBufferPoolClass GstOMXBufferPoolClass;
45
46 struct _GstOMXBufferPool
47 {
48   GstVideoBufferPool parent;
49
50   GstElement *element;
51
52   GstCaps *caps;
53   gboolean add_videometa;
54   gboolean need_copy;
55   GstVideoInfo video_info;
56
57   /* Owned by element, element has to stop this pool before
58    * it destroys component or port */
59   GstOMXComponent *component;
60   GstOMXPort *port;
61
62   /* For handling OpenMAX allocated memory */
63   GstAllocator *allocator;
64
65   /* Set from outside this pool */
66   /* TRUE if we're currently allocating all our buffers */
67   gboolean allocating;
68   /* TRUE if the pool is not used anymore */
69   gboolean deactivated;
70
71   /* For populating the pool from another one */
72   GstBufferPool *other_pool;
73   GPtrArray *buffers;
74
75   /* Used during acquire for output ports to
76    * specify which buffer has to be retrieved
77    * and during alloc, which buffer has to be
78    * wrapped
79    */
80   gint current_buffer_index;
81 #ifdef TIZEN_FEATURE_OMX
82   gint num_buffers;
83 #endif
84 };
85
86 struct _GstOMXBufferPoolClass
87 {
88   GstVideoBufferPoolClass parent_class;
89 };
90
91 GType gst_omx_buffer_pool_get_type (void);
92
93 GstBufferPool *gst_omx_buffer_pool_new (GstElement * element, GstOMXComponent * component, GstOMXPort * port);
94
95 G_END_DECLS
96
97 #endif /* __GST_OMX_BUFFER_POOL_H__ */