summaryrefslogtreecommitdiff
path: root/legacy/emotion
diff options
context:
space:
mode:
authorRafael Antognolli <antognolli@gmail.com>2012-03-23 19:42:38 +0000
committerRafael Antognolli <antognolli@gmail.com>2012-03-23 19:42:38 +0000
commita39a4f612e629509bcc457855bb769b53df4fe57 (patch)
tree536510e11a4faf87894b26a6ca023dae15f4ed75 /legacy/emotion
parent8e73b14577f737c918dd9a41fed7075220064123 (diff)
emotion/generic-vlc: Don't try to stop the player from event thread.
Must send the command through the pipe so the main thread can stop it. SVN revision: 69591
Diffstat (limited to 'legacy/emotion')
-rw-r--r--legacy/emotion/src/examples/emotion_generic_example.c16
-rw-r--r--legacy/emotion/src/generic_players/vlc/emotion_generic_vlc.c9
2 files changed, 22 insertions, 3 deletions
diff --git a/legacy/emotion/src/examples/emotion_generic_example.c b/legacy/emotion/src/examples/emotion_generic_example.c
index 8710c54747..53398c86d4 100644
--- a/legacy/emotion/src/examples/emotion_generic_example.c
+++ b/legacy/emotion/src/examples/emotion_generic_example.c
@@ -18,6 +18,13 @@ _playback_started_cb(void *data, Evas_Object *o, void *event_info)
18 printf("Emotion object started playback.\n"); 18 printf("Emotion object started playback.\n");
19} 19}
20 20
21static void
22_playback_stopped_cb(void *data, Evas_Object *o, void *event_info)
23{
24 emotion_object_play_set(o, EINA_FALSE);
25 emotion_object_position_set(o, 0);
26}
27
21static Evas_Object * 28static Evas_Object *
22_create_emotion_object(Evas *e) 29_create_emotion_object(Evas *e)
23{ 30{
@@ -27,6 +34,8 @@ _create_emotion_object(Evas *e)
27 34
28 evas_object_smart_callback_add( 35 evas_object_smart_callback_add(
29 em, "playback_started", _playback_started_cb, NULL); 36 em, "playback_started", _playback_started_cb, NULL);
37 evas_object_smart_callback_add(
38 em, "playback_stopped", _playback_stopped_cb, NULL);
30 39
31 return em; 40 return em;
32} 41}
@@ -57,8 +66,11 @@ _on_key_down(void *data, Evas *e, Evas_Object *o, void *event_info)
57 } 66 }
58 else if (!strcmp(ev->keyname, "s")) 67 else if (!strcmp(ev->keyname, "s"))
59 { 68 {
60 fprintf(stderr, "skipping to position 60\n"); 69 float len, pos;
61 emotion_object_position_set(em, 60); 70 len = emotion_object_play_length_get(em);
71 pos = 0.98 * len;
72 fprintf(stderr, "skipping to position %0.3f\n", pos);
73 emotion_object_position_set(em, pos);
62 } 74 }
63 else if (!strcmp(ev->keyname, "1")) 75 else if (!strcmp(ev->keyname, "1"))
64 { 76 {
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 feecac3285..266ae65019 100644
--- a/legacy/emotion/src/generic_players/vlc/emotion_generic_vlc.c
+++ b/legacy/emotion/src/generic_players/vlc/emotion_generic_vlc.c
@@ -23,6 +23,7 @@
23 23
24enum _Thread_Events { 24enum _Thread_Events {
25 EM_THREAD_POSITION_CHANGED, 25 EM_THREAD_POSITION_CHANGED,
26 EM_THREAD_PLAYBACK_STOPPED,
26 EM_THREAD_LAST 27 EM_THREAD_LAST
27}; 28};
28 29
@@ -367,7 +368,8 @@ _event_cb(const struct libvlc_event_t *ev, void *data)
367 _send_file_set(app); 368 _send_file_set(app);
368 break; 369 break;
369 case libvlc_MediaPlayerEndReached: 370 case libvlc_MediaPlayerEndReached:
370 _send_cmd(app, EM_RESULT_PLAYBACK_STOPPED); 371 thread_event = EM_THREAD_PLAYBACK_STOPPED;
372 write(app->fd_write, &thread_event, sizeof(thread_event));
371 break; 373 break;
372 } 374 }
373} 375}
@@ -718,6 +720,11 @@ _process_thread_events(struct _App *app)
718 case EM_THREAD_POSITION_CHANGED: 720 case EM_THREAD_POSITION_CHANGED:
719 _position_changed(app); 721 _position_changed(app);
720 break; 722 break;
723 case EM_THREAD_PLAYBACK_STOPPED:
724 libvlc_media_player_stop(app->mp);
725 app->playing = 0;
726 _send_cmd(app, EM_RESULT_PLAYBACK_STOPPED);
727 break;
721 } 728 }
722} 729}
723 730