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 /* metadata macros */
93 /**
94  * GST_META_TAG_VIDEO_STR:
95  *
96  * This metadata is relevant for video streams.
97  *
98  * Since: 1.2
99  */
100 #define GST_META_TAG_VIDEO_STR "video"
101 /**
102  * GST_META_TAG_VIDEO_ORIENTATION_STR:
103  *
104  * This metadata stays relevant as long as video orientation is unchanged.
105  *
106  * Since: 1.2
107  */
108 #define GST_META_TAG_VIDEO_ORIENTATION_STR "orientation"
109 /**
110  * GST_META_TAG_VIDEO_SIZE_STR:
111  *
112  * This metadata stays relevant as long as video size is unchanged.
113  *
114  * Since: 1.2
115  */
116 #define GST_META_TAG_VIDEO_SIZE_STR "size"
117 /**
118  * GST_META_TAG_VIDEO_COLORSPACE_STR:
119  *
120  * This metadata stays relevant as long as video colorspace is unchanged.
121  *
122  * Since: 1.2
123  */
124 #define GST_META_TAG_VIDEO_COLORSPACE_STR "colorspace"
125 
126 GST_VIDEO_API
127 void           gst_video_alignment_reset         (GstVideoAlignment *align);
128 
129 
130 /* some helper functions */
131 
132 GST_VIDEO_API
133 gboolean       gst_video_calculate_display_ratio (guint * dar_n,
134                                                   guint * dar_d,
135                                                   guint   video_width,
136                                                   guint   video_height,
137                                                   guint   video_par_n,
138                                                   guint   video_par_d,
139                                                   guint   display_par_n,
140                                                   guint   display_par_d);
141 
142 GST_VIDEO_API
143 gboolean       gst_video_guess_framerate (GstClockTime duration,
144                                           gint * dest_n, gint * dest_d);
145 
146 /* convert/encode video sample from one format to another */
147 
148 typedef void (*GstVideoConvertSampleCallback) (GstSample * sample, GError *error, gpointer user_data);
149 
150 GST_VIDEO_API
151 void          gst_video_convert_sample_async (GstSample                    * sample,
152                                               const GstCaps                * to_caps,
153                                               GstClockTime                   timeout,
154                                               GstVideoConvertSampleCallback  callback,
155                                               gpointer                       user_data,
156                                               GDestroyNotify                 destroy_notify);
157 
158 GST_VIDEO_API
159 GstSample *   gst_video_convert_sample       (GstSample     * sample,
160                                               const GstCaps * to_caps,
161                                               GstClockTime    timeout,
162                                               GError       ** error);
163 
164 G_END_DECLS
165 
166 #include <gst/video/colorbalancechannel.h>
167 #include <gst/video/colorbalance.h>
168 #include <gst/video/gstvideoaggregator.h>
169 #include <gst/video/gstvideodecoder.h>
170 #include <gst/video/gstvideoencoder.h>
171 #include <gst/video/gstvideofilter.h>
172 #include <gst/video/gstvideometa.h>
173 #include <gst/video/gstvideopool.h>
174 #include <gst/video/gstvideosink.h>
175 #include <gst/video/gstvideoutils.h>
176 #include <gst/video/navigation.h>
177 #include <gst/video/video-blend.h>
178 #include <gst/video/video-event.h>
179 #include <gst/video/videodirection.h>
180 #include <gst/video/videoorientation.h>
181 #include <gst/video/video-overlay-composition.h>
182 #include <gst/video/videooverlay.h>
183 #include <gst/video/gstvideotimecode.h>
184 #include <gst/video/gstvideoaffinetransformationmeta.h>
185 #include <gst/video/video-anc.h>
186 
187 #endif /* __GST_VIDEO_H__ */
188