|
@@ -49,29 +49,29 @@ struct RTC_CPP_EXPORT NalUnitFragmentHeader {
|
|
|
|
|
|
#pragma pack(pop)
|
|
#pragma pack(pop)
|
|
|
|
|
|
-typedef enum {
|
|
|
|
|
|
+enum NalUnitStartSequenceMatch {
|
|
NUSM_noMatch,
|
|
NUSM_noMatch,
|
|
NUSM_firstZero,
|
|
NUSM_firstZero,
|
|
NUSM_secondZero,
|
|
NUSM_secondZero,
|
|
NUSM_thirdZero,
|
|
NUSM_thirdZero,
|
|
NUSM_shortMatch,
|
|
NUSM_shortMatch,
|
|
NUSM_longMatch
|
|
NUSM_longMatch
|
|
-} NalUnitStartSequenceMatch;
|
|
|
|
|
|
+};
|
|
|
|
|
|
static const size_t H264_NAL_HEADER_SIZE = 1;
|
|
static const size_t H264_NAL_HEADER_SIZE = 1;
|
|
static const size_t H265_NAL_HEADER_SIZE = 2;
|
|
static const size_t H265_NAL_HEADER_SIZE = 2;
|
|
/// Nal unit
|
|
/// Nal unit
|
|
struct RTC_CPP_EXPORT NalUnit : binary {
|
|
struct RTC_CPP_EXPORT NalUnit : binary {
|
|
- typedef enum { H264, H265 } Type;
|
|
|
|
|
|
+ enum class Type { H264, H265 };
|
|
|
|
|
|
NalUnit(const NalUnit &unit) = default;
|
|
NalUnit(const NalUnit &unit) = default;
|
|
- NalUnit(size_t size, bool includingHeader = true, Type type = H264)
|
|
|
|
|
|
+ NalUnit(size_t size, bool includingHeader = true, Type type = Type::H264)
|
|
: binary(size + (includingHeader
|
|
: binary(size + (includingHeader
|
|
? 0
|
|
? 0
|
|
- : (type == H264 ? H264_NAL_HEADER_SIZE : H265_NAL_HEADER_SIZE))) {}
|
|
|
|
|
|
+ : (type == Type::H264 ? H264_NAL_HEADER_SIZE : H265_NAL_HEADER_SIZE))) {}
|
|
NalUnit(binary &&data) : binary(std::move(data)) {}
|
|
NalUnit(binary &&data) : binary(std::move(data)) {}
|
|
- NalUnit(Type type = H264)
|
|
|
|
- : binary(type == H264 ? H264_NAL_HEADER_SIZE : H265_NAL_HEADER_SIZE) {}
|
|
|
|
|
|
+ NalUnit(Type type = Type::H264)
|
|
|
|
+ : binary(type == Type::H264 ? H264_NAL_HEADER_SIZE : H265_NAL_HEADER_SIZE) {}
|
|
template <typename Iterator> NalUnit(Iterator begin_, Iterator end_) : binary(begin_, end_) {}
|
|
template <typename Iterator> NalUnit(Iterator begin_, Iterator end_) : binary(begin_, end_) {}
|
|
|
|
|
|
bool forbiddenBit() const { return header()->forbiddenBit(); }
|
|
bool forbiddenBit() const { return header()->forbiddenBit(); }
|