videopool: update for allocator api update
[platform/upstream/gstreamer.git] / gst-libs / gst / video / gstvideopool.h
1 /* GStreamer
2  * Copyright (C) <2011> Wim Taymans <wim.taymans@gmail.com>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 #ifndef __GST_VIDEO_POOL_H__
21 #define __GST_VIDEO_POOL_H__
22
23 #include <gst/gst.h>
24
25 #include <gst/video/video.h>
26
27 G_BEGIN_DECLS
28
29 /**
30  * GST_BUFFER_POOL_OPTION_VIDEO_META:
31  *
32  * An option that can be activated on bufferpool to request video metadata
33  * on buffers from the pool.
34  */
35 #define GST_BUFFER_POOL_OPTION_VIDEO_META "GstBufferPoolOptionVideoMeta"
36
37 /**
38  * GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT:
39  *
40  * A bufferpool option to enable extra padding. When a bufferpool supports this
41  * option, gst_buffer_pool_set_video_alignment() can be called.
42  */
43 #define GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT "GstBufferPoolOptionVideoAlignment"
44
45 typedef struct _GstVideoAlignment GstVideoAlignment;
46
47 /**
48  * GstVideoAlignment:
49  * @padding_left: extra pixels on the left side
50  * @padding_right: extra pixels on the right side
51  * @padding_top: extra pixels on the top
52  * @padding_bottom: extra pixels on the bottom
53  * @stride_align: array with extra alignment requirements for the strides
54  *
55  * Extra alignment paramters for the memory of video buffers. This
56  * structure is usually used to configure the bufferpool if it supports the
57  * #GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT.
58  */
59 struct _GstVideoAlignment
60 {
61   guint padding_top;
62   guint padding_bottom;
63   guint padding_left;
64   guint padding_right;
65   guint stride_align[GST_VIDEO_MAX_PLANES];
66 };
67
68 void gst_video_alignment_reset (GstVideoAlignment *align);
69
70 /* setting a bufferpool config */
71 void             gst_buffer_pool_config_set_video_alignment  (GstStructure *config, GstVideoAlignment *align);
72 gboolean         gst_buffer_pool_config_get_video_alignment  (GstStructure *config, GstVideoAlignment *align);
73
74 /* video bufferpool */
75 typedef struct _GstVideoBufferPool GstVideoBufferPool;
76 typedef struct _GstVideoBufferPoolClass GstVideoBufferPoolClass;
77 typedef struct _GstVideoBufferPoolPrivate GstVideoBufferPoolPrivate;
78
79 #define GST_TYPE_VIDEO_BUFFER_POOL      (gst_video_buffer_pool_get_type())
80 #define GST_IS_VIDEO_BUFFER_POOL(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VIDEO_BUFFER_POOL))
81 #define GST_VIDEO_BUFFER_POOL(obj)      (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VIDEO_BUFFER_POOL, GstVideoBufferPool))
82 #define GST_VIDEO_BUFFER_POOL_CAST(obj) ((GstVideoBufferPool*)(obj))
83
84 struct _GstVideoBufferPool
85 {
86   GstBufferPool bufferpool;
87
88   GstVideoBufferPoolPrivate *priv;
89 };
90
91 struct _GstVideoBufferPoolClass
92 {
93   GstBufferPoolClass parent_class;
94 };
95
96 GType             gst_video_buffer_pool_get_type      (void);
97
98 GstBufferPool *   gst_video_buffer_pool_new           (void);
99
100 GstAllocator *    gst_video_buffer_pool_get_allocator (GstVideoBufferPool *pool);
101 void              gst_video_buffer_pool_set_allocator (GstVideoBufferPool *pool,
102                                                        GstAllocator *allocator);
103
104 G_END_DECLS
105
106 #endif /* __GST_VIDEO_POOL_H__ */