-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
write_child_node need to help str node_type #16
Comments
@athensofamerica Thanks also. Regarding the issue, it could be a corner case. Can you help me reproduce the problem? Any test code you've faced the issue would be helpful. |
Here is an example .mpd file (multi_subs.mpd) from the git-hub Dash Industry Forum . I believe the issue here is that the file is marked as utf-8 encoded. @athensofamerica provided a fine set of patches that enable the library to work on utf-8 encoded .xml files. <?xml version="1.0" encoding="utf-8"?>
<MPD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:mpeg:dash:schema:mpd:2011" xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd" profiles="urn:mpeg:dash:profile:isoff-live:2011,urn:com:dashif:dash264" maxSegmentDuration="PT2S" minBufferTime="PT2S" type="static" mediaPresentationDuration="PT1H">
<ProgramInformation>
<Title>Media Presentation Description by MobiTV. Powered by MDL Team@Sweden.</Title>
</ProgramInformation>
<Period id="precambrian" start="PT0S">
<AdaptationSet contentType="audio" mimeType="audio/mp4" lang="eng" segmentAlignment="true" startWithSAP="1">
<Role schemeIdUri="urn:mpeg:dash:role:2011" value="main"/>
<SegmentTemplate startNumber="1" initialization="$RepresentationID$/init.mp4" duration="2" media="$RepresentationID$/$Number$.m4s"/>
<Representation id="A48" codecs="mp4a.40.2" bandwidth="48000" audioSamplingRate="48000">
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
</Representation>
</AdaptationSet>
<AdaptationSet contentType="video" mimeType="video/mp4" segmentAlignment="true" startWithSAP="1" par="16:9" minWidth="640" maxWidth="640" minHeight="360" maxHeight="360" maxFrameRate="60/2">
<Role schemeIdUri="urn:mpeg:dash:role:2011" value="main"/>
<SegmentTemplate startNumber="1" initialization="$RepresentationID$/init.mp4" duration="2" media="$RepresentationID$/$Number$.m4s"/>
<Representation id="V300" codecs="avc1.64001e" bandwidth="300000" width="640" height="360" frameRate="30" sar="1:1"/>
</AdaptationSet>
<AdaptationSet contentType="text" mimeType="application/mp4" segmentAlignment="true" lang="eng">
<Role schemeIdUri="urn:mpeg:dash:role:2011" value="subtitle"/>
<SegmentTemplate startNumber="1" initialization="$RepresentationID$/init.mp4" duration="2" media="$RepresentationID$/$Number$.m4s"/>
<Representation id="sub_eng" codecs="stpp" startWithSAP="1" bandwidth="5367"/>
</AdaptationSet>
<AdaptationSet contentType="text" mimeType="application/mp4" segmentAlignment="true" lang="eng">
<Role schemeIdUri="urn:mpeg:dash:role:2011" value="caption"/>
<SegmentTemplate startNumber="1" initialization="$RepresentationID$/init.mp4" duration="2" media="$RepresentationID$/$Number$.m4s"/>
<Representation id="sub_eng_cap" codecs="stpp" startWithSAP="1" bandwidth="5367"/>
</AdaptationSet>
<AdaptationSet contentType="text" mimeType="application/mp4" segmentAlignment="true" lang="swe">
<Role schemeIdUri="urn:mpeg:dash:role:2011" value="subtitle"/>
<SegmentTemplate startNumber="1" initialization="$RepresentationID$/init.mp4" duration="2" media="$RepresentationID$/$Number$.m4s"/>
<Representation id="sub_swe" codecs="stpp" startWithSAP="1" bandwidth="5367"/>
</AdaptationSet>
<AdaptationSet contentType="text" mimeType="application/mp4" segmentAlignment="true" lang="qbb">
<Role schemeIdUri="urn:mpeg:dash:role:2011" value="subtitle"/>
<SegmentTemplate startNumber="1" initialization="$RepresentationID$/init.mp4" duration="2" media="$RepresentationID$/$Number$.m4s"/>
<Representation id="sub_ttml_qbb" codecs="stpp" startWithSAP="1" bandwidth="5367"/>
</AdaptationSet>
<AdaptationSet contentType="text" mimeType="application/mp4" segmentAlignment="true" lang="nor">
<Role schemeIdUri="urn:mpeg:dash:role:2011" value="subtitle"/>
<SegmentTemplate startNumber="1" initialization="$RepresentationID$/init.mp4" duration="2" media="$RepresentationID$/$Number$.m4s"/>
<Representation id="sub_nor" codecs="stpp" startWithSAP="1" bandwidth="5367"/>
</AdaptationSet>
</Period>
</MPD>
|
@athensofamerica Hello, it was a long time. Today, I was trying to reproduce the issue again, but wasn't. The MPD sample from @mpegdash-user also works fine with parsing and saving. Can you give a valid MPD sample that causes |
The write_child_node defined in utils.py needs handle special case for str node type.
def write_child_node(xmlnode, tag_name, node):
if node:
xmldoc = xmlnode if isinstance(xmlnode, minidom.Document) else xmlnode.ownerDocument
if isinstance(node, list):
for n in node:
new_elem = xmldoc.createElement(tag_name)
#n.write(new_elem) #This doesn't work for str type. exception throws. Add the following 4 lines of code seems to solved the problem.
if isinstance(n, str) or isinstance(n, unicode):
write_node_value(new_elem, n)
else:
n.write(new_elem)
xmlnode.appendChild(new_elem)
else:
new_elem = xmldoc.createElement(tag_name)
node.write(new_elem)
xmlnode.appendChild(new_elem)
The text was updated successfully, but these errors were encountered: