| 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_parser.h" | 18 #include "media/formats/mp2t/es_parser.h" |
| 19 | 19 |
| 20 namespace media { | 20 namespace media { |
| 21 class H264Parser; | 21 class H264Parser; |
| 22 struct H264SPS; | 22 struct H264SPS; |
| 23 class OffsetByteQueue; | 23 class OffsetByteQueue; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace media { | 26 namespace media { |
| 27 namespace mp2t { | 27 namespace mp2t { |
| 28 | 28 |
| 29 class EsAdapterVideo; |
| 30 |
| 29 // Remark: | 31 // Remark: |
| 30 // In this h264 parser, frame splitting is based on AUD nals. | 32 // In this h264 parser, frame splitting is based on AUD nals. |
| 31 // Mpeg2 TS spec: "2.14 Carriage of Rec. ITU-T H.264 | ISO/IEC 14496-10 video" | 33 // Mpeg2 TS spec: "2.14 Carriage of Rec. ITU-T H.264 | ISO/IEC 14496-10 video" |
| 32 // "Each AVC access unit shall contain an access unit delimiter NAL Unit;" | 34 // "Each AVC access unit shall contain an access unit delimiter NAL Unit;" |
| 33 // | 35 // |
| 34 class MEDIA_EXPORT EsParserH264 : NON_EXPORTED_BASE(public EsParser) { | 36 class MEDIA_EXPORT EsParserH264 : NON_EXPORTED_BASE(public EsParser) { |
| 35 public: | 37 public: |
| 36 typedef base::Callback<void(const VideoDecoderConfig&)> NewVideoConfigCB; | 38 typedef base::Callback<void(const VideoDecoderConfig&)> NewVideoConfigCB; |
| 37 | 39 |
| 38 EsParserH264(const NewVideoConfigCB& new_video_config_cb, | 40 EsParserH264(const NewVideoConfigCB& new_video_config_cb, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 69 bool is_key_frame, int pps_id); | 71 bool is_key_frame, int pps_id); |
| 70 | 72 |
| 71 // Update the video decoder config based on an H264 SPS. | 73 // Update the video decoder config based on an H264 SPS. |
| 72 // Return true if successful. | 74 // Return true if successful. |
| 73 bool UpdateVideoDecoderConfig(const H264SPS* sps); | 75 bool UpdateVideoDecoderConfig(const H264SPS* sps); |
| 74 | 76 |
| 75 // Callbacks to pass the stream configuration and the frames. | 77 // Callbacks to pass the stream configuration and the frames. |
| 76 NewVideoConfigCB new_video_config_cb_; | 78 NewVideoConfigCB new_video_config_cb_; |
| 77 EmitBufferCB emit_buffer_cb_; | 79 EmitBufferCB emit_buffer_cb_; |
| 78 | 80 |
| 81 scoped_ptr<EsAdapterVideo> es_adapter_; |
| 82 |
| 79 // Bytes of the ES stream that have not been emitted yet. | 83 // Bytes of the ES stream that have not been emitted yet. |
| 80 scoped_ptr<media::OffsetByteQueue> es_queue_; | 84 scoped_ptr<media::OffsetByteQueue> es_queue_; |
| 81 std::list<std::pair<int64, TimingDesc> > timing_desc_list_; | 85 std::list<std::pair<int64, TimingDesc> > timing_desc_list_; |
| 82 | 86 |
| 83 // H264 parser state. | 87 // H264 parser state. |
| 84 // - |current_access_unit_pos_| is pointing to an annexB syncword | 88 // - |current_access_unit_pos_| is pointing to an annexB syncword |
| 85 // representing the first NALU of an H264 access unit. | 89 // representing the first NALU of an H264 access unit. |
| 86 scoped_ptr<H264Parser> h264_parser_; | 90 scoped_ptr<H264Parser> h264_parser_; |
| 87 int64 current_access_unit_pos_; | 91 int64 current_access_unit_pos_; |
| 88 int64 next_access_unit_pos_; | 92 int64 next_access_unit_pos_; |
| 89 | 93 |
| 90 // Last video decoder config. | 94 // Last video decoder config. |
| 91 VideoDecoderConfig last_video_decoder_config_; | 95 VideoDecoderConfig last_video_decoder_config_; |
| 96 |
| 97 DISALLOW_COPY_AND_ASSIGN(EsParserH264); |
| 92 }; | 98 }; |
| 93 | 99 |
| 94 } // namespace mp2t | 100 } // namespace mp2t |
| 95 } // namespace media | 101 } // namespace media |
| 96 | 102 |
| 97 #endif | 103 #endif |
| 98 | 104 |
| OLD | NEW |