diff options
author | davemds <dave@gurumeditation.it> | 2014-02-16 21:38:34 +0100 |
---|---|---|
committer | davemds <dave@gurumeditation.it> | 2014-02-16 21:38:34 +0100 |
commit | 345ac697dc7166189a636aceed8b508f46a7304e (patch) | |
tree | a7ef5d071eab9d5b96f4342a4aa7670c1c63dec5 | |
parent | d5c9aa0d4b38c22fab05d468958bea0abe448097 (diff) | |
download | emotion_generic_players-345ac697dc7166189a636aceed8b508f46a7304e.tar.gz |
Emotion VLC: cleanup: only changed function order in file.
-rw-r--r-- | src/vlc/emotion_generic_vlc.c | 162 |
1 files changed, 84 insertions, 78 deletions
diff --git a/src/vlc/emotion_generic_vlc.c b/src/vlc/emotion_generic_vlc.c index 8c4e049..19078ce 100644 --- a/src/vlc/emotion_generic_vlc.c +++ b/src/vlc/emotion_generic_vlc.c @@ -65,16 +65,11 @@ struct _App { Eina_Bool inited; }; -Eina_Bool -exit_func(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *ev EINA_UNUSED) -{ - ecore_main_loop_quit(); - return EINA_TRUE; -} -#define SEND_CMD_PARAM(app, i) \ - if ((app)->fd_write) \ - if (!ecore_pipe_write((app)->fd_write, &(i), sizeof((i)))) \ +/* Commands sent to the emotion pipe */ +#define SEND_CMD_PARAM(app, i) \ + if ((app)->fd_write) \ + if (!ecore_pipe_write((app)->fd_write, &(i), sizeof((i)))) \ ecore_main_loop_quit(); static void @@ -200,6 +195,37 @@ _send_all_meta_info(struct _App *app) _send_cmd_str(app, meta); } +static void +_send_length_changed(struct _App *app, const struct libvlc_event_t *ev) +{ + float length = ev->u.media_player_length_changed.new_length; + length /= 1000; + + _send_cmd(app, EM_RESULT_LENGTH_CHANGED); + SEND_CMD_PARAM(app, length); +} + +static void +_send_seekable_changed(struct _App *app, const struct libvlc_event_t *ev) +{ + int seekable = ev->u.media_player_seekable_changed.new_seekable; + + _send_cmd(app, EM_RESULT_SEEKABLE_CHANGED); + SEND_CMD_PARAM(app, seekable); +} + +static void +_send_file_set(struct _App *app) +{ + if (app->opening) + _send_cmd(app, EM_RESULT_FILE_SET); + + if (app->closing) + _send_file_closed(app); +} + + +/* libvlc */ static Eina_Bool _loaded_idler(void *data) { @@ -244,35 +270,6 @@ _position_changed(App *app) } static void -_send_length_changed(struct _App *app, const struct libvlc_event_t *ev) -{ - float length = ev->u.media_player_length_changed.new_length; - length /= 1000; - - _send_cmd(app, EM_RESULT_LENGTH_CHANGED); - SEND_CMD_PARAM(app, length); -} - -static void -_send_seekable_changed(struct _App *app, const struct libvlc_event_t *ev) -{ - int seekable = ev->u.media_player_seekable_changed.new_seekable; - - _send_cmd(app, EM_RESULT_SEEKABLE_CHANGED); - SEND_CMD_PARAM(app, seekable); -} - -static void -_send_file_set(struct _App *app) -{ - if (app->opening) - _send_cmd(app, EM_RESULT_FILE_SET); - - if (app->closing) - _send_file_closed(app); -} - -static void _event_cb(const struct libvlc_event_t *ev, void *data) { App *app = data; @@ -352,9 +349,47 @@ _tmp_play(void *data EINA_UNUSED, } */ +static void * +_lock(void *data, void **pixels) +{ + App *app = data; + + if (app->playing) + *pixels = app->vf.frames[app->vs->frame.player]; + else + *pixels = NULL; + + return NULL; // picture identifier, not needed here +} + +static void +_unlock(void *data EINA_UNUSED, void *id EINA_UNUSED, void *const *pixels EINA_UNUSED) +{ +} + +static void +_display(void *data, void *id EINA_UNUSED) +{ + App *app = data; + + if (!app->playing) + return; + + eina_semaphore_lock(&app->vs->lock); + app->vs->frame.last = app->vs->frame.player; + app->vs->frame.player = app->vs->frame.next; + app->vs->frame.next = app->vs->frame.last; + if (!app->vs->frame_drop++) + _send_cmd(app, EM_RESULT_FRAME_NEW); + eina_semaphore_release(&app->vs->lock, 1); +} + + +/* Commands received from the emotion pipe */ static void _file_set(App *app) { + DBG("Path: %s", app->filename); app->m = libvlc_media_new_path(app->libvlc, app->filename); if (!app->m) { @@ -392,41 +427,6 @@ _file_set(App *app) libvlc_media_player_play(app->mp); } -static void * -_lock(void *data, void **pixels) -{ - App *app = data; - - if (app->playing) - *pixels = app->vf.frames[app->vs->frame.player]; - else - *pixels = NULL; - - return NULL; // picture identifier, not needed here -} - -static void -_unlock(void *data EINA_UNUSED, void *id EINA_UNUSED, void *const *pixels EINA_UNUSED) -{ -} - -static void -_display(void *data, void *id EINA_UNUSED) -{ - App *app = data; - - if (!app->playing) - return; - - eina_semaphore_lock(&app->vs->lock); - app->vs->frame.last = app->vs->frame.player; - app->vs->frame.player = app->vs->frame.next; - app->vs->frame.next = app->vs->frame.last; - if (!app->vs->frame_drop++) - _send_cmd(app, EM_RESULT_FRAME_NEW); - eina_semaphore_release(&app->vs->lock, 1); -} - static void _file_set_done(App *app) { @@ -687,11 +687,19 @@ _remote_command(void *data, void *buffer, unsigned int nbyte) } } -void +static void _dummy(void *data EINA_UNUSED, void *buffer EINA_UNUSED, unsigned int nbyte EINA_UNUSED) { - /* This function is useless for the pipe we use to send message back to emotion, - but still needed */ + /* This function is useless for the pipe we use to send message back + to emotion, but still needed */ +} + +/* Main */ +Eina_Bool +exit_func(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *ev EINA_UNUSED) +{ + ecore_main_loop_quit(); + return EINA_TRUE; } int @@ -763,12 +771,10 @@ main(int argc, const char *argv[]) ecore_main_loop_begin(); libvlc_release(app.libvlc); - ecore_event_handler_del(hld); ecore_shutdown(); eina_shutdown(); - return 0; error: |