Exemplo n.º 1
0
 private string CreateUniqueId()
 {
     return(base.UniqueId + DescriptorUtil.CreateUniqueId(AsyncMethodInfo, CompletedMethodInfo));
 }
Exemplo n.º 2
0
 private string CreateUniqueId()
 {
     return(base.UniqueId + DescriptorUtil.CreateUniqueId(TaskMethodInfo));
 }
Exemplo n.º 3
0
        private void ParseEsds(Box sibling)
        {
            var box = sibling as EsdBox;

            _reader.BaseStream.Seek(4, SeekOrigin.Current); // FullBox
            box.ES.Tag = (DescriptorTag)_reader.ReadByte();
            _reader.ReadBytes(3);                           // 0x80 * 3
            _reader.ReadBytes(1);                           // TOOD: TagSize・・・?ツールにはそう表示されていた・・・
            box.ES.ESID = _reader.ReadUInt16();

            byte data1 = _reader.ReadByte();

            box.ES.StreamDependenceFlag = (byte)((data1 & 0x80) >> 7);
            box.ES.UrlFlag        = (byte)((data1 & 0x40) >> 6);
            box.ES.OcrStreamFlag  = (byte)((data1 & 0x20) >> 5);
            box.ES.StreamPriority = (byte)((data1 & 0x1f) >> 0);

            // TODO: 動作未確認
            if (box.ES.StreamDependenceFlag == 1)
            {
                box.ES.DependsOnESID = _reader.ReadUInt16();
            }

            // TODO: 動作未確認
            if (box.ES.UrlFlag == 1)
            {
                box.ES.UrlLength = _reader.ReadByte();
                box.ES.UrlString = StringUtil.FromBinary(_reader.ReadBytes(box.ES.UrlLength), Encoding.UTF8);
            }

            // TODO: 動作未確認
            if (box.ES.OcrStreamFlag == 1)
            {
                box.ES.OcrESID = _reader.ReadUInt16();
            }

            box.ES.DecConfigDescr.Tag = (DescriptorTag)_reader.ReadByte();
            _reader.ReadBytes(3); // 0x80 * 3
            _reader.ReadBytes(1); // TOOD: TagSize・・・?ツールにはそう表示されていた・・・
            box.ES.DecConfigDescr.ObjectTypeIndication = (ObjectType)_reader.ReadByte();

            byte data2 = _reader.ReadByte();

            box.ES.DecConfigDescr.StreamType = (byte)((data2 & 0xfc) >> 2);
            box.ES.DecConfigDescr.UpStream   = (byte)((data2 & 0x02) >> 1);
            box.ES.DecConfigDescr.Reserved   = (byte)((data2 & 0x01) >> 0);

            box.ES.DecConfigDescr.BufferSizeDB = _reader.ReadUInt24();
            box.ES.DecConfigDescr.MaxBitrate   = _reader.ReadUInt32();
            box.ES.DecConfigDescr.AvgBitrate   = _reader.ReadUInt32();

            var descriptor = DescriptorUtil.CreateInstance(box.ES.DecConfigDescr.ObjectTypeIndication);

            box.ES.DecConfigDescr.DecoderSpecificInfos[0] = descriptor;

            descriptor.Tag = (DescriptorTag)_reader.ReadByte();
            _reader.ReadBytes(3); // 0x80 * 3
            _reader.ReadBytes(1); // TOOD: TagSize・・・?ツールにはそう表示されていた・・・

            // TODO: ...
            if (descriptor is AudioSpecificConfig)
            {
                var audio = descriptor as AudioSpecificConfig;

                byte[] bits = _reader.ReadBytes(10);                                                      // TODO: 5bits + 4bits とかで読み難い・・・
                audio.AudioObjectType        = (AudioObjectType)((bits[0] & 0xf8) >> 3);
                audio.SamplingFrequencyIndex = (byte)(((bits[0] & 0x07) << 1) | ((bits[1] & 0x80) >> 7)); // TODO: バグ
            }

            // TODO: 動作確認の為、BOX末尾へシーク
            _reader.BaseStream.Seek(sibling.Offset + sibling.Size, SeekOrigin.Begin);
        }