Esempio n. 1
0
 public override void doWrite(TagWriter tagWriter, Playlist playlist, MediaPlaylist mediaPlaylist)
 {
     if (!mediaPlaylist.isOngoing())
     {
         tagWriter.writeTag(getTag());
     }
 }
Esempio n. 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());
                    }
                }
            }
Esempio n. 3
0
 public override void doWrite(TagWriter tagWriter, Playlist playlist, MediaPlaylist mediaPlaylist)
 {
     if (mediaPlaylist.isIframesOnly())
     {
         tagWriter.writeTag(getTag());
     }
 }
Esempio n. 4
0
 public virtual void write(TagWriter tagWriter, Playlist playlist)
 {
     if (!hasData())
     {
         tagWriter.writeTag(getTag());
     }
 }
Esempio n. 5
0
        protected void writeAttributes <T>(TagWriter tagWriter, T attributes, Dictionary <String, AttributeWriter <T> > attributeWriters)
        {
            StringBuilder sb = new StringBuilder();

            foreach (KeyValuePair <String, AttributeWriter <T> > entry in attributeWriters)
            {
                AttributeWriter <T> handler = entry.Value;
                String attribute            = entry.Key;
                if (handler.containsAttribute(attributes))
                {
                    String value = null;
                    try
                    {
                        value = handler.write(attributes);
                    }
                    catch (ParseException ex)
                    {
                        throw ParseException.create(ex.type, getTag(), ex.getMessageSuffix());
                    }
                    sb.Append(attribute).Append(Constants.ATTRIBUTE_SEPARATOR).Append(value);
                    sb.Append(Constants.ATTRIBUTE_LIST_SEPARATOR);
                }
            }
            sb.Remove(sb.Length - 1, 1);

            tagWriter.writeTag(getTag(), sb.ToString());
        }
Esempio n. 6
0
 public override void write(TagWriter tagWriter, Playlist playlist)
 {
     if (playlist.hasMediaPlaylist())
     {
         doWrite(tagWriter, playlist, playlist.getMediaPlaylist());
     }
 }
Esempio n. 7
0
 public override void doWrite(TagWriter tagWriter, Playlist playlist, MasterPlaylist masterPlaylist)
 {
     foreach (IFrameStreamInfo streamInfo in masterPlaylist.getIFramePlaylists())
     {
         writeAttributes(tagWriter, streamInfo, HANDLERS);
     }
 }
Esempio n. 8
0
 public override void doWrite(TagWriter tagWriter, Playlist playlist, MediaPlaylist mediaPlaylist)
 {
     if (mediaPlaylist.getPlaylistType() != null)
     {
         tagWriter.writeTag(getTag(), mediaPlaylist.getPlaylistType().getValue());
     }
 }
Esempio n. 9
0
 public override void doWrite(TagWriter tagWriter, Playlist playlist, MediaPlaylist mediaPlaylist)
 {
     if (mediaPlaylist.hasStartData())
     {
         StartData startData = mediaPlaylist.getStartData();
         writeAttributes(tagWriter, startData, HANDLERS);
     }
 }
Esempio n. 10
0
 public Writer(Stream outputStream, Encoding encoding)
 {
     try
     {
         tagWriter = new TagWriter(new StreamWriter(outputStream, encoding.getValue()));
     }
     catch (Exception e) // TODO: Was UnsupportedEncodingException. c# equivalent?
     {
         throw new ArgumentException(e.Message, e);
     }
 }
Esempio n. 11
0
 public override void doWrite(TagWriter tagWriter, Playlist playlist, MasterPlaylist masterPlaylist)
 {
     foreach (PlaylistData playlistData in masterPlaylist.getPlaylists())
     {
         if (playlistData.hasStreamInfo())
         {
             writeAttributes(tagWriter, playlistData.getStreamInfo(), HANDLERS);
             tagWriter.writeLine(playlistData.getUri());
         }
     }
 }
Esempio n. 12
0
 public override void doWrite(TagWriter tagWriter, Playlist playlist, MasterPlaylist masterPlaylist)
 {
     if (masterPlaylist.getMediaData().Count > 0)
     {
         List <MediaData> mds = masterPlaylist.getMediaData();
         foreach (MediaData md in mds)
         {
             writeAttributes(tagWriter, md, HANDLERS);
         }
     }
 }
Esempio n. 13
0
 public void writeTrackData(TagWriter tagWriter, Playlist playlist, TrackData trackData)
 {
     if (trackData != null && trackData.getMapInfo() != null)
     {
         MapInfo mapInfo = trackData.getMapInfo();
         if (!mapInfo.Equals(mMapInfo))
         {
             mMapInfo = mapInfo;
             write(tagWriter, playlist);
         }
     }
 }
Esempio n. 14
0
            public void writeTrackData(TagWriter tagWriter, Playlist playlist, TrackData trackData)
            {
                if (trackData != null && trackData.hasEncryptionData())
                {
                    EncryptionData encryptionData = trackData.getEncryptionData();

                    if (!encryptionData.Equals(mEncryptionData))
                    {
                        mEncryptionData = encryptionData;
                        write(tagWriter, playlist);
                    }
                }
            }
Esempio n. 15
0
        private static void writeByteRange(TagWriter tagWriter, ByteRange byteRange)
        {
            String value;

            if (byteRange.getOffset() != null)
            {
                value = byteRange.getSubRangeLength().ToString()
                        + '@' + byteRange.getOffset().ToString();
            }
            else
            {
                value = byteRange.getSubRangeLength().ToString();
            }

            tagWriter.writeTag(Constants.EXT_X_BYTERANGE_TAG, value);
        }
Esempio n. 16
0
            public override void write(TagWriter tagWriter, Playlist playlist)
            {
                List <String> unknownTags;

                if (playlist.hasMasterPlaylist() && playlist.getMasterPlaylist().hasUnknownTags())
                {
                    unknownTags = playlist.getMasterPlaylist().getUnknownTags();
                }
                else if (playlist.getMediaPlaylist().hasUnknownTags())
                {
                    unknownTags = playlist.getMediaPlaylist().getUnknownTags();
                }
                else
                {
                    unknownTags = new List <String>();
                }
                foreach (String line in unknownTags)
                {
                    tagWriter.writeLine(line);
                }
            }
Esempio n. 17
0
        private static void writeExtinf(TagWriter tagWriter, Playlist playlist, TrackData trackData)
        {
            StringBuilder builder = new StringBuilder();

            if (playlist.getCompatibilityVersion() < 3)
            {
                builder.Append(((int)trackData.getTrackInfo().duration).ToString());
            }
            else
            {
                builder.Append(trackData.getTrackInfo().duration.ToString());
            }

            if (!string.IsNullOrEmpty(trackData.getTrackInfo().title))
            {
                builder.Append(Constants.COMMA);
                builder.Append(trackData.getTrackInfo().title);
            }

            tagWriter.writeTag(Constants.EXTINF_TAG, builder.ToString());
        }
Esempio n. 18
0
 public override void doWrite(TagWriter tagWriter, Playlist playlist, MediaPlaylist mediaPlaylist)
 {
     // deprecated
 }
Esempio n. 19
0
 public override void write(TagWriter tagWriter, Playlist playlist)
 {
     tagWriter.writeTag(getTag(), playlist.getCompatibilityVersion().ToString());
 }
Esempio n. 20
0
 public override void doWrite(TagWriter tagWriter, Playlist playlist, MediaPlaylist mediaPlaylist)
 {
     writeAttributes(tagWriter, mMapInfo, HANDLERS);
 }
Esempio n. 21
0
 public override void doWrite(TagWriter tagWriter, Playlist playlist, MediaPlaylist mediaPlaylist)
 {
     writeAttributes(tagWriter, mEncryptionData, HANDLERS);
 }
Esempio n. 22
0
 public virtual void doWrite(TagWriter tagWriter, Playlist playlist, MediaPlaylist mediaPlaylist)
 {
     tagWriter.writeTag(getTag());
 }
Esempio n. 23
0
 public override void doWrite(TagWriter tagWriter, Playlist playlist, MediaPlaylist mediaPlaylist)
 {
     tagWriter.writeTag(getTag(), mediaPlaylist.getTargetDuration().ToString());
 }
Esempio n. 24
0
 public override void doWrite(TagWriter tagWriter, Playlist playlist, MediaPlaylist mediaPlaylist)
 {
     tagWriter.writeTag(getTag(), mediaPlaylist.getMediaSequenceNumber().ToString());
 }