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 #ifndef MEDIA_FORMATS_MP2T_ES_PARSER_H264_H_ | 5 #ifndef MEDIA_FORMATS_MP2T_ES_PARSER_H264_H_ |
6 #define MEDIA_FORMATS_MP2T_ES_PARSER_H264_H_ | 6 #define MEDIA_FORMATS_MP2T_ES_PARSER_H264_H_ |
7 | 7 |
8 #include <list> | |
9 #include <utility> | 8 #include <utility> |
10 | 9 |
11 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
12 #include "base/callback.h" | 11 #include "base/callback.h" |
13 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
14 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
15 #include "base/time/time.h" | 14 #include "base/time/time.h" |
16 #include "media/base/media_export.h" | 15 #include "media/base/media_export.h" |
17 #include "media/base/video_decoder_config.h" | 16 #include "media/base/video_decoder_config.h" |
18 #include "media/formats/mp2t/es_adapter_video.h" | 17 #include "media/formats/mp2t/es_adapter_video.h" |
19 #include "media/formats/mp2t/es_parser.h" | 18 #include "media/formats/mp2t/es_parser.h" |
20 | 19 |
21 namespace media { | 20 namespace media { |
| 21 class EncryptionScheme; |
22 class H264Parser; | 22 class H264Parser; |
23 struct H264SPS; | 23 struct H264SPS; |
24 class OffsetByteQueue; | 24 class OffsetByteQueue; |
25 } | 25 } |
26 | 26 |
27 namespace media { | 27 namespace media { |
28 namespace mp2t { | 28 namespace mp2t { |
29 | 29 |
30 // A few remarks: | 30 // A few remarks: |
31 // - In this h264 parser, frame splitting is based on AUD nals. | 31 // - In this h264 parser, frame splitting is based on AUD nals. |
(...skipping 27 matching lines...) Expand all Loading... |
59 // of the start code parser. | 59 // of the start code parser. |
60 bool FindAUD(int64* stream_pos); | 60 bool FindAUD(int64* stream_pos); |
61 | 61 |
62 // Emit a frame whose position in the ES queue starts at |access_unit_pos|. | 62 // Emit a frame whose position in the ES queue starts at |access_unit_pos|. |
63 // Returns true if successful, false if no PTS is available for the frame. | 63 // Returns true if successful, false if no PTS is available for the frame. |
64 bool EmitFrame(int64 access_unit_pos, int access_unit_size, | 64 bool EmitFrame(int64 access_unit_pos, int access_unit_size, |
65 bool is_key_frame, int pps_id); | 65 bool is_key_frame, int pps_id); |
66 | 66 |
67 // Update the video decoder config based on an H264 SPS. | 67 // Update the video decoder config based on an H264 SPS. |
68 // Return true if successful. | 68 // Return true if successful. |
69 bool UpdateVideoDecoderConfig(const H264SPS* sps); | 69 bool UpdateVideoDecoderConfig(const H264SPS* sps, |
| 70 const EncryptionScheme& scheme); |
70 | 71 |
71 EsAdapterVideo es_adapter_; | 72 EsAdapterVideo es_adapter_; |
72 | 73 |
73 // H264 parser state. | 74 // H264 parser state. |
74 // - |current_access_unit_pos_| is pointing to an annexB syncword | 75 // - |current_access_unit_pos_| is pointing to an annexB syncword |
75 // representing the first NALU of an H264 access unit. | 76 // representing the first NALU of an H264 access unit. |
76 scoped_ptr<H264Parser> h264_parser_; | 77 scoped_ptr<H264Parser> h264_parser_; |
77 int64 current_access_unit_pos_; | 78 int64 current_access_unit_pos_; |
78 int64 next_access_unit_pos_; | 79 int64 next_access_unit_pos_; |
79 | 80 |
80 // Last video decoder config. | 81 // Last video decoder config. |
81 VideoDecoderConfig last_video_decoder_config_; | 82 VideoDecoderConfig last_video_decoder_config_; |
82 | 83 |
83 DISALLOW_COPY_AND_ASSIGN(EsParserH264); | 84 DISALLOW_COPY_AND_ASSIGN(EsParserH264); |
84 }; | 85 }; |
85 | 86 |
86 } // namespace mp2t | 87 } // namespace mp2t |
87 } // namespace media | 88 } // namespace media |
88 | 89 |
89 #endif | 90 #endif |
OLD | NEW |