示例#1
0
 std::string raw_istream::read_ascii_null_terminated()
 {
     size_t l = strnlen(cursor_, remaining_bytes());
     std::string res(cursor_, l);
     skip(l + 1);
     return res;
 }
示例#2
0
文件: stsd.hpp 项目: steinwurf/petro
        void read(uint64_t size, byte_stream& bs)
        {
            sample_entry::read(size, bs);
            // reserved
            bs.skip(4 * 2);
            m_remaining_bytes -= 4 * 2;

            m_channel_count = bs.read_uint16_t();
            m_sample_size = bs.read_uint16_t();
            m_remaining_bytes -= 4;

            // pre_defined
            bs.skip(2);
            m_remaining_bytes -= 2;

            // reserved
            bs.skip(2);
            m_remaining_bytes -= 2;

            // {timescale of media}<<16;
            m_sample_rate = bs.read_fixed_point_1616();
            m_remaining_bytes -= 4;

            parser<esds> p;
            auto branched_bs = byte_stream(bs, m_remaining_bytes);
            p.read(branched_bs, shared_from_this());
            assert(branched_bs.remaining_bytes() == 0);
        }
示例#3
0
文件: stsd.hpp 项目: steinwurf/petro
        void read(uint64_t size, byte_stream& bs)
        {
            sample_entry::read(size, bs);
            // pre_defined
            bs.skip(2);
            m_remaining_bytes -= 2;

            // reserved
            bs.skip(2);
            m_remaining_bytes -= 2;

            // pre_defined
            bs.skip(4 * 3);
            m_remaining_bytes -= 4 * 3;

            m_width = bs.read_uint16_t();
            m_remaining_bytes -= 2;

            m_height = bs.read_uint16_t();
            m_remaining_bytes -= 2;

            m_horizontal_resolution = bs.read_fixed_point_1616();
            m_remaining_bytes -= 4;

            m_vertical_resolution = bs.read_fixed_point_1616();
            m_remaining_bytes -= 4;

            // reserved
            bs.skip(4);
            m_remaining_bytes -= 4;

            m_frame_count = bs.read_uint16_t();
            m_remaining_bytes -= 2;
            for (uint8_t i = 0; i < 32; ++i)
            {
                m_compressor_name += bs.read_uint8_t();
                m_remaining_bytes -= 1;
            }

            m_depth = bs.read_uint16_t();
            m_remaining_bytes -= 2;

            // pre_defined
            bs.skip(2);
            m_remaining_bytes -= 2;

            parser<avcc> p;
            auto branched_bs = byte_stream(bs, m_remaining_bytes);
            p.read(branched_bs, shared_from_this());
            assert(branched_bs.remaining_bytes() == 0);
        }
示例#4
0
 std::string raw_istream::peek_utf8_null_terminated() const
 {
     size_t l = strnlen(cursor_, remaining_bytes());
     return std::string(cursor_, l);
 }