Index: media/formats/mp2t/es_parser_mpeg1audio.h |
diff --git a/media/formats/mp2t/es_parser_adts.h b/media/formats/mp2t/es_parser_mpeg1audio.h |
similarity index 53% |
copy from media/formats/mp2t/es_parser_adts.h |
copy to media/formats/mp2t/es_parser_mpeg1audio.h |
index 55516b70619aa0842dd2a7b8d5683ba8c405be14..8ae1c1bda2b45114e84ca3da7bb35e123424aa7f 100644 |
--- a/media/formats/mp2t/es_parser_adts.h |
+++ b/media/formats/mp2t/es_parser_mpeg1audio.h |
@@ -2,8 +2,8 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef MEDIA_FORMATS_MP2T_ES_PARSER_ADTS_H_ |
-#define MEDIA_FORMATS_MP2T_ES_PARSER_ADTS_H_ |
+#ifndef MEDIA_FORMATS_MP2T_ES_PARSER_MPEG1AUDIO_H_ |
+#define MEDIA_FORMATS_MP2T_ES_PARSER_MPEG1AUDIO_H_ |
#include <list> |
#include <utility> |
@@ -14,6 +14,7 @@ |
#include "base/time/time.h" |
#include "media/base/audio_decoder_config.h" |
#include "media/base/media_export.h" |
+#include "media/base/media_log.h" |
#include "media/formats/mp2t/es_parser.h" |
namespace media { |
@@ -26,39 +27,45 @@ class StreamParserBuffer; |
namespace media { |
namespace mp2t { |
-class MEDIA_EXPORT EsParserAdts : public EsParser { |
+class MEDIA_EXPORT EsParserMpeg1Audio : public EsParser { |
public: |
typedef base::Callback<void(const AudioDecoderConfig&)> NewAudioConfigCB; |
- EsParserAdts(const NewAudioConfigCB& new_audio_config_cb, |
- const EmitBufferCB& emit_buffer_cb, |
- bool sbr_in_mimetype); |
- virtual ~EsParserAdts(); |
+ EsParserMpeg1Audio(const NewAudioConfigCB& new_audio_config_cb, |
+ const EmitBufferCB& emit_buffer_cb, |
+ const LogCB& log_cb); |
+ virtual ~EsParserMpeg1Audio(); |
// EsParser implementation. |
virtual void Flush() OVERRIDE; |
private: |
- struct AdtsFrame; |
+ // Used to link a PTS with a byte position in the ES stream. |
+ typedef std::pair<int64, base::TimeDelta> EsPts; |
+ typedef std::list<EsPts> EsPtsList; |
+ |
+ struct Mpeg1AudioFrame; |
// EsParser implementation. |
virtual bool ParseFromEsQueue() OVERRIDE; |
virtual void ResetInternal() OVERRIDE; |
- // Synchronize the stream on an ADTS syncword (consuming bytes from |
+ // Synchronize the stream on a Mpeg1 audio syncword (consuming bytes from |
// |es_queue_| if needed). |
- // Returns true when a full ADTS frame has been found: in that case |
- // |adts_frame| structure is filled up accordingly. |
- // Returns false otherwise (no ADTS syncword found or partial ADTS frame). |
- bool LookForAdtsFrame(AdtsFrame* adts_frame); |
- |
- // Skip an ADTS frame in the ES queue. |
- void SkipAdtsFrame(const AdtsFrame& adts_frame); |
+ // Returns true when a full Mpeg1 audio frame has been found: in that case |
+ // |mpeg1audio_frame| structure is filled up accordingly. |
+ // Returns false otherwise (no Mpeg1 audio syncword found or partial Mpeg1 |
+ // audio frame). |
+ bool LookForMpeg1AudioFrame(Mpeg1AudioFrame* mpeg1audio_frame); |
// Signal any audio configuration change (if any). |
// Return false if the current audio config is not |
- // a supported ADTS audio config. |
- bool UpdateAudioConfiguration(const uint8* adts_header); |
+ // a supported Mpeg1 audio config. |
+ bool UpdateAudioConfiguration(const uint8* mpeg1audio_header); |
+ |
+ void SkipMpeg1AudioFrame(const Mpeg1AudioFrame& mpeg1audio_frame); |
+ |
+ LogCB log_cb_; |
// Callbacks: |
// - to signal a new audio configuration, |
@@ -66,20 +73,16 @@ class MEDIA_EXPORT EsParserAdts : public EsParser { |
NewAudioConfigCB new_audio_config_cb_; |
EmitBufferCB emit_buffer_cb_; |
- // True when AAC SBR extension is signalled in the mimetype |
- // (mp4a.40.5 in the codecs parameter). |
- bool sbr_in_mimetype_; |
- |
// Interpolated PTS for frames that don't have one. |
scoped_ptr<AudioTimestampHelper> audio_timestamp_helper_; |
// Last audio config. |
AudioDecoderConfig last_audio_decoder_config_; |
- DISALLOW_COPY_AND_ASSIGN(EsParserAdts); |
+ DISALLOW_COPY_AND_ASSIGN(EsParserMpeg1Audio); |
}; |
} // namespace mp2t |
} // namespace media |
-#endif |
+#endif // MEDIA_FORMATS_MP2T_ES_PARSER_MPEG1AUDIO_H_ |