Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
34d09973
Commit
34d09973
authored
Dec 03, 2015
by
Hugo Beauzée-Luyssen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
upnp: Fix content listing on plex.
Fix #14976 This also removes multiple ununsed url parsing
parent
1095d828
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
32 deletions
+21
-32
modules/services_discovery/upnp.cpp
modules/services_discovery/upnp.cpp
+18
-31
modules/services_discovery/upnp.hpp
modules/services_discovery/upnp.hpp
+3
-1
No files found.
modules/services_discovery/upnp.cpp
View file @
34d09973
...
@@ -31,7 +31,6 @@
...
@@ -31,7 +31,6 @@
#include <vlc_access.h>
#include <vlc_access.h>
#include <vlc_plugin.h>
#include <vlc_plugin.h>
#include <vlc_services_discovery.h>
#include <vlc_services_discovery.h>
#include <vlc_url.h>
#include <assert.h>
#include <assert.h>
#include <limits.h>
#include <limits.h>
...
@@ -622,7 +621,8 @@ namespace Access
...
@@ -622,7 +621,8 @@ namespace Access
{
{
MediaServer
::
MediaServer
(
access_t
*
p_access
)
MediaServer
::
MediaServer
(
access_t
*
p_access
)
:
url_
(
p_access
->
psz_url
)
:
psz_root_
(
NULL
)
,
psz_objectId_
(
NULL
)
,
access_
(
p_access
)
,
access_
(
p_access
)
,
xmlDocument_
(
NULL
)
,
xmlDocument_
(
NULL
)
,
containerNodeList_
(
NULL
)
,
containerNodeList_
(
NULL
)
...
@@ -630,6 +630,15 @@ MediaServer::MediaServer( access_t *p_access )
...
@@ -630,6 +630,15 @@ MediaServer::MediaServer( access_t *p_access )
,
itemNodeList_
(
NULL
)
,
itemNodeList_
(
NULL
)
,
itemNodeIndex_
(
0
)
,
itemNodeIndex_
(
0
)
{
{
vlc_url_t
url
;
vlc_UrlParse
(
&
url
,
p_access
->
psz_location
);
if
(
asprintf
(
&
psz_root_
,
"%s://%s:%u%s"
,
url
.
psz_protocol
,
url
.
psz_host
,
url
.
i_port
?
url
.
i_port
:
80
,
url
.
psz_path
)
<
0
)
psz_root_
=
NULL
;
if
(
url
.
psz_option
&&
!
strncmp
(
url
.
psz_option
,
"ObjectID="
,
strlen
(
"ObjectID="
)
)
)
psz_objectId_
=
strdup
(
&
url
.
psz_option
[
strlen
(
"ObjectID="
)]
);
vlc_UrlClean
(
&
url
);
}
}
MediaServer
::~
MediaServer
()
MediaServer
::~
MediaServer
()
...
@@ -637,21 +646,16 @@ MediaServer::~MediaServer()
...
@@ -637,21 +646,16 @@ MediaServer::~MediaServer()
ixmlNodeList_free
(
containerNodeList_
);
ixmlNodeList_free
(
containerNodeList_
);
ixmlNodeList_free
(
itemNodeList_
);
ixmlNodeList_free
(
itemNodeList_
);
ixmlDocument_free
(
xmlDocument_
);
ixmlDocument_free
(
xmlDocument_
);
free
(
psz_objectId_
);
free
(
psz_root_
);
}
}
input_item_t
*
MediaServer
::
newItem
(
const
char
*
objectID
,
const
char
*
title
)
input_item_t
*
MediaServer
::
newItem
(
const
char
*
objectID
,
const
char
*
title
)
{
{
vlc_url_t
url
;
vlc_UrlParse
(
&
url
,
url_
.
c_str
()
);
char
*
psz_url
;
char
*
psz_url
;
if
(
asprintf
(
&
psz_url
,
"upnp://%s://%s:%u%s?ObjectID=%s"
,
url
.
psz_protocol
,
if
(
asprintf
(
&
psz_url
,
"upnp://%s?ObjectID=%s"
,
psz_root_
,
objectID
)
<
0
)
url
.
psz_host
,
url
.
i_port
?
url
.
i_port
:
80
,
url
.
psz_path
,
objectID
)
<
0
)
{
vlc_UrlClean
(
&
url
);
return
NULL
;
return
NULL
;
}
vlc_UrlClean
(
&
url
);
input_item_t
*
p_item
=
input_item_NewWithTypeExt
(
psz_url
,
title
,
0
,
NULL
,
input_item_t
*
p_item
=
input_item_NewWithTypeExt
(
psz_url
,
title
,
0
,
NULL
,
0
,
-
1
,
ITEM_TYPE_DIRECTORY
,
1
);
0
,
-
1
,
ITEM_TYPE_DIRECTORY
,
1
);
...
@@ -675,13 +679,6 @@ IXML_Document* MediaServer::_browseAction( const char* psz_object_id_,
...
@@ -675,13 +679,6 @@ IXML_Document* MediaServer::_browseAction( const char* psz_object_id_,
{
{
IXML_Document
*
p_action
=
NULL
;
IXML_Document
*
p_action
=
NULL
;
IXML_Document
*
p_response
=
NULL
;
IXML_Document
*
p_response
=
NULL
;
const
char
*
psz_url
=
url_
.
c_str
();
if
(
url_
.
empty
()
)
{
msg_Dbg
(
access_
,
"No subscription url set!"
);
return
NULL
;
}
int
i_res
;
int
i_res
;
...
@@ -745,7 +742,7 @@ IXML_Document* MediaServer::_browseAction( const char* psz_object_id_,
...
@@ -745,7 +742,7 @@ IXML_Document* MediaServer::_browseAction( const char* psz_object_id_,
}
}
i_res
=
UpnpSendAction
(
access_
->
p_sys
->
p_upnp
->
handle
(),
i_res
=
UpnpSendAction
(
access_
->
p_sys
->
p_upnp
->
handle
(),
psz_
url
,
psz_
root_
,
CONTENT_DIRECTORY_SERVICE_TYPE
,
CONTENT_DIRECTORY_SERVICE_TYPE
,
NULL
,
/* ignored in SDK, must be NULL */
NULL
,
/* ignored in SDK, must be NULL */
p_action
,
p_action
,
...
@@ -754,7 +751,7 @@ IXML_Document* MediaServer::_browseAction( const char* psz_object_id_,
...
@@ -754,7 +751,7 @@ IXML_Document* MediaServer::_browseAction( const char* psz_object_id_,
if
(
i_res
!=
UPNP_E_SUCCESS
)
if
(
i_res
!=
UPNP_E_SUCCESS
)
{
{
msg_Err
(
access_
,
"%s when trying the send() action with URL: %s"
,
msg_Err
(
access_
,
"%s when trying the send() action with URL: %s"
,
UpnpGetErrorMessage
(
i_res
),
psz_url
);
UpnpGetErrorMessage
(
i_res
),
access_
->
psz_location
);
ixmlDocument_free
(
p_response
);
ixmlDocument_free
(
p_response
);
p_response
=
NULL
;
p_response
=
NULL
;
...
@@ -770,16 +767,7 @@ browseActionCleanup:
...
@@ -770,16 +767,7 @@ browseActionCleanup:
*/
*/
void
MediaServer
::
fetchContents
()
void
MediaServer
::
fetchContents
()
{
{
const
char
*
objectID
=
""
;
IXML_Document
*
p_response
=
_browseAction
(
psz_objectId_
,
vlc_url_t
url
;
vlc_UrlParse
(
&
url
,
access_
->
psz_location
);
if
(
url
.
psz_option
&&
!
strncmp
(
url
.
psz_option
,
"ObjectID="
,
strlen
(
"ObjectID="
)
)
)
{
objectID
=
&
url
.
psz_option
[
strlen
(
"ObjectID="
)];
}
IXML_Document
*
p_response
=
_browseAction
(
objectID
,
"BrowseDirectChildren"
,
"BrowseDirectChildren"
,
"id,dc:title,res,"
/* Filter */
"id,dc:title,res,"
/* Filter */
"sec:CaptionInfo,sec:CaptionInfoEx,"
"sec:CaptionInfo,sec:CaptionInfoEx,"
...
@@ -787,7 +775,6 @@ void MediaServer::fetchContents()
...
@@ -787,7 +775,6 @@ void MediaServer::fetchContents()
"0"
,
/* RequestedCount */
"0"
,
/* RequestedCount */
""
/* SortCriteria */
""
/* SortCriteria */
);
);
vlc_UrlClean
(
&
url
);
if
(
!
p_response
)
if
(
!
p_response
)
{
{
msg_Err
(
access_
,
"No response from browse() action"
);
msg_Err
(
access_
,
"No response from browse() action"
);
...
...
modules/services_discovery/upnp.hpp
View file @
34d09973
...
@@ -37,6 +37,7 @@
...
@@ -37,6 +37,7 @@
#include <upnp/upnptools.h>
#include <upnp/upnptools.h>
#include <vlc_common.h>
#include <vlc_common.h>
#include <vlc_url.h>
namespace
SD
namespace
SD
{
{
...
@@ -136,7 +137,8 @@ private:
...
@@ -136,7 +137,8 @@ private:
const
char
*
,
const
char
*
,
const
char
*
);
const
char
*
,
const
char
*
,
const
char
*
);
private:
private:
const
std
::
string
url_
;
char
*
psz_root_
;
char
*
psz_objectId_
;
access_t
*
access_
;
access_t
*
access_
;
IXML_Document
*
xmlDocument_
;
IXML_Document
*
xmlDocument_
;
IXML_NodeList
*
containerNodeList_
;
IXML_NodeList
*
containerNodeList_
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment