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 "media/base/media_export.h" | 19 #include "media/base/media_export.h" |
19 #include "media/base/ranges.h" | 20 #include "media/base/ranges.h" |
20 #include "media/base/video_codecs.h" | 21 #include "media/base/video_codecs.h" |
21 #include "media/filters/h264_bit_reader.h" | 22 #include "media/filters/h264_bit_reader.h" |
22 | 23 |
| 24 namespace gfx { |
| 25 class Rect; |
| 26 class Size; |
| 27 } |
| 28 |
23 namespace media { | 29 namespace media { |
24 | 30 |
25 struct SubsampleEntry; | 31 struct SubsampleEntry; |
26 | 32 |
27 // For explanations of each struct and its members, see H.264 specification | 33 // For explanations of each struct and its members, see H.264 specification |
28 // at http://www.itu.int/rec/T-REC-H.264. | 34 // at http://www.itu.int/rec/T-REC-H.264. |
29 struct MEDIA_EXPORT H264NALU { | 35 struct MEDIA_EXPORT H264NALU { |
30 H264NALU(); | 36 H264NALU(); |
31 | 37 |
32 enum Type { | 38 enum Type { |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 int cpb_size_value_minus1[32]; | 165 int cpb_size_value_minus1[32]; |
160 bool cbr_flag[32]; | 166 bool cbr_flag[32]; |
161 int initial_cpb_removal_delay_length_minus_1; | 167 int initial_cpb_removal_delay_length_minus_1; |
162 int cpb_removal_delay_length_minus1; | 168 int cpb_removal_delay_length_minus1; |
163 int dpb_output_delay_length_minus1; | 169 int dpb_output_delay_length_minus1; |
164 int time_offset_length; | 170 int time_offset_length; |
165 | 171 |
166 bool low_delay_hrd_flag; | 172 bool low_delay_hrd_flag; |
167 | 173 |
168 int chroma_array_type; | 174 int chroma_array_type; |
| 175 |
| 176 // Helpers to compute frequently-used values. These methods return |
| 177 // base::nullopt if they encounter integer overflow. They do not verify that |
| 178 // the results are in-spec for the given profile or level. |
| 179 base::Optional<gfx::Size> GetCodedSize() const; |
| 180 base::Optional<gfx::Rect> GetVisibleRect() const; |
169 }; | 181 }; |
170 | 182 |
171 struct MEDIA_EXPORT H264PPS { | 183 struct MEDIA_EXPORT H264PPS { |
172 H264PPS(); | 184 H264PPS(); |
173 | 185 |
174 int pic_parameter_set_id; | 186 int pic_parameter_set_id; |
175 int seq_parameter_set_id; | 187 int seq_parameter_set_id; |
176 bool entropy_coding_mode_flag; | 188 bool entropy_coding_mode_flag; |
177 bool bottom_field_pic_order_in_frame_present_flag; | 189 bool bottom_field_pic_order_in_frame_present_flag; |
178 int num_slice_groups_minus1; | 190 int num_slice_groups_minus1; |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 // Ranges of encrypted bytes in the buffer passed to | 494 // Ranges of encrypted bytes in the buffer passed to |
483 // SetEncryptedStream(). | 495 // SetEncryptedStream(). |
484 Ranges<const uint8_t*> encrypted_ranges_; | 496 Ranges<const uint8_t*> encrypted_ranges_; |
485 | 497 |
486 DISALLOW_COPY_AND_ASSIGN(H264Parser); | 498 DISALLOW_COPY_AND_ASSIGN(H264Parser); |
487 }; | 499 }; |
488 | 500 |
489 } // namespace media | 501 } // namespace media |
490 | 502 |
491 #endif // MEDIA_FILTERS_H264_PARSER_H_ | 503 #endif // MEDIA_FILTERS_H264_PARSER_H_ |
OLD | NEW |