adder: fill the audio-info that we use and not some random other one
[platform/upstream/gstreamer.git] / gst-libs / gst / interfaces / videoorientation.c
1 /* GStreamer
2  * Copyright (C) 2006 Nokia <stefan.kost@nokia.com>
3  *
4  * videoorientation.c: video flipping and centering interface
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 #ifdef HAVE_CONFIG_H
23 #include "config.h"
24 #endif
25
26 #include "videoorientation.h"
27 #include "interfaces-marshal.h"
28
29 #include <string.h>
30
31 /**
32  * SECTION:gstvideoorientation
33  * @short_description: Interface for elements providing video orientation
34  * controls
35  *
36  * The interface allows unified access to control flipping and autocenter
37  * operation of video-sources or operators.
38  *
39  * Since: 0.10.11
40  */
41
42 /* FIXME 0.11: check if we need to add API for sometimes-supportedness
43  * (aka making up for GstImplementsInterface removal) (probably yes) */
44
45 static void gst_video_orientation_iface_init (GstVideoOrientationInterface *
46     iface);
47
48 GType
49 gst_video_orientation_get_type (void)
50 {
51   static GType gst_video_orientation_type = 0;
52
53   if (!gst_video_orientation_type) {
54     static const GTypeInfo gst_video_orientation_info = {
55       sizeof (GstVideoOrientationInterface),
56       (GBaseInitFunc) gst_video_orientation_iface_init,
57       NULL,
58       NULL,
59       NULL,
60       NULL,
61       0,
62       0,
63       NULL,
64     };
65
66     gst_video_orientation_type = g_type_register_static (G_TYPE_INTERFACE,
67         "GstVideoOrientation", &gst_video_orientation_info, 0);
68   }
69
70   return gst_video_orientation_type;
71 }
72
73 static void
74 gst_video_orientation_iface_init (GstVideoOrientationInterface * iface)
75 {
76   /* default virtual functions */
77
78   iface->get_hflip = NULL;
79   iface->get_vflip = NULL;
80   iface->get_hcenter = NULL;
81   iface->get_vcenter = NULL;
82
83   iface->set_hflip = NULL;
84   iface->set_vflip = NULL;
85   iface->set_hcenter = NULL;
86   iface->set_vcenter = NULL;
87 }
88
89 /**
90  * gst_video_orientation_get_hflip:
91  * @video_orientation: #GstVideoOrientation interface of a #GstElement
92  * @flip: return location for the result
93  *
94  * Get the horizontal flipping state (%TRUE for flipped) from the given object.
95  *
96  * Since: 0.10.11
97  * Returns: %TRUE in case the element supports flipping
98  */
99 gboolean
100 gst_video_orientation_get_hflip (GstVideoOrientation * video_orientation,
101     gboolean * flip)
102 {
103   GstVideoOrientationInterface *iface =
104       GST_VIDEO_ORIENTATION_GET_INTERFACE (video_orientation);
105
106   if (iface->get_hflip) {
107     return iface->get_hflip (video_orientation, flip);
108   }
109   return FALSE;
110 }
111
112 /**
113  * gst_video_orientation_get_vflip:
114  * @video_orientation: #GstVideoOrientation interface of a #GstElement
115  * @flip: return location for the result
116  *
117  * Get the vertical flipping state (%TRUE for flipped) from the given object.
118  *
119  * Since: 0.10.11
120  * Returns: %TRUE in case the element supports flipping
121  */
122 gboolean
123 gst_video_orientation_get_vflip (GstVideoOrientation * video_orientation,
124     gboolean * flip)
125 {
126   GstVideoOrientationInterface *iface =
127       GST_VIDEO_ORIENTATION_GET_INTERFACE (video_orientation);
128
129   if (iface->get_vflip) {
130     return iface->get_vflip (video_orientation, flip);
131   }
132   return FALSE;
133 }
134
135 /**
136  * gst_video_orientation_get_hcenter:
137  * @video_orientation: #GstVideoOrientation interface of a #GstElement
138  * @center: return location for the result
139  *
140  * Get the horizontal centering offset from the given object.
141  *
142  * Since: 0.10.11
143  * Returns: %TRUE in case the element supports centering
144  */
145 gboolean
146 gst_video_orientation_get_hcenter (GstVideoOrientation * video_orientation,
147     gint * center)
148 {
149   GstVideoOrientationInterface *iface =
150       GST_VIDEO_ORIENTATION_GET_INTERFACE (video_orientation);
151
152   if (iface->get_hcenter) {
153     return iface->get_hcenter (video_orientation, center);
154   }
155   return FALSE;
156 }
157
158 /**
159  * gst_video_orientation_get_vcenter:
160  * @video_orientation: #GstVideoOrientation interface of a #GstElement
161  * @center: return location for the result
162  *
163  * Get the vertical centering offset from the given object.
164  *
165  * Since: 0.10.11
166  * Returns: %TRUE in case the element supports centering
167  */
168 gboolean
169 gst_video_orientation_get_vcenter (GstVideoOrientation * video_orientation,
170     gint * center)
171 {
172   GstVideoOrientationInterface *iface =
173       GST_VIDEO_ORIENTATION_GET_INTERFACE (video_orientation);
174
175   if (iface->get_vcenter) {
176     return iface->get_vcenter (video_orientation, center);
177   }
178   return FALSE;
179 }
180
181 /**
182  * gst_video_orientation_set_hflip:
183  * @video_orientation: #GstVideoOrientation interface of a #GstElement
184  * @flip: use flipping
185  *
186  * Set the horizontal flipping state (%TRUE for flipped) for the given object.
187  *
188  * Since: 0.10.11
189  * Returns: %TRUE in case the element supports flipping
190  */
191 gboolean
192 gst_video_orientation_set_hflip (GstVideoOrientation * video_orientation,
193     gboolean flip)
194 {
195   GstVideoOrientationInterface *iface =
196       GST_VIDEO_ORIENTATION_GET_INTERFACE (video_orientation);
197
198   if (iface->set_hflip) {
199     return iface->set_hflip (video_orientation, flip);
200   }
201   return FALSE;
202 }
203
204 /**
205  * gst_video_orientation_set_vflip:
206  * @video_orientation: #GstVideoOrientation interface of a #GstElement
207  * @flip: use flipping
208  *
209  * Set the vertical flipping state (%TRUE for flipped) for the given object.
210  *
211  * Since: 0.10.11
212  * Returns: %TRUE in case the element supports flipping
213  */
214 gboolean
215 gst_video_orientation_set_vflip (GstVideoOrientation * video_orientation,
216     gboolean flip)
217 {
218   GstVideoOrientationInterface *iface =
219       GST_VIDEO_ORIENTATION_GET_INTERFACE (video_orientation);
220
221   if (iface->set_vflip) {
222     return iface->set_vflip (video_orientation, flip);
223   }
224   return FALSE;
225 }
226
227 /**
228  * gst_video_orientation_set_hcenter:
229  * @video_orientation: #GstVideoOrientation interface of a #GstElement
230  * @center: centering offset
231  *
232  * Set the horizontal centering offset for the given object.
233  *
234  * Since: 0.10.11
235  * Returns: %TRUE in case the element supports centering
236  */
237 gboolean
238 gst_video_orientation_set_hcenter (GstVideoOrientation * video_orientation,
239     gint center)
240 {
241   GstVideoOrientationInterface *iface =
242       GST_VIDEO_ORIENTATION_GET_INTERFACE (video_orientation);
243
244   if (iface->set_hcenter) {
245     return iface->set_hcenter (video_orientation, center);
246   }
247   return FALSE;
248 }
249
250 /**
251  * gst_video_orientation_set_vcenter:
252  * @video_orientation: #GstVideoOrientation interface of a #GstElement
253  * @center: centering offset
254  *
255  * Set the vertical centering offset for the given object.
256  *
257  * Since: 0.10.11
258  * Returns: %TRUE in case the element supports centering
259  */
260 gboolean
261 gst_video_orientation_set_vcenter (GstVideoOrientation * video_orientation,
262     gint center)
263 {
264   GstVideoOrientationInterface *iface =
265       GST_VIDEO_ORIENTATION_GET_INTERFACE (video_orientation);
266
267   if (iface->set_vcenter) {
268     return iface->set_vcenter (video_orientation, center);
269   }
270   return FALSE;
271 }