Branch data Line data Source code
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 : : static void gst_video_orientation_iface_init (GstVideoOrientationInterface *
43 : : iface);
44 : :
45 : : GType
46 : 9 : gst_video_orientation_get_type (void)
47 : : {
48 : : static GType gst_video_orientation_type = 0;
49 : :
50 [ + - ]: 9 : if (!gst_video_orientation_type) {
51 : : static const GTypeInfo gst_video_orientation_info = {
52 : : sizeof (GstVideoOrientationInterface),
53 : : (GBaseInitFunc) gst_video_orientation_iface_init,
54 : : NULL,
55 : : NULL,
56 : : NULL,
57 : : NULL,
58 : : 0,
59 : : 0,
60 : : NULL,
61 : : };
62 : :
63 : 9 : gst_video_orientation_type = g_type_register_static (G_TYPE_INTERFACE,
64 : : "GstVideoOrientation", &gst_video_orientation_info, 0);
65 : 9 : g_type_interface_add_prerequisite (gst_video_orientation_type,
66 : : GST_TYPE_IMPLEMENTS_INTERFACE);
67 : : }
68 : :
69 : 9 : return gst_video_orientation_type;
70 : : }
71 : :
72 : : static void
73 : 14 : gst_video_orientation_iface_init (GstVideoOrientationInterface * iface)
74 : : {
75 : : /* default virtual functions */
76 : :
77 : 14 : iface->get_hflip = NULL;
78 : 14 : iface->get_vflip = NULL;
79 : 14 : iface->get_hcenter = NULL;
80 : 14 : iface->get_vcenter = NULL;
81 : :
82 : 14 : iface->set_hflip = NULL;
83 : 14 : iface->set_vflip = NULL;
84 : 14 : iface->set_hcenter = NULL;
85 : 14 : iface->set_vcenter = NULL;
86 : 14 : }
87 : :
88 : : /**
89 : : * gst_video_orientation_get_hflip:
90 : : * @video_orientation: #GstVideoOrientation interface of a #GstElement
91 : : * @flip: return location for the result
92 : : *
93 : : * Get the horizontal flipping state (%TRUE for flipped) from the given object.
94 : : *
95 : : * Since: 0.10.11
96 : : * Returns: %TRUE in case the element supports flipping
97 : : */
98 : : gboolean
99 : 0 : gst_video_orientation_get_hflip (GstVideoOrientation * video_orientation,
100 : : gboolean * flip)
101 : : {
102 : 0 : GstVideoOrientationInterface *iface =
103 : 0 : GST_VIDEO_ORIENTATION_GET_IFACE (video_orientation);
104 : :
105 [ # # ]: 0 : if (iface->get_hflip) {
106 : 0 : return iface->get_hflip (video_orientation, flip);
107 : : }
108 : 0 : return FALSE;
109 : : }
110 : :
111 : : /**
112 : : * gst_video_orientation_get_vflip:
113 : : * @video_orientation: #GstVideoOrientation interface of a #GstElement
114 : : * @flip: return location for the result
115 : : *
116 : : * Get the vertical flipping state (%TRUE for flipped) from the given object.
117 : : *
118 : : * Since: 0.10.11
119 : : * Returns: %TRUE in case the element supports flipping
120 : : */
121 : : gboolean
122 : 0 : gst_video_orientation_get_vflip (GstVideoOrientation * video_orientation,
123 : : gboolean * flip)
124 : : {
125 : 0 : GstVideoOrientationInterface *iface =
126 : 0 : GST_VIDEO_ORIENTATION_GET_IFACE (video_orientation);
127 : :
128 [ # # ]: 0 : if (iface->get_vflip) {
129 : 0 : return iface->get_vflip (video_orientation, flip);
130 : : }
131 : 0 : return FALSE;
132 : : }
133 : :
134 : : /**
135 : : * gst_video_orientation_get_hcenter:
136 : : * @video_orientation: #GstVideoOrientation interface of a #GstElement
137 : : * @center: return location for the result
138 : : *
139 : : * Get the horizontal centering offset from the given object.
140 : : *
141 : : * Since: 0.10.11
142 : : * Returns: %TRUE in case the element supports centering
143 : : */
144 : : gboolean
145 : 0 : gst_video_orientation_get_hcenter (GstVideoOrientation * video_orientation,
146 : : gint * center)
147 : : {
148 : 0 : GstVideoOrientationInterface *iface =
149 : 0 : GST_VIDEO_ORIENTATION_GET_IFACE (video_orientation);
150 : :
151 [ # # ]: 0 : if (iface->get_hcenter) {
152 : 0 : return iface->get_hcenter (video_orientation, center);
153 : : }
154 : 0 : return FALSE;
155 : : }
156 : :
157 : : /**
158 : : * gst_video_orientation_get_vcenter:
159 : : * @video_orientation: #GstVideoOrientation interface of a #GstElement
160 : : * @center: return location for the result
161 : : *
162 : : * Get the vertical centering offset from the given object.
163 : : *
164 : : * Since: 0.10.11
165 : : * Returns: %TRUE in case the element supports centering
166 : : */
167 : : gboolean
168 : 0 : gst_video_orientation_get_vcenter (GstVideoOrientation * video_orientation,
169 : : gint * center)
170 : : {
171 : 0 : GstVideoOrientationInterface *iface =
172 : 0 : GST_VIDEO_ORIENTATION_GET_IFACE (video_orientation);
173 : :
174 [ # # ]: 0 : if (iface->get_vcenter) {
175 : 0 : return iface->get_vcenter (video_orientation, center);
176 : : }
177 : 0 : return FALSE;
178 : : }
179 : :
180 : : /**
181 : : * gst_video_orientation_set_hflip:
182 : : * @video_orientation: #GstVideoOrientation interface of a #GstElement
183 : : * @flip: use flipping
184 : : *
185 : : * Set the horizontal flipping state (%TRUE for flipped) for the given object.
186 : : *
187 : : * Since: 0.10.11
188 : : * Returns: %TRUE in case the element supports flipping
189 : : */
190 : : gboolean
191 : 0 : gst_video_orientation_set_hflip (GstVideoOrientation * video_orientation,
192 : : gboolean flip)
193 : : {
194 : 0 : GstVideoOrientationInterface *iface =
195 : 0 : GST_VIDEO_ORIENTATION_GET_IFACE (video_orientation);
196 : :
197 [ # # ]: 0 : if (iface->set_hflip) {
198 : 0 : return iface->set_hflip (video_orientation, flip);
199 : : }
200 : 0 : return FALSE;
201 : : }
202 : :
203 : : /**
204 : : * gst_video_orientation_set_vflip:
205 : : * @video_orientation: #GstVideoOrientation interface of a #GstElement
206 : : * @flip: use flipping
207 : : *
208 : : * Set the vertical flipping state (%TRUE for flipped) for the given object.
209 : : *
210 : : * Since: 0.10.11
211 : : * Returns: %TRUE in case the element supports flipping
212 : : */
213 : : gboolean
214 : 0 : gst_video_orientation_set_vflip (GstVideoOrientation * video_orientation,
215 : : gboolean flip)
216 : : {
217 : 0 : GstVideoOrientationInterface *iface =
218 : 0 : GST_VIDEO_ORIENTATION_GET_IFACE (video_orientation);
219 : :
220 [ # # ]: 0 : if (iface->set_vflip) {
221 : 0 : return iface->set_vflip (video_orientation, flip);
222 : : }
223 : 0 : return FALSE;
224 : : }
225 : :
226 : : /**
227 : : * gst_video_orientation_set_hcenter:
228 : : * @video_orientation: #GstVideoOrientation interface of a #GstElement
229 : : * @center: centering offset
230 : : *
231 : : * Set the horizontal centering offset for the given object.
232 : : *
233 : : * Since: 0.10.11
234 : : * Returns: %TRUE in case the element supports centering
235 : : */
236 : : gboolean
237 : 0 : gst_video_orientation_set_hcenter (GstVideoOrientation * video_orientation,
238 : : gint center)
239 : : {
240 : 0 : GstVideoOrientationInterface *iface =
241 : 0 : GST_VIDEO_ORIENTATION_GET_IFACE (video_orientation);
242 : :
243 [ # # ]: 0 : if (iface->set_hcenter) {
244 : 0 : return iface->set_hcenter (video_orientation, center);
245 : : }
246 : 0 : return FALSE;
247 : : }
248 : :
249 : : /**
250 : : * gst_video_orientation_set_vcenter:
251 : : * @video_orientation: #GstVideoOrientation interface of a #GstElement
252 : : * @center: centering offset
253 : : *
254 : : * Set the vertical centering offset for the given object.
255 : : *
256 : : * Since: 0.10.11
257 : : * Returns: %TRUE in case the element supports centering
258 : : */
259 : : gboolean
260 : 0 : gst_video_orientation_set_vcenter (GstVideoOrientation * video_orientation,
261 : : gint center)
262 : : {
263 : 0 : GstVideoOrientationInterface *iface =
264 : 0 : GST_VIDEO_ORIENTATION_GET_IFACE (video_orientation);
265 : :
266 [ # # ]: 0 : if (iface->set_vcenter) {
267 : 0 : return iface->set_vcenter (video_orientation, center);
268 : : }
269 : 0 : return FALSE;
270 : : }
|