| 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 <stddef.h> | 10 #include <stddef.h> |
| 11 #include <stdint.h> | 11 #include <stdint.h> |
| 12 #include <sys/types.h> | 12 #include <sys/types.h> |
| 13 | 13 |
| 14 #include <map> | 14 #include <map> |
| 15 #include <vector> | 15 #include <vector> |
| 16 | 16 |
| 17 #include "base/macros.h" | 17 #include "base/macros.h" |
| 18 #include "base/optional.h" | 18 #include "base/optional.h" |
| 19 #include "media/base/media_export.h" | 19 #include "media/base/media_export.h" |
| 20 #include "media/base/ranges.h" | 20 #include "media/base/ranges.h" |
| 21 #include "media/base/video_codecs.h" | 21 #include "media/base/video_codecs.h" |
| 22 #include "media/filters/h264_bit_reader.h" | 22 #include "media/filters/h264_bit_reader.h" |
| 23 #include "ui/gfx/color_space.h" |
| 23 | 24 |
| 24 namespace gfx { | 25 namespace gfx { |
| 25 class Rect; | 26 class Rect; |
| 26 class Size; | 27 class Size; |
| 27 } | 28 } |
| 28 | 29 |
| 29 namespace media { | 30 namespace media { |
| 30 | 31 |
| 31 struct SubsampleEntry; | 32 struct SubsampleEntry; |
| 32 | 33 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 int sar_width; // Set to 0 when not specified. | 150 int sar_width; // Set to 0 when not specified. |
| 150 int sar_height; // Set to 0 when not specified. | 151 int sar_height; // Set to 0 when not specified. |
| 151 bool bitstream_restriction_flag; | 152 bool bitstream_restriction_flag; |
| 152 int max_num_reorder_frames; | 153 int max_num_reorder_frames; |
| 153 int max_dec_frame_buffering; | 154 int max_dec_frame_buffering; |
| 154 bool timing_info_present_flag; | 155 bool timing_info_present_flag; |
| 155 int num_units_in_tick; | 156 int num_units_in_tick; |
| 156 int time_scale; | 157 int time_scale; |
| 157 bool fixed_frame_rate_flag; | 158 bool fixed_frame_rate_flag; |
| 158 | 159 |
| 160 bool video_signal_type_present_flag; |
| 161 int video_format; |
| 162 bool video_full_range_flag; |
| 163 bool colour_description_present_flag; |
| 164 int colour_primaries; |
| 165 int transfer_characteristics; |
| 166 int matrix_coefficients; |
| 167 |
| 159 // TODO(posciak): actually parse these instead of ParseAndIgnoreHRDParameters. | 168 // TODO(posciak): actually parse these instead of ParseAndIgnoreHRDParameters. |
| 160 bool nal_hrd_parameters_present_flag; | 169 bool nal_hrd_parameters_present_flag; |
| 161 int cpb_cnt_minus1; | 170 int cpb_cnt_minus1; |
| 162 int bit_rate_scale; | 171 int bit_rate_scale; |
| 163 int cpb_size_scale; | 172 int cpb_size_scale; |
| 164 int bit_rate_value_minus1[32]; | 173 int bit_rate_value_minus1[32]; |
| 165 int cpb_size_value_minus1[32]; | 174 int cpb_size_value_minus1[32]; |
| 166 bool cbr_flag[32]; | 175 bool cbr_flag[32]; |
| 167 int initial_cpb_removal_delay_length_minus_1; | 176 int initial_cpb_removal_delay_length_minus_1; |
| 168 int cpb_removal_delay_length_minus1; | 177 int cpb_removal_delay_length_minus1; |
| 169 int dpb_output_delay_length_minus1; | 178 int dpb_output_delay_length_minus1; |
| 170 int time_offset_length; | 179 int time_offset_length; |
| 171 | 180 |
| 172 bool low_delay_hrd_flag; | 181 bool low_delay_hrd_flag; |
| 173 | 182 |
| 174 int chroma_array_type; | 183 int chroma_array_type; |
| 175 | 184 |
| 176 // Helpers to compute frequently-used values. These methods return | 185 // Helpers to compute frequently-used values. These methods return |
| 177 // base::nullopt if they encounter integer overflow. They do not verify that | 186 // base::nullopt if they encounter integer overflow. They do not verify that |
| 178 // the results are in-spec for the given profile or level. | 187 // the results are in-spec for the given profile or level. |
| 179 base::Optional<gfx::Size> GetCodedSize() const; | 188 base::Optional<gfx::Size> GetCodedSize() const; |
| 180 base::Optional<gfx::Rect> GetVisibleRect() const; | 189 base::Optional<gfx::Rect> GetVisibleRect() const; |
| 190 gfx::ColorSpace GetColorSpace() const; |
| 181 }; | 191 }; |
| 182 | 192 |
| 183 struct MEDIA_EXPORT H264PPS { | 193 struct MEDIA_EXPORT H264PPS { |
| 184 H264PPS(); | 194 H264PPS(); |
| 185 | 195 |
| 186 int pic_parameter_set_id; | 196 int pic_parameter_set_id; |
| 187 int seq_parameter_set_id; | 197 int seq_parameter_set_id; |
| 188 bool entropy_coding_mode_flag; | 198 bool entropy_coding_mode_flag; |
| 189 bool bottom_field_pic_order_in_frame_present_flag; | 199 bool bottom_field_pic_order_in_frame_present_flag; |
| 190 int num_slice_groups_minus1; | 200 int num_slice_groups_minus1; |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 // Ranges of encrypted bytes in the buffer passed to | 504 // Ranges of encrypted bytes in the buffer passed to |
| 495 // SetEncryptedStream(). | 505 // SetEncryptedStream(). |
| 496 Ranges<const uint8_t*> encrypted_ranges_; | 506 Ranges<const uint8_t*> encrypted_ranges_; |
| 497 | 507 |
| 498 DISALLOW_COPY_AND_ASSIGN(H264Parser); | 508 DISALLOW_COPY_AND_ASSIGN(H264Parser); |
| 499 }; | 509 }; |
| 500 | 510 |
| 501 } // namespace media | 511 } // namespace media |
| 502 | 512 |
| 503 #endif // MEDIA_FILTERS_H264_PARSER_H_ | 513 #endif // MEDIA_FILTERS_H264_PARSER_H_ |
| OLD | NEW |