video-converter: Fix v210->I420 last line conversion
[platform/upstream/gstreamer.git] / subprojects / gst-plugins-base / gst-libs / gst / video / video.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., 51 Franklin St, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19
20 #ifndef __GST_VIDEO_H__
21 #define __GST_VIDEO_H__
22
23 #include <gst/gst.h>
24
25 #include <gst/video/video-prelude.h>
26
27 typedef struct _GstVideoAlignment GstVideoAlignment;
28
29 #include <gst/video/video-format.h>
30 #include <gst/video/video-color.h>
31 #include <gst/video/video-dither.h>
32 #include <gst/video/video-info.h>
33 #include <gst/video/video-frame.h>
34 #include <gst/video/video-enumtypes.h>
35 #include <gst/video/video-converter.h>
36 #include <gst/video/video-scaler.h>
37 #include <gst/video/video-multiview.h>
38
39 G_BEGIN_DECLS
40
41 /**
42  * GstVideoAlignment:
43  * @padding_left: extra pixels on the left side
44  * @padding_right: extra pixels on the right side
45  * @padding_top: extra pixels on the top
46  * @padding_bottom: extra pixels on the bottom
47  * @stride_align: array with extra alignment requirements for the strides
48  *
49  * Extra alignment parameters for the memory of video buffers. This
50  * structure is usually used to configure the bufferpool if it supports the
51  * #GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT.
52  */
53 struct _GstVideoAlignment
54 {
55   guint padding_top;
56   guint padding_bottom;
57   guint padding_left;
58   guint padding_right;
59   guint stride_align[GST_VIDEO_MAX_PLANES];
60 };
61
62 /**
63  * GstVideoOrientationMethod:
64  * @GST_VIDEO_ORIENTATION_IDENTITY: Identity (no rotation)
65  * @GST_VIDEO_ORIENTATION_90R: Rotate clockwise 90 degrees
66  * @GST_VIDEO_ORIENTATION_180: Rotate 180 degrees
67  * @GST_VIDEO_ORIENTATION_90L: Rotate counter-clockwise 90 degrees
68  * @GST_VIDEO_ORIENTATION_HORIZ: Flip horizontally
69  * @GST_VIDEO_ORIENTATION_VERT: Flip vertically
70  * @GST_VIDEO_ORIENTATION_UL_LR: Flip across upper left/lower right diagonal
71  * @GST_VIDEO_ORIENTATION_UR_LL: Flip across upper right/lower left diagonal
72  * @GST_VIDEO_ORIENTATION_AUTO: Select flip method based on image-orientation tag
73  * @GST_VIDEO_ORIENTATION_CUSTOM: Current status depends on plugin internal setup
74  *
75  * The different video orientation methods.
76  *
77  * Since: 1.10
78  */
79 typedef enum {
80   GST_VIDEO_ORIENTATION_IDENTITY,
81   GST_VIDEO_ORIENTATION_90R,
82   GST_VIDEO_ORIENTATION_180,
83   GST_VIDEO_ORIENTATION_90L,
84   GST_VIDEO_ORIENTATION_HORIZ,
85   GST_VIDEO_ORIENTATION_VERT,
86   GST_VIDEO_ORIENTATION_UL_LR,
87   GST_VIDEO_ORIENTATION_UR_LL,
88   GST_VIDEO_ORIENTATION_AUTO,
89   GST_VIDEO_ORIENTATION_CUSTOM,
90 } GstVideoOrientationMethod;
91
92 /**
93  * GST_TYPE_VIDEO_ORIENTATION_METHOD:
94  *
95  * Since: 1.20
96  */
97
98 GST_VIDEO_API
99 GType gst_video_orientation_method_get_type (void);
100 #define GST_TYPE_VIDEO_ORIENTATION_METHOD \
101   gst_video_orientation_method_get_type ()
102
103 /* metadata macros */
104 /**
105  * GST_META_TAG_VIDEO_STR:
106  *
107  * This metadata is relevant for video streams.
108  *
109  * Since: 1.2
110  */
111 #define GST_META_TAG_VIDEO_STR "video"
112 /**
113  * GST_META_TAG_VIDEO_ORIENTATION_STR:
114  *
115  * This metadata stays relevant as long as video orientation is unchanged.
116  *
117  * Since: 1.2
118  */
119 #define GST_META_TAG_VIDEO_ORIENTATION_STR "orientation"
120 /**
121  * GST_META_TAG_VIDEO_SIZE_STR:
122  *
123  * This metadata stays relevant as long as video size is unchanged.
124  *
125  * Since: 1.2
126  */
127 #define GST_META_TAG_VIDEO_SIZE_STR "size"
128 /**
129  * GST_META_TAG_VIDEO_COLORSPACE_STR:
130  *
131  * This metadata stays relevant as long as video colorspace is unchanged.
132  *
133  * Since: 1.2
134  */
135 #define GST_META_TAG_VIDEO_COLORSPACE_STR "colorspace"
136
137 GST_VIDEO_API
138 void           gst_video_alignment_reset         (GstVideoAlignment *align);
139
140
141 /* some helper functions */
142
143 GST_VIDEO_API
144 gboolean       gst_video_calculate_display_ratio (guint * dar_n,
145                                                   guint * dar_d,
146                                                   guint   video_width,
147                                                   guint   video_height,
148                                                   guint   video_par_n,
149                                                   guint   video_par_d,
150                                                   guint   display_par_n,
151                                                   guint   display_par_d);
152
153 GST_VIDEO_API
154 gboolean       gst_video_guess_framerate (GstClockTime duration,
155                                           gint * dest_n, gint * dest_d);
156
157 /* convert/encode video sample from one format to another */
158
159 typedef void (*GstVideoConvertSampleCallback) (GstSample * sample, GError *error, gpointer user_data);
160
161 GST_VIDEO_API
162 void          gst_video_convert_sample_async (GstSample                    * sample,
163                                               const GstCaps                * to_caps,
164                                               GstClockTime                   timeout,
165                                               GstVideoConvertSampleCallback  callback,
166                                               gpointer                       user_data,
167                                               GDestroyNotify                 destroy_notify);
168
169 GST_VIDEO_API
170 GstSample *   gst_video_convert_sample       (GstSample     * sample,
171                                               const GstCaps * to_caps,
172                                               GstClockTime    timeout,
173                                               GError       ** error);
174
175
176 GST_VIDEO_API
177 gboolean gst_video_orientation_from_tag (GstTagList * taglist,
178                                          GstVideoOrientationMethod * method);
179
180 G_END_DECLS
181
182 #include <gst/video/colorbalancechannel.h>
183 #include <gst/video/colorbalance.h>
184 #include <gst/video/gstvideoaffinetransformationmeta.h>
185 #include <gst/video/gstvideoaggregator.h>
186 #include <gst/video/gstvideocodecalphameta.h>
187 #include <gst/video/gstvideodecoder.h>
188 #include <gst/video/gstvideoencoder.h>
189 #include <gst/video/gstvideofilter.h>
190 #include <gst/video/gstvideometa.h>
191 #include <gst/video/gstvideopool.h>
192 #include <gst/video/gstvideosink.h>
193 #include <gst/video/gstvideotimecode.h>
194 #include <gst/video/gstvideoutils.h>
195 #include <gst/video/navigation.h>
196 #include <gst/video/video-anc.h>
197 #include <gst/video/video-blend.h>
198 #include <gst/video/videodirection.h>
199 #include <gst/video/video-event.h>
200 #include <gst/video/video-hdr.h>
201 #include <gst/video/videoorientation.h>
202 #include <gst/video/video-overlay-composition.h>
203 #include <gst/video/videooverlay.h>
204
205 #endif /* __GST_VIDEO_H__ */