2 * Copyright (C) 2006 Nokia <stefan.kost@nokia.com>
4 * videoorientation.c: video flipping and centering interface
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.
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.
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.
26 #include "videoorientation.h"
27 #include "interfaces-marshal.h"
32 * SECTION:gstvideoorientation
33 * @short_description: Interface for elements providing video orientation
36 * The interface allows unified access to control flipping and autocenter
37 * operation of video-sources or operators.
42 /* FIXME 0.11: check if we need to add API for sometimes-supportedness
43 * (aka making up for GstImplementsInterface removal) (probably yes) */
45 static void gst_video_orientation_iface_init (GstVideoOrientationInterface *
49 gst_video_orientation_get_type (void)
51 static GType gst_video_orientation_type = 0;
53 if (!gst_video_orientation_type) {
54 static const GTypeInfo gst_video_orientation_info = {
55 sizeof (GstVideoOrientationInterface),
56 (GBaseInitFunc) gst_video_orientation_iface_init,
66 gst_video_orientation_type = g_type_register_static (G_TYPE_INTERFACE,
67 "GstVideoOrientation", &gst_video_orientation_info, 0);
70 return gst_video_orientation_type;
74 gst_video_orientation_iface_init (GstVideoOrientationInterface * iface)
76 /* default virtual functions */
78 iface->get_hflip = NULL;
79 iface->get_vflip = NULL;
80 iface->get_hcenter = NULL;
81 iface->get_vcenter = NULL;
83 iface->set_hflip = NULL;
84 iface->set_vflip = NULL;
85 iface->set_hcenter = NULL;
86 iface->set_vcenter = NULL;
90 * gst_video_orientation_get_hflip:
91 * @video_orientation: #GstVideoOrientation interface of a #GstElement
92 * @flip: return location for the result
94 * Get the horizontal flipping state (%TRUE for flipped) from the given object.
97 * Returns: %TRUE in case the element supports flipping
100 gst_video_orientation_get_hflip (GstVideoOrientation * video_orientation,
103 GstVideoOrientationInterface *iface =
104 GST_VIDEO_ORIENTATION_GET_INTERFACE (video_orientation);
106 if (iface->get_hflip) {
107 return iface->get_hflip (video_orientation, flip);
113 * gst_video_orientation_get_vflip:
114 * @video_orientation: #GstVideoOrientation interface of a #GstElement
115 * @flip: return location for the result
117 * Get the vertical flipping state (%TRUE for flipped) from the given object.
120 * Returns: %TRUE in case the element supports flipping
123 gst_video_orientation_get_vflip (GstVideoOrientation * video_orientation,
126 GstVideoOrientationInterface *iface =
127 GST_VIDEO_ORIENTATION_GET_INTERFACE (video_orientation);
129 if (iface->get_vflip) {
130 return iface->get_vflip (video_orientation, flip);
136 * gst_video_orientation_get_hcenter:
137 * @video_orientation: #GstVideoOrientation interface of a #GstElement
138 * @center: return location for the result
140 * Get the horizontal centering offset from the given object.
143 * Returns: %TRUE in case the element supports centering
146 gst_video_orientation_get_hcenter (GstVideoOrientation * video_orientation,
149 GstVideoOrientationInterface *iface =
150 GST_VIDEO_ORIENTATION_GET_INTERFACE (video_orientation);
152 if (iface->get_hcenter) {
153 return iface->get_hcenter (video_orientation, center);
159 * gst_video_orientation_get_vcenter:
160 * @video_orientation: #GstVideoOrientation interface of a #GstElement
161 * @center: return location for the result
163 * Get the vertical centering offset from the given object.
166 * Returns: %TRUE in case the element supports centering
169 gst_video_orientation_get_vcenter (GstVideoOrientation * video_orientation,
172 GstVideoOrientationInterface *iface =
173 GST_VIDEO_ORIENTATION_GET_INTERFACE (video_orientation);
175 if (iface->get_vcenter) {
176 return iface->get_vcenter (video_orientation, center);
182 * gst_video_orientation_set_hflip:
183 * @video_orientation: #GstVideoOrientation interface of a #GstElement
184 * @flip: use flipping
186 * Set the horizontal flipping state (%TRUE for flipped) for the given object.
189 * Returns: %TRUE in case the element supports flipping
192 gst_video_orientation_set_hflip (GstVideoOrientation * video_orientation,
195 GstVideoOrientationInterface *iface =
196 GST_VIDEO_ORIENTATION_GET_INTERFACE (video_orientation);
198 if (iface->set_hflip) {
199 return iface->set_hflip (video_orientation, flip);
205 * gst_video_orientation_set_vflip:
206 * @video_orientation: #GstVideoOrientation interface of a #GstElement
207 * @flip: use flipping
209 * Set the vertical flipping state (%TRUE for flipped) for the given object.
212 * Returns: %TRUE in case the element supports flipping
215 gst_video_orientation_set_vflip (GstVideoOrientation * video_orientation,
218 GstVideoOrientationInterface *iface =
219 GST_VIDEO_ORIENTATION_GET_INTERFACE (video_orientation);
221 if (iface->set_vflip) {
222 return iface->set_vflip (video_orientation, flip);
228 * gst_video_orientation_set_hcenter:
229 * @video_orientation: #GstVideoOrientation interface of a #GstElement
230 * @center: centering offset
232 * Set the horizontal centering offset for the given object.
235 * Returns: %TRUE in case the element supports centering
238 gst_video_orientation_set_hcenter (GstVideoOrientation * video_orientation,
241 GstVideoOrientationInterface *iface =
242 GST_VIDEO_ORIENTATION_GET_INTERFACE (video_orientation);
244 if (iface->set_hcenter) {
245 return iface->set_hcenter (video_orientation, center);
251 * gst_video_orientation_set_vcenter:
252 * @video_orientation: #GstVideoOrientation interface of a #GstElement
253 * @center: centering offset
255 * Set the vertical centering offset for the given object.
258 * Returns: %TRUE in case the element supports centering
261 gst_video_orientation_set_vcenter (GstVideoOrientation * video_orientation,
264 GstVideoOrientationInterface *iface =
265 GST_VIDEO_ORIENTATION_GET_INTERFACE (video_orientation);
267 if (iface->set_vcenter) {
268 return iface->set_vcenter (video_orientation, center);