v4l2: guard use of ENODATA with #ifdef
[platform/upstream/gst-plugins-good.git] / sys / v4l2 / gstv4l2vidorient.h
1 /* GStreamer
2  *
3  * Copyright (C) 2006 Edgard Lima <edgard.lima@indt.org.br>
4  *
5  * gstv4l2vidorient.h: video orientation interface implementation for V4L2
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public
18  * License along with this library; if not, write to the
19  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
20  * Boston, MA 02110-1301, USA.
21  */
22
23 #ifndef __GST_V4L2_VIDORIENT_H__
24 #define __GST_V4L2_VIDORIENT_H__
25
26 #include <gst/gst.h>
27 #include <gst/video/videoorientation.h>
28
29 #include "gstv4l2object.h"
30
31 G_BEGIN_DECLS
32
33 void     gst_v4l2_video_orientation_interface_init (GstVideoOrientationInterface * iface);
34
35 gboolean gst_v4l2_video_orientation_get_hflip   (GstV4l2Object *v4l2object, gboolean *flip);
36 gboolean gst_v4l2_video_orientation_get_vflip   (GstV4l2Object *v4l2object, gboolean *flip);
37 gboolean gst_v4l2_video_orientation_get_hcenter (GstV4l2Object *v4l2object, gint *center);
38 gboolean gst_v4l2_video_orientation_get_vcenter (GstV4l2Object *v4l2object, gint *center);
39
40 gboolean gst_v4l2_video_orientation_set_hflip   (GstV4l2Object *v4l2object, gboolean flip);
41 gboolean gst_v4l2_video_orientation_set_vflip   (GstV4l2Object *v4l2object, gboolean flip);
42 gboolean gst_v4l2_video_orientation_set_hcenter (GstV4l2Object *v4l2object, gint center);
43 gboolean gst_v4l2_video_orientation_set_vcenter (GstV4l2Object *v4l2object, gint center);
44
45 #define GST_IMPLEMENT_V4L2_VIDORIENT_METHODS(Type, interface_as_function)                         \
46                                                                                                   \
47   static gboolean                                                                                 \
48   interface_as_function ## _video_orientation_get_hflip (GstVideoOrientation *vo, gboolean *flip)       \
49   {                                                                                               \
50     Type *this = (Type*) vo;                                                                      \
51     return gst_v4l2_video_orientation_get_hflip (this->v4l2object, flip);                         \
52   }                                                                                               \
53                                                                                                   \
54   static gboolean                                                                                 \
55   interface_as_function ## _video_orientation_get_vflip (GstVideoOrientation *vo, gboolean *flip)       \
56   {                                                                                               \
57     Type *this = (Type*) vo;                                                                      \
58     return gst_v4l2_video_orientation_get_vflip (this->v4l2object, flip);                         \
59   }                                                                                               \
60                                                                                                   \
61   static gboolean                                                                                 \
62   interface_as_function ## _video_orientation_get_hcenter (GstVideoOrientation *vo, gint *center)       \
63   {                                                                                               \
64     Type *this = (Type*) vo;                                                                      \
65     return gst_v4l2_video_orientation_get_hcenter (this->v4l2object, center);                     \
66   }                                                                                               \
67                                                                                                   \
68   static gboolean                                                                                 \
69   interface_as_function ## _video_orientation_get_vcenter (GstVideoOrientation *vo, gint *center)       \
70   {                                                                                               \
71     Type *this = (Type*) vo;                                                                      \
72     return gst_v4l2_video_orientation_get_vcenter (this->v4l2object, center);                     \
73   }                                                                                               \
74                                                                                                   \
75   static gboolean                                                                                 \
76   interface_as_function ## _video_orientation_set_hflip (GstVideoOrientation *vo, gboolean flip)        \
77   {                                                                                               \
78     Type *this = (Type*) vo;                                                                      \
79     return gst_v4l2_video_orientation_set_hflip (this->v4l2object, flip);                         \
80   }                                                                                               \
81                                                                                                   \
82   static gboolean                                                                                 \
83   interface_as_function ## _video_orientation_set_vflip (GstVideoOrientation *vo, gboolean flip)        \
84   {                                                                                               \
85     Type *this = (Type*) vo;                                                                      \
86     return gst_v4l2_video_orientation_set_vflip (this->v4l2object, flip);                         \
87   }                                                                                               \
88                                                                                                   \
89   static gboolean                                                                                 \
90   interface_as_function ## _video_orientation_set_hcenter (GstVideoOrientation *vo, gint center)        \
91   {                                                                                               \
92     Type *this = (Type*) vo;                                                                      \
93     return gst_v4l2_video_orientation_set_hcenter (this->v4l2object, center);                     \
94   }                                                                                               \
95                                                                                                   \
96   static gboolean                                                                                 \
97   interface_as_function ## _video_orientation_set_vcenter (GstVideoOrientation *vo, gint center)        \
98   {                                                                                               \
99     Type *this = (Type*) vo;                                                                      \
100     return gst_v4l2_video_orientation_set_vcenter (this->v4l2object, center);                     \
101   }                                                                                               \
102                                                                                                   \
103   static void                                                                                     \
104   interface_as_function ## _video_orientation_interface_init (GstVideoOrientationInterface * iface)          \
105   {                                                                                               \
106     /* default virtual functions */                                                               \
107     iface->get_hflip   = interface_as_function ## _video_orientation_get_hflip;                   \
108     iface->get_vflip   = interface_as_function ## _video_orientation_get_vflip;                   \
109     iface->get_hcenter = interface_as_function ## _video_orientation_get_hcenter;                 \
110     iface->get_vcenter = interface_as_function ## _video_orientation_get_vcenter;                 \
111     iface->set_hflip   = interface_as_function ## _video_orientation_set_hflip;                   \
112     iface->set_vflip   = interface_as_function ## _video_orientation_set_vflip;                   \
113     iface->set_hcenter = interface_as_function ## _video_orientation_set_hcenter;                 \
114     iface->set_vcenter = interface_as_function ## _video_orientation_set_vcenter;                 \
115   }
116
117 G_END_DECLS
118 #endif /* __GST_V4L2_VIDORIENT_H__ */