From f4bd2d33b753250efeeba2c405c75083900565f9 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Mon, 26 Nov 2012 16:12:24 -0500 Subject: [PATCH] Bug 815226 - Make the MediaPluginReader not depend on the concrete type of the AbstractMediaDecoder passed to it; r=cpearce --- content/media/plugins/MediaPluginDecoder.cpp | 2 +- content/media/plugins/MediaPluginReader.cpp | 5 +++-- content/media/plugins/MediaPluginReader.h | 5 ++++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/content/media/plugins/MediaPluginDecoder.cpp b/content/media/plugins/MediaPluginDecoder.cpp index 8751d826446f..df20598c5e34 100644 --- a/content/media/plugins/MediaPluginDecoder.cpp +++ b/content/media/plugins/MediaPluginDecoder.cpp @@ -16,7 +16,7 @@ MediaPluginDecoder::MediaPluginDecoder(const nsACString& aType) : mType(aType) MediaDecoderStateMachine* MediaPluginDecoder::CreateStateMachine() { - return new MediaDecoderStateMachine(this, new MediaPluginReader(this)); + return new MediaDecoderStateMachine(this, new MediaPluginReader(this, mType)); } } // namespace mozilla diff --git a/content/media/plugins/MediaPluginReader.cpp b/content/media/plugins/MediaPluginReader.cpp index aef9e90758de..b8bec26a2507 100644 --- a/content/media/plugins/MediaPluginReader.cpp +++ b/content/media/plugins/MediaPluginReader.cpp @@ -15,8 +15,10 @@ namespace mozilla { -MediaPluginReader::MediaPluginReader(AbstractMediaDecoder *aDecoder) : +MediaPluginReader::MediaPluginReader(AbstractMediaDecoder *aDecoder, + const nsACString& aContentType) : MediaDecoderReader(aDecoder), + mType(aContentType), mPlugin(NULL), mHasAudio(false), mHasVideo(false), @@ -24,7 +26,6 @@ MediaPluginReader::MediaPluginReader(AbstractMediaDecoder *aDecoder) : mAudioSeekTimeUs(-1), mLastVideoFrame(NULL) { - static_cast(aDecoder)->GetContentType(mType); } MediaPluginReader::~MediaPluginReader() diff --git a/content/media/plugins/MediaPluginReader.h b/content/media/plugins/MediaPluginReader.h index f86f7f1fef3d..ea44397fc9e6 100644 --- a/content/media/plugins/MediaPluginReader.h +++ b/content/media/plugins/MediaPluginReader.h @@ -11,6 +11,8 @@ #include "MPAPI.h" +class nsACString; + namespace mozilla { class AbstractMediaDecoder; @@ -27,7 +29,8 @@ class MediaPluginReader : public MediaDecoderReader int64_t mAudioSeekTimeUs; VideoData *mLastVideoFrame; public: - MediaPluginReader(AbstractMediaDecoder* aDecoder); + MediaPluginReader(AbstractMediaDecoder* aDecoder, + const nsACString& aContentType); ~MediaPluginReader(); virtual nsresult Init(MediaDecoderReader* aCloneDonor);