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