OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // This file contains an implementation of an H264 Annex-B video stream parser. | 5 // This file contains an implementation of an H264 Annex-B video stream parser. |
6 | 6 |
7 #ifndef MEDIA_FILTERS_H264_PARSER_H_ | 7 #ifndef MEDIA_FILTERS_H264_PARSER_H_ |
8 #define MEDIA_FILTERS_H264_PARSER_H_ | 8 #define MEDIA_FILTERS_H264_PARSER_H_ |
9 | 9 |
10 #include <sys/types.h> | 10 #include <sys/types.h> |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 }; | 56 }; |
57 | 57 |
58 enum { | 58 enum { |
59 kH264ScalingList4x4Length = 16, | 59 kH264ScalingList4x4Length = 16, |
60 kH264ScalingList8x8Length = 64, | 60 kH264ScalingList8x8Length = 64, |
61 }; | 61 }; |
62 | 62 |
63 struct MEDIA_EXPORT H264SPS { | 63 struct MEDIA_EXPORT H264SPS { |
64 H264SPS(); | 64 H264SPS(); |
65 | 65 |
66 enum H264ProfileIDC { | |
67 kProfileIDCBaseline = 66, | |
68 kProfileIDCConstrainedBaseline = kProfileIDCBaseline, | |
69 kProfileIDCMain = 77, | |
70 kProfileIDCHigh = 100, | |
71 }; | |
72 | |
73 enum AspectRatioIdc { | |
74 kExtendedSar = 255, | |
75 }; | |
76 | |
77 enum { | |
78 // Constants for HRD parameters (spec ch. E.2.2). | |
79 kBitRateScaleConstantTerm = 6, // Equation E-37. | |
80 kCPBSizeScaleConstantTerm = 4, // Equation E-38. | |
81 kDefaultInitialCPBRemovalDelayLength = 24, | |
82 kDefaultDPBOutputDelayLength = 24, | |
83 kDefaultTimeOffsetLength = 24, | |
84 }; | |
85 | |
86 int profile_idc; | 66 int profile_idc; |
87 bool constraint_set0_flag; | 67 bool constraint_set0_flag; |
88 bool constraint_set1_flag; | 68 bool constraint_set1_flag; |
89 bool constraint_set2_flag; | 69 bool constraint_set2_flag; |
90 bool constraint_set3_flag; | 70 bool constraint_set3_flag; |
91 bool constraint_set4_flag; | 71 bool constraint_set4_flag; |
92 bool constraint_set5_flag; | 72 bool constraint_set5_flag; |
93 int level_idc; | 73 int level_idc; |
94 int seq_parameter_set_id; | 74 int seq_parameter_set_id; |
95 | 75 |
(...skipping 28 matching lines...) Expand all Loading... |
124 int frame_crop_right_offset; | 104 int frame_crop_right_offset; |
125 int frame_crop_top_offset; | 105 int frame_crop_top_offset; |
126 int frame_crop_bottom_offset; | 106 int frame_crop_bottom_offset; |
127 | 107 |
128 bool vui_parameters_present_flag; | 108 bool vui_parameters_present_flag; |
129 int sar_width; // Set to 0 when not specified. | 109 int sar_width; // Set to 0 when not specified. |
130 int sar_height; // Set to 0 when not specified. | 110 int sar_height; // Set to 0 when not specified. |
131 bool bitstream_restriction_flag; | 111 bool bitstream_restriction_flag; |
132 int max_num_reorder_frames; | 112 int max_num_reorder_frames; |
133 int max_dec_frame_buffering; | 113 int max_dec_frame_buffering; |
134 bool timing_info_present_flag; | |
135 int num_units_in_tick; | |
136 int time_scale; | |
137 bool fixed_frame_rate_flag; | |
138 | |
139 // TODO(posciak): actually parse these instead of ParseAndIgnoreHRDParameters. | |
140 bool nal_hrd_parameters_present_flag; | |
141 int cpb_cnt_minus1; | |
142 int bit_rate_scale; | |
143 int cpb_size_scale; | |
144 int bit_rate_value_minus1[32]; | |
145 int cpb_size_value_minus1[32]; | |
146 bool cbr_flag[32]; | |
147 int initial_cpb_removal_delay_length_minus_1; | |
148 int cpb_removal_delay_length_minus1; | |
149 int dpb_output_delay_length_minus1; | |
150 int time_offset_length; | |
151 | |
152 bool low_delay_hrd_flag; | |
153 | 114 |
154 int chroma_array_type; | 115 int chroma_array_type; |
155 }; | 116 }; |
156 | 117 |
157 struct MEDIA_EXPORT H264PPS { | 118 struct MEDIA_EXPORT H264PPS { |
158 H264PPS(); | 119 H264PPS(); |
159 | 120 |
160 int pic_parameter_set_id; | 121 int pic_parameter_set_id; |
161 int seq_parameter_set_id; | 122 int seq_parameter_set_id; |
162 bool entropy_coding_mode_flag; | 123 bool entropy_coding_mode_flag; |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 typedef std::map<int, H264PPS*> PPSById; | 401 typedef std::map<int, H264PPS*> PPSById; |
441 SPSById active_SPSes_; | 402 SPSById active_SPSes_; |
442 PPSById active_PPSes_; | 403 PPSById active_PPSes_; |
443 | 404 |
444 DISALLOW_COPY_AND_ASSIGN(H264Parser); | 405 DISALLOW_COPY_AND_ASSIGN(H264Parser); |
445 }; | 406 }; |
446 | 407 |
447 } // namespace media | 408 } // namespace media |
448 | 409 |
449 #endif // MEDIA_FILTERS_H264_PARSER_H_ | 410 #endif // MEDIA_FILTERS_H264_PARSER_H_ |
OLD | NEW |