waylandsink : Add new flag to fix bug about flush buffer
[platform/upstream/gstreamer.git] / ext / wayland / gstwaylandsink.h
1 /*
2  * GStreamer Wayland video sink
3  * Copyright (C) 2011 Intel Corporation
4  * Copyright (C) 2011 Sreerenj Balachandran <sreerenj.balachandran@intel.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 Free
18  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  * Boston, MA 02110-1301 USA.
20  */
21
22 #ifndef __GST_WAYLAND_VIDEO_SINK_H__
23 #define __GST_WAYLAND_VIDEO_SINK_H__
24
25 #include <gst/gst.h>
26 #include <gst/video/video.h>
27
28 #include <wayland-client.h>
29
30 #include "wldisplay.h"
31 #include "wlwindow.h"
32
33 G_BEGIN_DECLS
34 #define GST_TYPE_WAYLAND_SINK \
35             (gst_wayland_sink_get_type())
36 #define GST_WAYLAND_SINK(obj) \
37             (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_WAYLAND_SINK,GstWaylandSink))
38 #define GST_WAYLAND_SINK_CLASS(klass) \
39             (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_WAYLAND_SINK,GstWaylandSinkClass))
40 #define GST_IS_WAYLAND_SINK(obj) \
41             (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_WAYLAND_SINK))
42 #define GST_IS_WAYLAND_SINK_CLASS(klass) \
43             (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_WAYLAND_SINK))
44 #define GST_WAYLAND_SINK_GET_CLASS(inst) \
45         (G_TYPE_INSTANCE_GET_CLASS ((inst), GST_TYPE_WAYLAND_SINK, GstWaylandSinkClass))
46 #ifdef TIZEN_FEATURE_WLSINK_ENHANCEMENT
47 enum
48 {
49   DISP_GEO_METHOD_LETTER_BOX = 0,
50   DISP_GEO_METHOD_ORIGIN_SIZE,
51   DISP_GEO_METHOD_FULL_SCREEN,
52   DISP_GEO_METHOD_CROPPED_FULL_SCREEN,
53   DISP_GEO_METHOD_ORIGIN_SIZE_OR_LETTER_BOX,
54   DISP_GEO_METHOD_CUSTOM_ROI,
55   DISP_GEO_METHOD_NUM,
56 };
57
58 enum
59 {
60   DEGREE_0,
61   DEGREE_90,
62   DEGREE_180,
63   DEGREE_270,
64   DEGREE_NUM,
65 };
66
67 enum
68 {
69   FLIP_NONE = 0,
70   FLIP_HORIZONTAL,
71   FLIP_VERTICAL,
72   FLIP_BOTH,
73   FLIP_NUM,
74 };
75
76 #define DEF_DISPLAY_FLIP            FLIP_NONE
77 #define DEF_DISPLAY_GEOMETRY_METHOD         DISP_GEO_METHOD_LETTER_BOX
78 #endif
79
80 typedef struct _GstWaylandSink GstWaylandSink;
81 typedef struct _GstWaylandSinkClass GstWaylandSinkClass;
82
83 struct _GstWaylandSink
84 {
85   GstVideoSink parent;
86
87   GMutex display_lock;
88   GstWlDisplay *display;
89   GstWlWindow *window;
90   GstBufferPool *pool;
91
92   gboolean video_info_changed;
93   GstVideoInfo video_info;
94
95   gchar *display_name;
96
97   gboolean redraw_pending;
98   GMutex render_lock;
99   GstBuffer *last_buffer;
100
101 #ifdef TIZEN_FEATURE_WLSINK_ENHANCEMENT
102   gboolean signal_handoffs;
103   gboolean request_camera_flush_buf;
104   gboolean keep_camera_preview;
105   gboolean got_costum_event;
106   gboolean visible;
107   gboolean follow_parent_transform;
108   gboolean USE_TBM;
109   guint rotate_angle;
110   guint display_geometry_method;
111   guint flip;
112   guint crop_x, crop_y, crop_w, crop_h;
113 #ifdef ENABLE_FUNCTION
114   guint offset_x, offset_y, offset_w, offset_h;
115   gdouble ratio_w, ratio_h;
116   gdouble scale_w, scale_h;
117   gdouble align_w, align_h;
118 #endif
119 #endif
120 };
121
122 struct _GstWaylandSinkClass
123 {
124   GstVideoSinkClass parent;
125 #ifdef TIZEN_FEATURE_WLSINK_ENHANCEMENT
126   /* signals */
127   void (*handoff) (GstElement *element, GstBuffer *buf, GstPad *pad);
128   void (*preroll_handoff) (GstElement *element, GstBuffer *buf, GstPad *pad);
129 #endif
130 };
131
132 GType
133 gst_wayland_sink_get_type (void)
134     G_GNUC_CONST;
135
136 G_END_DECLS
137 #endif /* __GST_WAYLAND_VIDEO_SINK_H__ */