summaryrefslogtreecommitdiff
path: root/legacy/emotion/src
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2012-08-21 09:17:38 +0000
committerCedric BAIL <cedric.bail@free.fr>2012-08-21 09:17:38 +0000
commit36bc7b270b9a50ad274699362b9986681e7a8210 (patch)
tree2d5ef18d51df6d0af0d1063c24df121778c65eee /legacy/emotion/src
parent3ec12202f9f65bbde1f8092604ec15a969e01f06 (diff)
emotion: fix priority_set/get
Patch by Sohyun Kim <anna1014.kim@samsung.com> SVN revision: 75495
Diffstat (limited to 'legacy/emotion/src')
-rw-r--r--legacy/emotion/src/generic_players/vlc/emotion_generic_vlc.c14
-rw-r--r--legacy/emotion/src/modules/generic/Emotion_Generic_Plugin.h1
-rw-r--r--legacy/emotion/src/modules/generic/emotion_generic.c4
-rw-r--r--legacy/emotion/src/modules/gstreamer/emotion_gstreamer.c29
4 files changed, 43 insertions, 5 deletions
diff --git a/legacy/emotion/src/generic_players/vlc/emotion_generic_vlc.c b/legacy/emotion/src/generic_players/vlc/emotion_generic_vlc.c
index 7ec0a6f6c2..f41506491e 100644
--- a/legacy/emotion/src/generic_players/vlc/emotion_generic_vlc.c
+++ b/legacy/emotion/src/generic_players/vlc/emotion_generic_vlc.c
@@ -25,6 +25,7 @@ enum _Thread_Events {
25 EM_THREAD_POSITION_CHANGED, 25 EM_THREAD_POSITION_CHANGED,
26 EM_THREAD_PLAYBACK_STARTED, 26 EM_THREAD_PLAYBACK_STARTED,
27 EM_THREAD_PLAYBACK_STOPPED, 27 EM_THREAD_PLAYBACK_STOPPED,
28 EM_THREAD_EOF,
28 EM_THREAD_LAST 29 EM_THREAD_LAST
29}; 30};
30 31
@@ -311,6 +312,7 @@ _play(struct _App *app)
311 else 312 else
312 { 313 {
313 libvlc_time_t new_time = pos * 1000; 314 libvlc_time_t new_time = pos * 1000;
315 fprintf(stderr, "pos %f\n", pos);
314 libvlc_media_player_set_time(app->mp, new_time); 316 libvlc_media_player_set_time(app->mp, new_time);
315 libvlc_media_player_play(app->mp); 317 libvlc_media_player_play(app->mp);
316 app->playing = 1; 318 app->playing = 1;
@@ -371,9 +373,11 @@ _event_cb(const struct libvlc_event_t *ev, void *data)
371 _send_file_set(app); 373 _send_file_set(app);
372 break; 374 break;
373 case libvlc_MediaPlayerEndReached: 375 case libvlc_MediaPlayerEndReached:
374 thread_event = EM_THREAD_PLAYBACK_STOPPED; 376 thread_event = EM_THREAD_EOF;
375 write(app->fd_write, &thread_event, sizeof(thread_event)); 377 write(app->fd_write, &thread_event, sizeof(thread_event));
376 break; 378 /* thread_event = EM_THREAD_PLAYBACK_STOPPED; */
379 /* write(app->fd_write, &thread_event, sizeof(thread_event)); */
380 break;
377 } 381 }
378} 382}
379 383
@@ -739,6 +743,10 @@ _process_thread_events(struct _App *app)
739 case EM_THREAD_PLAYBACK_STARTED: 743 case EM_THREAD_PLAYBACK_STARTED:
740 _send_cmd(app, EM_RESULT_PLAYBACK_STARTED); 744 _send_cmd(app, EM_RESULT_PLAYBACK_STARTED);
741 break; 745 break;
746 case EM_THREAD_EOF:
747 _send_cmd(app, EM_RESULT_FILE_EOF);
748 app->playing = 0;
749 break;
742 case EM_THREAD_PLAYBACK_STOPPED: 750 case EM_THREAD_PLAYBACK_STOPPED:
743 libvlc_media_player_stop(app->mp); 751 libvlc_media_player_stop(app->mp);
744 app->playing = 0; 752 app->playing = 0;
diff --git a/legacy/emotion/src/modules/generic/Emotion_Generic_Plugin.h b/legacy/emotion/src/modules/generic/Emotion_Generic_Plugin.h
index 17bd7e9c50..e4813055b9 100644
--- a/legacy/emotion/src/modules/generic/Emotion_Generic_Plugin.h
+++ b/legacy/emotion/src/modules/generic/Emotion_Generic_Plugin.h
@@ -56,6 +56,7 @@ enum _Emotion_Generic_Result
56 EM_RESULT_SPU_TRACK_INFO, // param: current spu, spu count, spu_id, spu_name, spu_id2, spu_name2, ... 56 EM_RESULT_SPU_TRACK_INFO, // param: current spu, spu count, spu_id, spu_name, spu_id2, spu_name2, ...
57 // (int, int, int, string, int, string, ...) 57 // (int, int, int, string, int, string, ...)
58 EM_RESULT_META_INFO, // param: title, artist, album, year, genre, comments, disc id, count (all int) 58 EM_RESULT_META_INFO, // param: title, artist, album, year, genre, comments, disc id, count (all int)
59 EM_RESULT_FILE_EOF, // param: none
59 EM_RESULT_LAST 60 EM_RESULT_LAST
60}; 61};
61 62
diff --git a/legacy/emotion/src/modules/generic/emotion_generic.c b/legacy/emotion/src/modules/generic/emotion_generic.c
index 549c179534..147fb8ee9f 100644
--- a/legacy/emotion/src/modules/generic/emotion_generic.c
+++ b/legacy/emotion/src/modules/generic/emotion_generic.c
@@ -587,6 +587,10 @@ _player_cmd_process(Emotion_Generic_Video *ev)
587 case EM_RESULT_META_INFO: 587 case EM_RESULT_META_INFO:
588 _player_meta_info_read(ev); 588 _player_meta_info_read(ev);
589 break; 589 break;
590 case EM_RESULT_FILE_EOF:
591 _emotion_decode_stop(ev->obj);
592 _emotion_playback_finished(ev->obj);
593 break;
590 default: 594 default:
591 WRN("received wrong command: %d", ev->cmd.type); 595 WRN("received wrong command: %d", ev->cmd.type);
592 } 596 }
diff --git a/legacy/emotion/src/modules/gstreamer/emotion_gstreamer.c b/legacy/emotion/src/modules/gstreamer/emotion_gstreamer.c
index 3383ce9863..df29de835f 100644
--- a/legacy/emotion/src/modules/gstreamer/emotion_gstreamer.c
+++ b/legacy/emotion/src/modules/gstreamer/emotion_gstreamer.c
@@ -36,6 +36,8 @@ int _emotion_gstreamer_log_domain = -1;
36Eina_Bool debug_fps = EINA_FALSE; 36Eina_Bool debug_fps = EINA_FALSE;
37Eina_Bool _ecore_x_available = EINA_FALSE; 37Eina_Bool _ecore_x_available = EINA_FALSE;
38 38
39static Ecore_Idler *restart_idler;
40
39/* Callbacks to get the eos */ 41/* Callbacks to get the eos */
40static void _for_each_tag (GstTagList const* list, gchar const* tag, void *data); 42static void _for_each_tag (GstTagList const* list, gchar const* tag, void *data);
41static void _free_metadata (Emotion_Gstreamer_Metadata *m); 43static void _free_metadata (Emotion_Gstreamer_Metadata *m);
@@ -201,6 +203,8 @@ static GstBusSyncReply _eos_sync_fct(GstBus *bus,
201 GstMessage *message, 203 GstMessage *message,
202 gpointer data); 204 gpointer data);
203 205
206static Eina_Bool _em_restart_stream(void *data);
207
204/* Module interface */ 208/* Module interface */
205 209
206static Emotion_Video_Module em_module = 210static Emotion_Video_Module em_module =
@@ -439,6 +443,12 @@ em_cleanup(Emotion_Gstreamer_Video *ev)
439#endif 443#endif
440 } 444 }
441 445
446 if (restart_idler)
447 {
448 ecore_idler_del(restart_idler);
449 restart_idler = NULL;
450 }
451
442 EINA_LIST_FREE(ev->audio_streams, astream) 452 EINA_LIST_FREE(ev->audio_streams, astream)
443 free(astream); 453 free(astream);
444 EINA_LIST_FREE(ev->video_streams, vstream) 454 EINA_LIST_FREE(ev->video_streams, vstream)
@@ -1275,6 +1285,19 @@ em_priority_set(void *video, Eina_Bool pri)
1275 1285
1276 ev = video; 1286 ev = video;
1277 if (priority_overide > 3) return ; /* If we failed to much to create that pipeline, let's don't wast our time anymore */ 1287 if (priority_overide > 3) return ; /* If we failed to much to create that pipeline, let's don't wast our time anymore */
1288
1289 if (ev->priority != pri && ev->pipeline)
1290 {
1291 if (ev->threads)
1292 {
1293 Ecore_Thread *t;
1294
1295 EINA_LIST_FREE(ev->threads, t)
1296 ecore_thread_cancel(t);
1297 }
1298 em_cleanup(ev);
1299 restart_idler = ecore_idler_add(_em_restart_stream, ev);
1300 }
1278 ev->priority = pri; 1301 ev->priority = pri;
1279} 1302}
1280 1303
@@ -1284,7 +1307,7 @@ em_priority_get(void *video)
1284 Emotion_Gstreamer_Video *ev; 1307 Emotion_Gstreamer_Video *ev;
1285 1308
1286 ev = video; 1309 ev = video;
1287 return ev->stream; 1310 return !ev->stream;
1288} 1311}
1289 1312
1290#ifdef HAVE_ECORE_X 1313#ifdef HAVE_ECORE_X
@@ -1606,6 +1629,8 @@ _em_restart_stream(void *data)
1606 gst_bus_set_sync_handler(ev->eos_bus, _eos_sync_fct, ev); 1629 gst_bus_set_sync_handler(ev->eos_bus, _eos_sync_fct, ev);
1607 } 1630 }
1608 1631
1632 restart_idler = NULL;
1633
1609 return ECORE_CALLBACK_CANCEL; 1634 return ECORE_CALLBACK_CANCEL;
1610} 1635}
1611 1636
@@ -1723,7 +1748,7 @@ _eos_main_fct(void *data)
1723 ev->priority = EINA_FALSE; 1748 ev->priority = EINA_FALSE;
1724 priority_overide++; 1749 priority_overide++;
1725 1750
1726 ecore_idler_add(_em_restart_stream, ev); 1751 restart_idler = ecore_idler_add(_em_restart_stream, ev);
1727 } 1752 }
1728 break; 1753 break;
1729 default: 1754 default: