/* * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree.
*/
namespace H264 { // The size of a full NALU start sequence {0 0 0 1}, used for the first NALU // of an access unit, and for SPS and PPS blocks. const size_t kNaluLongStartSequenceSize = 4;
// The size of a shortened NALU start sequence {0 0 1}, that may be used if // not the first NALU of an access unit or an SPS or PPS block. const size_t kNaluShortStartSequenceSize = 3;
// The size of the NALU type byte (1). const size_t kNaluTypeSize = 1;
// Maximum reference index for reference pictures.
constexpr int kMaxReferenceIndex = 31;
struct NaluIndex { // Start index of NALU, including start sequence.
size_t start_offset; // Start index of NALU payload, typically type header.
size_t payload_start_offset; // Length of NALU payload, in bytes, counting from payload_start_offset.
size_t payload_size;
};
// Returns a vector of the NALU indices in the given buffer.
RTC_EXPORT std::vector<NaluIndex> FindNaluIndices(
rtc::ArrayView<const uint8_t> buffer);
// Get the NAL type from the header byte immediately following start sequence.
RTC_EXPORT NaluType ParseNaluType(uint8_t data);
// Methods for parsing and writing RBSP. See section 7.4.1 of the H264 spec. // // The following sequences are illegal, and need to be escaped when encoding: // 00 00 00 -> 00 00 03 00 // 00 00 01 -> 00 00 03 01 // 00 00 02 -> 00 00 03 02 // And things in the source that look like the emulation byte pattern (00 00 03) // need to have an extra emulation byte added, so it's removed when decoding: // 00 00 03 -> 00 00 03 03 // // Decoding is simply a matter of finding any 00 00 03 sequence and removing // the 03 emulation byte.
// Parse the given data and remove any emulation byte escaping.
std::vector<uint8_t> ParseRbsp(rtc::ArrayView<const uint8_t> data);
// Write the given data to the destination buffer, inserting and emulation // bytes in order to escape any data the could be interpreted as a start // sequence. void WriteRbsp(rtc::ArrayView<const uint8_t> bytes, rtc::Buffer* destination);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.