[vlc-commits] chromecast: demux: use DEMUX_GET_META by default to get the title and artwork URL

Steve Lhomme git at videolan.org
Fri Jun 24 18:37:03 CEST 2016


vlc | branch: master | Steve Lhomme <robUx4 at videolabs.io> | Thu Jun 23 18:29:41 2016 +0200| [0f32ad9424ba557a71c5c043611241f05fc08e9f] | committer: Jean-Baptiste Kempf

chromecast: demux: use DEMUX_GET_META by default to get the title and artwork URL

most of the time we won't have anything

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0f32ad9424ba557a71c5c043611241f05fc08e9f
---

 modules/stream_out/chromecast/chromecast_demux.cpp |   26 +++++++++-----------
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/modules/stream_out/chromecast/chromecast_demux.cpp b/modules/stream_out/chromecast/chromecast_demux.cpp
index e671043..82cd8f6 100644
--- a/modules/stream_out/chromecast/chromecast_demux.cpp
+++ b/modules/stream_out/chromecast/chromecast_demux.cpp
@@ -46,22 +46,20 @@ struct demux_sys_t
         ,canSeek(false)
         ,m_seektime( VLC_TS_INVALID )
     {
-        demux_t *p_last_demux = demux->p_next;
-        while (p_last_demux->p_next)
-            p_last_demux = p_last_demux->p_next;
-        input_thread_t *p_input = p_last_demux->p_input;
-        input_item_t *p_item = input_GetItem( p_input );
-        if ( p_item )
+        vlc_meta_t *p_meta = vlc_meta_New();
+        if( likely(p_meta != NULL) )
         {
-            char *psz_title = input_item_GetTitleFbName( p_item );
-            p_renderer->pf_set_title( p_renderer->p_opaque, psz_title );
-            free( psz_title );
-
-            psz_title = input_item_GetArtworkURL( p_item );
-            p_renderer->pf_set_artwork( p_renderer->p_opaque, psz_title );
-            free( psz_title );
+            if (demux_Control( demux->p_next, DEMUX_GET_META, p_meta) == VLC_SUCCESS)
+            {
+                const char *meta = vlc_meta_Get( p_meta, vlc_meta_Title );
+                if ( meta != NULL )
+                    p_renderer->pf_set_title( p_renderer->p_opaque, meta );
+                meta = vlc_meta_Get( p_meta, vlc_meta_ArtworkURL );
+                if ( meta != NULL )
+                    p_renderer->pf_set_artwork( p_renderer->p_opaque, meta );
+            }
+            vlc_meta_Delete(p_meta);
         }
-
         p_renderer->pf_set_input_state( p_renderer->p_opaque,
                                         (input_state_e) var_GetInteger( p_input, "state" ) );
         var_AddCallback( p_input, "intf-event", InputEvent, this );



More information about the vlc-commits mailing list