forked from enlightenment/efl
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
This commit is contained in:
parent
8e73b14577
commit
a39a4f612e
|
@ -18,6 +18,13 @@ _playback_started_cb(void *data, Evas_Object *o, void *event_info)
|
|||
printf("Emotion object started playback.\n");
|
||||
}
|
||||
|
||||
static void
|
||||
_playback_stopped_cb(void *data, Evas_Object *o, void *event_info)
|
||||
{
|
||||
emotion_object_play_set(o, EINA_FALSE);
|
||||
emotion_object_position_set(o, 0);
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_create_emotion_object(Evas *e)
|
||||
{
|
||||
|
@ -27,6 +34,8 @@ _create_emotion_object(Evas *e)
|
|||
|
||||
evas_object_smart_callback_add(
|
||||
em, "playback_started", _playback_started_cb, NULL);
|
||||
evas_object_smart_callback_add(
|
||||
em, "playback_stopped", _playback_stopped_cb, NULL);
|
||||
|
||||
return em;
|
||||
}
|
||||
|
@ -57,8 +66,11 @@ _on_key_down(void *data, Evas *e, Evas_Object *o, void *event_info)
|
|||
}
|
||||
else if (!strcmp(ev->keyname, "s"))
|
||||
{
|
||||
fprintf(stderr, "skipping to position 60\n");
|
||||
emotion_object_position_set(em, 60);
|
||||
float len, pos;
|
||||
len = emotion_object_play_length_get(em);
|
||||
pos = 0.98 * len;
|
||||
fprintf(stderr, "skipping to position %0.3f\n", pos);
|
||||
emotion_object_position_set(em, pos);
|
||||
}
|
||||
else if (!strcmp(ev->keyname, "1"))
|
||||
{
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
enum _Thread_Events {
|
||||
EM_THREAD_POSITION_CHANGED,
|
||||
EM_THREAD_PLAYBACK_STOPPED,
|
||||
EM_THREAD_LAST
|
||||
};
|
||||
|
||||
|
@ -367,7 +368,8 @@ _event_cb(const struct libvlc_event_t *ev, void *data)
|
|||
_send_file_set(app);
|
||||
break;
|
||||
case libvlc_MediaPlayerEndReached:
|
||||
_send_cmd(app, EM_RESULT_PLAYBACK_STOPPED);
|
||||
thread_event = EM_THREAD_PLAYBACK_STOPPED;
|
||||
write(app->fd_write, &thread_event, sizeof(thread_event));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -718,6 +720,11 @@ _process_thread_events(struct _App *app)
|
|||
case EM_THREAD_POSITION_CHANGED:
|
||||
_position_changed(app);
|
||||
break;
|
||||
case EM_THREAD_PLAYBACK_STOPPED:
|
||||
libvlc_media_player_stop(app->mp);
|
||||
app->playing = 0;
|
||||
_send_cmd(app, EM_RESULT_PLAYBACK_STOPPED);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue