Repository: ossrs/srs
File: trunk/src/kernel/srs_kernel_codec.hpp (C++)

Code before:
    uint16_t nal_unit_length;
    std::vector<uint8_t> nal_unit_data;
};

struct SrsHevcHvccNalu {
    uint8_t array_completeness;
    uint8_t nal_unit_type;
    uint16_t num_nalus;
    std::vector<SrsHevcNalData> nal_data_vec;
};

/**
 * HEVC Common Max define.
 * @doc ITU-T-H.265-2021.pdf
 */
enum {
    // @see F.7.3.2.1: vps_video_parameter_set_id is u(4).
    // @doc ITU-T-H.265-2021.pdf, page 464.
    SrsHevcMax_VPS_COUNT = 16,
    // @see 7.4.3.2.1: sps_seq_parameter_set_id is in [0, 15].
    // @doc ITU-T-H.265-2021.pdf, page 95.
    SrsHevcMax_SPS_COUNT = 16,
    // @see 7.4.3.3.1: pps_pic_parameter_set_id is in [0, 63].
    // @doc ITU-T-H.265-2021.pdf, page 102.
    SrsHevcMax_PPS_COUNT = 64,
};

/**
 * Profile, tier and level
 * @see 7.3.3 Profile, tier and level syntax
 * @doc ITU-T-H.265-2021.pdf, page 62.
 */
struct SrsHevcProfileTierLevel
{
    uint8_t general_profile_space;
    uint8_t general_tier_flag;
    uint8_t general_profile_idc;
    uint8_t general_profile_compatibility_flag[32];
    uint8_t general_progressive_source_flag;
    uint8_t general_interlaced_source_flag;
    uint8_t general_non_packed_constraint_flag;
    uint8_t general_frame_only_constraint_flag;
    uint8_t general_max_12bit_constraint_flag;
    uint8_t general_max_10bit_constraint_flag;
    uint8_t general_max_8bit_constraint_flag;
    uint8_t general_max_422chroma_constraint_flag;
    uint8_t general_max_420chroma_constraint_flag;
    uint8_t general_max_monochrome_constraint_flag;
    uint8_t general_intra_constraint_flag;
    uint8_t general_one_picture_only_constraint_flag;
    uint8_t general_lower_bit_rate_constraint_flag;

Review comment (suggestion):
These are not a type of data, so it is not suitable to make them an enum. They should be made as const.

`TRANS_BY_GPT3`

Code after:
    uint16_t nal_unit_length;
    std::vector<uint8_t> nal_unit_data;
};

struct SrsHevcHvccNalu {
    uint8_t array_completeness;
    uint8_t nal_unit_type;
    uint16_t num_nalus;
    std::vector<SrsHevcNalData> nal_data_vec;
};

/**
 * HEVC Common Max define.
 * @doc ITU-T-H.265-2021.pdf
 */
// @see F.7.3.2.1: vps_video_parameter_set_id is u(4).
// @doc ITU-T-H.265-2021.pdf, page 464.
const int SrsHevcMax_VPS_COUNT = 16;
// @see 7.4.3.2.1: sps_seq_parameter_set_id is in [0, 15].
// @doc ITU-T-H.265-2021.pdf, page 95.
const int SrsHevcMax_SPS_COUNT = 16;
// @see 7.4.3.3.1: pps_pic_parameter_set_id is in [0, 63].
// @doc ITU-T-H.265-2021.pdf, page 102.
const int SrsHevcMax_PPS_COUNT = 64;

/**
 * Profile, tier and level
 * @see 7.3.3 Profile, tier and level syntax
 * @doc ITU-T-H.265-2021.pdf, page 62.
 */
struct SrsHevcProfileTierLevel
{
    uint8_t general_profile_space;
    uint8_t general_tier_flag;
    uint8_t general_profile_idc;
    uint8_t general_profile_compatibility_flag[32];
    uint8_t general_progressive_source_flag;
    uint8_t general_interlaced_source_flag;
    uint8_t general_non_packed_constraint_flag;
    uint8_t general_frame_only_constraint_flag;
    uint8_t general_max_12bit_constraint_flag;
    uint8_t general_max_10bit_constraint_flag;
    uint8_t general_max_8bit_constraint_flag;
    uint8_t general_max_422chroma_constraint_flag;
    uint8_t general_max_420chroma_constraint_flag;
    uint8_t general_max_monochrome_constraint_flag;
    uint8_t general_intra_constraint_flag;
    uint8_t general_one_picture_only_constraint_flag;
    uint8_t general_lower_bit_rate_constraint_flag;
    uint32_t general_max_14bit_constraint_flag;
    uint8_t general_reserved_zero_7bits;