| 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> | 8 #include <list> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "media/base/media_export.h" | 16 #include "media/base/media_export.h" |
| 17 #include "media/base/video_decoder_config.h" | 17 #include "media/base/video_decoder_config.h" |
| 18 #include "media/formats/mp2t/es_adapter_video.h" |
| 18 #include "media/formats/mp2t/es_parser.h" | 19 #include "media/formats/mp2t/es_parser.h" |
| 19 | 20 |
| 20 namespace media { | 21 namespace media { |
| 21 class H264Parser; | 22 class H264Parser; |
| 22 struct H264SPS; | 23 struct H264SPS; |
| 23 class OffsetByteQueue; | 24 class OffsetByteQueue; |
| 24 } | 25 } |
| 25 | 26 |
| 26 namespace media { | 27 namespace media { |
| 27 namespace mp2t { | 28 namespace mp2t { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 66 |
| 66 // Emit a frame whose position in the ES queue starts at |access_unit_pos|. | 67 // Emit a frame whose position in the ES queue starts at |access_unit_pos|. |
| 67 // Returns true if successful, false if no PTS is available for the frame. | 68 // Returns true if successful, false if no PTS is available for the frame. |
| 68 bool EmitFrame(int64 access_unit_pos, int access_unit_size, | 69 bool EmitFrame(int64 access_unit_pos, int access_unit_size, |
| 69 bool is_key_frame, int pps_id); | 70 bool is_key_frame, int pps_id); |
| 70 | 71 |
| 71 // Update the video decoder config based on an H264 SPS. | 72 // Update the video decoder config based on an H264 SPS. |
| 72 // Return true if successful. | 73 // Return true if successful. |
| 73 bool UpdateVideoDecoderConfig(const H264SPS* sps); | 74 bool UpdateVideoDecoderConfig(const H264SPS* sps); |
| 74 | 75 |
| 75 // Callbacks to pass the stream configuration and the frames. | 76 EsAdapterVideo es_adapter_; |
| 76 NewVideoConfigCB new_video_config_cb_; | |
| 77 EmitBufferCB emit_buffer_cb_; | |
| 78 | 77 |
| 79 // Bytes of the ES stream that have not been emitted yet. | 78 // Bytes of the ES stream that have not been emitted yet. |
| 80 scoped_ptr<media::OffsetByteQueue> es_queue_; | 79 scoped_ptr<media::OffsetByteQueue> es_queue_; |
| 81 std::list<std::pair<int64, TimingDesc> > timing_desc_list_; | 80 std::list<std::pair<int64, TimingDesc> > timing_desc_list_; |
| 82 | 81 |
| 83 // H264 parser state. | 82 // H264 parser state. |
| 84 // - |current_access_unit_pos_| is pointing to an annexB syncword | 83 // - |current_access_unit_pos_| is pointing to an annexB syncword |
| 85 // representing the first NALU of an H264 access unit. | 84 // representing the first NALU of an H264 access unit. |
| 86 scoped_ptr<H264Parser> h264_parser_; | 85 scoped_ptr<H264Parser> h264_parser_; |
| 87 int64 current_access_unit_pos_; | 86 int64 current_access_unit_pos_; |
| 88 int64 next_access_unit_pos_; | 87 int64 next_access_unit_pos_; |
| 89 | 88 |
| 90 // Last video decoder config. | 89 // Last video decoder config. |
| 91 VideoDecoderConfig last_video_decoder_config_; | 90 VideoDecoderConfig last_video_decoder_config_; |
| 91 |
| 92 DISALLOW_COPY_AND_ASSIGN(EsParserH264); |
| 92 }; | 93 }; |
| 93 | 94 |
| 94 } // namespace mp2t | 95 } // namespace mp2t |
| 95 } // namespace media | 96 } // namespace media |
| 96 | 97 |
| 97 #endif | 98 #endif |
| 98 | 99 |
| OLD | NEW |