[vlc-commits] upnp: Support UPnP A/V MediaServer:2 devices
Chris Clayton
git at videolan.org
Mon Dec 19 04:18:04 CET 2011
vlc | branch: master | Chris Clayton <chris2553 at googlemail.com> | Sat Dec 17 23:30:08 2011 +0000| [02f60487e26191b02b8d33c50323f5c1c1fffc4b] | committer: Mirsal Ennaime
upnp: Support UPnP A/V MediaServer:2 devices
* Accept any version of the MediaServer service
* Browse the advertised ContentDirectory service version
Signed-off-by: Mirsal Ennaime <mirsal at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=02f60487e26191b02b8d33c50323f5c1c1fffc4b
---
modules/services_discovery/upnp.cpp | 15 ++++++++++++---
modules/services_discovery/upnp.hpp | 1 +
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/modules/services_discovery/upnp.cpp b/modules/services_discovery/upnp.cpp
index cc61e1d..00750f5 100644
--- a/modules/services_discovery/upnp.cpp
+++ b/modules/services_discovery/upnp.cpp
@@ -380,7 +380,8 @@ void MediaServer::parseDeviceDescription( IXML_Document* p_doc,
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( IXML_Document* p_doc,
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* psz_udn,
_p_contents = NULL;
_p_input_item = NULL;
+ _i_content_directory_service_version = 1;
}
MediaServer::~MediaServer()
@@ -597,6 +603,9 @@ IXML_Document* MediaServer::_browseAction( const char* psz_object_id_,
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",
diff --git a/modules/services_discovery/upnp.hpp b/modules/services_discovery/upnp.hpp
index 8e45fe8..935317f 100644
--- a/modules/services_discovery/upnp.hpp
+++ b/modules/services_discovery/upnp.hpp
@@ -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;
};
More information about the vlc-commits
mailing list