summaryrefslogtreecommitdiff
path: root/legacy/emotion/src/modules/gstreamer
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@gmail.com>2008-09-25 23:15:21 +0000
committerGustavo Sverzut Barbieri <barbieri@gmail.com>2008-09-25 23:15:21 +0000
commitd29b7694cb99cfcbf9598976733824bea02fa0b8 (patch)
tree624fb2973b2ea9516417d09f8dd53ad5f36fb48e /legacy/emotion/src/modules/gstreamer
parent42d39725b43c3739744114d361e826c7bf014aff (diff)
emotion+visualization: export and reorder.
done: * module api changed, vis_set is not close to vis_get, vis_supported was added. * exported these properties in emotion_object. * gstreamer plugin now starts with no visualization. todo: * add xine support. * make gstreamer able to dynamically change visualization. PS: gstreamer module really needs a cleanup, losts of functions need "static" or add proper prefix, including "gst" to avoid it clash with other symbols. SVN revision: 36260
Diffstat (limited to 'legacy/emotion/src/modules/gstreamer')
-rw-r--r--legacy/emotion/src/modules/gstreamer/emotion_gstreamer.c58
-rw-r--r--legacy/emotion/src/modules/gstreamer/emotion_gstreamer_pipeline.c178
-rw-r--r--legacy/emotion/src/modules/gstreamer/emotion_gstreamer_pipeline.h2
3 files changed, 129 insertions, 109 deletions
diff --git a/legacy/emotion/src/modules/gstreamer/emotion_gstreamer.c b/legacy/emotion/src/modules/gstreamer/emotion_gstreamer.c
index f78ecadee5..2ada21518a 100644
--- a/legacy/emotion/src/modules/gstreamer/emotion_gstreamer.c
+++ b/legacy/emotion/src/modules/gstreamer/emotion_gstreamer.c
@@ -42,8 +42,6 @@ static void em_size_get (void *video,
42static void em_pos_set (void *video, 42static void em_pos_set (void *video,
43 double pos); 43 double pos);
44 44
45static void em_vis_set (void *video,
46 Emotion_Vis vis);
47 45
48static double em_len_get (void *video); 46static double em_len_get (void *video);
49 47
@@ -55,8 +53,14 @@ static double em_fps_get (void *video);
55 53
56static double em_pos_get (void *video); 54static double em_pos_get (void *video);
57 55
56static void em_vis_set (void *video,
57 Emotion_Vis vis);
58
58static Emotion_Vis em_vis_get (void *video); 59static Emotion_Vis em_vis_get (void *video);
59 60
61static Evas_Bool em_vis_supported (void *video,
62 Emotion_Vis vis);
63
60static double em_ratio_get (void *video); 64static double em_ratio_get (void *video);
61 65
62static int em_video_handled (void *video); 66static int em_video_handled (void *video);
@@ -177,13 +181,14 @@ static Emotion_Video_Module em_module =
177 em_stop, /* stop */ 181 em_stop, /* stop */
178 em_size_get, /* size_get */ 182 em_size_get, /* size_get */
179 em_pos_set, /* pos_set */ 183 em_pos_set, /* pos_set */
180 em_vis_set, /* vis_set */
181 em_len_get, /* len_get */ 184 em_len_get, /* len_get */
182 em_fps_num_get, /* fps_num_get */ 185 em_fps_num_get, /* fps_num_get */
183 em_fps_den_get, /* fps_den_get */ 186 em_fps_den_get, /* fps_den_get */
184 em_fps_get, /* fps_get */ 187 em_fps_get, /* fps_get */
185 em_pos_get, /* pos_get */ 188 em_pos_get, /* pos_get */
189 em_vis_set, /* vis_set */
186 em_vis_get, /* vis_get */ 190 em_vis_get, /* vis_get */
191 em_vis_supported, /* vis_supported */
187 em_ratio_get, /* ratio_get */ 192 em_ratio_get, /* ratio_get */
188 em_video_handled, /* video_handled */ 193 em_video_handled, /* video_handled */
189 em_audio_handled, /* audio_handled */ 194 em_audio_handled, /* audio_handled */
@@ -265,7 +270,7 @@ em_init(Evas_Object *obj,
265 ev->ratio = 1.0; 270 ev->ratio = 1.0;
266 ev->video_sink_nbr = 0; 271 ev->video_sink_nbr = 0;
267 ev->audio_sink_nbr = 0; 272 ev->audio_sink_nbr = 0;
268 ev->vis = EMOTION_VIS_GOOM; 273 ev->vis = EMOTION_VIS_NONE;
269 274
270 /* Create the file descriptors */ 275 /* Create the file descriptors */
271 if (pipe(fds) == 0) 276 if (pipe(fds) == 0)
@@ -581,18 +586,6 @@ em_pos_set(void *video,
581 } 586 }
582} 587}
583 588
584static void
585em_vis_set(void *video,
586 Emotion_Vis vis)
587{
588 Emotion_Gstreamer_Video *ev;
589
590 ev = (Emotion_Gstreamer_Video *)video;
591
592 if (ev->vis == vis) return;
593 ev->vis = vis;
594}
595
596static double 589static double
597em_len_get(void *video) 590em_len_get(void *video)
598{ 591{
@@ -663,6 +656,18 @@ em_pos_get(void *video)
663 return ev->position; 656 return ev->position;
664} 657}
665 658
659static void
660em_vis_set(void *video,
661 Emotion_Vis vis)
662{
663 Emotion_Gstreamer_Video *ev;
664
665 ev = (Emotion_Gstreamer_Video *)video;
666
667 if (ev->vis == vis) return;
668 ev->vis = vis;
669}
670
666static Emotion_Vis 671static Emotion_Vis
667em_vis_get(void *video) 672em_vis_get(void *video)
668{ 673{
@@ -673,6 +678,27 @@ em_vis_get(void *video)
673 return ev->vis; 678 return ev->vis;
674} 679}
675 680
681static Evas_Bool
682em_vis_supported(void *ef, Emotion_Vis vis)
683{
684 const char *name;
685 GstElementFactory *factory;
686
687 if (vis == EMOTION_VIS_NONE)
688 return 1;
689
690 name = emotion_visualization_element_name_get(vis);
691 if (!name)
692 return 0;
693
694 factory = gst_element_factory_find(name);
695 if (!factory)
696 return 0;
697
698 gst_object_unref(factory);
699 return 1;
700}
701
676static double 702static double
677em_ratio_get(void *video) 703em_ratio_get(void *video)
678{ 704{
diff --git a/legacy/emotion/src/modules/gstreamer/emotion_gstreamer_pipeline.c b/legacy/emotion/src/modules/gstreamer/emotion_gstreamer_pipeline.c
index 4499a86c63..1a921fc7eb 100644
--- a/legacy/emotion/src/modules/gstreamer/emotion_gstreamer_pipeline.c
+++ b/legacy/emotion/src/modules/gstreamer/emotion_gstreamer_pipeline.c
@@ -249,6 +249,54 @@ emotion_pipeline_cdda_track_count_get(void *video)
249 return tracks_count; 249 return tracks_count;
250} 250}
251 251
252const char *
253emotion_visualization_element_name_get(Emotion_Vis visualisation)
254{
255 switch (visualisation)
256 {
257 case EMOTION_VIS_NONE:
258 return NULL;
259 case EMOTION_VIS_GOOM:
260 return "goom";
261 case EMOTION_VIS_LIBVISUAL_BUMPSCOPE:
262 return "libvisual_bumpscope";
263 case EMOTION_VIS_LIBVISUAL_CORONA:
264 return "libvisual_corona";
265 case EMOTION_VIS_LIBVISUAL_DANCING_PARTICLES:
266 return "libvisual_dancingparticles";
267 case EMOTION_VIS_LIBVISUAL_GDKPIXBUF:
268 return "libvisual_gdkpixbuf";
269 case EMOTION_VIS_LIBVISUAL_G_FORCE:
270 return "libvisual_G-Force";
271 case EMOTION_VIS_LIBVISUAL_GOOM:
272 return "libvisual_goom";
273 case EMOTION_VIS_LIBVISUAL_INFINITE:
274 return "libvisual_infinite";
275 case EMOTION_VIS_LIBVISUAL_JAKDAW:
276 return "libvisual_jakdaw";
277 case EMOTION_VIS_LIBVISUAL_JESS:
278 return "libvisual_jess";
279 case EMOTION_VIS_LIBVISUAL_LV_ANALYSER:
280 return "libvisual_lv_analyzer";
281 case EMOTION_VIS_LIBVISUAL_LV_FLOWER:
282 return "libvisual_lv_flower";
283 case EMOTION_VIS_LIBVISUAL_LV_GLTEST:
284 return "libvisual_lv_gltest";
285 case EMOTION_VIS_LIBVISUAL_LV_SCOPE:
286 return "libvisual_lv_scope";
287 case EMOTION_VIS_LIBVISUAL_MADSPIN:
288 return "libvisual_madspin";
289 case EMOTION_VIS_LIBVISUAL_NEBULUS:
290 return "libvisual_nebulus";
291 case EMOTION_VIS_LIBVISUAL_OINKSIE:
292 return "libvisual_oinksie";
293 case EMOTION_VIS_LIBVISUAL_PLASMA:
294 return "libvisual_plazma";
295 default:
296 return "goom";
297 }
298}
299
252GstElement * 300GstElement *
253emotion_audio_sink_create(Emotion_Gstreamer_Video *ev, int index) 301emotion_audio_sink_create(Emotion_Gstreamer_Video *ev, int index)
254{ 302{
@@ -302,102 +350,46 @@ emotion_audio_sink_create(Emotion_Gstreamer_Video *ev, int index)
302 350
303 /* visualisation part */ 351 /* visualisation part */
304 { 352 {
305 GstElement *vis = NULL; 353 const char *vis_name = emotion_visualization_element_name_get(ev->vis);
306 char *vis_name;
307 354
308 switch (ev->vis) 355 if (vis_name)
309 { 356 {
310 case EMOTION_VIS_GOOM: 357 GstElement *vis;
311 vis_name = "goom";
312 break;
313 case EMOTION_VIS_LIBVISUAL_BUMPSCOPE:
314 vis_name = "libvisual_bumpscope";
315 break;
316 case EMOTION_VIS_LIBVISUAL_CORONA:
317 vis_name = "libvisual_corona";
318 break;
319 case EMOTION_VIS_LIBVISUAL_DANCING_PARTICLES:
320 vis_name = "libvisual_dancingparticles";
321 break;
322 case EMOTION_VIS_LIBVISUAL_GDKPIXBUF:
323 vis_name = "libvisual_gdkpixbuf";
324 break;
325 case EMOTION_VIS_LIBVISUAL_G_FORCE:
326 vis_name = "libvisual_G-Force";
327 break;
328 case EMOTION_VIS_LIBVISUAL_GOOM:
329 vis_name = "libvisual_goom";
330 break;
331 case EMOTION_VIS_LIBVISUAL_INFINITE:
332 vis_name = "libvisual_infinite";
333 break;
334 case EMOTION_VIS_LIBVISUAL_JAKDAW:
335 vis_name = "libvisual_jakdaw";
336 break;
337 case EMOTION_VIS_LIBVISUAL_JESS:
338 vis_name = "libvisual_jess";
339 break;
340 case EMOTION_VIS_LIBVISUAL_LV_ANALYSER:
341 vis_name = "libvisual_lv_analyzer";
342 break;
343 case EMOTION_VIS_LIBVISUAL_LV_FLOWER:
344 vis_name = "libvisual_lv_flower";
345 break;
346 case EMOTION_VIS_LIBVISUAL_LV_GLTEST:
347 vis_name = "libvisual_lv_gltest";
348 break;
349 case EMOTION_VIS_LIBVISUAL_LV_SCOPE:
350 vis_name = "libvisual_lv_scope";
351 break;
352 case EMOTION_VIS_LIBVISUAL_MADSPIN:
353 vis_name = "libvisual_madspin";
354 break;
355 case EMOTION_VIS_LIBVISUAL_NEBULUS:
356 vis_name = "libvisual_nebulus";
357 break;
358 case EMOTION_VIS_LIBVISUAL_OINKSIE:
359 vis_name = "libvisual_oinksie";
360 break;
361 case EMOTION_VIS_LIBVISUAL_PLASMA:
362 vis_name = "libvisual_plazma";
363 break;
364 default:
365 vis_name = "goom";
366 break;
367 }
368 358
369 g_snprintf(buf, 128, "vis%d", index); 359 g_snprintf(buf, 128, "vis%d", index);
370 if ((vis = gst_element_factory_make(vis_name, buf))) 360 vis = gst_element_factory_make(vis_name, buf);
371 { 361 if (vis)
372 GstElement *queue; 362 {
373 GstElement *conv; 363 GstElement *queue;
374 GstElement *cspace; 364 GstElement *conv;
375 GstElement *sink; 365 GstElement *cspace;
376 GstPad *vispad; 366 GstElement *sink;
377 GstCaps *caps; 367 GstPad *vispad;
378 368 GstCaps *caps;
379 g_snprintf(buf, 128, "visbin%d", index); 369
380 visbin = gst_bin_new(buf); 370 g_snprintf(buf, 128, "visbin%d", index);
381 371 visbin = gst_bin_new(buf);
382 queue = gst_element_factory_make("queue", NULL); 372
383 conv = gst_element_factory_make("audioconvert", NULL); 373 queue = gst_element_factory_make("queue", NULL);
384 cspace = gst_element_factory_make("ffmpegcolorspace", NULL); 374 conv = gst_element_factory_make("audioconvert", NULL);
385 g_snprintf(buf, 128, "vissink%d", index); 375 cspace = gst_element_factory_make("ffmpegcolorspace", NULL);
386 sink = gst_element_factory_make("fakesink", buf); 376 g_snprintf(buf, 128, "vissink%d", index);
387 377 sink = gst_element_factory_make("fakesink", buf);
388 gst_bin_add_many(GST_BIN(visbin), 378
389 queue, conv, vis, cspace, sink, NULL); 379 gst_bin_add_many(GST_BIN(visbin),
390 gst_element_link_many(queue, conv, vis, cspace, NULL); 380 queue, conv, vis, cspace, sink, NULL);
391 caps = gst_caps_new_simple("video/x-raw-rgb", 381 gst_element_link_many(queue, conv, vis, cspace, NULL);
392 "bpp", G_TYPE_INT, 32, 382 caps = gst_caps_new_simple("video/x-raw-rgb",
393 "width", G_TYPE_INT, 320, 383 "bpp", G_TYPE_INT, 32,
394 "height", G_TYPE_INT, 200, 384 "width", G_TYPE_INT, 320,
395 NULL); 385 "height", G_TYPE_INT, 200,
396 gst_element_link_filtered(cspace, sink, caps); 386 NULL);
397 387 gst_element_link_filtered(cspace, sink, caps);
398 vispad = gst_element_get_pad(queue, "sink"); 388
399 gst_element_add_pad(visbin, gst_ghost_pad_new("sink", vispad)); 389 vispad = gst_element_get_pad(queue, "sink");
400 gst_object_unref(vispad); 390 gst_element_add_pad(visbin, gst_ghost_pad_new("sink", vispad));
391 gst_object_unref(vispad);
392 }
401 } 393 }
402 } 394 }
403 395
diff --git a/legacy/emotion/src/modules/gstreamer/emotion_gstreamer_pipeline.h b/legacy/emotion/src/modules/gstreamer/emotion_gstreamer_pipeline.h
index a5ac8be644..2e8a703294 100644
--- a/legacy/emotion/src/modules/gstreamer/emotion_gstreamer_pipeline.h
+++ b/legacy/emotion/src/modules/gstreamer/emotion_gstreamer_pipeline.h
@@ -37,5 +37,7 @@ void file_new_decoded_pad_cb (GstElement *decodebin,
37 gboolean last, 37 gboolean last,
38 gpointer user_data); 38 gpointer user_data);
39 39
40const char *emotion_visualization_element_name_get(Emotion_Vis visualisation);
41
40 42
41#endif /* __EMOTION_GSTREAMER_PIPELINE_H__ */ 43#endif /* __EMOTION_GSTREAMER_PIPELINE_H__ */