Exemplo n.º 1
0
 private void fullLace_cm_Click(object sender, RoutedEventArgs e)
 {
     lacingType                = LacingType.FULL;
     fullLace_cm.IsChecked     = true;
     shortestList_cm.IsChecked = false;
     longestList_cm.IsChecked  = false;
 }
Exemplo n.º 2
0
 private void shortestList_cm_Click(object sender, RoutedEventArgs e)
 {
     lacingType = LacingType.SHORTEST;
     //fullLace_cm.IsChecked = false;
     //shortestList_cm.IsChecked = true;
     //longestList_cm.IsChecked = false;
 }
Exemplo n.º 3
0
        public override PesPacket[] GetNextPesPackets()
        {
            if (CurrentIndex >= Clusters.Keys.Count)
            {
                return(null);
            }
            EbmlElement cluster = Clusters[Clusters.Keys[CurrentIndex]];

            EbmlElement[]    blocks   = cluster.Children;
            List <PesPacket> packList = new List <PesPacket>();
            Int64            clock    = GetClusterClock(cluster);

            if (pcrDelegate != null)
            {
                pcrDelegate(clock * (Constants.MPEG2TS_CLOCK_RATE / 1000));
            }
            foreach (EbmlElement bl in blocks)
            {
                EbmlElement block = null;
                switch (bl.Id)
                {
                case 0xa0:     // block group
                    EbmlElement[] cbls = bl.Children;
                    foreach (EbmlElement bl2 in cbls)
                    {
                        if (bl2.Id == 0xa1)
                        {
                            block = bl2;
                            break;
                        }
                    }
                    break;

                case 0xa3:
                    block = bl;
                    break;
                }
                if (null != block)
                {
                    Stream stm    = block.DataStream;
                    Int64  endPos = stm.Position + block.Size;
                    Int64  track  = EbmlElement.VintToInt64(stm);
                    Int16  time   = (short)stm.ReadByte();
                    time <<= 8;
                    time  += (short)stm.ReadByte();
                    Int64 pts = clock + time;
                    pts *= 90;
                    byte       flags  = (byte)stm.ReadByte();
                    LacingType lacing = (LacingType)((flags >> 1) & 0x03);
                    if (lacing != LacingType.NoLacing && lacing != LacingType.FixedSizeLacing)
                    {
                        throw new FormatException("Variable lacing is not yet supported");
                    }
                    if (lacing == LacingType.FixedSizeLacing)
                    {
                        stm.Position += 1;
                    }
                    byte[] data = new byte[endPos - stm.Position];
                    stm.Read(data, 0, (int)(endPos - stm.Position));
                    if (data.Length > 0 && TrackList.ContainsKey((ushort)track))
                    {
                        TrackInfo ti = TrackList[(ushort)track];
                        if (ptsDelegate != null)
                        {
                            ptsDelegate(pts, ti.pid);
                        }
                        switch (sis[(ushort)track - 1].StreamType)
                        {
                        case ElementaryStreamTypes.AUDIO_STREAM_AC3:
                            packList.Add(BuildAc3Pes(pts, data, ti.pid));
                            break;

                        case ElementaryStreamTypes.AUDIO_STREAM_DTS:
                            packList.Add(BuildDtsPes(pts, data, ti.pid));
                            break;

                        case ElementaryStreamTypes.VIDEO_STREAM_MPEG2:
                            packList.Add(BuildMpeg2Pes(pts, data, ti.pid));
                            break;

                        case ElementaryStreamTypes.VIDEO_STREAM_H264:
                            packList.Add(BuildAvcPes(pts, data, ti.pid));
                            break;

                        case ElementaryStreamTypes.VIDEO_STREAM_VC1:
                            packList.Add(BuildVc1Pes(pts, data, ti.pid));
                            break;
                        }
                    }
                }
            }
            CurrentIndex++;
            if (packList.Count == 0)
            {
                return(null);
            }
            return(packList.ToArray());
        }
Exemplo n.º 4
0
 private void longestList_cm_Click(object sender, RoutedEventArgs e)
 {
     lacingType = LacingType.LONGEST;
     fullLace_cm.IsChecked = false;
     shortestList_cm.IsChecked = false;
     longestList_cm.IsChecked = true;
 }