summaryrefslogtreecommitdiff
path: root/sys/v4l2/gstv4l2vidorient.h
blob: 102ae8a777e3e255378d85bde59a6b3cc77c2e44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/* GStreamer
 *
 * Copyright (C) 2006 Edgard Lima <edgard.lima@gmail.com>
 *
 * gstv4l2vidorient.h: video orientation interface implementation for V4L2
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

#ifndef __GST_V4L2_VIDORIENT_H__
#define __GST_V4L2_VIDORIENT_H__

#include <gst/gst.h>
#include <gst/video/videoorientation.h>

#include "gstv4l2object.h"

G_BEGIN_DECLS

void     gst_v4l2_video_orientation_interface_init (GstVideoOrientationInterface * iface);

gboolean gst_v4l2_video_orientation_get_hflip 	(GstV4l2Object *v4l2object, gboolean *flip);
gboolean gst_v4l2_video_orientation_get_vflip 	(GstV4l2Object *v4l2object, gboolean *flip);
gboolean gst_v4l2_video_orientation_get_hcenter (GstV4l2Object *v4l2object, gint *center);
gboolean gst_v4l2_video_orientation_get_vcenter (GstV4l2Object *v4l2object, gint *center);

gboolean gst_v4l2_video_orientation_set_hflip 	(GstV4l2Object *v4l2object, gboolean flip);
gboolean gst_v4l2_video_orientation_set_vflip 	(GstV4l2Object *v4l2object, gboolean flip);
gboolean gst_v4l2_video_orientation_set_hcenter (GstV4l2Object *v4l2object, gint center);
gboolean gst_v4l2_video_orientation_set_vcenter (GstV4l2Object *v4l2object, gint center);

#define GST_IMPLEMENT_V4L2_VIDORIENT_METHODS(Type, interface_as_function)                         \
                                                                                                  \
  static gboolean                                                                                 \
  interface_as_function ## _video_orientation_get_hflip (GstVideoOrientation *vo, gboolean *flip)       \
  {                                                                                               \
    Type *this = (Type*) vo;                                                                      \
    return gst_v4l2_video_orientation_get_hflip (this->v4l2object, flip);		          \
  }                                                                                               \
                                                                                                  \
  static gboolean                                                                                 \
  interface_as_function ## _video_orientation_get_vflip (GstVideoOrientation *vo, gboolean *flip)       \
  {                                                                                               \
    Type *this = (Type*) vo;                                                                      \
    return gst_v4l2_video_orientation_get_vflip (this->v4l2object, flip);		          \
  }                                                                                               \
                                                                                                  \
  static gboolean                                                                                 \
  interface_as_function ## _video_orientation_get_hcenter (GstVideoOrientation *vo, gint *center)       \
  {                                                                                               \
    Type *this = (Type*) vo;                                                                      \
    return gst_v4l2_video_orientation_get_hcenter (this->v4l2object, center);		          \
  }                                                                                               \
                                                                                                  \
  static gboolean                                                                                 \
  interface_as_function ## _video_orientation_get_vcenter (GstVideoOrientation *vo, gint *center)       \
  {                                                                                               \
    Type *this = (Type*) vo;                                                                      \
    return gst_v4l2_video_orientation_get_vcenter (this->v4l2object, center);		          \
  }                                                                                               \
                                                                                                  \
  static gboolean                                                                                 \
  interface_as_function ## _video_orientation_set_hflip (GstVideoOrientation *vo, gboolean flip)        \
  {                                                                                               \
    Type *this = (Type*) vo;                                                                      \
    return gst_v4l2_video_orientation_set_hflip (this->v4l2object, flip);		          \
  }                                                                                               \
                                                                                                  \
  static gboolean                                                                                 \
  interface_as_function ## _video_orientation_set_vflip (GstVideoOrientation *vo, gboolean flip)        \
  {                                                                                               \
    Type *this = (Type*) vo;                                                                      \
    return gst_v4l2_video_orientation_set_vflip (this->v4l2object, flip);		          \
  }                                                                                               \
                                                                                                  \
  static gboolean                                                                                 \
  interface_as_function ## _video_orientation_set_hcenter (GstVideoOrientation *vo, gint center)        \
  {                                                                                               \
    Type *this = (Type*) vo;                                                                      \
    return gst_v4l2_video_orientation_set_hcenter (this->v4l2object, center);		          \
  }                                                                                               \
                                                                                                  \
  static gboolean                                                                                 \
  interface_as_function ## _video_orientation_set_vcenter (GstVideoOrientation *vo, gint center)        \
  {                                                                                               \
    Type *this = (Type*) vo;                                                                      \
    return gst_v4l2_video_orientation_set_vcenter (this->v4l2object, center);		          \
  }                                                                                               \
                                                                                                  \
  static void                                                                                     \
  interface_as_function ## _video_orientation_interface_init (GstVideoOrientationInterface * iface)          \
  {                                                                                               \
    /* default virtual functions */                                                               \
    iface->get_hflip   = interface_as_function ## _video_orientation_get_hflip;                   \
    iface->get_vflip   = interface_as_function ## _video_orientation_get_vflip;                   \
    iface->get_hcenter = interface_as_function ## _video_orientation_get_hcenter;                 \
    iface->get_vcenter = interface_as_function ## _video_orientation_get_vcenter;                 \
    iface->set_hflip   = interface_as_function ## _video_orientation_set_hflip;                   \
    iface->set_vflip   = interface_as_function ## _video_orientation_set_vflip;                   \
    iface->set_hcenter = interface_as_function ## _video_orientation_set_hcenter;                 \
    iface->set_vcenter = interface_as_function ## _video_orientation_set_vcenter;                 \
  }

G_END_DECLS
#endif /* __GST_V4L2_VIDORIENT_H__ */