summaryrefslogtreecommitdiff
path: root/legacy/emotion/src/generic_players/vlc/emotion_generic_vlc.c
diff options
context:
space:
mode:
authorRafael Antognolli <antognolli@gmail.com>2011-09-05 21:52:14 +0000
committerRafael Antognolli <antognolli@gmail.com>2011-09-05 21:52:14 +0000
commit0d7da38f058933fb46dcedfa4e8751d0b5f7b40e (patch)
tree32f2cf0efce4114a9448ed10cf4ae644e42d3439 /legacy/emotion/src/generic_players/vlc/emotion_generic_vlc.c
parentbed7fa1c6a2b70ce6bab313e17ba4c03370f3792 (diff)
emotion/generic: Add support for fetching meta info.
SVN revision: 63219
Diffstat (limited to '')
-rw-r--r--legacy/emotion/src/generic_players/vlc/emotion_generic_vlc.c38
1 files changed, 37 insertions, 1 deletions
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 2e13ed4878..b3e1eb1d1c 100644
--- a/legacy/emotion/src/generic_players/vlc/emotion_generic_vlc.c
+++ b/legacy/emotion/src/generic_players/vlc/emotion_generic_vlc.c
@@ -186,7 +186,10 @@ static void
186_send_cmd_str(struct _App *app, const char *str) 186_send_cmd_str(struct _App *app, const char *str)
187{ 187{
188 int len; 188 int len;
189 len = strlen(str) + 1; 189 if (str)
190 len = strlen(str) + 1;
191 else
192 len = 0;
190 _em_write_safe(app->em_write, &len, sizeof(len)); 193 _em_write_safe(app->em_write, &len, sizeof(len));
191 _em_write_safe(app->em_write, str, len); 194 _em_write_safe(app->em_write, str, len);
192} 195}
@@ -650,6 +653,36 @@ _send_all_track_info(struct _App *app)
650} 653}
651 654
652static void 655static void
656_send_all_meta_info(struct _App *app)
657{
658 const char *meta;
659
660 _send_cmd_start(app, EM_RESULT_META_INFO);
661
662 /*
663 * Will send in this order: title, artist, album, year,
664 * genre, comments, disc id and track count.
665 */
666 meta = libvlc_media_get_meta(app->m, libvlc_meta_Title);
667 _send_cmd_str(app, meta);
668 meta = libvlc_media_get_meta(app->m, libvlc_meta_Artist);
669 _send_cmd_str(app, meta);
670 meta = libvlc_media_get_meta(app->m, libvlc_meta_Album);
671 _send_cmd_str(app, meta);
672 meta = libvlc_media_get_meta(app->m, libvlc_meta_Date);
673 _send_cmd_str(app, meta);
674 meta = libvlc_media_get_meta(app->m, libvlc_meta_Genre);
675 _send_cmd_str(app, meta);
676 meta = NULL; // sending empty comments
677 _send_cmd_str(app, meta);
678 meta = NULL; // sending empty disc id
679 _send_cmd_str(app, meta);
680 meta = libvlc_media_get_meta(app->m, libvlc_meta_TrackNumber);
681 _send_cmd_str(app, meta);
682 _send_cmd_finish(app);
683}
684
685static void
653_position_changed(struct _App *app) 686_position_changed(struct _App *app)
654{ 687{
655 if (!app->opening) 688 if (!app->opening)
@@ -665,6 +698,9 @@ _position_changed(struct _App *app)
665 /* sending audio track info */ 698 /* sending audio track info */
666 _send_all_track_info(app); 699 _send_all_track_info(app);
667 700
701 /* sending meta info */
702 _send_all_meta_info(app);
703
668 libvlc_media_player_stop(app->mp); 704 libvlc_media_player_stop(app->mp);
669} 705}
670 706