1 /*
2  * GStreamer
3  * Copyright (C) 2014 Jan Schmidt <jan@centricular.com>
4  * Copyright (C) 2015 Matthew Waters <matthew@centricular.com>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  */
21 
22 #ifndef _GST_GL_VIEW_CONVERT_H_
23 #define _GST_GL_VIEW_CONVERT_H_
24 
25 #include <gst/gstmemory.h>
26 #include <gst/video/video.h>
27 
28 #include <gst/gl/gstgl_fwd.h>
29 
30 G_BEGIN_DECLS
31 #define GST_TYPE_GL_VIEW_CONVERT            (gst_gl_view_convert_get_type())
32 #define GST_GL_VIEW_CONVERT(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_VIEW_CONVERT,GstGLViewConvert))
33 #define GST_IS_GL_VIEW_CONVERT(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_VIEW_CONVERT))
34 #define GST_GL_VIEW_CONVERT_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_GL_VIEW_CONVERT,GstGLViewConvertClass))
35 #define GST_IS_GL_VIEW_CONVERT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_GL_VIEW_CONVERT))
36 #define GST_GL_VIEW_CONVERT_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_GL_VIEW_CONVERT,GstGLViewConvertClass))
37 
38 /**
39  * GstGLStereoDownmix:
40  * @GST_GL_STEREO_DOWNMIX_ANAGLYPH_GREEN_MAGENTA_DUBOIS: Dubois optimised Green-Magenta anaglyph
41  * @GST_GL_STEREO_DOWNMIX_ANAGLYPH_RED_CYAN_DUBOIS: Dubois optimised Red-Cyan anaglyph
42  * @GST_GL_STEREO_DOWNMIX_ANAGLYPH_AMBER_BLUE_DUBOIS: Dubois optimised Amber-Blue anaglyph
43  *
44  * Output anaglyph type to generate when downmixing to mono
45  */
46 typedef enum {
47   GST_GL_STEREO_DOWNMIX_ANAGLYPH_GREEN_MAGENTA_DUBOIS,
48   GST_GL_STEREO_DOWNMIX_ANAGLYPH_RED_CYAN_DUBOIS,
49   GST_GL_STEREO_DOWNMIX_ANAGLYPH_AMBER_BLUE_DUBOIS,
50 } GstGLStereoDownmix;
51 
52 #ifndef GST_DISABLE_DEPRECATED
53 #define GST_TYPE_GL_STEREO_DOWNMIX_MODE_TYPE GST_TYPE_GL_STEREO_DOWNMIX
54 
55 GST_GL_API
56 GType gst_gl_stereo_downmix_mode_get_type (void);
57 #endif
58 
59 /**
60  * GstGLViewConvert:
61  *
62  * #GstGLViewConvert is an opaque struct and should only be accessed through the
63  * provided api.
64  */
65 struct _GstGLViewConvert
66 {
67   GstObject object;
68 
69   GstGLContext *context;
70 
71   GstGLShader *shader;
72 
73   GstVideoMultiviewMode input_mode_override;
74   GstVideoMultiviewFlags input_flags_override;
75   GstVideoMultiviewMode output_mode_override;
76   GstVideoMultiviewFlags output_flags_override;
77 
78   GstGLStereoDownmix downmix_mode;
79 
80   GstVideoInfo in_info;
81   GstVideoInfo out_info;
82 
83   GstGLTextureTarget from_texture_target;
84   GstGLTextureTarget to_texture_target;
85   gboolean caps_passthrough;
86 
87   gboolean initted;
88   gboolean reconfigure;
89 
90   GstGLFramebuffer *fbo;
91 
92   /* <private> */
93   GstGLViewConvertPrivate *priv;
94 
95   gpointer _padding[GST_PADDING];
96 };
97 
98 /**
99  * GstGLViewConvertClass:
100  *
101  * Opaque #GstGLViewConvertClass struct
102  */
103 struct _GstGLViewConvertClass
104 {
105   /* <private> */
106   GstObjectClass object_class;
107 
108   gpointer                  _padding[GST_PADDING];
109 };
110 
111 GST_GL_API
112 GType gst_gl_view_convert_get_type (void);
113 GST_GL_API
114 GstGLViewConvert * gst_gl_view_convert_new (void);
115 
116 GST_GL_API
117 gboolean  gst_gl_view_convert_set_caps (GstGLViewConvert * viewconvert, GstCaps * in_caps, GstCaps * out_caps);
118 GST_GL_API
119 GstCaps * gst_gl_view_convert_transform_caps (GstGLViewConvert * viewconvert,
120     GstPadDirection direction, GstCaps * caps, GstCaps * filter);
121 GST_GL_API
122 GstCaps * gst_gl_view_convert_fixate_caps (GstGLViewConvert *viewconvert,
123     GstPadDirection direction, GstCaps * caps, GstCaps * othercaps);
124 GST_GL_API
125 GstFlowReturn gst_gl_view_convert_submit_input_buffer (GstGLViewConvert *viewconvert,
126     gboolean is_discont, GstBuffer * input);
127 GST_GL_API
128 GstFlowReturn gst_gl_view_convert_get_output (GstGLViewConvert *viewconvert,
129     GstBuffer ** outbuf_ptr);
130 
131 GST_GL_API
132 GstBuffer * gst_gl_view_convert_perform (GstGLViewConvert * viewconvert, GstBuffer *inbuf);
133 GST_GL_API
134 void gst_gl_view_convert_reset (GstGLViewConvert * viewconvert);
135 GST_GL_API
136 void gst_gl_view_convert_set_context (GstGLViewConvert *viewconvert, GstGLContext * context);
137 
138 G_END_DECLS
139 #endif /* _GST_GL_VIEW_CONVERT_H_ */
140