Tizen 2.0 Release
[framework/multimedia/gst-plugins-bad0.10.git] / sys / pvr2d / gstpvrbufferpool.h
1 /*
2  * GStreamer
3  * Copyright (c) 2010, 2011 Texas Instruments Incorporated
4  * Copyright (c) 2011, Collabora Ltda
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation
9  * version 2.1 of the License.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
19  */
20
21 #ifndef __GSTPVRBUFFERPOOL_H__
22 #define __GSTPVRBUFFERPOOL_H__
23
24 #include "gstpvr.h"
25 #include <pvr2d.h>
26
27 G_BEGIN_DECLS
28
29 GType gst_ducati_buffer_get_type (void);
30 #define GST_TYPE_DUCATIBUFFER (gst_ducati_buffer_get_type())
31 #define GST_IS_DUCATIBUFFER(obj) \
32   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_DUCATIBUFFER))
33 #define GST_DUCATIBUFFER(obj) \
34   (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_DUCATIBUFFER, GstDucatiBuffer))
35
36 GType gst_pvr_bufferpool_get_type (void);
37 #define GST_TYPE_PVRBUFFERPOOL (gst_pvr_bufferpool_get_type())
38 #define GST_IS_PVRBUFFERPOOL(obj) \
39   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PVRBUFFERPOOL))
40 #define GST_PVRBUFFERPOOL(obj) \
41   (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PVRBUFFERPOOL, \
42                                GstPvrBufferPool))
43
44 typedef struct _GstPvrBufferPool GstPvrBufferPool;
45 typedef struct _GstDucatiBuffer GstDucatiBuffer;
46
47 struct _GstPvrBufferPool
48 {
49   GstMiniObject parent;
50
51   /* output (padded) size including any codec padding: */
52   gint padded_width, padded_height;
53   gint size;
54   PVR2DCONTEXTHANDLE pvr_context;
55
56   GstCaps *caps;
57   GMutex *lock;
58   gboolean running;  /* with lock */
59   GstElement *element;  /* the element that owns us.. */
60   GQueue *free_buffers;
61   GQueue *used_buffers;
62   guint buffer_count;
63 };
64
65 GstPvrBufferPool * gst_pvr_bufferpool_new (GstElement * element,
66     GstCaps * caps, gint num_buffers, gint size,
67     PVR2DCONTEXTHANDLE pvr_context);
68 void gst_pvr_bufferpool_stop_running (GstPvrBufferPool * pool, gboolean unwrap);
69 GstDucatiBuffer * gst_pvr_bufferpool_get (GstPvrBufferPool * self,
70     GstBuffer * orig);
71
72 #define GST_PVR_BUFFERPOOL_LOCK(self)     g_mutex_lock ((self)->lock)
73 #define GST_PVR_BUFFERPOOL_UNLOCK(self)   g_mutex_unlock ((self)->lock)
74
75 struct _GstDucatiBuffer {
76   GstBuffer parent;
77
78   GstPvrBufferPool *pool; /* buffer-pool that this buffer belongs to */
79   GstBuffer       *orig;     /* original buffer, if we need to copy output */
80   PVR2DMEMINFO *src_mem; /* Memory wrapped by pvr */
81   gboolean wrapped;
82 };
83
84 GstBuffer * gst_ducati_buffer_get (GstDucatiBuffer * self);
85 PVR2DMEMINFO * gst_ducati_buffer_get_meminfo (GstDucatiBuffer * self);
86
87 G_END_DECLS
88
89 #endif /* __GSTPVRBUFFERPOOL_H__ */