Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
b6f472ba
Commit
b6f472ba
authored
Apr 20, 2011
by
Konstantin Pavlov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UPNP: set input item duration if available in UPNP response.
parent
4dc39e9f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
6 deletions
+61
-6
modules/services_discovery/upnp.cpp
modules/services_discovery/upnp.cpp
+57
-5
modules/services_discovery/upnp.hpp
modules/services_discovery/upnp.hpp
+4
-1
No files found.
modules/services_discovery/upnp.cpp
View file @
b6f472ba
...
@@ -25,6 +25,8 @@
...
@@ -25,6 +25,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
*****************************************************************************/
#define __STDC_CONSTANT_MACROS 1
#undef PACKAGE_NAME
#undef PACKAGE_NAME
#ifdef HAVE_CONFIG_H
#ifdef HAVE_CONFIG_H
# include "config.h"
# include "config.h"
...
@@ -75,6 +77,10 @@ static int Callback( Upnp_EventType event_type, void* p_event, void* p_user_data
...
@@ -75,6 +77,10 @@ static int Callback( Upnp_EventType event_type, void* p_event, void* p_user_data
const
char
*
xml_getChildElementValue
(
IXML_Element
*
p_parent
,
const
char
*
xml_getChildElementValue
(
IXML_Element
*
p_parent
,
const
char
*
psz_tag_name
);
const
char
*
psz_tag_name
);
const
char
*
xml_getChildElementAttributeValue
(
IXML_Element
*
p_parent
,
const
char
*
psz_tag_name_
,
const
char
*
psz_attribute_
);
IXML_Document
*
parseBrowseResult
(
IXML_Document
*
p_doc
);
IXML_Document
*
parseBrowseResult
(
IXML_Document
*
p_doc
);
...
@@ -166,6 +172,24 @@ const char* xml_getChildElementValue( IXML_Element* p_parent,
...
@@ -166,6 +172,24 @@ const char* xml_getChildElementValue( IXML_Element* p_parent,
return
ixmlNode_getNodeValue
(
p_text_node
);
return
ixmlNode_getNodeValue
(
p_text_node
);
}
}
const
char
*
xml_getChildElementAttributeValue
(
IXML_Element
*
p_parent
,
const
char
*
psz_tag_name_
,
const
char
*
psz_attribute_
)
{
if
(
!
p_parent
)
return
NULL
;
if
(
!
psz_tag_name_
)
return
NULL
;
if
(
!
psz_attribute_
)
return
NULL
;
IXML_NodeList
*
p_node_list
=
ixmlElement_getElementsByTagName
(
p_parent
,
psz_tag_name_
);
if
(
!
p_node_list
)
return
NULL
;
IXML_Node
*
p_element
=
ixmlNodeList_item
(
p_node_list
,
0
);
ixmlNodeList_free
(
p_node_list
);
if
(
!
p_element
)
return
NULL
;
return
ixmlElement_getAttribute
(
(
IXML_Element
*
)
p_element
,
psz_attribute_
);
}
// Extracts the result document from a SOAP response
// Extracts the result document from a SOAP response
IXML_Document
*
parseBrowseResult
(
IXML_Document
*
p_doc
)
IXML_Document
*
parseBrowseResult
(
IXML_Document
*
p_doc
)
{
{
...
@@ -740,7 +764,7 @@ bool MediaServer::_fetchContents( Container* p_parent )
...
@@ -740,7 +764,7 @@ bool MediaServer::_fetchContents( Container* p_parent )
if
(
resource
&&
childCount
<
1
)
if
(
resource
&&
childCount
<
1
)
{
{
Item
*
item
=
new
Item
(
p_parent
,
objectID
,
title
,
resource
);
Item
*
item
=
new
Item
(
p_parent
,
objectID
,
title
,
resource
,
-
1
);
p_parent
->
addItem
(
item
);
p_parent
->
addItem
(
item
);
}
}
...
@@ -783,7 +807,24 @@ bool MediaServer::_fetchContents( Container* p_parent )
...
@@ -783,7 +807,24 @@ bool MediaServer::_fetchContents( Container* p_parent )
if
(
!
resource
)
if
(
!
resource
)
continue
;
continue
;
Item
*
item
=
new
Item
(
p_parent
,
objectID
,
title
,
resource
);
const
char
*
psz_duration
=
xml_getChildElementAttributeValue
(
itemElement
,
"res"
,
"duration"
);
mtime_t
i_duration
=
-
1
;
int
i_hours
,
i_minutes
,
i_seconds
,
i_decis
;
if
(
psz_duration
)
{
if
(
sscanf
(
psz_duration
,
"%02d:%02d:%02d.%d"
,
&
i_hours
,
&
i_minutes
,
&
i_seconds
,
&
i_decis
))
i_duration
=
INT64_C
(
1000000
)
*
(
i_hours
*
3600
+
i_minutes
*
60
+
i_seconds
)
+
INT64_C
(
100000
)
*
i_decis
;
}
Item
*
item
=
new
Item
(
p_parent
,
objectID
,
title
,
resource
,
i_duration
);
p_parent
->
addItem
(
item
);
p_parent
->
addItem
(
item
);
}
}
ixmlNodeList_free
(
itemNodeList
);
ixmlNodeList_free
(
itemNodeList
);
...
@@ -849,9 +890,14 @@ void MediaServer::_buildPlaylist( Container* p_parent, input_item_node_t *p_inpu
...
@@ -849,9 +890,14 @@ void MediaServer::_buildPlaylist( Container* p_parent, input_item_node_t *p_inpu
{
{
Item
*
p_item
=
p_parent
->
getItem
(
i
);
Item
*
p_item
=
p_parent
->
getItem
(
i
);
input_item_t
*
p_input_item
=
input_item_New
(
_p_sd
,
input_item_t
*
p_input_item
=
input_item_New
Ext
(
_p_sd
,
p_item
->
getResource
(),
p_item
->
getResource
(),
p_item
->
getTitle
()
);
p_item
->
getTitle
(),
0
,
NULL
,
0
,
p_item
->
getDuration
()
);
assert
(
p_input_item
);
assert
(
p_input_item
);
input_item_node_AppendItem
(
p_input_node
,
p_input_item
);
input_item_node_AppendItem
(
p_input_node
,
p_input_item
);
p_item
->
setInputItem
(
p_input_item
);
p_item
->
setInputItem
(
p_input_item
);
...
@@ -974,13 +1020,14 @@ void MediaServerList::removeServer( const char* psz_udn )
...
@@ -974,13 +1020,14 @@ void MediaServerList::removeServer( const char* psz_udn )
// Item...
// Item...
Item
::
Item
(
Container
*
p_parent
,
const
char
*
psz_object_id
,
const
char
*
psz_title
,
Item
::
Item
(
Container
*
p_parent
,
const
char
*
psz_object_id
,
const
char
*
psz_title
,
const
char
*
psz_resource
)
const
char
*
psz_resource
,
mtime_t
i_duration
)
{
{
_parent
=
p_parent
;
_parent
=
p_parent
;
_objectID
=
psz_object_id
;
_objectID
=
psz_object_id
;
_title
=
psz_title
;
_title
=
psz_title
;
_resource
=
psz_resource
;
_resource
=
psz_resource
;
_duration
=
i_duration
;
_p_input_item
=
NULL
;
_p_input_item
=
NULL
;
}
}
...
@@ -1006,6 +1053,11 @@ const char* Item::getResource() const
...
@@ -1006,6 +1053,11 @@ const char* Item::getResource() const
return
_resource
.
c_str
();
return
_resource
.
c_str
();
}
}
const
mtime_t
Item
::
getDuration
()
const
{
return
_duration
;
}
void
Item
::
setInputItem
(
input_item_t
*
p_input_item
)
void
Item
::
setInputItem
(
input_item_t
*
p_input_item
)
{
{
if
(
_p_input_item
==
p_input_item
)
if
(
_p_input_item
==
p_input_item
)
...
...
modules/services_discovery/upnp.hpp
View file @
b6f472ba
...
@@ -119,12 +119,14 @@ public:
...
@@ -119,12 +119,14 @@ public:
Item
(
Container
*
parent
,
Item
(
Container
*
parent
,
const
char
*
objectID
,
const
char
*
objectID
,
const
char
*
title
,
const
char
*
title
,
const
char
*
resource
);
const
char
*
resource
,
mtime_t
duration
);
~
Item
();
~
Item
();
const
char
*
getObjectID
()
const
;
const
char
*
getObjectID
()
const
;
const
char
*
getTitle
()
const
;
const
char
*
getTitle
()
const
;
const
char
*
getResource
()
const
;
const
char
*
getResource
()
const
;
const
mtime_t
getDuration
()
const
;
void
setInputItem
(
input_item_t
*
p_input_item
);
void
setInputItem
(
input_item_t
*
p_input_item
);
...
@@ -136,6 +138,7 @@ private:
...
@@ -136,6 +138,7 @@ private:
std
::
string
_objectID
;
std
::
string
_objectID
;
std
::
string
_title
;
std
::
string
_title
;
std
::
string
_resource
;
std
::
string
_resource
;
mtime_t
_duration
;
};
};
...
...
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