summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordavemds <dave@gurumeditation.it>2014-02-22 11:26:40 +0100
committerdavemds <dave@gurumeditation.it>2014-02-22 11:26:40 +0100
commit4eec2f9e9ef76d46820aa715812cc04ab78afc53 (patch)
tree75c309c2135983b4ea10c3d5564416fd282712f6 /src
parent9b09d9bbbce8632e66e67cd7b28aae5c61288018 (diff)
downloademotion_generic_players-4eec2f9e9ef76d46820aa715812cc04ab78afc53.tar.gz
Emotion VLC: recreate the player when end reached.
Fix the restart-play-when-end-reached bug.
Diffstat (limited to 'src')
-rw-r--r--src/vlc/emotion_generic_vlc.c48
1 files changed, 29 insertions, 19 deletions
diff --git a/src/vlc/emotion_generic_vlc.c b/src/vlc/emotion_generic_vlc.c
index fbc8bb3..177f9f7 100644
--- a/src/vlc/emotion_generic_vlc.c
+++ b/src/vlc/emotion_generic_vlc.c
@@ -56,6 +56,7 @@ struct _App {
Eina_Bool inited;
};
+static void _player_setup(App *app);
/* Commands sent to the emotion pipe */
#define SEND_CMD_PARAM(app, i) \
@@ -212,7 +213,7 @@ _event_cb(const struct libvlc_event_t *ev, void *data)
switch (ev->type)
{
case libvlc_MediaPlayerTimeChanged:
- DBG("libvlc_MediaPlayerTimeChanged");
+ // DBG("libvlc_MediaPlayerTimeChanged");
_send_time_changed(app, ev);
break;
case libvlc_MediaPlayerLengthChanged:
@@ -236,13 +237,15 @@ _event_cb(const struct libvlc_event_t *ev, void *data)
case libvlc_MediaPlayerEndReached:
DBG("libvlc_MediaPlayerEndReached");
app->playing = 0;
+ /* vlc had released the media_playere here, we create a new one */
+ app->mp = libvlc_media_player_new_from_media(app->m);
+ _player_setup(app);
_send_cmd(app, EM_RESULT_PLAYBACK_STOPPED);
break;
}
ecore_thread_main_loop_end();
}
-
static void
_tmp_playing_event_cb(const struct libvlc_event_t *ev, void *data)
{
@@ -309,6 +312,29 @@ _display(void *data, void *id EINA_UNUSED)
eina_semaphore_release(&app->vs->lock, 1);
}
+static void
+_player_setup(App *app)
+{
+
+ libvlc_video_set_format(app->mp, "RV32", app->w, app->h, app->w * 4);
+ libvlc_video_set_callbacks(app->mp, _lock, _unlock, _display, app);
+
+ app->event_mgr = libvlc_media_player_event_manager(app->mp);
+ libvlc_event_attach(app->event_mgr, libvlc_MediaPlayerPlaying,
+ _event_cb, app);
+ libvlc_event_attach(app->event_mgr, libvlc_MediaPlayerTimeChanged,
+ _event_cb, app);
+ libvlc_event_attach(app->event_mgr, libvlc_MediaPlayerLengthChanged,
+ _event_cb, app);
+ libvlc_event_attach(app->event_mgr, libvlc_MediaPlayerSeekableChanged,
+ _event_cb, app);
+ libvlc_event_attach(app->event_mgr, libvlc_MediaPlayerEndReached,
+ _event_cb, app);
+ libvlc_event_attach(app->event_mgr, libvlc_MediaPlayerPositionChanged,
+ _event_cb, app);
+ libvlc_event_attach(app->event_mgr, libvlc_MediaPlayerStopped,
+ _event_cb, app);
+}
/* Commands received from the emotion pipe */
static void
@@ -361,23 +387,7 @@ _file_set_done(App *app)
}
else
{
- libvlc_video_set_format(app->mp, "RV32", app->w, app->h, app->w * 4);
- libvlc_video_set_callbacks(app->mp, _lock, _unlock, _display, app);
-
- libvlc_event_attach(app->event_mgr, libvlc_MediaPlayerPlaying,
- _event_cb, app);
- libvlc_event_attach(app->event_mgr, libvlc_MediaPlayerTimeChanged,
- _event_cb, app);
- libvlc_event_attach(app->event_mgr, libvlc_MediaPlayerLengthChanged,
- _event_cb, app);
- libvlc_event_attach(app->event_mgr, libvlc_MediaPlayerSeekableChanged,
- _event_cb, app);
- libvlc_event_attach(app->event_mgr, libvlc_MediaPlayerEndReached,
- _event_cb, app);
- libvlc_event_attach(app->event_mgr, libvlc_MediaPlayerPositionChanged,
- _event_cb, app);
- libvlc_event_attach(app->event_mgr, libvlc_MediaPlayerStopped,
- _event_cb, app);
+ _player_setup(app);
}
_send_cmd(app, EM_RESULT_FILE_SET_DONE);