[vlc-devel] [PATCH 1/3] chromecast: demux: use DEMUX_GET_META by default to get the title and artwork URL

Steve Lhomme robux4 at videolabs.io
Thu Jun 23 18:29:41 CEST 2016


most of the time we won't have anything

--
replaces https://patches.videolan.org/patch/13786/
---
 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 );
-- 
2.8.2



More information about the vlc-devel mailing list