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"
31 * SECTION:gstvideoorientation
32 * @short_description: Interface for elements providing video orientation
35 * The interface allows unified access to control flipping and autocenter
36 * operation of video-sources or operators.
39 /* FIXME 0.11: check if we need to add API for sometimes-supportedness
40 * (aka making up for GstImplementsInterface removal) (probably yes) */
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);
67 return gst_video_orientation_type;
71 gst_video_orientation_iface_init (GstVideoOrientationInterface * iface)
73 /* default virtual functions */
75 iface->get_hflip = NULL;
76 iface->get_vflip = NULL;
77 iface->get_hcenter = NULL;
78 iface->get_vcenter = NULL;
80 iface->set_hflip = NULL;
81 iface->set_vflip = NULL;
82 iface->set_hcenter = NULL;
83 iface->set_vcenter = NULL;
87 * gst_video_orientation_get_hflip:
88 * @video_orientation: #GstVideoOrientation interface of a #GstElement
89 * @flip: return location for the result
91 * Get the horizontal flipping state (%TRUE for flipped) from the given object.
92 * Returns: %TRUE in case the element supports flipping
95 gst_video_orientation_get_hflip (GstVideoOrientation * video_orientation,
98 GstVideoOrientationInterface *iface =
99 GST_VIDEO_ORIENTATION_GET_INTERFACE (video_orientation);
101 if (iface->get_hflip) {
102 return iface->get_hflip (video_orientation, flip);
108 * gst_video_orientation_get_vflip:
109 * @video_orientation: #GstVideoOrientation interface of a #GstElement
110 * @flip: return location for the result
112 * Get the vertical flipping state (%TRUE for flipped) from the given object.
113 * Returns: %TRUE in case the element supports flipping
116 gst_video_orientation_get_vflip (GstVideoOrientation * video_orientation,
119 GstVideoOrientationInterface *iface =
120 GST_VIDEO_ORIENTATION_GET_INTERFACE (video_orientation);
122 if (iface->get_vflip) {
123 return iface->get_vflip (video_orientation, flip);
129 * gst_video_orientation_get_hcenter:
130 * @video_orientation: #GstVideoOrientation interface of a #GstElement
131 * @center: return location for the result
133 * Get the horizontal centering offset from the given object.
134 * Returns: %TRUE in case the element supports centering
137 gst_video_orientation_get_hcenter (GstVideoOrientation * video_orientation,
140 GstVideoOrientationInterface *iface =
141 GST_VIDEO_ORIENTATION_GET_INTERFACE (video_orientation);
143 if (iface->get_hcenter) {
144 return iface->get_hcenter (video_orientation, center);
150 * gst_video_orientation_get_vcenter:
151 * @video_orientation: #GstVideoOrientation interface of a #GstElement
152 * @center: return location for the result
154 * Get the vertical centering offset from the given object.
155 * Returns: %TRUE in case the element supports centering
158 gst_video_orientation_get_vcenter (GstVideoOrientation * video_orientation,
161 GstVideoOrientationInterface *iface =
162 GST_VIDEO_ORIENTATION_GET_INTERFACE (video_orientation);
164 if (iface->get_vcenter) {
165 return iface->get_vcenter (video_orientation, center);
171 * gst_video_orientation_set_hflip:
172 * @video_orientation: #GstVideoOrientation interface of a #GstElement
173 * @flip: use flipping
175 * Set the horizontal flipping state (%TRUE for flipped) for the given object.
176 * Returns: %TRUE in case the element supports flipping
179 gst_video_orientation_set_hflip (GstVideoOrientation * video_orientation,
182 GstVideoOrientationInterface *iface =
183 GST_VIDEO_ORIENTATION_GET_INTERFACE (video_orientation);
185 if (iface->set_hflip) {
186 return iface->set_hflip (video_orientation, flip);
192 * gst_video_orientation_set_vflip:
193 * @video_orientation: #GstVideoOrientation interface of a #GstElement
194 * @flip: use flipping
196 * Set the vertical flipping state (%TRUE for flipped) for the given object.
197 * Returns: %TRUE in case the element supports flipping
200 gst_video_orientation_set_vflip (GstVideoOrientation * video_orientation,
203 GstVideoOrientationInterface *iface =
204 GST_VIDEO_ORIENTATION_GET_INTERFACE (video_orientation);
206 if (iface->set_vflip) {
207 return iface->set_vflip (video_orientation, flip);
213 * gst_video_orientation_set_hcenter:
214 * @video_orientation: #GstVideoOrientation interface of a #GstElement
215 * @center: centering offset
217 * Set the horizontal centering offset for the given object.
218 * Returns: %TRUE in case the element supports centering
221 gst_video_orientation_set_hcenter (GstVideoOrientation * video_orientation,
224 GstVideoOrientationInterface *iface =
225 GST_VIDEO_ORIENTATION_GET_INTERFACE (video_orientation);
227 if (iface->set_hcenter) {
228 return iface->set_hcenter (video_orientation, center);
234 * gst_video_orientation_set_vcenter:
235 * @video_orientation: #GstVideoOrientation interface of a #GstElement
236 * @center: centering offset
238 * Set the vertical centering offset for the given object.
239 * Returns: %TRUE in case the element supports centering
242 gst_video_orientation_set_vcenter (GstVideoOrientation * video_orientation,
245 GstVideoOrientationInterface *iface =
246 GST_VIDEO_ORIENTATION_GET_INTERFACE (video_orientation);
248 if (iface->set_vcenter) {
249 return iface->set_vcenter (video_orientation, center);