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., 51 Franklin St, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
26 #include "videoorientation.h"
31 * SECTION:gstvideoorientation
32 * @title: 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.
40 /* FIXME 0.11: check if we need to add API for sometimes-supportedness
41 * (aka making up for GstImplementsInterface removal) (probably yes) */
43 G_DEFINE_INTERFACE (GstVideoOrientation, gst_video_orientation, 0)
46 gst_video_orientation_default_init (GstVideoOrientationInterface *
49 /* default virtual functions */
51 iface->get_hflip = NULL;
52 iface->get_vflip = NULL;
53 iface->get_hcenter = NULL;
54 iface->get_vcenter = NULL;
56 iface->set_hflip = NULL;
57 iface->set_vflip = NULL;
58 iface->set_hcenter = NULL;
59 iface->set_vcenter = NULL;
63 * gst_video_orientation_get_hflip:
64 * @video_orientation: #GstVideoOrientation interface of a #GstElement
65 * @flip: (out): return location for the result
67 * Get the horizontal flipping state (%TRUE for flipped) from the given object.
68 * Returns: %TRUE in case the element supports flipping
71 gst_video_orientation_get_hflip (GstVideoOrientation * video_orientation,
74 GstVideoOrientationInterface *iface =
75 GST_VIDEO_ORIENTATION_GET_INTERFACE (video_orientation);
77 if (iface->get_hflip) {
78 return iface->get_hflip (video_orientation, flip);
84 * gst_video_orientation_get_vflip:
85 * @video_orientation: #GstVideoOrientation interface of a #GstElement
86 * @flip: (out): return location for the result
88 * Get the vertical flipping state (%TRUE for flipped) from the given object.
89 * Returns: %TRUE in case the element supports flipping
92 gst_video_orientation_get_vflip (GstVideoOrientation * video_orientation,
95 GstVideoOrientationInterface *iface =
96 GST_VIDEO_ORIENTATION_GET_INTERFACE (video_orientation);
98 if (iface->get_vflip) {
99 return iface->get_vflip (video_orientation, flip);
105 * gst_video_orientation_get_hcenter:
106 * @video_orientation: #GstVideoOrientation interface of a #GstElement
107 * @center: (out): return location for the result
109 * Get the horizontal centering offset from the given object.
110 * Returns: %TRUE in case the element supports centering
113 gst_video_orientation_get_hcenter (GstVideoOrientation * video_orientation,
116 GstVideoOrientationInterface *iface =
117 GST_VIDEO_ORIENTATION_GET_INTERFACE (video_orientation);
119 if (iface->get_hcenter) {
120 return iface->get_hcenter (video_orientation, center);
126 * gst_video_orientation_get_vcenter:
127 * @video_orientation: #GstVideoOrientation interface of a #GstElement
128 * @center: (out): return location for the result
130 * Get the vertical centering offset from the given object.
131 * Returns: %TRUE in case the element supports centering
134 gst_video_orientation_get_vcenter (GstVideoOrientation * video_orientation,
137 GstVideoOrientationInterface *iface =
138 GST_VIDEO_ORIENTATION_GET_INTERFACE (video_orientation);
140 if (iface->get_vcenter) {
141 return iface->get_vcenter (video_orientation, center);
147 * gst_video_orientation_set_hflip:
148 * @video_orientation: #GstVideoOrientation interface of a #GstElement
149 * @flip: use flipping
151 * Set the horizontal flipping state (%TRUE for flipped) for the given object.
152 * Returns: %TRUE in case the element supports flipping
155 gst_video_orientation_set_hflip (GstVideoOrientation * video_orientation,
158 GstVideoOrientationInterface *iface =
159 GST_VIDEO_ORIENTATION_GET_INTERFACE (video_orientation);
161 if (iface->set_hflip) {
162 return iface->set_hflip (video_orientation, flip);
168 * gst_video_orientation_set_vflip:
169 * @video_orientation: #GstVideoOrientation interface of a #GstElement
170 * @flip: use flipping
172 * Set the vertical flipping state (%TRUE for flipped) for the given object.
173 * Returns: %TRUE in case the element supports flipping
176 gst_video_orientation_set_vflip (GstVideoOrientation * video_orientation,
179 GstVideoOrientationInterface *iface =
180 GST_VIDEO_ORIENTATION_GET_INTERFACE (video_orientation);
182 if (iface->set_vflip) {
183 return iface->set_vflip (video_orientation, flip);
189 * gst_video_orientation_set_hcenter:
190 * @video_orientation: #GstVideoOrientation interface of a #GstElement
191 * @center: centering offset
193 * Set the horizontal centering offset for the given object.
194 * Returns: %TRUE in case the element supports centering
197 gst_video_orientation_set_hcenter (GstVideoOrientation * video_orientation,
200 GstVideoOrientationInterface *iface =
201 GST_VIDEO_ORIENTATION_GET_INTERFACE (video_orientation);
203 if (iface->set_hcenter) {
204 return iface->set_hcenter (video_orientation, center);
210 * gst_video_orientation_set_vcenter:
211 * @video_orientation: #GstVideoOrientation interface of a #GstElement
212 * @center: centering offset
214 * Set the vertical centering offset for the given object.
215 * Returns: %TRUE in case the element supports centering
218 gst_video_orientation_set_vcenter (GstVideoOrientation * video_orientation,
221 GstVideoOrientationInterface *iface =
222 GST_VIDEO_ORIENTATION_GET_INTERFACE (video_orientation);
224 if (iface->set_vcenter) {
225 return iface->set_vcenter (video_orientation, center);