Bug 810177 - Part 2: Break MetadataTags out of nsHTMLMediaElements; r=cpearce

This patch simply moves the MetadataTags typedef to nsMediaDecoder.h to
reduce the dependencies on nsHTMLMediaElements.h.  The rest of the
changes are made to make this compile.
This commit is contained in:
Ehsan Akhgari 2012-11-08 19:40:08 -05:00
parent e67d7b9a8a
commit 23ed600a8a
24 changed files with 36 additions and 36 deletions

View File

@ -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<nsCStringHashKey, nsCString> MetadataTags;
#ifdef MOZ_DASH
friend class nsDASHDecoder;
#endif

View File

@ -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.");

View File

@ -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

View File

@ -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;

View File

@ -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,

View File

@ -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) {

View File

@ -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.

View File

@ -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

View File

@ -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);

View File

@ -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<nsCStringHashKey, nsCString> 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.

View File

@ -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());

View File

@ -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:

View File

@ -162,7 +162,7 @@ void nsOggReader::BuildSerialList(nsTArray<uint32_t>& aTracks)
}
nsresult nsOggReader::ReadMetadata(nsVideoInfo* aInfo,
nsHTMLMediaElement::MetadataTags** aTags)
MetadataTags** aTags)
{
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");

View File

@ -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);

View File

@ -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.");

View File

@ -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() {

View File

@ -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.");

View File

@ -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() {

View File

@ -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.");

View File

@ -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);

View File

@ -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.");

View File

@ -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);

View File

@ -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.");

View File

@ -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);