コード例 #1
0
 public override void write(TagWriter tagWriter, Playlist playlist)
 {
     if (playlist.hasMediaPlaylist())
     {
         doWrite(tagWriter, playlist, playlist.getMediaPlaylist());
     }
 }
コード例 #2
0
            public void write(TagWriter tagWriter, Playlist playlist)
            {
                if (playlist.hasMediaPlaylist())
                {
                    KeyWriter     keyWriter     = new KeyWriter();
                    MapInfoWriter mapInfoWriter = new MapInfoWriter();

                    foreach (TrackData trackData in playlist.getMediaPlaylist().getTracks())
                    {
                        if (trackData.hasDiscontinuity())
                        {
                            tagWriter.writeTag(Constants.EXT_X_DISCONTINUITY_TAG);
                        }

                        keyWriter.writeTrackData(tagWriter, playlist, trackData);
                        mapInfoWriter.writeTrackData(tagWriter, playlist, trackData);

                        if (trackData.hasByteRange())
                        {
                            writeByteRange(tagWriter, trackData.getByteRange());
                        }

                        writeExtinf(tagWriter, playlist, trackData);
                        tagWriter.writeLine(trackData.getUri());
                    }
                }
            }
コード例 #3
0
        public void test()
        {
            Playlist      playlist      = TestUtil.parsePlaylistFromResource("mediaPlaylist.m3u8");
            MediaPlaylist mediaPlaylist = playlist.getMediaPlaylist();

            Assert.False(playlist.hasMasterPlaylist());
            Assert.True(playlist.hasMediaPlaylist());
            Assert.True(mediaPlaylist.hasStartData());
            Assert.Equal(-4.5, mediaPlaylist.getStartData().getTimeOffset(), 12);
            Assert.True(mediaPlaylist.getStartData().isPrecise());
            Assert.Equal(10, mediaPlaylist.getTargetDuration());
        }
コード例 #4
0
ファイル: PlaylistValidation.cs プロジェクト: bzier/open-m3u8
        public static PlaylistValidation from(Playlist playlist, ParsingMode parsingMode)
        {
            HashSet <PlaylistError> errors = new HashSet <PlaylistError>();

            if (playlist == null)
            {
                errors.Add(PlaylistError.NO_PLAYLIST);
                return(new PlaylistValidation(errors));
            }

            if (playlist.getCompatibilityVersion() < Playlist.MIN_COMPATIBILITY_VERSION)
            {
                errors.Add(PlaylistError.COMPATIBILITY_TOO_LOW);
            }

            if (hasNoPlaylistTypes(playlist))
            {
                errors.Add(PlaylistError.NO_MASTER_OR_MEDIA);
            }
            else if (hasBothPlaylistTypes(playlist))
            {
                errors.Add(PlaylistError.BOTH_MASTER_AND_MEDIA);
            }

            if (playlist.hasMasterPlaylist())
            {
                if (!playlist.isExtended())
                {
                    errors.Add(PlaylistError.MASTER_NOT_EXTENDED);
                }

                addMasterPlaylistErrors(playlist.getMasterPlaylist(), errors);
            }

            if (playlist.hasMediaPlaylist())
            {
                addMediaPlaylistErrors(playlist.getMediaPlaylist(), errors, playlist.isExtended(), parsingMode);
            }

            return(new PlaylistValidation(errors));
        }
コード例 #5
0
ファイル: PlaylistValidation.cs プロジェクト: bzier/open-m3u8
 private static bool hasBothPlaylistTypes(Playlist playlist)
 {
     return(playlist.hasMasterPlaylist() && playlist.hasMediaPlaylist());
 }
コード例 #6
0
ファイル: PlaylistValidation.cs プロジェクト: bzier/open-m3u8
 private static bool hasNoPlaylistTypes(Playlist playlist)
 {
     return(!(playlist.hasMasterPlaylist() || playlist.hasMediaPlaylist()));
 }