diff --git a/content/html/content/public/nsHTMLMediaElement.h b/content/html/content/public/nsHTMLMediaElement.h index c02b45f91158..a2d0fe57e8e8 100644 --- a/content/html/content/public/nsHTMLMediaElement.h +++ b/content/html/content/public/nsHTMLMediaElement.h @@ -16,7 +16,6 @@ #include "nsCycleCollectionParticipant.h" #include "nsILoadGroup.h" #include "nsIObserver.h" -#include "nsDataHashtable.h" #include "nsAudioStream.h" #include "VideoFrameContainer.h" #include "mozilla/CORSMode.h" @@ -47,8 +46,6 @@ public: typedef mozilla::MediaStream MediaStream; typedef mozilla::MediaResource MediaResource; - typedef nsDataHashtable MetadataTags; - #ifdef MOZ_DASH friend class nsDASHDecoder; #endif diff --git a/content/media/dash/nsDASHReader.cpp b/content/media/dash/nsDASHReader.cpp index be589acc4abe..94fe7413ea2b 100644 --- a/content/media/dash/nsDASHReader.cpp +++ b/content/media/dash/nsDASHReader.cpp @@ -114,7 +114,7 @@ nsDASHReader::DecodeAudioData() nsresult nsDASHReader::ReadMetadata(nsVideoInfo* aInfo, - nsHTMLMediaElement::MetadataTags** aTags) + MetadataTags** aTags) { NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); diff --git a/content/media/dash/nsDASHReader.h b/content/media/dash/nsDASHReader.h index 0948647ebe89..302cd706450f 100644 --- a/content/media/dash/nsDASHReader.h +++ b/content/media/dash/nsDASHReader.h @@ -48,7 +48,7 @@ public: // Waits for metadata bytes to be downloaded, then reads and parses them. // Called on the decode thread only. nsresult ReadMetadata(nsVideoInfo* aInfo, - nsHTMLMediaElement::MetadataTags** aTags); + MetadataTags** aTags); // Waits for |ReadyToReadMetadata| or |NotifyDecoderShuttingDown| // notification, whichever comes first. Ensures no attempt to read metadata diff --git a/content/media/gstreamer/nsGStreamerReader.cpp b/content/media/gstreamer/nsGStreamerReader.cpp index cdabbd4d9235..c9602cf3380b 100644 --- a/content/media/gstreamer/nsGStreamerReader.cpp +++ b/content/media/gstreamer/nsGStreamerReader.cpp @@ -195,7 +195,7 @@ void nsGStreamerReader::PlayBinSourceSetup(GstAppSrc *aSource) } nsresult nsGStreamerReader::ReadMetadata(nsVideoInfo* aInfo, - nsHTMLMediaElement::MetadataTags** aTags) + MetadataTags** aTags) { NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); nsresult ret = NS_OK; diff --git a/content/media/gstreamer/nsGStreamerReader.h b/content/media/gstreamer/nsGStreamerReader.h index b7a929ff6767..1a616be6e53f 100644 --- a/content/media/gstreamer/nsGStreamerReader.h +++ b/content/media/gstreamer/nsGStreamerReader.h @@ -27,7 +27,7 @@ public: virtual bool DecodeVideoFrame(bool &aKeyframeSkip, int64_t aTimeThreshold); virtual nsresult ReadMetadata(nsVideoInfo* aInfo, - nsHTMLMediaElement::MetadataTags** aTags); + MetadataTags** aTags); virtual nsresult Seek(int64_t aTime, int64_t aStartTime, int64_t aEndTime, diff --git a/content/media/nsBuiltinDecoder.cpp b/content/media/nsBuiltinDecoder.cpp index 20d08e8802f7..90b26baa7a6d 100644 --- a/content/media/nsBuiltinDecoder.cpp +++ b/content/media/nsBuiltinDecoder.cpp @@ -543,7 +543,7 @@ void nsBuiltinDecoder::AudioAvailable(float* aFrameBuffer, void nsBuiltinDecoder::MetadataLoaded(uint32_t aChannels, uint32_t aRate, bool aHasAudio, - const nsHTMLMediaElement::MetadataTags* aTags) + const MetadataTags* aTags) { NS_ASSERTION(NS_IsMainThread(), "Should be on main thread."); if (mShuttingDown) { diff --git a/content/media/nsBuiltinDecoder.h b/content/media/nsBuiltinDecoder.h index 3407c962b46f..ee6353af7466 100644 --- a/content/media/nsBuiltinDecoder.h +++ b/content/media/nsBuiltinDecoder.h @@ -506,7 +506,7 @@ public: void MetadataLoaded(uint32_t aChannels, uint32_t aRate, bool aHasAudio, - const nsHTMLMediaElement::MetadataTags* aTags); + const MetadataTags* aTags); // Called when the first frame has been loaded. // Call on the main thread only. diff --git a/content/media/nsBuiltinDecoderReader.h b/content/media/nsBuiltinDecoderReader.h index 469448490bfd..7ee69ffebe01 100644 --- a/content/media/nsBuiltinDecoderReader.h +++ b/content/media/nsBuiltinDecoderReader.h @@ -395,7 +395,7 @@ public: // with tag metadata from the file. // Returns NS_OK on success, or NS_ERROR_FAILURE on failure. virtual nsresult ReadMetadata(nsVideoInfo* aInfo, - nsHTMLMediaElement::MetadataTags** aTags) = 0; + MetadataTags** aTags) = 0; // Stores the presentation time of the first frame we'd be able to play if // we started playback at the current position. Returns the first video diff --git a/content/media/nsBuiltinDecoderStateMachine.cpp b/content/media/nsBuiltinDecoderStateMachine.cpp index ec03d2c36219..9fda48305e0e 100644 --- a/content/media/nsBuiltinDecoderStateMachine.cpp +++ b/content/media/nsBuiltinDecoderStateMachine.cpp @@ -118,7 +118,7 @@ private: public: nsAudioMetadataEventRunner(nsBuiltinDecoder* aDecoder, uint32_t aChannels, uint32_t aRate, bool aHasAudio, - nsHTMLMediaElement::MetadataTags* aTags) : + MetadataTags* aTags) : mDecoder(aDecoder), mChannels(aChannels), mRate(aRate), @@ -136,7 +136,7 @@ public: const uint32_t mChannels; const uint32_t mRate; const bool mHasAudio; - nsHTMLMediaElement::MetadataTags* mTags; + MetadataTags* mTags; }; // Owns the global state machine thread and counts of @@ -1726,7 +1726,7 @@ nsresult nsBuiltinDecoderStateMachine::DecodeMetadata() LOG(PR_LOG_DEBUG, ("%p Decoding Media Headers", mDecoder.get())); nsresult res; nsVideoInfo info; - nsHTMLMediaElement::MetadataTags* tags; + MetadataTags* tags; { ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor()); res = mReader->ReadMetadata(&info, &tags); diff --git a/content/media/nsMediaDecoder.h b/content/media/nsMediaDecoder.h index 7a442735cd3c..299437ab97f1 100644 --- a/content/media/nsMediaDecoder.h +++ b/content/media/nsMediaDecoder.h @@ -10,6 +10,7 @@ #include "VideoFrameContainer.h" #include "MediaStreamGraph.h" #include "nsIObserver.h" +#include "nsDataHashtable.h" class nsHTMLMediaElement; class nsIStreamListener; @@ -33,6 +34,8 @@ static const uint32_t FRAMEBUFFER_LENGTH_PER_CHANNEL = 1024; static const uint32_t FRAMEBUFFER_LENGTH_MIN = 512; static const uint32_t FRAMEBUFFER_LENGTH_MAX = 16384; +typedef nsDataHashtable MetadataTags; + // All methods of nsMediaDecoder must be called from the main thread only // with the exception of GetVideoFrameContainer and GetStatistics, // which can be called from any thread. diff --git a/content/media/ogg/nsOggCodecState.cpp b/content/media/ogg/nsOggCodecState.cpp index 0cf3a25389b8..512e4f9a0594 100644 --- a/content/media/ogg/nsOggCodecState.cpp +++ b/content/media/ogg/nsOggCodecState.cpp @@ -130,7 +130,7 @@ bool nsOggCodecState::IsValidVorbisTagName(nsCString& aName) return true; } -bool nsOggCodecState::AddVorbisComment(nsHTMLMediaElement::MetadataTags* aTags, +bool nsOggCodecState::AddVorbisComment(MetadataTags* aTags, const char* aComment, uint32_t aLength) { @@ -654,13 +654,13 @@ nsVorbisState::IsHeader(ogg_packet* aPacket) return aPacket->bytes > 0 ? (aPacket->packet[0] & 0x1) : false; } -nsHTMLMediaElement::MetadataTags* +MetadataTags* nsVorbisState::GetTags() { - nsHTMLMediaElement::MetadataTags* tags; + MetadataTags* tags; NS_ASSERTION(mComment.user_comments, "no vorbis comment strings!"); NS_ASSERTION(mComment.comment_lengths, "no vorbis comment lengths!"); - tags = new nsHTMLMediaElement::MetadataTags; + tags = new MetadataTags; tags->Init(); for (int i = 0; i < mComment.comments; i++) { AddVorbisComment(tags, mComment.user_comments[i], @@ -1037,11 +1037,11 @@ bool nsOpusState::DecodeHeader(ogg_packet* aPacket) } /* Construct and return a tags hashmap from our internal array */ -nsHTMLMediaElement::MetadataTags* nsOpusState::GetTags() +MetadataTags* nsOpusState::GetTags() { - nsHTMLMediaElement::MetadataTags* tags; + MetadataTags* tags; - tags = new nsHTMLMediaElement::MetadataTags; + tags = new MetadataTags; tags->Init(); for (uint32_t i = 0; i < mTags.Length(); i++) { AddVorbisComment(tags, mTags[i].Data(), mTags[i].Length()); diff --git a/content/media/ogg/nsOggCodecState.h b/content/media/ogg/nsOggCodecState.h index ce4899d272d8..aaef07d9daad 100644 --- a/content/media/ogg/nsOggCodecState.h +++ b/content/media/ogg/nsOggCodecState.h @@ -98,7 +98,7 @@ public: } // Build a hash table with tag metadata parsed from the stream. - virtual nsHTMLMediaElement::MetadataTags* GetTags() { + virtual MetadataTags* GetTags() { return nullptr; } @@ -200,7 +200,7 @@ protected: // Utility method to parse and add a vorbis-style comment // to a metadata hash table. Most Ogg-encapsulated codecs // use the vorbis comment format for metadata. - static bool AddVorbisComment(nsHTMLMediaElement::MetadataTags* aTags, + static bool AddVorbisComment(MetadataTags* aTags, const char* aComment, uint32_t aLength); }; @@ -219,7 +219,7 @@ public: nsresult PageIn(ogg_page* aPage); // Return a hash table with tag metadata. - nsHTMLMediaElement::MetadataTags* GetTags(); + MetadataTags* GetTags(); // Returns the end time that a granulepos represents. static int64_t Time(vorbis_info* aInfo, int64_t aGranulePos); @@ -357,7 +357,7 @@ public: int64_t mPrevPacketGranulepos; // Construct and return a table of tags from the metadata header. - nsHTMLMediaElement::MetadataTags* GetTags(); + MetadataTags* GetTags(); private: diff --git a/content/media/ogg/nsOggReader.cpp b/content/media/ogg/nsOggReader.cpp index a5c97c6d9337..3925b7f37e6d 100644 --- a/content/media/ogg/nsOggReader.cpp +++ b/content/media/ogg/nsOggReader.cpp @@ -162,7 +162,7 @@ void nsOggReader::BuildSerialList(nsTArray& aTracks) } nsresult nsOggReader::ReadMetadata(nsVideoInfo* aInfo, - nsHTMLMediaElement::MetadataTags** aTags) + MetadataTags** aTags) { NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); diff --git a/content/media/ogg/nsOggReader.h b/content/media/ogg/nsOggReader.h index 71504547560e..7daba169720f 100644 --- a/content/media/ogg/nsOggReader.h +++ b/content/media/ogg/nsOggReader.h @@ -47,7 +47,7 @@ public: } virtual nsresult ReadMetadata(nsVideoInfo* aInfo, - nsHTMLMediaElement::MetadataTags** aTags); + MetadataTags** aTags); virtual nsresult Seek(int64_t aTime, int64_t aStartTime, int64_t aEndTime, int64_t aCurrentTime); virtual nsresult GetBuffered(nsTimeRanges* aBuffered, int64_t aStartTime); diff --git a/content/media/omx/nsMediaOmxReader.cpp b/content/media/omx/nsMediaOmxReader.cpp index d31bbcdb6d41..bfb90474ca2b 100644 --- a/content/media/omx/nsMediaOmxReader.cpp +++ b/content/media/omx/nsMediaOmxReader.cpp @@ -38,7 +38,7 @@ nsresult nsMediaOmxReader::Init(nsBuiltinDecoderReader* aCloneDonor) } nsresult nsMediaOmxReader::ReadMetadata(nsVideoInfo* aInfo, - nsHTMLMediaElement::MetadataTags** aTags) + MetadataTags** aTags) { NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); diff --git a/content/media/omx/nsMediaOmxReader.h b/content/media/omx/nsMediaOmxReader.h index 1a2dd199604e..d33b2650da88 100644 --- a/content/media/omx/nsMediaOmxReader.h +++ b/content/media/omx/nsMediaOmxReader.h @@ -47,7 +47,7 @@ public: } virtual nsresult ReadMetadata(nsVideoInfo* aInfo, - nsHTMLMediaElement::MetadataTags** aTags); + MetadataTags** aTags); virtual nsresult Seek(int64_t aTime, int64_t aStartTime, int64_t aEndTime, int64_t aCurrentTime); virtual nsresult GetBuffered(nsTimeRanges* aBuffered, int64_t aStartTime); virtual bool IsSeekableInBufferedRanges() { diff --git a/content/media/plugins/nsMediaPluginReader.cpp b/content/media/plugins/nsMediaPluginReader.cpp index 86660fcacb60..4252587f41aa 100644 --- a/content/media/plugins/nsMediaPluginReader.cpp +++ b/content/media/plugins/nsMediaPluginReader.cpp @@ -37,7 +37,7 @@ nsresult nsMediaPluginReader::Init(nsBuiltinDecoderReader* aCloneDonor) } nsresult nsMediaPluginReader::ReadMetadata(nsVideoInfo* aInfo, - nsHTMLMediaElement::MetadataTags** aTags) + MetadataTags** aTags) { NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); diff --git a/content/media/plugins/nsMediaPluginReader.h b/content/media/plugins/nsMediaPluginReader.h index aaa6ee27fc92..2fe05c2b068c 100644 --- a/content/media/plugins/nsMediaPluginReader.h +++ b/content/media/plugins/nsMediaPluginReader.h @@ -45,7 +45,7 @@ public: } virtual nsresult ReadMetadata(nsVideoInfo* aInfo, - nsHTMLMediaElement::MetadataTags** aTags); + MetadataTags** aTags); virtual nsresult Seek(int64_t aTime, int64_t aStartTime, int64_t aEndTime, int64_t aCurrentTime); virtual nsresult GetBuffered(nsTimeRanges* aBuffered, int64_t aStartTime); virtual bool IsSeekableInBufferedRanges() { diff --git a/content/media/raw/nsRawReader.cpp b/content/media/raw/nsRawReader.cpp index 37adf23064a0..77bce16710fb 100644 --- a/content/media/raw/nsRawReader.cpp +++ b/content/media/raw/nsRawReader.cpp @@ -35,7 +35,7 @@ nsresult nsRawReader::ResetDecode() } nsresult nsRawReader::ReadMetadata(nsVideoInfo* aInfo, - nsHTMLMediaElement::MetadataTags** aTags) + MetadataTags** aTags) { NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); diff --git a/content/media/raw/nsRawReader.h b/content/media/raw/nsRawReader.h index 254fa12eefce..d3696abd4b5f 100644 --- a/content/media/raw/nsRawReader.h +++ b/content/media/raw/nsRawReader.h @@ -33,7 +33,7 @@ public: } virtual nsresult ReadMetadata(nsVideoInfo* aInfo, - nsHTMLMediaElement::MetadataTags** aTags); + MetadataTags** aTags); virtual nsresult Seek(int64_t aTime, int64_t aStartTime, int64_t aEndTime, int64_t aCurrentTime); virtual nsresult GetBuffered(nsTimeRanges* aBuffered, int64_t aStartTime); diff --git a/content/media/wave/nsWaveReader.cpp b/content/media/wave/nsWaveReader.cpp index bbcb09fe3db8..c7e2db670114 100644 --- a/content/media/wave/nsWaveReader.cpp +++ b/content/media/wave/nsWaveReader.cpp @@ -121,7 +121,7 @@ nsresult nsWaveReader::Init(nsBuiltinDecoderReader* aCloneDonor) } nsresult nsWaveReader::ReadMetadata(nsVideoInfo* aInfo, - nsHTMLMediaElement::MetadataTags** aTags) + MetadataTags** aTags) { NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); diff --git a/content/media/wave/nsWaveReader.h b/content/media/wave/nsWaveReader.h index 690dcfe5a264..d00ec5b33e41 100644 --- a/content/media/wave/nsWaveReader.h +++ b/content/media/wave/nsWaveReader.h @@ -33,7 +33,7 @@ public: } virtual nsresult ReadMetadata(nsVideoInfo* aInfo, - nsHTMLMediaElement::MetadataTags** aTags); + MetadataTags** aTags); virtual nsresult Seek(int64_t aTime, int64_t aStartTime, int64_t aEndTime, int64_t aCurrentTime); virtual nsresult GetBuffered(nsTimeRanges* aBuffered, int64_t aStartTime); diff --git a/content/media/webm/nsWebMReader.cpp b/content/media/webm/nsWebMReader.cpp index ca0069cd80a6..989da7b8bb00 100644 --- a/content/media/webm/nsWebMReader.cpp +++ b/content/media/webm/nsWebMReader.cpp @@ -180,7 +180,7 @@ void nsWebMReader::Cleanup() } nsresult nsWebMReader::ReadMetadata(nsVideoInfo* aInfo, - nsHTMLMediaElement::MetadataTags** aTags) + MetadataTags** aTags) { NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); diff --git a/content/media/webm/nsWebMReader.h b/content/media/webm/nsWebMReader.h index 47007e5175fa..cd3ed4822d12 100644 --- a/content/media/webm/nsWebMReader.h +++ b/content/media/webm/nsWebMReader.h @@ -131,7 +131,7 @@ public: } virtual nsresult ReadMetadata(nsVideoInfo* aInfo, - nsHTMLMediaElement::MetadataTags** aTags); + MetadataTags** aTags); virtual nsresult Seek(int64_t aTime, int64_t aStartTime, int64_t aEndTime, int64_t aCurrentTime); virtual nsresult GetBuffered(nsTimeRanges* aBuffered, int64_t aStartTime); virtual void NotifyDataArrived(const char* aBuffer, uint32_t aLength, int64_t aOffset);