BDInfo.TSStreamBuffer.ReadByte C# (CSharp) Метод

ReadByte() публичный Метод

public ReadByte ( ) : byte
Результат byte
        public byte ReadByte()
        {
            return (byte)Stream.ReadByte();
        }

Usage Example

Пример #1
0
        public static void Scan(
            TSAudioStream stream,
            TSStreamBuffer buffer,
            long bitrate,
            ref string tag)
        {
            if (stream.IsInitialized) return;

            bool syncFound = false;
            uint sync = 0;
            for (int i = 0; i < buffer.Length; i++)
            {
                sync = (sync << 8) + buffer.ReadByte();
                if (sync == 0x7FFE8001)
                {
                    syncFound = true;
                    break;
                }
            }
            if (!syncFound) return;

            int frame_type = buffer.ReadBits(1);
            int samples_deficit = buffer.ReadBits(5);
            int crc_present = buffer.ReadBits(1);
            int sample_blocks = buffer.ReadBits(7);
            int frame_size = buffer.ReadBits(14);
            if (frame_size < 95)
            {
                return;
            }
            int amode = buffer.ReadBits(6);
            int sample_rate = buffer.ReadBits(4);
            if (sample_rate < 0 || sample_rate >= dca_sample_rates.Length)
            {
                return;
            }
            int bit_rate = buffer.ReadBits(5);
            if (bit_rate < 0 || bit_rate >= dca_bit_rates.Length)
            {
                return;
            }
            int downmix = buffer.ReadBits(1);
            int dynrange = buffer.ReadBits(1);
            int timestamp = buffer.ReadBits(1);
            int aux_data = buffer.ReadBits(1);
            int hdcd = buffer.ReadBits(1);
            int ext_descr = buffer.ReadBits(3);
            int ext_coding = buffer.ReadBits(1);
            int aspf = buffer.ReadBits(1);
            int lfe = buffer.ReadBits(2);
            int predictor_history = buffer.ReadBits(1);
            if (crc_present == 1)
            {
                int crc = buffer.ReadBits(16);
            }
            int multirate_inter = buffer.ReadBits(1);
            int version = buffer.ReadBits(4);
            int copy_history = buffer.ReadBits(2);
            int source_pcm_res = buffer.ReadBits(3);
            int front_sum = buffer.ReadBits(1);
            int surround_sum = buffer.ReadBits(1);
            int dialog_norm = buffer.ReadBits(4);
            if (source_pcm_res < 0 || source_pcm_res >= dca_bits_per_sample.Length)
            {
                return;
            }
            int subframes = buffer.ReadBits(4);
            int total_channels = buffer.ReadBits(3) + 1 + ext_coding;

            stream.SampleRate = dca_sample_rates[sample_rate];
            stream.ChannelCount = total_channels;
            stream.LFE = (lfe > 0 ? 1 : 0);
            stream.BitDepth = dca_bits_per_sample[source_pcm_res];
            stream.DialNorm = -dialog_norm;
            if ((source_pcm_res & 0x1) == 0x1)
            {
                stream.AudioMode = TSAudioMode.Extended;
            }

            stream.BitRate = (uint)dca_bit_rates[bit_rate];
            switch (stream.BitRate)
            {
                case 1:
                    if (bitrate > 0)
                    {
                        stream.BitRate = bitrate;
                        stream.IsVBR = false;
                        stream.IsInitialized = true;
                    }
                    else
                    {
                        stream.BitRate = 0;
                    }
                    break;

                case 2:
                case 3:
                    stream.IsVBR = true;
                    stream.IsInitialized = true;
                    break;

                default:
                    stream.IsVBR = false;
                    stream.IsInitialized = true;
                    break;
            }
        }
All Usage Examples Of BDInfo.TSStreamBuffer::ReadByte