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 static void gst_video_orientation_iface_init (GstVideoOrientationInterface *
46 gst_video_orientation_get_type (void)
48 static GType gst_video_orientation_type = 0;
50 if (!gst_video_orientation_type) {
51 static const GTypeInfo gst_video_orientation_info = {
52 sizeof (GstVideoOrientationInterface),
53 (GBaseInitFunc) gst_video_orientation_iface_init,
63 gst_video_orientation_type = g_type_register_static (G_TYPE_INTERFACE,
64 "GstVideoOrientation", &gst_video_orientation_info, 0);
65 g_type_interface_add_prerequisite (gst_video_orientation_type,
66 GST_TYPE_IMPLEMENTS_INTERFACE);
69 return gst_video_orientation_type;
73 gst_video_orientation_iface_init (GstVideoOrientationInterface * iface)
75 /* default virtual functions */
77 iface->get_hflip = NULL;
78 iface->get_vflip = NULL;
79 iface->get_hcenter = NULL;
80 iface->get_vcenter = NULL;
82 iface->set_hflip = NULL;
83 iface->set_vflip = NULL;
84 iface->set_hcenter = NULL;
85 iface->set_vcenter = NULL;
89 * gst_video_orientation_get_hflip:
90 * @video_orientation: #GstVideoOrientation interface of a #GstElement
91 * @flip: return location for the result
93 * Get the horizontal flipping state (%TRUE for flipped) from the given object.
96 * Returns: %TRUE in case the element supports flipping
99 gst_video_orientation_get_hflip (GstVideoOrientation * video_orientation,
102 GstVideoOrientationInterface *iface =
103 GST_VIDEO_ORIENTATION_GET_IFACE (video_orientation);
105 if (iface->get_hflip) {
106 return iface->get_hflip (video_orientation, flip);
112 * gst_video_orientation_get_vflip:
113 * @video_orientation: #GstVideoOrientation interface of a #GstElement
114 * @flip: return location for the result
116 * Get the vertical flipping state (%TRUE for flipped) from the given object.
119 * Returns: %TRUE in case the element supports flipping
122 gst_video_orientation_get_vflip (GstVideoOrientation * video_orientation,
125 GstVideoOrientationInterface *iface =
126 GST_VIDEO_ORIENTATION_GET_IFACE (video_orientation);
128 if (iface->get_vflip) {
129 return iface->get_vflip (video_orientation, flip);
135 * gst_video_orientation_get_hcenter:
136 * @video_orientation: #GstVideoOrientation interface of a #GstElement
137 * @center: return location for the result
139 * Get the horizontal centering offset from the given object.
142 * Returns: %TRUE in case the element supports centering
145 gst_video_orientation_get_hcenter (GstVideoOrientation * video_orientation,
148 GstVideoOrientationInterface *iface =
149 GST_VIDEO_ORIENTATION_GET_IFACE (video_orientation);
151 if (iface->get_hcenter) {
152 return iface->get_hcenter (video_orientation, center);
158 * gst_video_orientation_get_vcenter:
159 * @video_orientation: #GstVideoOrientation interface of a #GstElement
160 * @center: return location for the result
162 * Get the vertical centering offset from the given object.
165 * Returns: %TRUE in case the element supports centering
168 gst_video_orientation_get_vcenter (GstVideoOrientation * video_orientation,
171 GstVideoOrientationInterface *iface =
172 GST_VIDEO_ORIENTATION_GET_IFACE (video_orientation);
174 if (iface->get_vcenter) {
175 return iface->get_vcenter (video_orientation, center);
181 * gst_video_orientation_set_hflip:
182 * @video_orientation: #GstVideoOrientation interface of a #GstElement
183 * @flip: use flipping
185 * Set the horizontal flipping state (%TRUE for flipped) for the given object.
188 * Returns: %TRUE in case the element supports flipping
191 gst_video_orientation_set_hflip (GstVideoOrientation * video_orientation,
194 GstVideoOrientationInterface *iface =
195 GST_VIDEO_ORIENTATION_GET_IFACE (video_orientation);
197 if (iface->set_hflip) {
198 return iface->set_hflip (video_orientation, flip);
204 * gst_video_orientation_set_vflip:
205 * @video_orientation: #GstVideoOrientation interface of a #GstElement
206 * @flip: use flipping
208 * Set the vertical flipping state (%TRUE for flipped) for the given object.
211 * Returns: %TRUE in case the element supports flipping
214 gst_video_orientation_set_vflip (GstVideoOrientation * video_orientation,
217 GstVideoOrientationInterface *iface =
218 GST_VIDEO_ORIENTATION_GET_IFACE (video_orientation);
220 if (iface->set_vflip) {
221 return iface->set_vflip (video_orientation, flip);
227 * gst_video_orientation_set_hcenter:
228 * @video_orientation: #GstVideoOrientation interface of a #GstElement
229 * @center: centering offset
231 * Set the horizontal centering offset for the given object.
234 * Returns: %TRUE in case the element supports centering
237 gst_video_orientation_set_hcenter (GstVideoOrientation * video_orientation,
240 GstVideoOrientationInterface *iface =
241 GST_VIDEO_ORIENTATION_GET_IFACE (video_orientation);
243 if (iface->set_hcenter) {
244 return iface->set_hcenter (video_orientation, center);
250 * gst_video_orientation_set_vcenter:
251 * @video_orientation: #GstVideoOrientation interface of a #GstElement
252 * @center: centering offset
254 * Set the vertical centering offset for the given object.
257 * Returns: %TRUE in case the element supports centering
260 gst_video_orientation_set_vcenter (GstVideoOrientation * video_orientation,
263 GstVideoOrientationInterface *iface =
264 GST_VIDEO_ORIENTATION_GET_IFACE (video_orientation);
266 if (iface->set_vcenter) {
267 return iface->set_vcenter (video_orientation, center);