Commit 52201454 authored by Chris Clayton's avatar Chris Clayton Committed by Jean-Baptiste Kempf

upnp: Support UPnP A/V MediaServer:2 devices

* Accept any version of the MediaServer service
* Browse the advertised ContentDirectory service version
Signed-off-by: default avatarMirsal Ennaime <mirsal@videolan.org>
(cherry picked from commit 02f60487e26191b02b8d33c50323f5c1c1fffc4b)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 68c6cf2d
...@@ -380,7 +380,8 @@ void MediaServer::parseDeviceDescription( IXML_Document* p_doc, ...@@ -380,7 +380,8 @@ void MediaServer::parseDeviceDescription( IXML_Document* p_doc,
continue; 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; continue;
const char* psz_udn = xml_getChildElementValue( p_device_element, "UDN" ); const char* psz_udn = xml_getChildElementValue( p_device_element, "UDN" );
...@@ -437,10 +438,14 @@ void MediaServer::parseDeviceDescription( IXML_Document* p_doc, ...@@ -437,10 +438,14 @@ void MediaServer::parseDeviceDescription( IXML_Document* p_doc,
continue; continue;
} }
if ( strcmp( CONTENT_DIRECTORY_SERVICE_TYPE, int k = strlen( CONTENT_DIRECTORY_SERVICE_TYPE ) - 1;
psz_service_type ) != 0 ) if ( strncmp( CONTENT_DIRECTORY_SERVICE_TYPE,
psz_service_type, k ) != 0 )
continue; continue;
p_server->_i_content_directory_service_version =
psz_service_type[k];
const char* psz_event_sub_url = const char* psz_event_sub_url =
xml_getChildElementValue( p_service_element, xml_getChildElementValue( p_service_element,
"eventSubURL" ); "eventSubURL" );
...@@ -509,6 +514,7 @@ MediaServer::MediaServer( const char* psz_udn, ...@@ -509,6 +514,7 @@ MediaServer::MediaServer( const char* psz_udn,
_p_contents = NULL; _p_contents = NULL;
_p_input_item = NULL; _p_input_item = NULL;
_i_content_directory_service_version = 1;
} }
MediaServer::~MediaServer() MediaServer::~MediaServer()
...@@ -597,6 +603,9 @@ IXML_Document* MediaServer::_browseAction( const char* psz_object_id_, ...@@ -597,6 +603,9 @@ IXML_Document* MediaServer::_browseAction( const char* psz_object_id_,
char* psz_service_type = strdup( CONTENT_DIRECTORY_SERVICE_TYPE ); 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; int i_res;
i_res = UpnpAddToAction( &p_action, "Browse", i_res = UpnpAddToAction( &p_action, "Browse",
......
...@@ -87,6 +87,7 @@ private: ...@@ -87,6 +87,7 @@ private:
std::string _content_directory_control_url; std::string _content_directory_control_url;
int _i_subscription_timeout; int _i_subscription_timeout;
int _i_content_directory_service_version;
Upnp_SID _subscription_id; Upnp_SID _subscription_id;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment