1 #ifndef __EMOTION_GSTREAMER_H__
2 #define __EMOTION_GSTREAMER_H__
13 # include <Ecore_Evas.h>
14 # ifdef HAVE_XOVERLAY_H
15 # include <gst/interfaces/xoverlay.h>
23 #include <glib-object.h>
24 #include <gst/video/gstvideosink.h>
25 #include <gst/video/video.h>
27 #include "emotion_private.h"
29 typedef void (*Evas_Video_Convert_Cb)(unsigned char *evas_data,
30 const unsigned char *gst_data,
33 unsigned int output_height);
35 typedef struct _EvasVideoSinkPrivate EvasVideoSinkPrivate;
36 typedef struct _EvasVideoSink EvasVideoSink;
37 typedef struct _EvasVideoSinkClass EvasVideoSinkClass;
38 typedef struct _Emotion_Gstreamer_Video Emotion_Gstreamer_Video;
39 typedef struct _Emotion_Audio_Stream Emotion_Audio_Stream;
40 typedef struct _Emotion_Gstreamer_Metadata Emotion_Gstreamer_Metadata;
41 typedef struct _Emotion_Gstreamer_Buffer Emotion_Gstreamer_Buffer;
42 typedef struct _Emotion_Gstreamer_Message Emotion_Gstreamer_Message;
43 typedef struct _Emotion_Video_Stream Emotion_Video_Stream;
45 struct _Emotion_Video_Stream
56 struct _Emotion_Audio_Stream
63 struct _Emotion_Gstreamer_Metadata
75 struct _Emotion_Gstreamer_Video
77 /* Gstreamer elements */
91 Eina_List *video_streams;
92 Eina_List *audio_streams;
97 /* We need to keep a copy of the last inserted buffer as evas doesn't copy YUV data around */
98 GstBuffer *last_buffer;
103 /* Characteristics of stream */
108 volatile int seek_to;
109 volatile int get_poslen;
111 Emotion_Gstreamer_Metadata *metadata;
119 Emotion_Gstreamer_Buffer *send;
121 EvasVideoSinkPrivate *sink_data;
140 Eina_Bool play_started : 1;
141 Eina_Bool video_mute : 1;
142 Eina_Bool audio_mute : 1;
143 Eina_Bool pipeline_parsed : 1;
144 Eina_Bool delete_me : 1;
145 Eina_Bool samsung : 1;
146 Eina_Bool kill_buffer : 1;
147 Eina_Bool stream : 1;
148 Eina_Bool priority : 1;
151 struct _EvasVideoSink {
154 EvasVideoSinkPrivate *priv;
157 struct _EvasVideoSinkClass {
159 GstVideoSinkClass parent_class;
162 struct _EvasVideoSinkPrivate {
167 Emotion_Gstreamer_Video *ev;
169 Evas_Video_Convert_Cb func;
173 unsigned int source_height;
174 Evas_Colorspace eformat;
179 // If this is TRUE all processing should finish ASAP
180 // This is necessary because there could be a race between
181 // unlock() and render(), where unlock() wins, signals the
182 // GCond, then render() tries to render a frame although
183 // everything else isn't running anymore. This will lead
184 // to deadlocks because render() holds the stream lock.
186 // Protected by the buffer mutex
187 Eina_Bool unlocked : 1;
188 Eina_Bool samsung : 1; /** ST12 will only define a Samsung specific GstBuffer */
191 struct _Emotion_Gstreamer_Buffer
193 Emotion_Gstreamer_Video *ev;
194 EvasVideoSinkPrivate *sink;
198 Eina_Bool preroll : 1;
202 struct _Emotion_Gstreamer_Message
204 Emotion_Gstreamer_Video *ev;
209 extern Eina_Bool window_manager_video;
210 extern Eina_Bool debug_fps;
211 extern int _emotion_gstreamer_log_domain;
212 #define DBG(...) EINA_LOG_DOM_DBG(_emotion_gstreamer_log_domain, __VA_ARGS__)
213 #define INF(...) EINA_LOG_DOM_INFO(_emotion_gstreamer_log_domain, __VA_ARGS__)
214 #define WRN(...) EINA_LOG_DOM_WARN(_emotion_gstreamer_log_domain, __VA_ARGS__)
215 #define ERR(...) EINA_LOG_DOM_ERR(_emotion_gstreamer_log_domain, __VA_ARGS__)
216 #define CRITICAL(...) EINA_LOG_DOM_CRIT(_emotion_gstreamer_log_domain, __VA_ARGS__)
218 #define EVAS_TYPE_VIDEO_SINK evas_video_sink_get_type()
220 GType fakeeos_bin_get_type(void);
222 #define EVAS_VIDEO_SINK(obj) \
223 (G_TYPE_CHECK_INSTANCE_CAST((obj), \
224 EVAS_TYPE_VIDEO_SINK, EvasVideoSink))
226 #define EVAS_VIDEO_SINK_CLASS(klass) \
227 (G_TYPE_CHECK_CLASS_CAST((klass), \
228 EVAS_TYPE_VIDEO_SINK, EvasVideoSinkClass))
230 #define EVAS_IS_VIDEO_SINK(obj) \
231 (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
232 EVAS_TYPE_VIDEO_SINK))
234 #define EVAS_IS_VIDEO_SINK_CLASS(klass) \
235 (G_TYPE_CHECK_CLASS_TYPE((klass), \
236 EVAS_TYPE_VIDEO_SINK))
238 #define EVAS_VIDEO_SINK_GET_CLASS(obj) \
239 (G_TYPE_INSTANCE_GET_CLASS((obj), \
240 EVAS_TYPE_VIDEO_SINK, EvasVideoSinkClass))
242 #define GST_TYPE_FAKEEOS_BIN fakeeos_bin_get_type()
244 GstElement *gstreamer_video_sink_new(Emotion_Gstreamer_Video *ev,
248 gboolean gstreamer_plugin_init(GstPlugin *plugin);
250 Emotion_Gstreamer_Buffer *emotion_gstreamer_buffer_alloc(EvasVideoSinkPrivate *sink,
253 void emotion_gstreamer_buffer_free(Emotion_Gstreamer_Buffer *send);
255 Emotion_Gstreamer_Message *emotion_gstreamer_message_alloc(Emotion_Gstreamer_Video *ev,
257 void emotion_gstreamer_message_free(Emotion_Gstreamer_Message *send);
258 Eina_Bool _emotion_gstreamer_video_pipeline_parse(Emotion_Gstreamer_Video *ev,
261 int em_shutdown(void *video);
263 typedef struct _ColorSpace_FourCC_Convertion ColorSpace_FourCC_Convertion;
264 typedef struct _ColorSpace_Format_Convertion ColorSpace_Format_Convertion;
266 struct _ColorSpace_FourCC_Convertion
270 Evas_Colorspace eformat;
271 Evas_Video_Convert_Cb func;
272 Eina_Bool force_height;
275 struct _ColorSpace_Format_Convertion
278 GstVideoFormat format;
279 Evas_Colorspace eformat;
280 Evas_Video_Convert_Cb func;
283 extern const ColorSpace_FourCC_Convertion colorspace_fourcc_convertion[];
284 extern const ColorSpace_Format_Convertion colorspace_format_convertion[];
286 /** Samsung specific infrastructure - do not touch, do not modify */
287 #define MPLANE_IMGB_MAX_COUNT 4
288 #define SCMN_IMGB_MAX_PLANE 4
290 typedef struct _GstMultiPlaneImageBuffer GstMultiPlaneImageBuffer;
291 typedef struct _SCMN_IMGB SCMN_IMGB;
293 struct _GstMultiPlaneImageBuffer
297 /* width of each image plane */
298 gint width[MPLANE_IMGB_MAX_COUNT];
299 /* height of each image plane */
300 gint height[MPLANE_IMGB_MAX_COUNT];
301 /* stride of each image plane */
302 gint stride[MPLANE_IMGB_MAX_COUNT];
303 /* elevation of each image plane */
304 gint elevation[MPLANE_IMGB_MAX_COUNT];
305 /* user space address of each image plane */
306 gpointer uaddr[MPLANE_IMGB_MAX_COUNT];
307 /* Index of real address of each image plane, if needs */
308 gpointer index[MPLANE_IMGB_MAX_COUNT];
309 /* left postion, if needs */
311 /* top position, if needs */
313 /* to align memory */
321 /* width of each image plane */
322 int width[SCMN_IMGB_MAX_PLANE];
323 /* height of each image plane */
324 int height[SCMN_IMGB_MAX_PLANE];
325 /* stride of each image plane */
326 int stride[SCMN_IMGB_MAX_PLANE];
327 /* elevation of each image plane */
328 int elevation[SCMN_IMGB_MAX_PLANE];
329 /* user space address of each image plane */
330 void * uaddr[SCMN_IMGB_MAX_PLANE];
331 /* physical address of each image plane, if needs */
332 void * p[SCMN_IMGB_MAX_PLANE];
333 /* color space type of image */
335 /* left postion, if needs */
337 /* top position, if needs */
339 /* to align memory */
345 void _evas_video_st12_multiplane(unsigned char *evas_data, const unsigned char *gst_data, unsigned int w, unsigned int h, unsigned int output_height __UNUSED__);
346 void _evas_video_st12(unsigned char *evas_data, const unsigned char *gst_data, unsigned int w __UNUSED__, unsigned int h, unsigned int output_height __UNUSED__);
348 #endif /* __EMOTION_GSTREAMER_H__ */