Bug 811381 - Move media code into mozilla namespace. r=roc

This commit is contained in:
Chris Pearce 2012-11-14 11:45:33 -08:00
parent 092eb0ac65
commit 5ac4df2ef3
60 changed files with 282 additions and 141 deletions

View File

@ -6658,7 +6658,7 @@ nsContentUtils::FindInternalContentViewer(const char* aType,
#endif
#ifdef MOZ_MEDIA_PLUGINS
if (nsBuiltinDecoder::IsMediaPluginsEnabled() &&
if (mozilla::nsBuiltinDecoder::IsMediaPluginsEnabled() &&
nsHTMLMediaElement::IsMediaPluginsType(nsDependentCString(aType))) {
docFactory = do_GetService("@mozilla.org/content/document-loader-factory;1");
if (docFactory && aLoaderType) {

View File

@ -32,12 +32,11 @@ typedef uint16_t nsMediaReadyState;
namespace mozilla {
class MediaResource;
}
class nsBuiltinDecoder;
#ifdef MOZ_DASH
class nsDASHDecoder;
#endif
}
class nsHTMLMediaElement : public nsGenericHTMLElement,
public nsIObserver,
@ -51,6 +50,8 @@ public:
typedef mozilla::MediaResource MediaResource;
typedef mozilla::MediaDecoderOwner MediaDecoderOwner;
typedef mozilla::MetadataTags MetadataTags;
typedef mozilla::nsAudioStream nsAudioStream;
typedef mozilla::nsBuiltinDecoder nsBuiltinDecoder;
#ifdef MOZ_DASH
friend class nsDASHDecoder;
@ -125,7 +126,7 @@ public:
virtual void MetadataLoaded(uint32_t aChannels,
uint32_t aRate,
bool aHasAudio,
const MetadataTags* aTags) MOZ_FINAL MOZ_OVERRIDE;
const mozilla::MetadataTags* aTags) MOZ_FINAL MOZ_OVERRIDE;
// Called by the video decoder object, on the main thread,
// when it has read the first frame of the video
@ -745,7 +746,7 @@ protected:
static PLDHashOperator BuildObjectFromTags(nsCStringHashKey::KeyType aKey,
nsCString aValue,
void* aUserArg);
nsAutoPtr<const MetadataTags> mTags;
nsAutoPtr<const mozilla::MetadataTags> mTags;
// URI of the resource we're attempting to load. This stores the value we
// return in the currentSrc attribute. Use GetCurrentSrc() to access the
@ -753,7 +754,7 @@ protected:
// This is always the original URL we're trying to load --- before
// redirects etc.
nsCOMPtr<nsIURI> mLoadingSrc;
// Stores the current preload action for this element. Initially set to
// PRELOAD_UNDEFINED, its value is changed by calling
// UpdatePreloadAction().

View File

@ -39,6 +39,7 @@
#include "nsEventDispatcher.h"
#include "nsMediaError.h"
#include "nsBuiltinDecoder.h"
#include "nsICategoryManager.h"
#include "nsCharSeparatedTokenizer.h"
#include "MediaResource.h"
@ -118,6 +119,7 @@ using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::layers;
// Number of milliseconds between timeupdate events as defined by spec
#define TIMEUPDATE_MS 250

View File

@ -130,6 +130,6 @@ ConvertAudioSamplesWithScale(const int16_t* aFrom, int16_t* aTo, int aCount, flo
}
}
}
} // namespace mozilla
#endif /* MOZILLA_AUDIOSAMPLEFORMAT_H_ */

View File

@ -11,10 +11,10 @@
#include "AudioSampleFormat.h"
#include "SharedBuffer.h"
class nsAudioStream;
namespace mozilla {
class nsAudioStream;
struct AudioChunk {
typedef mozilla::AudioSampleFormat SampleFormat;

View File

@ -45,7 +45,7 @@ PRLogModuleInfo* gMediaResourceLog;
static const uint32_t HTTP_OK_CODE = 200;
static const uint32_t HTTP_PARTIAL_RESPONSE_CODE = 206;
using namespace mozilla;
namespace mozilla {
ChannelMediaResource::ChannelMediaResource(nsBuiltinDecoder* aDecoder,
nsIChannel* aChannel, nsIURI* aURI)
@ -1570,3 +1570,6 @@ void MediaResource::ModifyLoadFlags(nsLoadFlags aFlags)
NS_ASSERTION(NS_SUCCEEDED(rv), "AddRequest() failed!");
}
}
} // namespace mozilla

View File

@ -26,10 +26,10 @@ static const int64_t SEEK_VS_READ_THRESHOLD = 32*1024;
static const uint32_t HTTP_REQUESTED_RANGE_NOT_SATISFIABLE_CODE = 416;
class nsBuiltinDecoder;
namespace mozilla {
class nsBuiltinDecoder;
/**
* This class is useful for estimating rates of data passing through
* some channel. The idea is that activity on the channel "starts"
@ -526,6 +526,6 @@ protected:
int64_t mSeekOffset;
};
}
} // namespace mozilla
#endif

View File

@ -128,7 +128,7 @@
#include "nsDASHRepDecoder.h"
#include "nsDASHDecoder.h"
using mozilla::ReentrantMonitorAutoEnter;
namespace mozilla {
#ifdef PR_LOGGING
extern PRLogModuleInfo* gBuiltinDecoderLog;
@ -730,3 +730,6 @@ nsDASHDecoder::DecodeError()
}
}
}
} // namespace mozilla

View File

@ -22,15 +22,14 @@
#include "nsBuiltinDecoder.h"
#include "nsDASHReader.h"
class nsDASHRepDecoder;
namespace mozilla {
namespace net {
class IMPDManager;
class nsDASHMPDParser;
class Representation;
}// net
}// mozilla
class nsDASHRepDecoder;
class nsDASHDecoder : public nsBuiltinDecoder
{
@ -153,4 +152,6 @@ private:
nsTArray<nsRefPtr<nsDASHRepDecoder> > mVideoRepDecoders;
};
} // namespace mozilla
#endif

View File

@ -17,6 +17,8 @@
#include "nsBuiltinDecoder.h"
#include "nsDASHReader.h"
namespace mozilla {
#ifdef PR_LOGGING
extern PRLogModuleInfo* gBuiltinDecoderLog;
#define LOG(msg, ...) PR_LOG(gBuiltinDecoderLog, PR_LOG_DEBUG, \
@ -323,3 +325,6 @@ nsDASHReader::IsSeekableInBufferedRanges()
!((mVideoReader && !mVideoReader->IsSeekableInBufferedRanges()) ||
(mAudioReader && !mAudioReader->IsSeekableInBufferedRanges()));
}
} // namespace mozilla

View File

@ -18,11 +18,11 @@
#include "nsBuiltinDecoderReader.h"
namespace mozilla {
class nsDASHReader : public nsBuiltinDecoderReader
{
public:
typedef mozilla::MediaResource MediaResource;
nsDASHReader(nsBuiltinDecoder* aDecoder) :
nsBuiltinDecoderReader(aDecoder),
mReadMetadataMonitor("media.dashreader.readmetadata"),
@ -310,5 +310,6 @@ private:
MonitoredSubReaderList mVideoReaders;
};
} // namespace mozilla
#endif

View File

@ -20,7 +20,7 @@
#include "MediaResource.h"
#include "nsDASHRepDecoder.h"
using mozilla::ReentrantMonitor;
namespace mozilla {
#ifdef PR_LOGGING
extern PRLogModuleInfo* gBuiltinDecoderLog;
@ -381,3 +381,5 @@ nsDASHRepDecoder::ReleaseStateMachine()
nsBuiltinDecoder::ReleaseStateMachine();
}
} // namespace mozilla

View File

@ -22,6 +22,8 @@
#include "nsWebMReader.h"
#include "nsBuiltinDecoder.h"
namespace mozilla {
class nsDASHDecoder;
class nsDASHRepDecoder : public nsBuiltinDecoder
@ -185,4 +187,6 @@ private:
nsBuiltinDecoderReader* mReader;
};
} // namespace mozilla
#endif //nsDASHRepDecoder_h_

View File

@ -8,7 +8,12 @@
#include "nsGStreamerReader.h"
#include "nsGStreamerDecoder.h"
namespace mozilla {
nsBuiltinDecoderStateMachine* nsGStreamerDecoder::CreateStateMachine()
{
return new nsBuiltinDecoderStateMachine(this, new nsGStreamerReader(this));
}
} // namespace mozilla

View File

@ -9,6 +9,8 @@
#include "nsBuiltinDecoder.h"
namespace mozilla {
class nsGStreamerDecoder : public nsBuiltinDecoder
{
public:
@ -16,4 +18,6 @@ public:
virtual nsBuiltinDecoderStateMachine* CreateStateMachine();
};
} // namespace mozilla
#endif

View File

@ -13,8 +13,9 @@
#include "nsTimeRanges.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
using namespace mozilla::layers;
namespace mozilla {
using namespace layers;
// Un-comment to enable logging of seek bisections.
//#define SEEK_LOGGING
@ -835,3 +836,6 @@ void nsGStreamerReader::Eos(GstAppSink *aSink)
mon.NotifyAll();
}
}
} // namespace mozilla

View File

@ -11,9 +11,12 @@
#include <gst/video/video.h>
#include "nsBuiltinDecoderReader.h"
class nsBuiltinDecoder;
class nsTimeRanges;
namespace mozilla {
class nsBuiltinDecoder;
class nsGStreamerReader : public nsBuiltinDecoderReader
{
public:
@ -134,4 +137,6 @@ private:
int fpsDen;
};
} // namespace mozilla
#endif

View File

@ -8,9 +8,10 @@
#include "nsAudioAvailableEventManager.h"
#include "VideoUtils.h"
static const nsTArray< nsCOMPtr<nsIRunnable> >::size_type MAX_PENDING_EVENTS = 100;
using namespace mozilla;
namespace mozilla {
static const nsTArray< nsCOMPtr<nsIRunnable> >::size_type MAX_PENDING_EVENTS = 100;
class nsAudioAvailableEventRunner : public nsRunnable
{
@ -243,3 +244,6 @@ void nsAudioAvailableEventManager::NotifyAudioAvailableListener()
mHasListener = true;
}
} // namespace mozilla

View File

@ -12,6 +12,7 @@
#include "nsBuiltinDecoder.h"
#include "nsBuiltinDecoderReader.h"
namespace mozilla {
class nsAudioAvailableEventManager
{
@ -29,7 +30,7 @@ public:
// Queues audio sample data and re-packages it into equal sized
// framebuffers. Called from the audio thread.
void QueueWrittenAudioData(mozilla::AudioDataValue* aAudioData,
void QueueWrittenAudioData(AudioDataValue* aAudioData,
uint32_t aAudioDataLength,
uint64_t aEndTimeSampleOffset);
@ -78,7 +79,7 @@ private:
// ReentrantMonitor for shared access to mPendingEvents queue or
// buffer length.
mozilla::ReentrantMonitor mReentrantMonitor;
ReentrantMonitor mReentrantMonitor;
// True if something in the owning document has a listener on the
// "MozAudioAvailable" event. If not, we don't need to bother copying played
@ -86,4 +87,6 @@ private:
bool mHasListener;
};
} // namespace mozilla
#endif

View File

@ -29,9 +29,17 @@ extern "C" {
#if defined(MOZ_CUBEB)
#include "nsAutoRef.h"
#include "cubeb/cubeb.h"
template <>
class nsAutoRefTraits<cubeb_stream> : public nsPointerRefTraits<cubeb_stream>
{
public:
static void Release(cubeb_stream* aStream) { cubeb_stream_destroy(aStream); }
};
#endif
using namespace mozilla;
namespace mozilla {
#if defined(XP_MACOSX)
#define SA_PER_STREAM_VOLUME 1
@ -730,13 +738,6 @@ nsRemotedAudioStream::IsPaused()
#endif
#if defined(MOZ_CUBEB)
template <>
class nsAutoRefTraits<cubeb_stream> : public nsPointerRefTraits<cubeb_stream>
{
public:
static void Release(cubeb_stream* aStream) { cubeb_stream_destroy(aStream); }
};
class nsCircularByteBuffer
{
public:
@ -1198,3 +1199,4 @@ nsBufferedAudioStream::StateCallback(cubeb_state aState)
}
#endif
} // namespace mozilla

View File

@ -12,6 +12,8 @@
#include "nsAutoPtr.h"
#include "AudioSampleFormat.h"
namespace mozilla {
// Access to a single instance of this class must be synchronized by
// callers, or made from a single thread. One exception is that access to
// GetPosition, GetPositionInFrames, SetVolume, and Get{Rate,Channels}
@ -105,4 +107,6 @@ protected:
int mChannels;
};
} // namespace mozilla
#endif

View File

@ -21,9 +21,10 @@
#include "nsError.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
using namespace mozilla::layers;
namespace mozilla {
// Number of milliseconds between progress events as defined by spec
static const uint32_t PROGRESS_MS = 350;
@ -38,9 +39,6 @@ static const uint32_t STALL_MS = 3000;
// fluctuating bitrates.
static const int64_t CAN_PLAY_THROUGH_MARGIN = 10;
using namespace mozilla;
#ifdef PR_LOGGING
PRLogModuleInfo* gBuiltinDecoderLog;
#define LOG(type, msg) PR_LOG(gBuiltinDecoderLog, type, msg)
@ -48,7 +46,6 @@ PRLogModuleInfo* gBuiltinDecoderLog;
#define LOG(type, msg)
#endif
namespace mozilla {
class MediaMemoryReporter
{
MediaMemoryReporter();
@ -105,8 +102,6 @@ public:
}
};
} //namespace mozilla
NS_IMPL_THREADSAFE_ISUPPORTS1(nsBuiltinDecoder, nsIObserver)
void nsBuiltinDecoder::Pause()
@ -1559,8 +1554,6 @@ nsBuiltinDecoder::IsDASHEnabled()
}
#endif
namespace mozilla {
MediaMemoryReporter* MediaMemoryReporter::sUniqueInstance;
NS_MEMORY_REPORTER_IMPLEMENT(MediaDecodedVideoMemory,
@ -1592,3 +1585,4 @@ MediaMemoryReporter::~MediaMemoryReporter()
}
} // namespace mozilla

View File

@ -193,22 +193,23 @@ destroying the nsBuiltinDecoder object.
#include "MediaStreamGraph.h"
#include "MediaDecoderOwner.h"
namespace mozilla {
namespace layers {
class Image;
} //namespace
class nsMediaByteRange;
class VideoFrameContainer;
} //namespace
class nsAudioStream;
class nsBuiltinDecoderStateMachine;
class nsIStreamListener;
class nsTimeRanges;
class nsIMemoryReporter;
class nsIPrincipal;
class nsITimer;
namespace mozilla {
namespace layers {
class Image;
} //namespace layers
class MediaByteRange;
class VideoFrameContainer;
class nsAudioStream;
class nsBuiltinDecoderStateMachine;
class MediaDecoderOwner;
// The size to use for audio data frames in MozAudioAvailable events.
// This value is per channel, and is chosen to give ~43 fps of events,
// for example, 44100 with 2 channels, 2*1024 = 2048.
@ -226,21 +227,7 @@ static inline bool IsCurrentThread(nsIThread* aThread) {
class nsBuiltinDecoder : public nsIObserver
{
public:
typedef mozilla::MediaChannelStatistics MediaChannelStatistics;
typedef mozilla::MediaResource MediaResource;
typedef mozilla::MediaByteRange MediaByteRange;
typedef mozilla::ReentrantMonitor ReentrantMonitor;
typedef mozilla::SourceMediaStream SourceMediaStream;
typedef mozilla::ProcessedMediaStream ProcessedMediaStream;
typedef mozilla::MediaInputPort MediaInputPort;
typedef mozilla::MainThreadMediaStreamListener MainThreadMediaStreamListener;
typedef mozilla::TimeStamp TimeStamp;
typedef mozilla::TimeDuration TimeDuration;
typedef mozilla::VideoFrameContainer VideoFrameContainer;
typedef mozilla::layers::Image Image;
typedef mozilla::MetadataTags MetadataTags;
typedef mozilla::MediaDecoderOwner MediaDecoderOwner;
class DecodedStreamMainThreadListener;
NS_DECL_ISUPPORTS
@ -1042,4 +1029,6 @@ protected:
bool mShuttingDown;
};
} // namespace mozilla
#endif

View File

@ -14,9 +14,10 @@
#include "mozilla/mozalloc.h"
#include "mozilla/StandardInteger.h"
using namespace mozilla;
using mozilla::layers::ImageContainer;
using mozilla::layers::PlanarYCbCrImage;
namespace mozilla {
using layers::ImageContainer;
using layers::PlanarYCbCrImage;
// Verify these values are sane. Once we've checked the frame sizes, we then
// can do less integer overflow checking.
@ -533,4 +534,5 @@ nsresult nsBuiltinDecoderReader::DecodeToTarget(int64_t aTarget)
return NS_OK;
}
} // namespace mozilla

View File

@ -16,6 +16,8 @@
#include "MediaResource.h"
#include "nsHTMLMediaElement.h"
namespace mozilla {
class nsBuiltinDecoder;
// Stores info relevant to presenting media frames.
@ -25,7 +27,7 @@ public:
: mAudioRate(44100),
mAudioChannels(2),
mDisplay(0,0),
mStereoMode(mozilla::STEREO_MODE_MONO),
mStereoMode(STEREO_MODE_MONO),
mHasAudio(false),
mHasVideo(false)
{}
@ -49,7 +51,7 @@ public:
nsIntSize mDisplay;
// Indicates the frame layout for single track stereo videos.
mozilla::StereoMode mStereoMode;
StereoMode mStereoMode;
// True if we have an active audio bitstream.
bool mHasAudio;
@ -61,8 +63,6 @@ public:
// Holds chunk a decoded audio frames.
class AudioData {
public:
typedef mozilla::SharedBuffer SharedBuffer;
typedef mozilla::AudioDataValue AudioDataValue;
AudioData(int64_t aOffset,
int64_t aTime,
@ -105,17 +105,15 @@ public:
nsAutoArrayPtr<AudioDataValue> mAudioData;
};
namespace mozilla {
namespace layers {
class GraphicBufferLocked;
}
}
// Holds a decoded video frame, in YCbCr format. These are queued in the reader.
class VideoData {
public:
typedef mozilla::layers::ImageContainer ImageContainer;
typedef mozilla::layers::Image Image;
typedef layers::ImageContainer ImageContainer;
typedef layers::Image Image;
// YCbCr data obtained from decoding the video. The index's are:
// 0 = Y
@ -155,7 +153,7 @@ public:
int64_t aOffset,
int64_t aTime,
int64_t aEndTime,
mozilla::layers::GraphicBufferLocked *aBuffer,
layers::GraphicBufferLocked *aBuffer,
bool aKeyframe,
int64_t aTimecode,
nsIntRect aPicture);
@ -224,8 +222,6 @@ class MediaQueueDeallocator : public nsDequeFunctor {
template <class T> class MediaQueue : private nsDeque {
public:
typedef mozilla::ReentrantMonitorAutoEnter ReentrantMonitorAutoEnter;
typedef mozilla::ReentrantMonitor ReentrantMonitor;
MediaQueue()
: nsDeque(new MediaQueueDeallocator<T>()),
@ -359,13 +355,6 @@ private:
// this class can only be accessed on the decode thread.
class nsBuiltinDecoderReader : public nsRunnable {
public:
typedef mozilla::ReentrantMonitor ReentrantMonitor;
typedef mozilla::ReentrantMonitorAutoEnter ReentrantMonitorAutoEnter;
typedef mozilla::VideoFrameContainer VideoFrameContainer;
typedef mozilla::MediaByteRange MediaByteRange;
typedef mozilla::AudioDataValue AudioDataValue;
typedef mozilla::MetadataTags MetadataTags;
nsBuiltinDecoderReader(nsBuiltinDecoder* aDecoder);
virtual ~nsBuiltinDecoderReader();
@ -503,4 +492,6 @@ protected:
nsVideoInfo mInfo;
};
} // namespace mozilla
#endif

View File

@ -21,8 +21,9 @@
#include "mozilla/StandardInteger.h"
#include "mozilla/Util.h"
using namespace mozilla;
using namespace mozilla::layers;
namespace mozilla {
using namespace layers;
#ifdef PR_LOGGING
extern PRLogModuleInfo* gBuiltinDecoderLog;
@ -2591,7 +2592,7 @@ nsresult nsBuiltinDecoderStateMachine::ScheduleStateMachine(int64_t aUsecs) {
mTimer->SetTarget(GetStateMachineThread());
}
res = mTimer->InitWithFuncCallback(::TimeoutExpired,
res = mTimer->InitWithFuncCallback(mozilla::TimeoutExpired,
this,
ms,
nsITimer::TYPE_ONE_SHOT);
@ -2602,7 +2603,7 @@ bool nsBuiltinDecoderStateMachine::OnStateMachineThread() const
{
return IsCurrentThread(GetStateMachineThread());
}
nsIThread* nsBuiltinDecoderStateMachine::GetStateMachineThread()
{
return StateMachineTracker::Instance().GetGlobalStateMachineThread();
@ -2620,3 +2621,5 @@ bool nsBuiltinDecoderStateMachine::IsShutdown()
return GetState() == DECODER_STATE_SHUTDOWN;
}
} // namespace mozilla

View File

@ -84,6 +84,7 @@ hardware (via nsAudioStream and libsydneyaudio).
#include "AudioSegment.h"
#include "VideoSegment.h"
namespace mozilla {
class nsBuiltinDecoderReader;
@ -102,17 +103,10 @@ class nsBuiltinDecoderReader;
class nsBuiltinDecoderStateMachine : public nsRunnable
{
public:
typedef mozilla::ReentrantMonitor ReentrantMonitor;
typedef mozilla::TimeStamp TimeStamp;
typedef mozilla::TimeDuration TimeDuration;
typedef mozilla::VideoFrameContainer VideoFrameContainer;
typedef nsBuiltinDecoder::DecodedStreamData DecodedStreamData;
typedef mozilla::SourceMediaStream SourceMediaStream;
typedef mozilla::AudioSegment AudioSegment;
typedef mozilla::VideoSegment VideoSegment;
typedef mozilla::MediaDecoderOwner MediaDecoderOwner;
nsBuiltinDecoderStateMachine(nsBuiltinDecoder* aDecoder, nsBuiltinDecoderReader* aReader, bool aRealTime = false);
nsBuiltinDecoderStateMachine(nsBuiltinDecoder* aDecoder,
nsBuiltinDecoderReader* aReader,
bool aRealTime = false);
~nsBuiltinDecoderStateMachine();
// nsDecoderStateMachine interface
@ -336,7 +330,7 @@ private:
{
// Don't let Run() (called by media stream graph thread) race with
// Revoke() (called by decoder state machine thread)
mozilla::MutexAutoLock lock(mMutex);
MutexAutoLock lock(mMutex);
if (!mStateMachine)
return NS_OK;
stateMachine = mStateMachine;
@ -346,11 +340,11 @@ private:
}
void Revoke()
{
mozilla::MutexAutoLock lock(mMutex);
MutexAutoLock lock(mMutex);
mStateMachine = nullptr;
}
mozilla::Mutex mMutex;
Mutex mMutex;
// Protected by mMutex.
// We don't use an owning pointer here, because keeping mStateMachine alive
// would mean in some cases we'd have to destroy mStateMachine from this
@ -760,4 +754,5 @@ private:
nsVideoInfo mInfo;
};
} // namespace mozilla;
#endif

View File

@ -20,7 +20,7 @@
#include "mozilla/Attributes.h"
#include "nsAnonymousTemporaryFile.h"
using namespace mozilla;
namespace mozilla {
#ifdef PR_LOGGING
PRLogModuleInfo* gMediaCacheLog;
@ -2279,3 +2279,6 @@ nsresult nsMediaCacheStream::GetCachedRanges(nsTArray<MediaByteRange>& aRanges)
}
return NS_OK;
}
} // namespace mozilla

View File

@ -17,7 +17,6 @@ class ChannelMediaResource;
class MediaByteRange;
class MediaResource;
class ReentrantMonitorAutoEnter;
}
/**
* Media applications want fast, "on demand" random access to media data,
@ -181,11 +180,6 @@ class nsMediaCache;
*/
class nsMediaCacheStream {
public:
typedef mozilla::ChannelMediaResource ChannelMediaResource;
typedef mozilla::MediaByteRange MediaByteRange;
typedef mozilla::MediaResource MediaResource;
typedef mozilla::ReentrantMonitorAutoEnter ReentrantMonitorAutoEnter;
enum {
// This needs to be a power of two
BLOCK_SIZE = 32768
@ -506,4 +500,6 @@ private:
int64_t mPartialBlockBuffer[BLOCK_SIZE/sizeof(int64_t)];
};
} // namespace mozilla
#endif

View File

@ -14,7 +14,7 @@
#include "mozilla/StandardInteger.h"
#include "mozilla/Util.h" // DebugOnly
using namespace mozilla;
namespace mozilla {
#ifdef PR_LOGGING
extern PRLogModuleInfo* gBuiltinDecoderLog;
@ -1529,3 +1529,7 @@ bool nsSkeletonState::DecodeHeader(ogg_packet* aPacket)
}
return false;
}
} // namespace mozilla

View File

@ -36,6 +36,8 @@
#include <map>
#endif
namespace mozilla {
// Deallocates a packet, used in nsPacketQueue below.
class OggPacketDeallocator : public nsDequeFunctor {
virtual void* operator() (void* aPacket) {
@ -514,6 +516,8 @@ private:
nsClassHashtable<nsUint32HashKey, nsKeyFrameIndex> mIndex;
};
} // namespace mozilla
// This allows the use of nsAutoRefs for an ogg_packet that properly free the
// contents of the packet.
template <>
@ -521,8 +525,9 @@ class nsAutoRefTraits<ogg_packet> : public nsPointerRefTraits<ogg_packet>
{
public:
static void Release(ogg_packet* aPacket) {
nsOggCodecState::ReleasePacket(aPacket);
mozilla::nsOggCodecState::ReleasePacket(aPacket);
}
};
#endif

View File

@ -8,7 +8,11 @@
#include "nsOggReader.h"
#include "nsOggDecoder.h"
namespace mozilla {
nsBuiltinDecoderStateMachine* nsOggDecoder::CreateStateMachine()
{
return new nsBuiltinDecoderStateMachine(this, new nsOggReader(this));
}
} // namespace mozilla

View File

@ -8,6 +8,8 @@
#include "nsBuiltinDecoder.h"
namespace mozilla {
class nsOggDecoder : public nsBuiltinDecoder
{
public:
@ -20,4 +22,6 @@ public:
virtual nsBuiltinDecoderStateMachine* CreateStateMachine();
};
} // namespace mozilla
#endif

View File

@ -19,7 +19,7 @@ extern "C" {
#include "mozilla/TimeStamp.h"
#include "VorbisUtils.h"
using namespace mozilla;
namespace mozilla {
// On B2G estimate the buffered ranges rather than calculating them explicitly.
// This prevents us doing I/O on the main thread, which is prohibited in B2G.
@ -1728,3 +1728,6 @@ bool nsOggReader::IsKnownStream(uint32_t aSerial)
return false;
}
} // namespace mozilla

View File

@ -17,9 +17,11 @@
#include "nsOggCodecState.h"
#include "VideoUtils.h"
class nsTimeRanges;
namespace mozilla {
class nsBuiltinDecoder;
class nsTimeRanges;
class nsOggReader : public nsBuiltinDecoderReader
{
@ -276,4 +278,6 @@ private:
nsIntRect mPicture;
};
} // namespace mozilla
#endif

View File

@ -29,6 +29,7 @@ PRLogModuleInfo *gOmxDecoderLog;
#endif
using namespace MPAPI;
using namespace mozilla;
namespace mozilla {
namespace layers {

View File

@ -31,6 +31,7 @@ namespace android {
// MediaStreamSource is a DataSource that reads from a MPAPI media stream.
class MediaStreamSource : public DataSource {
typedef mozilla::MediaResource MediaResource;
typedef mozilla::nsBuiltinDecoder nsBuiltinDecoder;
MediaResource *mResource;
nsBuiltinDecoder *mDecoder;
@ -65,6 +66,7 @@ class OmxDecoder {
typedef MPAPI::AudioFrame AudioFrame;
typedef MPAPI::VideoFrame VideoFrame;
typedef mozilla::MediaResource MediaResource;
typedef mozilla::nsBuiltinDecoder nsBuiltinDecoder;
enum {
kPreferSoftwareCodecs = 1

View File

@ -8,6 +8,8 @@
#include "nsMediaOmxReader.h"
#include "nsBuiltinDecoderStateMachine.h"
namespace mozilla {
nsMediaOmxDecoder::nsMediaOmxDecoder() :
nsBuiltinDecoder()
{
@ -26,3 +28,6 @@ nsBuiltinDecoderStateMachine* nsMediaOmxDecoder::CreateStateMachine()
nsMediaOmxDecoder::~nsMediaOmxDecoder()
{
}
} // namespace mozilla

View File

@ -9,6 +9,8 @@
#include "base/basictypes.h"
#include "nsBuiltinDecoder.h"
namespace mozilla {
class nsMediaOmxDecoder : public nsBuiltinDecoder
{
public:
@ -19,4 +21,6 @@ public:
virtual nsBuiltinDecoderStateMachine* CreateStateMachine();
};
} // namespace mozilla
#endif

View File

@ -14,7 +14,8 @@
#include "nsMediaOmxDecoder.h"
using namespace android;
using namespace mozilla;
namespace mozilla {
nsMediaOmxReader::nsMediaOmxReader(nsBuiltinDecoder *aDecoder) :
nsBuiltinDecoderReader(aDecoder),
@ -361,3 +362,6 @@ nsresult nsMediaOmxReader::GetBuffered(nsTimeRanges* aBuffered, int64_t aStartTi
}
return NS_OK;
}
} // namespace mozilla

View File

@ -14,6 +14,8 @@
#include "MPAPI.h"
namespace mozilla {
class nsMediaOmxReader : public nsBuiltinDecoderReader
{
nsCString mType;
@ -56,4 +58,6 @@ public:
};
} // namespace mozilla
#endif

View File

@ -8,6 +8,8 @@
#include "nsMediaPluginDecoder.h"
#include "nsMediaPluginReader.h"
namespace mozilla {
nsMediaPluginDecoder::nsMediaPluginDecoder(const nsACString& aType) : mType(aType)
{
}
@ -16,3 +18,6 @@ nsBuiltinDecoderStateMachine* nsMediaPluginDecoder::CreateStateMachine()
{
return new nsBuiltinDecoderStateMachine(this, new nsMediaPluginReader(this));
}
} // namespace mozilla

View File

@ -9,6 +9,8 @@
#include "nsBuiltinDecoder.h"
#include "nsMediaPluginDecoder.h"
namespace mozilla {
class nsMediaPluginDecoder : public nsBuiltinDecoder
{
nsCString mType;
@ -24,4 +26,6 @@ public:
virtual nsBuiltinDecoderStateMachine* CreateStateMachine();
};
} // namespace mozilla
#endif

View File

@ -18,7 +18,13 @@
#include "MPAPI.h"
using namespace MPAPI;
using namespace mozilla;
Decoder::Decoder() :
mResource(NULL), mPrivate(NULL)
{
}
namespace mozilla {
static MediaResource *GetResource(Decoder *aDecoder)
{
@ -148,11 +154,6 @@ bool nsMediaPluginHost::FindDecoder(const nsACString& aMimeType, const char* con
return false;
}
Decoder::Decoder() :
mResource(NULL), mPrivate(NULL)
{
}
MPAPI::Decoder *nsMediaPluginHost::CreateDecoder(MediaResource *aResource, const nsACString& aMimeType)
{
const char *chars;
@ -201,4 +202,4 @@ void nsMediaPluginHost::Shutdown()
}
}
} // namespace mozilla

View File

@ -10,6 +10,8 @@
#include "MediaResource.h"
#include "MPAPI.h"
namespace mozilla {
class nsMediaPluginReader;
class nsMediaPluginHost {
@ -29,4 +31,6 @@ public:
nsMediaPluginHost *GetMediaPluginHost();
} // namespace mozilla
#endif

View File

@ -12,7 +12,7 @@
#include "nsMediaPluginHost.h"
#include "nsBuiltinDecoderStateMachine.h"
using namespace mozilla;
namespace mozilla {
nsMediaPluginReader::nsMediaPluginReader(nsBuiltinDecoder *aDecoder) :
nsBuiltinDecoderReader(aDecoder),
@ -307,3 +307,5 @@ nsresult nsMediaPluginReader::GetBuffered(nsTimeRanges* aBuffered, int64_t aStar
return NS_OK;
}
} // namespace mozilla

View File

@ -12,6 +12,8 @@
#include "MPAPI.h"
namespace mozilla {
class nsMediaPluginReader : public nsBuiltinDecoderReader
{
nsCString mType;
@ -54,4 +56,6 @@ public:
};
} // namespace mozilla
#endif

View File

@ -6,7 +6,12 @@
#include "nsRawReader.h"
#include "nsRawDecoder.h"
namespace mozilla {
nsBuiltinDecoderStateMachine* nsRawDecoder::CreateStateMachine()
{
return new nsBuiltinDecoderStateMachine(this, new nsRawReader(this), true);
}
} // namespace mozilla

View File

@ -7,6 +7,8 @@
#include "nsBuiltinDecoder.h"
namespace mozilla {
class nsRawDecoder : public nsBuiltinDecoder
{
public:
@ -19,4 +21,6 @@ public:
virtual nsBuiltinDecoderStateMachine* CreateStateMachine();
};
} // namespace mozilla
#endif

View File

@ -9,6 +9,8 @@
#include "nsBuiltinDecoderReader.h"
#include "nsRawStructs.h"
namespace mozilla {
class nsRawReader : public nsBuiltinDecoderReader
{
public:
@ -52,4 +54,6 @@ private:
nsIntRect mPicture;
};
} // namespace mozilla
#endif

View File

@ -7,7 +7,11 @@
#include "nsWaveReader.h"
#include "nsWaveDecoder.h"
namespace mozilla {
nsBuiltinDecoderStateMachine* nsWaveDecoder::CreateStateMachine()
{
return new nsBuiltinDecoderStateMachine(this, new nsWaveReader(this));
}
} // namespace mozilla

View File

@ -19,6 +19,7 @@
* WAVE_FORMAT_EXTENSIBLE chunk format.
**/
namespace mozilla {
class nsWaveDecoder : public nsBuiltinDecoder
{
@ -32,4 +33,6 @@ public:
virtual nsBuiltinDecoderStateMachine* CreateStateMachine();
};
} // namespace mozilla
#endif

View File

@ -13,7 +13,7 @@
#include "mozilla/StandardInteger.h"
using namespace mozilla;
namespace mozilla {
// Un-comment to enable logging of seek bisections.
//#define SEEK_LOGGING
@ -542,3 +542,5 @@ nsWaveReader::GetPosition()
{
return mDecoder->GetResource()->Tell();
}
} // namespace mozilla

View File

@ -8,9 +8,12 @@
#include "nsBuiltinDecoderReader.h"
class nsBuiltinDecoder;
class nsTimeRanges;
namespace mozilla {
class nsBuiltinDecoder;
class nsWaveReader : public nsBuiltinDecoderReader
{
public:
@ -96,4 +99,6 @@ private:
int64_t mWavePCMOffset;
};
} // namespace mozilla
#endif

View File

@ -9,7 +9,7 @@
#include "nsTimeRanges.h"
#include "nsThreadUtils.h"
using mozilla::ReentrantMonitorAutoEnter;
namespace mozilla {
static const double NS_PER_S = 1e9;
@ -265,3 +265,6 @@ void nsWebMBufferedState::NotifyDataArrived(const char* aBuffer, uint32_t aLengt
}
}
}
} // namespace mozilla

View File

@ -11,7 +11,8 @@
#include "mozilla/ReentrantMonitor.h"
class nsTimeRanges;
using mozilla::ReentrantMonitor;
namespace mozilla {
// Stores a stream byte offset and the scaled timecode of the block at
// that offset. The timecode must be scaled by the stream's timecode
@ -208,4 +209,6 @@ private:
nsTArray<nsWebMBufferedParser> mRangeParsers;
};
} // namespace mozilla
#endif

View File

@ -8,7 +8,12 @@
#include "nsWebMReader.h"
#include "nsWebMDecoder.h"
namespace mozilla {
nsBuiltinDecoderStateMachine* nsWebMDecoder::CreateStateMachine()
{
return new nsBuiltinDecoderStateMachine(this, new nsWebMReader(this));
}
} // namespace mozilla

View File

@ -8,6 +8,8 @@
#include "nsBuiltinDecoder.h"
namespace mozilla {
class nsWebMDecoder : public nsBuiltinDecoder
{
public:
@ -20,4 +22,6 @@ public:
virtual nsBuiltinDecoderStateMachine* CreateStateMachine();
};
} // namespace mozilla
#endif

View File

@ -17,8 +17,18 @@
#include "vpx/vp8dx.h"
#include "vpx/vpx_decoder.h"
using namespace mozilla;
using namespace mozilla::layers;
using mozilla::NesteggPacketHolder;
template <>
class nsAutoRefTraits<NesteggPacketHolder> : public nsPointerRefTraits<NesteggPacketHolder>
{
public:
static void Release(NesteggPacketHolder* aHolder) { delete aHolder; }
};
namespace mozilla {
using namespace layers;
// Un-comment to enable logging of seek bisections.
//#define SEEK_LOGGING
@ -44,13 +54,6 @@ static const double NS_PER_S = 1e9;
// a full seek.
static const int SEEK_DECODE_MARGIN = 250000;
template <>
class nsAutoRefTraits<NesteggPacketHolder> : public nsPointerRefTraits<NesteggPacketHolder>
{
public:
static void Release(NesteggPacketHolder* aHolder) { delete aHolder; }
};
// Functions for reading and seeking using MediaResource required for
// nestegg_io. The 'user data' passed to these functions is the
// decoder from which the media resource is obtained.
@ -840,3 +843,7 @@ nsWebMReader::GetIndexByteRanges(nsTArray<MediaByteRange>& aByteRanges)
return NS_OK;
}
} // namespace mozilla

View File

@ -22,6 +22,8 @@
#include "vorbis/codec.h"
#endif
namespace mozilla {
class nsWebMBufferedState;
// Holds a nestegg_packet, and its file offset. This is needed so we
@ -98,8 +100,6 @@ class PacketQueue : private nsDeque {
class nsWebMReader : public nsBuiltinDecoderReader
{
public:
typedef mozilla::MediaByteRange MediaByteRange;
nsWebMReader(nsBuiltinDecoder* aDecoder);
~nsWebMReader();
@ -237,4 +237,6 @@ private:
nsTArray<MediaByteRange> mClusterByteRanges;
};
} // namespace mozilla
#endif