Merge remote-tracking branch 'gst-plugins-base/tizen_gst_1.19.2' into tizen_gst_1...
[platform/upstream/gstreamer.git] / gst-libs / gst / allocators / gsttizenbufferpool.h
1 /*
2  * GStreamer tizen buffer pool
3  * Copyright (c) 2018 Samsung Electronics Co., Ltd.
4  * Author: Sejun Park <sejun79.park@samsung.com>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
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  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21
22 #ifndef _GST_TIZEN_BUFFERPOOL_H_
23 #define _GST_TIZEN_BUFFERPOOL_H_
24
25 #include <gst/gst.h>
26 #include <gst/video/video.h>
27 #include <gst/video/gstvideometa.h>
28 #include <gst/video/gstvideopool.h>
29 #include <gst/allocators/gsttizenmemory.h>
30
31 G_BEGIN_DECLS
32
33 /**
34  * GST_BUFFER_POOL_OPTION_TIZEN_META:
35  *
36  * An option that can be activated on bufferpool to request TizenVideo metadata
37  * on buffers from the pool.
38  */
39 #define GST_BUFFER_POOL_OPTION_TIZEN_META "GstBufferPoolOptionTizenVideoMeta"
40
41 typedef struct _GstTizenBufferPool GstTizenBufferPool;
42 typedef struct _GstTizenBufferPoolClass GstTizenBufferPoolClass;
43 typedef struct _GstTizenBufferPoolPrivate GstTizenBufferPoolPrivate;
44
45 /* buffer pool functions */
46 #define GST_TYPE_TIZEN_BUFFER_POOL      (gst_tizen_buffer_pool_get_type())
47 #define GST_IS_TIZEN_BUFFER_POOL(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TIZEN_BUFFER_POOL))
48 #define GST_TIZEN_BUFFER_POOL(obj)      (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TIZEN_BUFFER_POOL, GstTizenBufferPool))
49 #define GST_TIZEN_BUFFER_POOL_CAST(obj) ((GstTizenBufferPool*)(obj))
50
51 struct _GstTizenBufferPool
52 {
53   GstBufferPool bufferpool;
54
55   GstAllocator *allocator;
56   GstVideoInfo  info;
57
58   gboolean      add_videometa;
59   gboolean      add_tizenmeta;
60
61   GMutex       lock;
62
63   GPtrArray    *buffers;
64   gint         current_buffer_index;
65   gint         outstandings;
66   gboolean     empty;
67
68   GstTizenBufferPoolPrivate *priv;
69 };
70
71 struct _GstTizenBufferPoolClass
72 {
73   GstBufferPoolClass parent_class;
74 };
75
76 GST_ALLOCATORS_API
77 GType gst_tizen_buffer_pool_get_type (void);
78
79 GST_ALLOCATORS_API
80 GstBufferPool *gst_tizen_buffer_pool_new (void);
81
82
83 G_END_DECLS
84
85 #endif /* _GST_TIZEN_BUFFER_POOL_H_ */