public override string ToTextualConvention(Container.Node node)
 {
     if (node.Master.Equals(this))
     {
         return(TransportStreamReader.ToTextualConvention(this, node.Identifier));
     }
     return(base.ToTextualConvention(node));
 }
 public static string ToTextualConvention(TransportStreamReader reader, byte[] identifier)
 {
     TransportStreamUnit.PacketIdentifier result = TransportStreamUnit.GetPacketIdentifier(identifier, reader.UnitOverhead);
     if (TransportStreamUnit.IsReserved(result))
     {
         return("Reserved");
     }
     if (TransportStreamUnit.IsDVBMetaData(result))
     {
         return("DVBMetaData");
     }
     if (TransportStreamUnit.IsUserDefined(result))
     {
         return("UserDefined");
     }
     return(result.ToString());
 }
Exemple #3
0
        private void WritePacketAndIncrementClock(byte[] packet, bool incrementContinuityCountr)
        {
            if (HeaderLength != 4)
            {
                // Note: both ArrivalTimeStamp and the PCR represent the system clock, and thus must be equal to or
                // greater than the value in the previous packet.
                // 27 MHz = 300 * 90 KHz
                throw new NotImplementedException();
            }

            ushort pid = (ushort)TransportStreamReader.GetPacketIdentifier(null, packet);

            if (false == m_continuityCounter.ContainsKey(pid))
            {
                m_continuityCounter[pid] = 0;
            }

            int continuityCounter = m_continuityCounter[pid];

            //ScramblingControl 2 bit
            //AdaptationFieldControl 2 bit

            //packet.Header.ContinuityCounter (last 4 bits)
            packet[3] = (byte)(((continuityCounter % 16) & Common.Binary.FourBitMaxValue) >> 4);

            //m_stream.WritePacket(packet);
            //WriteBytes(packet.GetBytes());

            double packetTimeSpan = (double)packet.Length / MaximumMultiplexRate;

            m_systemTimeClock += packetTimeSpan;

            if (incrementContinuityCountr)
            {
                m_continuityCounter[pid]++;
            }
        }
 public static bool HasPayloadUnitStartIndicator(TransportStreamReader reader, Container.Node tsUnit)
 {
     return(TransportStreamUnit.HasPayloadUnitStartIndicator(tsUnit.Identifier, reader.UnitOverhead));
 }
 public static byte[] GetAdaptationFieldData(TransportStreamReader reader, Container.Node tsUnit)
 {
     return(TransportStreamUnit.AdaptationField.GetAdaptationFieldData(tsUnit.Identifier, reader.UnitOverhead, tsUnit.Data, 0));
 }
 public static int GetContinuityCounter(TransportStreamReader reader, Container.Node tsUnit)
 {
     return(TransportStreamUnit.GetContinuityCounter(tsUnit.Identifier, reader.UnitOverhead));
 }
 public static TransportStreamUnit.AdaptationField.AdaptationFieldFlags GetAdaptationFieldFlags(TransportStreamReader reader, Media.Container.Node tsUnit)
 {
     return((TransportStreamUnit.AdaptationField.AdaptationFieldFlags)TransportStreamUnit.AdaptationField.GetAdaptationFieldData(tsUnit.Identifier, reader.UnitOverhead, tsUnit.Data, 0).FirstOrDefault());
 }
 public static TransportStreamUnit.ScramblingControl GetScramblingControl(TransportStreamReader reader, Container.Node tsUnit)
 {
     return(TransportStreamUnit.GetScramblingControl(tsUnit.Identifier, reader.UnitOverhead));
 }
 public static bool HasPayload(TransportStreamReader reader, Container.Node tsUnit)
 {
     return(GetAdaptationFieldControl(reader, tsUnit).HasFlag(TransportStreamUnit.AdaptationFieldControl.AdaptationFieldAndPayload));
 }
 public static bool HasAdaptationField(TransportStreamReader reader, Container.Node tsUnit)
 {
     return(TransportStreamUnit.GetAdaptationFieldControl(tsUnit.Identifier, reader.UnitOverhead) > TransportStreamUnit.AdaptationFieldControl.None);
 }
 public static TransportStreamUnit.PacketIdentifier GetPacketIdentifier(TransportStreamReader reader, byte[] identifier)
 {
     return(TransportStreamUnit.GetPacketIdentifier(identifier, reader.UnitOverhead));
 }
 public static bool HasTransportPriority(TransportStreamReader reader, Container.Node tsUnit)
 {
     return(TransportStreamUnit.HasTransportPriority(tsUnit.Identifier, reader.UnitOverhead));
 }