Tizen 2.0 Release
[framework/multimedia/gst-plugins-good0.10.git] / sys / v4l2 / gstv4l2vidorient.c
1 /* GStreamer
2  *
3  * Copyright (C) 2006 Edgard Lima <edgard.lima@indt.org.br>
4  *
5  * gstv4l2vidorient.c: 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., 59 Temple Place - Suite 330,
20  * Boston, MA 02111-1307, USA.
21  */
22
23 #ifdef HAVE_CONFIG_H
24 #include "config.h"
25 #endif
26
27 #include <gst/gst.h>
28
29 #include "gstv4l2vidorient.h"
30 #include "gstv4l2object.h"
31 #include "v4l2_calls.h"
32 #include "v4l2src_calls.h"
33
34 GST_DEBUG_CATEGORY_STATIC (v4l2vo_debug);
35 #define GST_CAT_DEFAULT v4l2vo_debug
36
37 /* Those are deprecated calls that have been replaced */
38 #ifndef V4L2_CID_HCENTER
39 #define V4L2_CID_HCENTER V4L2_CID_PAN_RESET
40 #endif
41 #ifndef V4L2_CID_VCENTER
42 #define V4L2_CID_VCENTER V4L2_CID_TILT_RESET
43 #endif
44
45 void
46 gst_v4l2_video_orientation_interface_init (GstVideoOrientationInterface * klass)
47 {
48   GST_DEBUG_CATEGORY_INIT (v4l2vo_debug, "v4l2vo", 0,
49       "V4L2 VideoOrientation interface debugging");
50 }
51
52
53 gboolean
54 gst_v4l2_video_orientation_get_hflip (GstV4l2Object * v4l2object,
55     gboolean * flip)
56 {
57
58   return gst_v4l2_get_attribute (v4l2object, V4L2_CID_HFLIP, flip);
59 }
60
61 gboolean
62 gst_v4l2_video_orientation_get_vflip (GstV4l2Object * v4l2object,
63     gboolean * flip)
64 {
65   return gst_v4l2_get_attribute (v4l2object, V4L2_CID_VFLIP, flip);
66 }
67
68 gboolean
69 gst_v4l2_video_orientation_get_hcenter (GstV4l2Object * v4l2object,
70     gint * center)
71 {
72   return gst_v4l2_get_attribute (v4l2object, V4L2_CID_HCENTER, center);
73 }
74
75 gboolean
76 gst_v4l2_video_orientation_get_vcenter (GstV4l2Object * v4l2object,
77     gint * center)
78 {
79   return gst_v4l2_get_attribute (v4l2object, V4L2_CID_VCENTER, center);
80 }
81
82 gboolean
83 gst_v4l2_video_orientation_set_hflip (GstV4l2Object * v4l2object, gboolean flip)
84 {
85   return gst_v4l2_set_attribute (v4l2object, V4L2_CID_HFLIP, flip);
86 }
87
88 gboolean
89 gst_v4l2_video_orientation_set_vflip (GstV4l2Object * v4l2object, gboolean flip)
90 {
91   return gst_v4l2_set_attribute (v4l2object, V4L2_CID_VFLIP, flip);
92 }
93
94 gboolean
95 gst_v4l2_video_orientation_set_hcenter (GstV4l2Object * v4l2object, gint center)
96 {
97   return gst_v4l2_set_attribute (v4l2object, V4L2_CID_HCENTER, center);
98 }
99
100 gboolean
101 gst_v4l2_video_orientation_set_vcenter (GstV4l2Object * v4l2object, gint center)
102 {
103   return gst_v4l2_set_attribute (v4l2object, V4L2_CID_VCENTER, center);
104 }