• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* GStreamer
2  *
3  * Copyright (C) 2006 Edgard Lima <edgard.lima@gmail.com>
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., 51 Franklin St, Fifth Floor,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 #ifdef HAVE_CONFIG_H
24 #include "config.h"
25 #endif
26 
27 #include <gst/gst.h>
28 
29 #include "gstv4l2object.h"
30 #include "gstv4l2vidorient.h"
31 #include "gstv4l2object.h"
32 
33 GST_DEBUG_CATEGORY_STATIC (v4l2vo_debug);
34 #define GST_CAT_DEFAULT v4l2vo_debug
35 
36 void
gst_v4l2_video_orientation_interface_init(GstVideoOrientationInterface * iface)37 gst_v4l2_video_orientation_interface_init (GstVideoOrientationInterface * iface)
38 {
39   GST_DEBUG_CATEGORY_INIT (v4l2vo_debug, "v4l2vo", 0,
40       "V4L2 VideoOrientation interface debugging");
41 }
42 
43 
44 gboolean
gst_v4l2_video_orientation_get_hflip(GstV4l2Object * v4l2object,gboolean * flip)45 gst_v4l2_video_orientation_get_hflip (GstV4l2Object * v4l2object,
46     gboolean * flip)
47 {
48 
49   return gst_v4l2_get_attribute (v4l2object, V4L2_CID_HFLIP, flip);
50 }
51 
52 gboolean
gst_v4l2_video_orientation_get_vflip(GstV4l2Object * v4l2object,gboolean * flip)53 gst_v4l2_video_orientation_get_vflip (GstV4l2Object * v4l2object,
54     gboolean * flip)
55 {
56   return gst_v4l2_get_attribute (v4l2object, V4L2_CID_VFLIP, flip);
57 }
58 
59 /* named hcenter because of historical v4l2 naming */
60 gboolean
gst_v4l2_video_orientation_get_hcenter(GstV4l2Object * v4l2object,gint * center)61 gst_v4l2_video_orientation_get_hcenter (GstV4l2Object * v4l2object,
62     gint * center)
63 {
64   return gst_v4l2_get_attribute (v4l2object, V4L2_CID_PAN_RESET, center);
65 }
66 
67 /* named vcenter because of historical v4l2 naming */
68 gboolean
gst_v4l2_video_orientation_get_vcenter(GstV4l2Object * v4l2object,gint * center)69 gst_v4l2_video_orientation_get_vcenter (GstV4l2Object * v4l2object,
70     gint * center)
71 {
72   return gst_v4l2_get_attribute (v4l2object, V4L2_CID_TILT_RESET, center);
73 }
74 
75 gboolean
gst_v4l2_video_orientation_set_hflip(GstV4l2Object * v4l2object,gboolean flip)76 gst_v4l2_video_orientation_set_hflip (GstV4l2Object * v4l2object, gboolean flip)
77 {
78   return gst_v4l2_set_attribute (v4l2object, V4L2_CID_HFLIP, flip);
79 }
80 
81 gboolean
gst_v4l2_video_orientation_set_vflip(GstV4l2Object * v4l2object,gboolean flip)82 gst_v4l2_video_orientation_set_vflip (GstV4l2Object * v4l2object, gboolean flip)
83 {
84   return gst_v4l2_set_attribute (v4l2object, V4L2_CID_VFLIP, flip);
85 }
86 
87 gboolean
gst_v4l2_video_orientation_set_hcenter(GstV4l2Object * v4l2object,gint center)88 gst_v4l2_video_orientation_set_hcenter (GstV4l2Object * v4l2object, gint center)
89 {
90   return gst_v4l2_set_attribute (v4l2object, V4L2_CID_PAN_RESET, center);
91 }
92 
93 gboolean
gst_v4l2_video_orientation_set_vcenter(GstV4l2Object * v4l2object,gint center)94 gst_v4l2_video_orientation_set_vcenter (GstV4l2Object * v4l2object, gint center)
95 {
96   return gst_v4l2_set_attribute (v4l2object, V4L2_CID_TILT_RESET, center);
97 }
98