Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(910)

Unified Diff: media/formats/mp2t/es_parser_mpeg1audio.h

Issue 506943003: Support MPEG1 audio in the MPEG2-TS stream parser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address CR comments from patch set #4 and Rebase. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 54%
copy from media/formats/mp2t/es_parser_adts.h
copy to media/formats/mp2t/es_parser_mpeg1audio.h
index 55516b70619aa0842dd2a7b8d5683ba8c405be14..0b18a388f49bd05ba4202568af5f30f0e717d6b0 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,44 @@ 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);
+ 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 +72,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_

Powered by Google App Engine
This is Rietveld 408576698