| 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" | |
| 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 { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 50 private: | 49 private: |
| 51 // EsParser implementation. | 50 // EsParser implementation. |
| 52 bool ParseFromEsQueue() override; | 51 bool ParseFromEsQueue() override; |
| 53 void ResetInternal() override; | 52 void ResetInternal() override; |
| 54 | 53 |
| 55 // Find the AUD located at or after |*stream_pos|. | 54 // Find the AUD located at or after |*stream_pos|. |
| 56 // Return true if an AUD is found. | 55 // Return true if an AUD is found. |
| 57 // If found, |*stream_pos| corresponds to the position of the AUD start code | 56 // If found, |*stream_pos| corresponds to the position of the AUD start code |
| 58 // in the stream. Otherwise, |*stream_pos| corresponds to the last position | 57 // in the stream. Otherwise, |*stream_pos| corresponds to the last position |
| 59 // of the start code parser. | 58 // of the start code parser. |
| 60 bool FindAUD(int64* stream_pos); | 59 bool FindAUD(int64_t* stream_pos); |
| 61 | 60 |
| 62 // Emit a frame whose position in the ES queue starts at |access_unit_pos|. | 61 // 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. | 62 // Returns true if successful, false if no PTS is available for the frame. |
| 64 bool EmitFrame(int64 access_unit_pos, int access_unit_size, | 63 bool EmitFrame(int64_t access_unit_pos, |
| 65 bool is_key_frame, int pps_id); | 64 int access_unit_size, |
| 65 bool is_key_frame, |
| 66 int pps_id); |
| 66 | 67 |
| 67 // Update the video decoder config based on an H264 SPS. | 68 // Update the video decoder config based on an H264 SPS. |
| 68 // Return true if successful. | 69 // Return true if successful. |
| 69 bool UpdateVideoDecoderConfig(const H264SPS* sps); | 70 bool UpdateVideoDecoderConfig(const H264SPS* sps); |
| 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_t current_access_unit_pos_; |
| 78 int64 next_access_unit_pos_; | 79 int64_t 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 |