예제 #1
0
 public SegmentFragmentPair GetFirstSegment()
 {
     if (segmentRunTables.Count > 0)
     {
         AdobeSegmentRunTable segTable = segmentRunTables[0];
         if (segTable.segmentFragmentPairs.Count > 0)
         {
             return(segTable.segmentFragmentPairs[0]);
         }
     }
     return(null);
 }
예제 #2
0
 public SegmentFragmentPair GetLastSegment()
 {
     if (segmentRunTables.Count > 0)
     {
         AdobeSegmentRunTable segTable = segmentRunTables[segmentRunTables.Count - 1];
         if (segTable.segmentFragmentPairs.Count > 0)
         {
             return(segTable.segmentFragmentPairs[segTable.segmentFragmentPairs.Count - 1]);
         }
         else if (segmentRunTables.Count > 1)
         {
             segTable = segmentRunTables[segmentRunTables.Count - 2];
             if (segTable.segmentFragmentPairs.Count > 0)
             {
                 return(segTable.segmentFragmentPairs[segTable.segmentFragmentPairs.Count - 1]);
             }
         }
     }
     return(null);
 }
예제 #3
0
        public override void Parse(BoxInfo bi, HDSBinaryReader br)
        {
            base.Parse(bi, br);

            bootstrapVersion = br.ReadUInt32();

            byte temp = br.ReadByte();

            profile = (uint)(temp >> 6);
            live    = ((temp & 0x20) > 0);
            update  = ((temp & 0x01) > 0);

            timeScale           = br.ReadUInt32();
            currentMediaTime    = br.ReadUInt64();
            smpteTimeCodeOffset = br.ReadUInt64();
            movieIdentifier     = br.ReadString();

            serverBaseURLs.Clear();
            int serverEntryCount = br.ReadByte();

            for (int i = 0; i < serverEntryCount; i++)
            {
                serverBaseURLs.Add(br.ReadString());
            }

            qualitySegmentURLModifiers.Clear();
            int qualityEntryCount = br.ReadByte();

            for (int i = 0; i < qualityEntryCount; i++)
            {
                qualitySegmentURLModifiers.Add(br.ReadString());
            }

            drmData  = br.ReadString();
            metadata = br.ReadString();

            segmentRunTables.Clear();
            uint segmentRunTableCount = br.ReadByte();

            for (uint i = 0; i < segmentRunTableCount; i++)
            {
                BoxInfo boxInfo = BoxInfo.getNextBoxInfo(br);
                if (boxInfo == null)
                {
                    break;
                }
                if (boxInfo.Type == F4FConstants.BOX_TYPE_ASRT)
                {
                    AdobeSegmentRunTable asrt = new AdobeSegmentRunTable();
                    asrt.Parse(boxInfo, br);
                    segmentRunTables.Add(asrt);
                }
            }

            fragmentRunTables.Clear();
            uint fragmentRunTableCount = br.ReadByte();

            for (uint i = 0; i < fragmentRunTableCount; i++)
            {
                BoxInfo boxInfo = BoxInfo.getNextBoxInfo(br);
                if (boxInfo == null)
                {
                    break;
                }
                if (boxInfo.Type == F4FConstants.BOX_TYPE_AFRT)
                {
                    AdobeFragmentRunTable afrt = new AdobeFragmentRunTable();
                    afrt.Parse(boxInfo, br);
                    fragmentRunTables.Add(afrt);
                }
            }

            // Check if live stream is still live
            if (live && (fragmentRunTables.Count > 0) && ContentComplete())
            {
                live = false;
                RemoveLastFragment();
            }
        }