1 /*
2  * GStreamer
3  * Copyright (C) 2016 Matthew Waters <matthew@centricular.com>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef _GST_GL_VIDEO_FLIP_H_
22 #define _GST_GL_VIDEO_FLIP_H_
23 
24 #include <gst/gl/gl.h>
25 
26 G_BEGIN_DECLS
27 
28 #define GST_TYPE_GL_VIDEO_FLIP            (gst_gl_video_flip_get_type())
29 #define GST_GL_VIDEO_FLIP(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_VIDEO_FLIP,GstGLVideoFlip))
30 #define GST_IS_GL_VIDEO_FLIP(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_VIDEO_FLIP))
31 #define GST_GL_VIDEO_FLIP_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_GL_VIDEO_FLIP,GstGLVideoFlipClass))
32 #define GST_IS_GL_VIDEO_FLIP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_GL_VIDEO_FLIP))
33 #define GST_GL_VIDEO_FLIP_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_GL_VIDEO_FLIP,GstGLVideoFlipClass))
34 
35 /**
36  * GstVideoFlipMethod:
37  * @GST_GL_VIDEO_FLIP_METHOD_IDENTITY: Identity (no rotation)
38  * @GST_GL_VIDEO_FLIP_METHOD_90R: Rotate clockwise 90 degrees
39  * @GST_GL_VIDEO_FLIP_METHOD_180: Rotate 180 degrees
40  * @GST_GL_VIDEO_FLIP_METHOD_90L: Rotate counter-clockwise 90 degrees
41  * @GST_GL_VIDEO_FLIP_METHOD_FLIP_HORIZ: Flip horizontally
42  * @GST_GL_VIDEO_FLIP_METHOD_FLIP_VERT: Flip vertically
43  * @GST_GL_VIDEO_FLIP_METHOD_FLIP_UL_LR: Flip across upper left/lower right diagonal
44  * @GST_GL_VIDEO_FLIP_METHOD_FLIP_UR_LL: Flip across upper right/lower left diagonal
45  * @GST_GL_VIDEO_FLIP_METHOD_AUTO: Select flip method based on image-orientation tag
46  *
47  * The different flip methods.
48  */
49 typedef enum {
50   GST_GL_VIDEO_FLIP_METHOD_IDENTITY,
51   GST_GL_VIDEO_FLIP_METHOD_90R,
52   GST_GL_VIDEO_FLIP_METHOD_180,
53   GST_GL_VIDEO_FLIP_METHOD_90L,
54   GST_GL_VIDEO_FLIP_METHOD_FLIP_HORIZ,
55   GST_GL_VIDEO_FLIP_METHOD_FLIP_VERT,
56   GST_GL_VIDEO_FLIP_METHOD_FLIP_UL_LR,
57   GST_GL_VIDEO_FLIP_METHOD_FLIP_UR_LL,
58   GST_GL_VIDEO_FLIP_METHOD_AUTO,
59 } GstGLVideoFlipMethod;
60 
61 typedef struct _GstGLVideoFlip GstGLVideoFlip;
62 typedef struct _GstGLVideoFlipClass GstGLVideoFlipClass;
63 
64 struct _GstGLVideoFlip
65 {
66   GstBin        bin;
67 
68   GstPad       *srcpad;
69   GstPad       *sinkpad;
70 
71   GstElement   *input_capsfilter;
72   GstElement   *transformation;
73   GstElement   *output_capsfilter;
74 
75   gulong        sink_probe;
76   gulong        src_probe;
77 
78   GstCaps      *input_caps;
79 
80   /* properties */
81   GstVideoOrientationMethod method;
82   GstVideoOrientationMethod tag_method;
83   GstVideoOrientationMethod active_method;
84 
85   gfloat aspect;
86 };
87 
88 struct _GstGLVideoFlipClass
89 {
90   GstBinClass filter_class;
91 };
92 
93 GType gst_gl_video_flip_get_type (void);
94 
95 G_END_DECLS
96 
97 #endif /* _GST_GL_VIDEO_FLIP_H_ */
98