Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef MEDIA_MP2T_ES_PARSER_ADTS_H_ | |
| 6 #define MEDIA_MP2T_ES_PARSER_ADTS_H_ | |
| 7 | |
| 8 #include <list> | |
| 9 #include <utility> | |
| 10 | |
| 11 #include "base/callback.h" | |
| 12 #include "base/compiler_specific.h" | |
| 13 #include "base/memory/scoped_ptr.h" | |
| 14 #include "base/time/time.h" | |
| 15 #include "media/base/audio_decoder_config.h" | |
| 16 #include "media/base/byte_queue.h" | |
| 17 #include "media/mp2t/es_parser.h" | |
| 18 | |
| 19 namespace media { | |
| 20 class AudioDecoderConfig; | |
|
acolwell GONE FROM CHROMIUM
2013/09/16 06:19:30
nit: Not needed since you are including the .h
damienv1
2013/09/17 02:58:22
Done.
| |
| 21 class AudioTimestampHelper; | |
| 22 class BitReader; | |
| 23 class StreamParserBuffer; | |
| 24 } | |
| 25 | |
| 26 namespace media { | |
| 27 namespace mp2t { | |
| 28 | |
| 29 class EsParserAdts : public EsParser { | |
| 30 public: | |
| 31 typedef base::Callback<void(const AudioDecoderConfig&)> NewAudioConfigCB; | |
| 32 | |
| 33 EsParserAdts(NewAudioConfigCB new_audio_config_cb, | |
| 34 EmitBufferCB emit_buffer_cb); | |
| 35 virtual ~EsParserAdts(); | |
| 36 | |
| 37 // EsParser implementation. | |
| 38 virtual bool Parse(const uint8* buf, int size, | |
| 39 base::TimeDelta pts, | |
| 40 base::TimeDelta dts) OVERRIDE; | |
| 41 virtual void Flush() OVERRIDE; | |
| 42 virtual void Reset() OVERRIDE; | |
| 43 | |
| 44 private: | |
| 45 // Used to link a PTS with a byte position in the ES stream. | |
| 46 typedef std::pair<int, base::TimeDelta> EsPts; | |
| 47 typedef std::list<EsPts> EsPtsList; | |
| 48 | |
| 49 // Signal any audio configuration change (if any). | |
| 50 // Return false if the current audio config is not | |
| 51 // a supported ADTS audio config. | |
| 52 bool UpdateAudioConfiguration(const uint8* adts_header); | |
| 53 | |
| 54 // Discard some bytes from the ES stream. | |
| 55 void DiscardEs(int nbytes); | |
| 56 | |
| 57 // Callbacks: | |
| 58 // - to signal a new audio configuration, | |
| 59 // - to send ES buffers. | |
| 60 NewAudioConfigCB new_audio_config_cb_; | |
| 61 EmitBufferCB emit_buffer_cb_; | |
| 62 | |
| 63 // Bytes of the ES stream that have not been emitted yet. | |
| 64 ByteQueue es_byte_queue_; | |
| 65 | |
| 66 // List of PTS associated with a position in the ES stream. | |
| 67 EsPtsList pts_list_; | |
| 68 | |
| 69 // Interpolated PTS for frames that don't have one. | |
| 70 scoped_ptr<AudioTimestampHelper> audio_timestamp_helper_; | |
| 71 | |
| 72 // Last audio config. | |
| 73 AudioDecoderConfig last_audio_decoder_config_; | |
| 74 | |
| 75 DISALLOW_COPY_AND_ASSIGN(EsParserAdts); | |
| 76 }; | |
| 77 | |
| 78 } // namespace mp2t | |
| 79 } // namespace media | |
| 80 | |
| 81 #endif | |
| 82 | |
| OLD | NEW |