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