[vlc-devel] [RFC 4/4] UPnP subtitles support

Jean-Baptiste Kempf jb at videolan.org
Mon May 11 20:46:05 CEST 2015


---
 modules/services_discovery/upnp.cpp | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/modules/services_discovery/upnp.cpp b/modules/services_discovery/upnp.cpp
index 097a92b..8b656ba 100644
--- a/modules/services_discovery/upnp.cpp
+++ b/modules/services_discovery/upnp.cpp
@@ -554,11 +554,20 @@ void MediaServer::addItem(const char *objectID, const char *title )
     input_item_Release( p_item );
 }
 
-void MediaServer::addItem(const char* title, const char*, const char*,
+void MediaServer::addItem(const char* title, const char*, const char* psz_subtitle,
                           mtime_t duration, const char* psz_url)
 {
-    input_item_t* p_item = input_item_NewWithTypeExt( psz_url, title, 0, NULL, 0,
-                                                      duration, ITEM_TYPE_FILE, 1 );
+    int i_option = 0;
+    char *psz_option = NULL;
+    if( psz_subtitle )
+    {
+        if( asprintf( &psz_option, "sub-mrl=%s", psz_subtitle ) >= 0 )
+            i_option = 1;
+    }
+
+    input_item_t* p_item = input_item_NewWithTypeExt( psz_url, title, i_option,
+                                                      i_option > 0 ? &psz_option : NULL,
+                                                      0, duration, ITEM_TYPE_FILE, 1 );
     input_item_node_AppendItem( node_, p_item );
     input_item_Release( p_item );
 }
-- 
2.4.0




More information about the vlc-devel mailing list