-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
first pass on XML/.mpd decoder, finds all BaseURL variations
- Loading branch information
Showing
9 changed files
with
287 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" mediaPresentationDuration="PT9.767S" minBufferTime="PT1.500S" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011" type="static"> | ||
<Period duration="PT9.767S"> | ||
<AdaptationSet segmentAlignment="true" subsegmentAlignment="true" subsegmentStartsWithSAP="1"> | ||
<Representation bandwidth="2398602" codecs="avc1.4d401f" frameRate="30" height="480" id="VIDEO-1" mimeType="video/mp4" startWithSAP="1" width="270"> | ||
<BaseURL>DASH_2_4_M</BaseURL> | ||
<SegmentBase indexRange="902-993" indexRangeExact="true"> | ||
<Initialization range="0-901" /> | ||
</SegmentBase> | ||
</Representation> | ||
<Representation bandwidth="1203299" codecs="avc1.4d401e" frameRate="30" height="360" id="VIDEO-2" mimeType="video/mp4" startWithSAP="1" width="202"> | ||
<BaseURL>DASH_1_2_M</BaseURL> | ||
<SegmentBase indexRange="923-1014" indexRangeExact="true"> | ||
<Initialization range="0-922" /> | ||
</SegmentBase> | ||
</Representation> | ||
<Representation bandwidth="4815509" codecs="avc1.4d401f" frameRate="30" height="720" id="VIDEO-3" mimeType="video/mp4" startWithSAP="1" width="404"> | ||
<BaseURL>DASH_4_8_M</BaseURL> | ||
<SegmentBase indexRange="923-1014" indexRangeExact="true"> | ||
<Initialization range="0-922" /> | ||
</SegmentBase> | ||
</Representation> | ||
<Representation bandwidth="608626" codecs="avc1.4d401e" frameRate="30" height="240" id="VIDEO-5" mimeType="video/mp4" startWithSAP="1" width="134"> | ||
<BaseURL>DASH_600_K</BaseURL> | ||
<SegmentBase indexRange="922-1013" indexRangeExact="true"> | ||
<Initialization range="0-921" /> | ||
</SegmentBase> | ||
</Representation> | ||
</AdaptationSet> | ||
</Period> | ||
</MPD> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" mediaPresentationDuration="PT9.767S" minBufferTime="PT1.500S" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011" type="static"> | ||
<Period duration="PT9.767S"> | ||
<AdaptationSet segmentAlignment="true" subsegmentAlignment="true" subsegmentStartsWithSAP="1"> | ||
<Representation bandwidth="2398602" codecs="avc1.4d401f" frameRate="30" height="480" id="VIDEO-1" mimeType="video/mp4" startWithSAP="1" width="270"> | ||
<BaseURL>DASH_2_4_M</BaseURL> | ||
<SegmentBase indexRange="902-993" indexRangeExact="true"> | ||
<Initialization range="0-901" /> | ||
</SegmentBase> | ||
</Representation> | ||
<Representation bandwidth="1203299" codecs="avc1.4d401e" frameRate="30" height="360" id="VIDEO-2" mimeType="video/mp4" startWithSAP="1" width="202"> | ||
<BaseURL>DASH_1_2_M</BaseURL> | ||
<SegmentBase indexRange="923-1014" indexRangeExact="true"> | ||
<Initialization range="0-922" /> | ||
</SegmentBase> | ||
</Representation> | ||
<Representation bandwidth="4815509" codecs="avc1.4d401f" frameRate="30" height="720" id="VIDEO-3" mimeType="video/mp4" startWithSAP="1" width="404"> | ||
<BaseURL>DASH_4_8_M</BaseURL> | ||
<SegmentBase indexRange="923-1014" indexRangeExact="true"> | ||
<Initialization range="0-922" /> | ||
</SegmentBase> | ||
</Representation> | ||
<Representation bandwidth="608626" codecs="avc1.4d401e" frameRate="30" height="240" id="VIDEO-5" mimeType="video/mp4" startWithSAP="1" width="134"> | ||
<BaseURL>DASH_600_K</BaseURL> | ||
<SegmentBase indexRange="922-1013" indexRangeExact="true"> | ||
<Initialization range="0-921" /> | ||
</SegmentBase> | ||
</Representation> | ||
</AdaptationSet> | ||
</Period> | ||
</MPD> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" mediaPresentationDuration="PT9.767S" minBufferTime="PT1.500S" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011" type="static"> | ||
<Period duration="PT9.767S"> | ||
<AdaptationSet segmentAlignment="true" subsegmentAlignment="true" subsegmentStartsWithSAP="1"> | ||
<Representation bandwidth="2398602" codecs="avc1.4d401f" frameRate="30" height="480" id="VIDEO-1" mimeType="video/mp4" startWithSAP="1" width="270"> | ||
<BaseURL>DASH_2_4_M</BaseURL> | ||
<SegmentBase indexRange="902-993" indexRangeExact="true"> | ||
<Initialization range="0-901" /> | ||
</SegmentBase> | ||
</Representation> | ||
<Representation bandwidth="1203299" codecs="avc1.4d401e" frameRate="30" height="360" id="VIDEO-2" mimeType="video/mp4" startWithSAP="1" width="202"> | ||
<BaseURL>DASH_1_2_M</BaseURL> | ||
<SegmentBase indexRange="923-1014" indexRangeExact="true"> | ||
<Initialization range="0-922" /> | ||
</SegmentBase> | ||
</Representation> | ||
<Representation bandwidth="4815509" codecs="avc1.4d401f" frameRate="30" height="720" id="VIDEO-3" mimeType="video/mp4" startWithSAP="1" width="404"> | ||
<BaseURL>DASH_4_8_M</BaseURL> | ||
<SegmentBase indexRange="923-1014" indexRangeExact="true"> | ||
<Initialization range="0-922" /> | ||
</SegmentBase> | ||
</Representation> | ||
<Representation bandwidth="608626" codecs="avc1.4d401e" frameRate="30" height="240" id="VIDEO-5" mimeType="video/mp4" startWithSAP="1" width="134"> | ||
<BaseURL>DASH_600_K</BaseURL> | ||
<SegmentBase indexRange="922-1013" indexRangeExact="true"> | ||
<Initialization range="0-921" /> | ||
</SegmentBase> | ||
</Representation> | ||
</AdaptationSet> | ||
</Period> | ||
</MPD> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" mediaPresentationDuration="PT56.1S" minBufferTime="PT1.500S" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011" type="static"> | ||
<Period duration="PT56.1S"> | ||
<AdaptationSet segmentAlignment="true" subsegmentAlignment="true" subsegmentStartsWithSAP="1"> | ||
<Representation bandwidth="2385146" codecs="avc1.4d401f" frameRate="30" height="480" id="VIDEO-1" mimeType="video/mp4" startWithSAP="1" width="854"> | ||
<BaseURL>DASH_2_4_M</BaseURL> | ||
<SegmentBase indexRange="923-1302" indexRangeExact="true"> | ||
<Initialization range="0-922" /> | ||
</SegmentBase> | ||
</Representation> | ||
<Representation bandwidth="1191540" codecs="avc1.4d401e" frameRate="30" height="360" id="VIDEO-2" mimeType="video/mp4" startWithSAP="1" width="640"> | ||
<BaseURL>DASH_1_2_M</BaseURL> | ||
<SegmentBase indexRange="903-1282" indexRangeExact="true"> | ||
<Initialization range="0-902" /> | ||
</SegmentBase> | ||
</Representation> | ||
<Representation bandwidth="4715386" codecs="avc1.4d401f" frameRate="30" height="720" id="VIDEO-3" mimeType="video/mp4" startWithSAP="1" width="1280"> | ||
<BaseURL>DASH_4_8_M</BaseURL> | ||
<SegmentBase indexRange="902-1281" indexRangeExact="true"> | ||
<Initialization range="0-901" /> | ||
</SegmentBase> | ||
</Representation> | ||
<Representation bandwidth="606496" codecs="avc1.4d401e" frameRate="30" height="240" id="VIDEO-4" mimeType="video/mp4" startWithSAP="1" width="426"> | ||
<BaseURL>DASH_600_K</BaseURL> | ||
<SegmentBase indexRange="902-1281" indexRangeExact="true"> | ||
<Initialization range="0-901" /> | ||
</SegmentBase> | ||
</Representation> | ||
</AdaptationSet> | ||
<AdaptationSet> | ||
<Representation audioSamplingRate="48000" bandwidth="130177" codecs="mp4a.40.2" id="AUDIO-1" mimeType="audio/mp4" startWithSAP="1"> | ||
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2" /> | ||
<BaseURL>audio</BaseURL> | ||
<SegmentBase indexRange="832-1211" indexRangeExact="true"> | ||
<Initialization range="0-831" /> | ||
</SegmentBase> | ||
</Representation> | ||
</AdaptationSet> | ||
</Period> | ||
</MPD> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" mediaPresentationDuration="PT56.1S" minBufferTime="PT1.500S" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011" type="static"> | ||
<Period duration="PT56.1S"> | ||
<AdaptationSet segmentAlignment="true" subsegmentAlignment="true" subsegmentStartsWithSAP="1"> | ||
<Representation bandwidth="2385146" codecs="avc1.4d401f" frameRate="30" height="480" id="VIDEO-1" mimeType="video/mp4" startWithSAP="1" width="854"> | ||
<BaseURL>DASH_2_4_M</BaseURL> | ||
<SegmentBase indexRange="923-1302" indexRangeExact="true"> | ||
<Initialization range="0-922" /> | ||
</SegmentBase> | ||
</Representation> | ||
<Representation bandwidth="1191540" codecs="avc1.4d401e" frameRate="30" height="360" id="VIDEO-2" mimeType="video/mp4" startWithSAP="1" width="640"> | ||
<BaseURL>DASH_1_2_M</BaseURL> | ||
<SegmentBase indexRange="903-1282" indexRangeExact="true"> | ||
<Initialization range="0-902" /> | ||
</SegmentBase> | ||
</Representation> | ||
<Representation bandwidth="4715386" codecs="avc1.4d401f" frameRate="30" height="720" id="VIDEO-3" mimeType="video/mp4" startWithSAP="1" width="1280"> | ||
<BaseURL>DASH_4_8_M</BaseURL> | ||
<SegmentBase indexRange="902-1281" indexRangeExact="true"> | ||
<Initialization range="0-901" /> | ||
</SegmentBase> | ||
</Representation> | ||
<Representation bandwidth="606496" codecs="avc1.4d401e" frameRate="30" height="240" id="VIDEO-4" mimeType="video/mp4" startWithSAP="1" width="426"> | ||
<BaseURL>DASH_600_K</BaseURL> | ||
<SegmentBase indexRange="902-1281" indexRangeExact="true"> | ||
<Initialization range="0-901" /> | ||
</SegmentBase> | ||
</Representation> | ||
</AdaptationSet> | ||
<AdaptationSet> | ||
<Representation audioSamplingRate="48000" bandwidth="130177" codecs="mp4a.40.2" id="AUDIO-1" mimeType="audio/mp4" startWithSAP="1"> | ||
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2" /> | ||
<BaseURL>audio</BaseURL> | ||
<SegmentBase indexRange="832-1211" indexRangeExact="true"> | ||
<Initialization range="0-831" /> | ||
</SegmentBase> | ||
</Representation> | ||
</AdaptationSet> | ||
</Period> | ||
</MPD> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" mediaPresentationDuration="PT43.046S" minBufferTime="PT4.99S" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011" type="static" xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 http://standards.iso.org/ittf/PubliclyAvailableStandards/MPEG-DASH_schema_files/DASH-MPD.xsd"> | ||
<Period duration="PT43.046S"> | ||
<AdaptationSet contentType="audio" group="1" mimeType="audio/mp4" segmentAlignment="true" startWithSAP="1" subsegmentAlignment="true" subsegmentStartsWithSAP="1"> | ||
<Representation audioSamplingRate="48000" bandwidth="131893" codecs="mp4a.40.2" id="audio_0_131893"> | ||
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2" /> | ||
<BaseURL>DASH_audio.mp4</BaseURL> | ||
<SegmentBase indexRange="663-802" indexRangeExact="true" timescale="48000"> | ||
<Initialization range="0-662" /> | ||
</SegmentBase> | ||
</Representation> | ||
</AdaptationSet> | ||
<AdaptationSet contentType="video" group="2" maxFrameRate="30" maxHeight="468" maxWidth="854" mimeType="video/mp4" par="1.85:1" sar="1:1" segmentAlignment="true" startWithSAP="1" subsegmentAlignment="true" subsegmentStartsWithSAP="1"> | ||
<Representation bandwidth="600031" codecs="avc1.4D401E" frameRate="30" height="234" id="video_600031" scanType="progressive" width="426"> | ||
<BaseURL>DASH_240.mp4</BaseURL> | ||
<SegmentBase indexRange="767-906" indexRangeExact="true" timescale="3000"> | ||
<Initialization range="0-766" /> | ||
</SegmentBase> | ||
</Representation> | ||
<Representation bandwidth="800671" codecs="avc1.4D401E" frameRate="30" height="352" id="video_800671" scanType="progressive" width="640"> | ||
<BaseURL>DASH_360.mp4</BaseURL> | ||
<SegmentBase indexRange="766-905" indexRangeExact="true" timescale="3000"> | ||
<Initialization range="0-765" /> | ||
</SegmentBase> | ||
</Representation> | ||
<Representation bandwidth="1204314" codecs="avc1.4D401F" frameRate="30" height="468" id="video_1204314" scanType="progressive" width="854"> | ||
<BaseURL>DASH_480.mp4</BaseURL> | ||
<SegmentBase indexRange="764-903" indexRangeExact="true" timescale="3000"> | ||
<Initialization range="0-763" /> | ||
</SegmentBase> | ||
</Representation> | ||
</AdaptationSet> | ||
</Period> | ||
</MPD> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" mediaPresentationDuration="PT9.767S" minBufferTime="PT1.500S" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011" type="static"> | ||
<Period duration="PT9.767S"> | ||
<AdaptationSet segmentAlignment="true" subsegmentAlignment="true" subsegmentStartsWithSAP="1"> | ||
<Representation bandwidth="2398602" codecs="avc1.4d401f" frameRate="30" height="480" id="VIDEO-1" mimeType="video/mp4" startWithSAP="1" width="270"> | ||
<BaseURL>DASH_2_4_M</BaseURL> | ||
<SegmentBase indexRange="902-993" indexRangeExact="true"> | ||
<Initialization range="0-901" /> | ||
</SegmentBase> | ||
</Representation> | ||
<Representation bandwidth="1203299" codecs="avc1.4d401e" frameRate="30" height="360" id="VIDEO-2" mimeType="video/mp4" startWithSAP="1" width="202"> | ||
<BaseURL>DASH_1_2_M</BaseURL> | ||
<SegmentBase indexRange="923-1014" indexRangeExact="true"> | ||
<Initialization range="0-922" /> | ||
</SegmentBase> | ||
</Representation> | ||
<Representation bandwidth="4815509" codecs="avc1.4d401f" frameRate="30" height="720" id="VIDEO-3" mimeType="video/mp4" startWithSAP="1" width="404"> | ||
<BaseURL>DASH_4_8_M</BaseURL> | ||
<SegmentBase indexRange="923-1014" indexRangeExact="true"> | ||
<Initialization range="0-922" /> | ||
</SegmentBase> | ||
</Representation> | ||
<Representation bandwidth="608626" codecs="avc1.4d401e" frameRate="30" height="240" id="VIDEO-5" mimeType="video/mp4" startWithSAP="1" width="134"> | ||
<BaseURL>DASH_600_K</BaseURL> | ||
<SegmentBase indexRange="922-1013" indexRangeExact="true"> | ||
<Initialization range="0-921" /> | ||
</SegmentBase> | ||
</Representation> | ||
</AdaptationSet> | ||
</Period> | ||
</MPD> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package main | ||
|
||
import ( | ||
"encoding/xml" | ||
"fmt" | ||
"io" | ||
"os" | ||
) | ||
|
||
type BaseUrl struct { | ||
Data string `xml:",chardata"` | ||
} | ||
|
||
// decode returns all variations of BaseUrl in a DASHPlaylist.mpd file. | ||
func decode(fileName string) []string { | ||
f, _ := os.Open(fileName) | ||
dec := xml.NewDecoder(f) | ||
var stack []string | ||
for { | ||
tok, err := dec.Token() | ||
if err == io.EOF { | ||
break | ||
} else if err != nil { | ||
fmt.Fprintf(os.Stderr, "xmlselect: %v\n", err) | ||
os.Exit(1) | ||
} | ||
switch tok := tok.(type) { | ||
case xml.StartElement: | ||
if tok.Name.Local == "BaseURL" { | ||
var Url BaseUrl | ||
_ = dec.DecodeElement(&Url, &tok) | ||
stack = append(stack, Url.Data) | ||
} | ||
} | ||
} | ||
return stack | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"io/ioutil" | ||
"strings" | ||
"testing" | ||
) | ||
|
||
func Test_decode(t *testing.T) { | ||
dashDir := "./DashFiles/" | ||
fs, _ := ioutil.ReadDir(dashDir) | ||
for _, f := range fs { | ||
if strings.HasSuffix(f.Name(), ".mpd") { | ||
list := decode(dashDir + f.Name()) | ||
fmt.Println(list) | ||
} | ||
} | ||
} |