Пример #1
0
    def update_mpd(self, raw_mpd):
        self.mpd = MPDParser.parse(raw_mpd)
        self.refresh_interval = str_to_seconds(self.mpd.minimum_update_period)
        self.segmentDuration = self.get_segment_duration()

        if len(self.initSegments) == 0:
            self.createInitSegmentList()
        self.createLastSegmentList()
Пример #2
0
    def test_mpd2xml(self):
        mpd = MPDParser.parse('./tests/mpd-samples/sample-001.mpd')
        MPDParser.write(mpd, './tests/mpd-samples/output.mpd')

        mpd2 = MPDParser.parse('./tests/mpd-samples/output.mpd')

        all_reprs = []
        for period in mpd.periods:
            for adapt_set in period.adaptation_sets:
                for repr in adapt_set.representations:
                    all_reprs.append(repr)

        all_reprs2 = []
        for period in mpd2.periods:
            for adapt_set in period.adaptation_sets:
                for repr in adapt_set.representations:
                    all_reprs2.append(repr)

        self.assertTrue(len(all_reprs) == 5)
        self.assertTrue(len(all_reprs) == len(all_reprs2))
Пример #3
0
    def test_mdp2xml(self):
        mpd = MPDParser.parse('./tests/mpd-samples/sample-001.mpd')
        MPDParser.write(mpd, './tests/mpd-samples/output.mpd')

        mpd2 = MPDParser.parse('./tests/mpd-samples/output.mpd')

        all_reprs = []
        for period in mpd.periods:
            for adapt_set in period.adaptation_sets:
                for repr in adapt_set.representations:
                    all_reprs.append(repr)

        all_reprs2 = []
        for period in mpd2.periods:
            for adapt_set in period.adaptation_sets:
                for repr in adapt_set.representations:
                    all_reprs2.append(repr)

        self.assertTrue(len(all_reprs) == 5)
        self.assertTrue(len(all_reprs) == len(all_reprs2))
Пример #4
0
 def test_xml2mpd_from_string(self):
     mpd_string = '''
     <MPD xmlns="urn:mpeg:DASH:schema:MPD:2011" mediaPresentationDuration="PT0H1M52.43S" minBufferTime="PT1.5S"
     profiles="urn:mpeg:dash:profile:isoff-on-demand:2011" type="static">
       <Period duration="PT0H1M52.43S" start="PT0S">
         <AdaptationSet>
           <ContentComponent contentType="video" id="1" />
           <Representation bandwidth="4190760" codecs="avc1.640028" height="1080" id="1" mimeType="video/mp4" width="1920">
             <BaseURL>motion-20120802-89.mp4</BaseURL>
             <SegmentBase indexRange="674-981">
               <Initialization range="0-673" />
             </SegmentBase>
           </Representation>
         </AdaptationSet>
       </Period>
     </MPD>
     '''
     self.assertMPD(MPDParser.parse(mpd_string))
Пример #5
0
 def test_xml2mpd_from_string(self):
     mpd_string = '''
     <MPD xmlns="urn:mpeg:DASH:schema:MPD:2011" mediaPresentationDuration="PT0H1M52.43S" minBufferTime="PT1.5S"
     profiles="urn:mpeg:dash:profile:isoff-on-demand:2011" type="static">
       <Period duration="PT0H1M52.43S" start="PT0S">
         <AdaptationSet>
           <ContentComponent contentType="video" id="1" />
           <Representation bandwidth="4190760" codecs="avc1.640028" height="1080" id="1" mimeType="video/mp4" width="1920">
             <BaseURL>motion-20120802-89.mp4</BaseURL>
             <SegmentBase indexRange="674-981">
               <Initialization range="0-673" />
             </SegmentBase>
           </Representation>
         </AdaptationSet>
       </Period>
     </MPD>
     '''
     self.assertMPD(MPDParser.parse(mpd_string))
Пример #6
0
 def test_xml2mpd_from_url(self):
     mpd_url = 'http://yt-dash-mse-test.commondatastorage.googleapis.com/media/motion-20120802-manifest.mpd'
     self.assertMPD(MPDParser.parse(mpd_url))
Пример #7
0
 def test_xml2mpd_from_file(self):
     self.assertMPD(MPDParser.parse('./tests/mpd-samples/sample-001.mpd'))
     self.assertMPD(MPDParser.parse('./tests/mpd-samples/motion-20120802-manifest.mpd'))
     self.assertMPD(MPDParser.parse('./tests/mpd-samples/oops-20120802-manifest.mpd'))
     self.assertMPD(MPDParser.parse('./tests/mpd-samples/360p_speciment_dash.mpd'))
Пример #8
0
 def test_xml2mpd_from_url(self):
     mpd_url = 'http://yt-dash-mse-test.commondatastorage.googleapis.com/media/motion-20120802-manifest.mpd'
     self.assertMPD(MPDParser.parse(mpd_url))
Пример #9
0
 def test_xml2mpd_from_file(self):
     self.assertMPD(MPDParser.parse('./tests/mpd-samples/sample-001.mpd'))
     self.assertMPD(MPDParser.parse('./tests/mpd-samples/motion-20120802-manifest.mpd'))
     self.assertMPD(MPDParser.parse('./tests/mpd-samples/oops-20120802-manifest.mpd'))
     self.assertMPD(MPDParser.parse('./tests/mpd-samples/360p_speciment_dash.mpd'))
Пример #10
0
 def test_xml2mpd_from_file(self):
     self.assertMPD(MPDParser.parse("./tests/mpd-samples/sample-001.mpd"))
     self.assertMPD(MPDParser.parse("./tests/mpd-samples/motion-20120802-manifest.mpd"))
     self.assertMPD(MPDParser.parse("./tests/mpd-samples/oops-20120802-manifest.mpd"))