diff options
author | Rafael Antognolli <antognolli@gmail.com> | 2011-09-05 21:52:14 +0000 |
---|---|---|
committer | Rafael Antognolli <antognolli@gmail.com> | 2011-09-05 21:52:14 +0000 |
commit | e7f5540ad6c4cb8be2c301a80f45e449b6e40e25 (patch) | |
tree | 12980723db66e660c7fe66d636b8572ce6575d17 /src | |
parent | 2c841d673ed81afaad77813f53ce76d1d57b8533 (diff) | |
download | emotion_generic_players-e7f5540ad6c4cb8be2c301a80f45e449b6e40e25.tar.gz |
emotion/generic: Add support for fetching meta info.
SVN revision: 63219
Diffstat (limited to 'src')
-rw-r--r-- | src/vlc/emotion_generic_vlc.c | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/src/vlc/emotion_generic_vlc.c b/src/vlc/emotion_generic_vlc.c index 2e13ed4..b3e1eb1 100644 --- a/src/vlc/emotion_generic_vlc.c +++ b/src/vlc/emotion_generic_vlc.c @@ -186,7 +186,10 @@ static void _send_cmd_str(struct _App *app, const char *str) { int len; - len = strlen(str) + 1; + if (str) + len = strlen(str) + 1; + else + len = 0; _em_write_safe(app->em_write, &len, sizeof(len)); _em_write_safe(app->em_write, str, len); } @@ -650,6 +653,36 @@ _send_all_track_info(struct _App *app) } static void +_send_all_meta_info(struct _App *app) +{ + const char *meta; + + _send_cmd_start(app, EM_RESULT_META_INFO); + + /* + * Will send in this order: title, artist, album, year, + * genre, comments, disc id and track count. + */ + meta = libvlc_media_get_meta(app->m, libvlc_meta_Title); + _send_cmd_str(app, meta); + meta = libvlc_media_get_meta(app->m, libvlc_meta_Artist); + _send_cmd_str(app, meta); + meta = libvlc_media_get_meta(app->m, libvlc_meta_Album); + _send_cmd_str(app, meta); + meta = libvlc_media_get_meta(app->m, libvlc_meta_Date); + _send_cmd_str(app, meta); + meta = libvlc_media_get_meta(app->m, libvlc_meta_Genre); + _send_cmd_str(app, meta); + meta = NULL; // sending empty comments + _send_cmd_str(app, meta); + meta = NULL; // sending empty disc id + _send_cmd_str(app, meta); + meta = libvlc_media_get_meta(app->m, libvlc_meta_TrackNumber); + _send_cmd_str(app, meta); + _send_cmd_finish(app); +} + +static void _position_changed(struct _App *app) { if (!app->opening) @@ -665,6 +698,9 @@ _position_changed(struct _App *app) /* sending audio track info */ _send_all_track_info(app); + /* sending meta info */ + _send_all_meta_info(app); + libvlc_media_player_stop(app->mp); } |