7 #ifndef PACKAGER_MEDIA_CODECS_H264_PARSER_H_ 8 #define PACKAGER_MEDIA_CODECS_H264_PARSER_H_ 16 #include "packager/media/codecs/h26x_bit_reader.h" 17 #include "packager/media/codecs/nalu_reader.h" 26 bool ExtractResolutionFromSps(
const H264Sps& sps,
27 uint32_t* coded_width,
28 uint32_t* coded_height,
29 uint32_t* pixel_width,
30 uint32_t* pixel_height);
33 kH264ScalingList4x4Length = 16,
34 kH264ScalingList8x8Length = 64,
41 bool constraint_set0_flag;
42 bool constraint_set1_flag;
43 bool constraint_set2_flag;
44 bool constraint_set3_flag;
45 bool constraint_set4_flag;
46 bool constraint_set5_flag;
48 int seq_parameter_set_id;
50 int chroma_format_idc;
51 bool separate_colour_plane_flag;
52 int bit_depth_luma_minus8;
53 int bit_depth_chroma_minus8;
54 bool qpprime_y_zero_transform_bypass_flag;
56 bool seq_scaling_matrix_present_flag;
57 int scaling_list4x4[6][kH264ScalingList4x4Length];
58 int scaling_list8x8[6][kH264ScalingList8x8Length];
60 int log2_max_frame_num_minus4;
61 int pic_order_cnt_type;
62 int log2_max_pic_order_cnt_lsb_minus4;
63 bool delta_pic_order_always_zero_flag;
64 int offset_for_non_ref_pic;
65 int offset_for_top_to_bottom_field;
66 int num_ref_frames_in_pic_order_cnt_cycle;
67 int expected_delta_per_pic_order_cnt_cycle;
68 int offset_for_ref_frame[255];
69 int max_num_ref_frames;
70 bool gaps_in_frame_num_value_allowed_flag;
71 int pic_width_in_mbs_minus1;
72 int pic_height_in_map_units_minus1;
73 bool frame_mbs_only_flag;
74 bool mb_adaptive_frame_field_flag;
75 bool direct_8x8_inference_flag;
76 bool frame_cropping_flag;
77 int frame_crop_left_offset;
78 int frame_crop_right_offset;
79 int frame_crop_top_offset;
80 int frame_crop_bottom_offset;
82 bool vui_parameters_present_flag;
85 int transfer_characteristics;
87 bool bitstream_restriction_flag;
88 int max_num_reorder_frames;
89 int max_dec_frame_buffering;
91 int chroma_array_type;
97 int pic_parameter_set_id;
98 int seq_parameter_set_id;
99 bool entropy_coding_mode_flag;
100 bool bottom_field_pic_order_in_frame_present_flag;
101 int num_slice_groups_minus1;
102 int num_ref_idx_l0_default_active_minus1;
103 int num_ref_idx_l1_default_active_minus1;
104 bool weighted_pred_flag;
105 int weighted_bipred_idc;
106 int pic_init_qp_minus26;
107 int pic_init_qs_minus26;
108 int chroma_qp_index_offset;
109 bool deblocking_filter_control_present_flag;
110 bool constrained_intra_pred_flag;
111 bool redundant_pic_cnt_present_flag;
112 bool transform_8x8_mode_flag;
114 bool pic_scaling_matrix_present_flag;
115 int scaling_list4x4[6][kH264ScalingList4x4Length];
116 int scaling_list8x8[6][kH264ScalingList8x8Length];
118 int second_chroma_qp_index_offset;
122 int modification_of_pic_nums_idc;
124 int abs_diff_pic_num_minus1;
125 int long_term_pic_num;
130 bool luma_weight_flag[32];
131 bool chroma_weight_flag[32];
134 int chroma_weight[32][2];
135 int chroma_offset[32][2];
139 int memory_mgmnt_control_operation;
140 int difference_of_pic_nums_minus1;
141 int long_term_pic_num;
142 int long_term_frame_idx;
143 int max_long_term_frame_idx_plus1;
151 kRefListModSize = kRefListSize
162 bool IsPSlice()
const;
163 bool IsBSlice()
const;
164 bool IsISlice()
const;
165 bool IsSPSlice()
const;
166 bool IsSISlice()
const;
171 const uint8_t* nalu_data;
180 size_t header_bit_size;
182 int first_mb_in_slice;
184 int pic_parameter_set_id;
188 bool bottom_field_flag;
190 int pic_order_cnt_lsb;
191 int delta_pic_order_cnt_bottom;
192 int delta_pic_order_cnt[2];
193 int redundant_pic_cnt;
194 bool direct_spatial_mv_pred_flag;
196 bool num_ref_idx_active_override_flag;
197 int num_ref_idx_l0_active_minus1;
198 int num_ref_idx_l1_active_minus1;
199 bool ref_pic_list_modification_flag_l0;
200 bool ref_pic_list_modification_flag_l1;
204 int luma_log2_weight_denom;
205 int chroma_log2_weight_denom;
210 bool no_output_of_prior_pics_flag;
211 bool long_term_reference_flag;
213 bool adaptive_ref_pic_marking_mode_flag;
218 bool sp_for_switch_flag;
220 int disable_deblocking_filter_idc;
221 int slice_alpha_c0_offset_div2;
222 int slice_beta_offset_div2;
226 int recovery_frame_cnt;
227 bool exact_match_flag;
228 bool broken_link_flag;
229 int changing_slice_group_idc;
236 kSEIRecoveryPoint = 6,
272 Result ParseSps(
const Nalu& nalu,
int* sps_id);
273 Result ParsePps(
const Nalu& nalu,
int* pps_id);
277 const H264Sps* GetSps(
int sps_id);
278 const H264Pps* GetPps(
int pps_id);
308 bool* hrd_parameters_present);
313 int num_ref_idx_active_minus1,
323 int num_ref_idx_active_minus1,
324 int chroma_array_type,
325 int luma_log2_weight_denom,
326 int chroma_log2_weight_denom,
333 typedef std::map<int, std::unique_ptr<H264Sps>> SpsById;
334 typedef std::map<int, std::unique_ptr<H264Pps>> PpsById;
335 SpsById active_SPSes_;
336 PpsById active_PPSes_;
344 #endif // PACKAGER_MEDIA_CODECS_H264_PARSER_H_
All the methods that are virtual are virtual for mocking.