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
ec6c8366
Commit
ec6c8366
authored
Apr 28, 2015
by
Hugo Beauzée-Luyssen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
upnp: Do not add the same element more than once
parent
3447e875
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
24 deletions
+18
-24
modules/services_discovery/upnp.cpp
modules/services_discovery/upnp.cpp
+18
-24
No files found.
modules/services_discovery/upnp.cpp
View file @
ec6c8366
...
...
@@ -767,34 +767,28 @@ bool MediaServer::fetchContents()
/* Try to extract all resources in DIDL */
IXML_NodeList
*
p_resource_list
=
ixmlDocument_getElementsByTagName
(
(
IXML_Document
*
)
itemElement
,
"res"
);
if
(
p_resource_list
)
if
(
p_resource_list
&&
ixmlNodeList_length
(
p_resource_list
)
>
0
)
{
int
i_length
=
ixmlNodeList_length
(
p_resource_list
);
for
(
int
i
=
0
;
i
<
i_length
;
i
++
)
mtime_t
i_duration
=
-
1
;
int
i_hours
,
i_minutes
,
i_seconds
;
IXML_Element
*
p_resource
=
(
IXML_Element
*
)
ixmlNodeList_item
(
p_resource_list
,
0
);
const
char
*
psz_resource_url
=
xml_getChildElementValue
(
p_resource
,
"res"
);
if
(
!
psz_resource_url
)
continue
;
const
char
*
psz_duration
=
ixmlElement_getAttribute
(
p_resource
,
"duration"
);
if
(
psz_duration
)
{
mtime_t
i_duration
=
-
1
;
int
i_hours
,
i_minutes
,
i_seconds
;
IXML_Element
*
p_resource
=
(
IXML_Element
*
)
ixmlNodeList_item
(
p_resource_list
,
i
);
const
char
*
psz_resource_url
=
xml_getChildElementValue
(
p_resource
,
"res"
);
if
(
!
psz_resource_url
)
continue
;
const
char
*
psz_duration
=
ixmlElement_getAttribute
(
p_resource
,
"duration"
);
if
(
psz_duration
)
{
if
(
sscanf
(
psz_duration
,
"%d:%02d:%02d"
,
&
i_hours
,
&
i_minutes
,
&
i_seconds
)
)
i_duration
=
INT64_C
(
1000000
)
*
(
i_hours
*
3600
+
i_minutes
*
60
+
i_seconds
);
}
addItem
(
title
,
objectID
,
psz_subtitles
,
i_duration
,
psz_resource_url
);
if
(
sscanf
(
psz_duration
,
"%d:%02d:%02d"
,
&
i_hours
,
&
i_minutes
,
&
i_seconds
)
)
i_duration
=
INT64_C
(
1000000
)
*
(
i_hours
*
3600
+
i_minutes
*
60
+
i_seconds
);
}
ixmlNodeList_free
(
p_resource_list
);
addItem
(
title
,
objectID
,
psz_subtitles
,
i_duration
,
psz_resource_url
);
}
else
continue
;
ixmlNodeList_free
(
p_resource_list
);
}
ixmlNodeList_free
(
itemNodeList
);
}
...
...
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