[vlc-devel] Patch: compatibility with upnp Mediaserver v2

Chris Clayton chris2553 at googlemail.com
Sun Dec 18 00:30:08 CET 2011


Hi,

I own a Panasonic Blu-Ray recorder (model DMR-BW880), which also acts as DLNA Mediaserver for video 
or photos stored on its hard drive. The Mediaserver announces itself as being version 2, so the 
content directory service is also version 2.

The patch below (against the 20111216 snapshot) allows VLC to play content from the server. The 
Panasonic is the only mediaserver v2 device that I have, so I can't test whether the patch will 
work with other devices. Perhaps owners of other v2 mediaservers could try it out. At the least, my 
patch can be the basis for development by someone who knows more about upnp/dlna.

--- vlc-1.3.0-git/modules/services_discovery/upnp.hpp~	2011-12-16 10:04:39.000000000 +0000
+++ vlc-1.3.0-git/modules/services_discovery/upnp.hpp	2011-12-16 10:05:37.000000000 +0000
@@ -87,6 +87,7 @@ private:
     std::string _content_directory_control_url;
 
     int _i_subscription_timeout;
+    int _i_content_directory_service_version;
     Upnp_SID _subscription_id;
 };
 
--- vlc-1.3.0-git/modules/services_discovery/upnp.cpp~	2011-12-16 09:35:44.000000000 +0000
+++ vlc-1.3.0-git/modules/services_discovery/upnp.cpp	2011-12-16 10:09:12.000000000 +0000
@@ -380,7 +380,8 @@ void MediaServer::parseDeviceDescription
                 continue;
             }
 
-            if ( strcmp( MEDIA_SERVER_DEVICE_TYPE, psz_device_type ) != 0 )
+            if ( strncmp( MEDIA_SERVER_DEVICE_TYPE, psz_device_type,
+        		    strlen( MEDIA_SERVER_DEVICE_TYPE ) - 1 ) != 0 )
                 continue;
 
             const char* psz_udn = xml_getChildElementValue( p_device_element, "UDN" );
@@ -437,10 +438,14 @@ void MediaServer::parseDeviceDescription
                         continue;
                     }
 
-                    if ( strcmp( CONTENT_DIRECTORY_SERVICE_TYPE,
-                                psz_service_type ) != 0 )
+                    int k = strlen( CONTENT_DIRECTORY_SERVICE_TYPE ) - 1;
+                    if ( strncmp( CONTENT_DIRECTORY_SERVICE_TYPE,
+                                psz_service_type, k ) != 0 )
                         continue;
 
+		    p_server->_i_content_directory_service_version =
+			psz_service_type[k];
+
                     const char* psz_event_sub_url =
                         xml_getChildElementValue( p_service_element,
                                                   "eventSubURL" );
@@ -509,6 +514,7 @@ MediaServer::MediaServer( const char* ps
 
     _p_contents = NULL;
     _p_input_item = NULL;
+    _i_content_directory_service_version = 1;
 }
 
 MediaServer::~MediaServer()
@@ -597,6 +603,9 @@ IXML_Document* MediaServer::_browseActio
 
     char* psz_service_type = strdup( CONTENT_DIRECTORY_SERVICE_TYPE );
 
+    psz_service_type[strlen( psz_service_type ) - 1] =
+	_i_content_directory_service_version;
+
     int i_res;
 
     i_res = UpnpAddToAction( &p_action, "Browse",


-- 
The more I see, the more I know. The more I know, the less I understand. Changing Man - Paul Weller



More information about the vlc-devel mailing list