From eb3d295f7f9734ed0d728f0bd318c8fe80b7b93b Mon Sep 17 00:00:00 2001 From: Andrea Marchesini Date: Tue, 19 Mar 2013 13:23:54 +0100 Subject: [PATCH] Bug 841493 - Rename nsHTMLMediaElement to HTMLMediaElement, r=Ms2ger --HG-- rename : content/html/content/public/nsHTMLMediaElement.h => content/html/content/public/HTMLMediaElement.h rename : content/html/content/src/nsHTMLMediaElement.cpp => content/html/content/src/HTMLMediaElement.cpp --- content/base/public/nsINode.h | 4 +- content/base/src/nsContentUtils.cpp | 2 +- content/base/src/nsDocument.cpp | 6 +- content/base/src/nsNodeUtils.cpp | 4 +- ...sHTMLMediaElement.h => HTMLMediaElement.h} | 53 +- content/html/content/public/Makefile.in | 2 +- .../html/content/public/nsHTMLAudioElement.h | 8 +- .../html/content/public/nsHTMLVideoElement.h | 8 +- ...LMediaElement.cpp => HTMLMediaElement.cpp} | 509 +++++++++--------- .../html/content/src/HTMLSourceElement.cpp | 2 +- content/html/content/src/HTMLSourceElement.h | 2 +- content/html/content/src/Makefile.in | 2 +- content/html/content/src/MediaError.cpp | 2 +- content/html/content/src/MediaError.h | 8 +- content/html/content/src/TimeRanges.cpp | 2 +- .../html/content/src/nsHTMLAudioElement.cpp | 8 +- .../html/content/src/nsHTMLVideoElement.cpp | 14 +- content/html/document/src/VideoDocument.cpp | 8 +- content/media/MediaDecoderOwner.h | 10 +- content/media/MediaDecoderReader.h | 2 +- content/media/MediaResource.cpp | 20 +- content/media/VideoFrameContainer.cpp | 4 +- content/media/VideoFrameContainer.h | 14 +- content/media/dash/DASHDecoder.cpp | 8 +- content/media/dash/DASHReader.cpp | 2 +- content/media/ogg/OggCodecState.h | 2 +- content/media/plugins/MediaPluginHost.cpp | 2 +- content/media/test/test_playback_rate.html | 2 +- content/media/wave/WaveReader.cpp | 8 +- content/media/wave/WaveReader.h | 4 +- content/media/webaudio/MediaBufferDecoder.cpp | 2 +- layout/base/nsPresShell.cpp | 2 +- layout/generic/nsVideoFrame.cpp | 4 +- 33 files changed, 370 insertions(+), 360 deletions(-) rename content/html/content/public/{nsHTMLMediaElement.h => HTMLMediaElement.h} (96%) rename content/html/content/src/{nsHTMLMediaElement.cpp => HTMLMediaElement.cpp} (86%) diff --git a/content/base/public/nsINode.h b/content/base/public/nsINode.h index 93bdf5e6c5cf..5ff9dc0f14a5 100644 --- a/content/base/public/nsINode.h +++ b/content/base/public/nsINode.h @@ -284,7 +284,7 @@ public: // - HTMLFrameSetElement: mRowSpecs, mColSpecs // - nsHTMLInputElement: mInputData, mFiles, mFileList, mStaticDocfileList // - nsHTMLMapElement: mAreas - // - nsHTMLMediaElement: many! + // - HTMLMediaElement: many! // - nsHTMLOutputElement: mDefaultValue, mTokenList // - nsHTMLRowElement: mCells // - nsHTMLSelectElement: mOptions, mRestoreState @@ -360,7 +360,7 @@ public: /** data nodes (comments, PIs, text). Nodes of this type always returns a non-null value for nsIContent::GetText() */ eDATA_NODE = 1 << 8, - /** nsHTMLMediaElement */ + /** HTMLMediaElement */ eMEDIA = 1 << 9, /** animation elements */ eANIMATION = 1 << 10, diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUtils.cpp index 7a47e565d58d..79507d123bcc 100644 --- a/content/base/src/nsContentUtils.cpp +++ b/content/base/src/nsContentUtils.cpp @@ -168,7 +168,7 @@ #include "nsIBidiKeyboard.h" #endif #ifdef MOZ_MEDIA -#include "nsHTMLMediaElement.h" +#include "mozilla/dom/HTMLMediaElement.h" #endif extern "C" int MOZ_XMLTranslateEntity(const char* ptr, const char* end, diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index 36fd23eab80b..65955152ca73 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -147,7 +147,7 @@ #include "nsHtml5TreeOpExecutor.h" #include "nsIDOMElementReplaceEvent.h" #ifdef MOZ_MEDIA -#include "nsHTMLMediaElement.h" +#include "mozilla/dom/HTMLMediaElement.h" #endif // MOZ_MEDIA #ifdef MOZ_WEBRTC #include "IPeerConnection.h" @@ -3979,7 +3979,7 @@ NotifyActivityChanged(nsIContent *aContent, void *aUnused) #ifdef MOZ_MEDIA nsCOMPtr domMediaElem(do_QueryInterface(aContent)); if (domMediaElem) { - nsHTMLMediaElement* mediaElem = static_cast(aContent); + HTMLMediaElement* mediaElem = static_cast(aContent); mediaElem->NotifyOwnerDocumentActivityChanged(); } #endif @@ -8955,7 +8955,7 @@ NotifyAudioAvailableListener(nsIContent *aContent, void *aUnused) #ifdef MOZ_MEDIA nsCOMPtr domMediaElem(do_QueryInterface(aContent)); if (domMediaElem) { - nsHTMLMediaElement* mediaElem = static_cast(aContent); + HTMLMediaElement* mediaElem = static_cast(aContent); mediaElem->NotifyAudioAvailableListener(); } #endif diff --git a/content/base/src/nsNodeUtils.cpp b/content/base/src/nsNodeUtils.cpp index 249310f4efad..1e95255b1d1b 100644 --- a/content/base/src/nsNodeUtils.cpp +++ b/content/base/src/nsNodeUtils.cpp @@ -25,7 +25,7 @@ #include "nsBindingManager.h" #include "nsGenericHTMLElement.h" #ifdef MOZ_MEDIA -#include "nsHTMLMediaElement.h" +#include "mozilla/dom/HTMLMediaElement.h" #endif // MOZ_MEDIA #include "nsWrapperCacheInlines.h" #include "nsObjectLoadingContent.h" @@ -508,7 +508,7 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNode, bool aClone, bool aDeep, #ifdef MOZ_MEDIA nsCOMPtr domMediaElem(do_QueryInterface(aNode)); if (domMediaElem) { - nsHTMLMediaElement* mediaElem = static_cast(aNode); + HTMLMediaElement* mediaElem = static_cast(aNode); mediaElem->NotifyOwnerDocumentActivityChanged(); } #endif diff --git a/content/html/content/public/nsHTMLMediaElement.h b/content/html/content/public/HTMLMediaElement.h similarity index 96% rename from content/html/content/public/nsHTMLMediaElement.h rename to content/html/content/public/HTMLMediaElement.h index 6c52b584a2e1..18b846859498 100644 --- a/content/html/content/public/nsHTMLMediaElement.h +++ b/content/html/content/public/HTMLMediaElement.h @@ -3,8 +3,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#if !defined(nsHTMLMediaElement_h__) -#define nsHTMLMediaElement_h__ +#ifndef mozilla_dom_HTMLMediaElement_h +#define mozilla_dom_HTMLMediaElement_h #include "nsIDOMHTMLMediaElement.h" #include "nsGenericHTMLElement.h" @@ -39,10 +39,13 @@ class MediaResource; class MediaDecoder; } -class nsHTMLMediaElement : public nsGenericHTMLElement, - public nsIObserver, - public mozilla::MediaDecoderOwner, - public nsIAudioChannelAgentCallback +namespace mozilla { +namespace dom { + +class HTMLMediaElement : public nsGenericHTMLElement, + public nsIObserver, + public MediaDecoderOwner, + public nsIAudioChannelAgentCallback { public: typedef mozilla::TimeStamp TimeStamp; @@ -52,16 +55,13 @@ public: typedef mozilla::MediaResource MediaResource; typedef mozilla::MediaDecoderOwner MediaDecoderOwner; typedef mozilla::MetadataTags MetadataTags; - typedef mozilla::AudioStream AudioStream; - typedef mozilla::MediaDecoder MediaDecoder; - typedef mozilla::DOMMediaStream DOMMediaStream; - mozilla::CORSMode GetCORSMode() { + CORSMode GetCORSMode() { return mCORSMode; } - nsHTMLMediaElement(already_AddRefed aNodeInfo); - virtual ~nsHTMLMediaElement(); + HTMLMediaElement(already_AddRefed aNodeInfo); + virtual ~HTMLMediaElement(); /** * This is used when the browser is constructing a video element to play @@ -82,7 +82,7 @@ public: // nsISupports NS_DECL_ISUPPORTS_INHERITED - NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsHTMLMediaElement, + NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLMediaElement, nsGenericHTMLElement) virtual bool ParseAttribute(int32_t aNamespaceID, @@ -194,7 +194,7 @@ public: // Called by the media decoder and the video frame to get the // ImageContainer containing the video data. virtual VideoFrameContainer* GetVideoFrameContainer() MOZ_FINAL MOZ_OVERRIDE; - ImageContainer* GetImageContainer(); + layers::ImageContainer* GetImageContainer(); // Called by the video frame to get the print surface, if this is // a static document and we're not actually playing video @@ -255,7 +255,7 @@ public: // Returns the CanPlayStatus indicating if we can handle the // full MIME type including the optional codecs parameter. - static mozilla::CanPlayStatus GetCanPlay(const nsAString& aType); + static CanPlayStatus GetCanPlay(const nsAString& aType); /** * Called when a child source element is added to this media element. This @@ -296,7 +296,7 @@ public: */ bool GetPlayedOrSeeked() const { return mHasPlayedOrSeeked; } - nsresult CopyInnerTo(mozilla::dom::Element* aDest); + nsresult CopyInnerTo(Element* aDest); /** * Sets the Accept header on the HTTP channel to the required @@ -334,13 +334,13 @@ protected: class WakeLockBoolWrapper { public: WakeLockBoolWrapper(bool val = false) : mValue(val), mOuter(NULL), mWakeLock(NULL) {} - void SetOuter(nsHTMLMediaElement* outer) { mOuter = outer; } + void SetOuter(HTMLMediaElement* outer) { mOuter = outer; } operator bool() { return mValue; } WakeLockBoolWrapper& operator=(bool val); bool operator !() const { return !mValue; } private: bool mValue; - nsHTMLMediaElement* mOuter; + HTMLMediaElement* mOuter; nsCOMPtr mWakeLock; }; @@ -415,7 +415,7 @@ protected: * Call this to find a media element with the same NodePrincipal and mLoadingSrc * set to aURI, and with a decoder on which Load() has been called. */ - nsHTMLMediaElement* LookupMediaElementURITable(nsIURI* aURI); + HTMLMediaElement* LookupMediaElementURITable(nsIURI* aURI); /** * Shutdown and clear mDecoder and maintain associated invariants. @@ -595,9 +595,9 @@ protected: */ void SuspendOrResumeElement(bool aPauseElement, bool aSuspendEvents); - // Get the nsHTMLMediaElement object if the decoder is being used from an + // Get the HTMLMediaElement object if the decoder is being used from an // HTML media element, and null otherwise. - virtual nsHTMLMediaElement* GetMediaElement() MOZ_FINAL MOZ_OVERRIDE + virtual HTMLMediaElement* GetMediaElement() MOZ_FINAL MOZ_OVERRIDE { return this; } @@ -771,7 +771,7 @@ protected: nsAutoPtr mAudioStream; // Range of time played. - mozilla::dom::TimeRanges mPlayed; + TimeRanges mPlayed; // Stores the time at the start of the current 'played' range. double mCurrentPlayRangeStart; @@ -880,7 +880,7 @@ protected: bool mMediaSecurityVerified; // The CORS mode when loading the media element - mozilla::CORSMode mCORSMode; + CORSMode mCORSMode; // True if the media has an audio track bool mHasAudio; @@ -889,7 +889,7 @@ protected: bool mDownloadSuspendedByCache; // Audio Channel Type. - mozilla::dom::AudioChannelType mAudioChannelType; + AudioChannelType mAudioChannelType; // The audiochannel has been suspended. bool mChannelSuspended; @@ -901,4 +901,7 @@ protected: nsCOMPtr mAudioChannelAgent; }; -#endif +} // namespace dom +} // namespace mozilla + +#endif // mozilla_dom_HTMLMediaElement_h diff --git a/content/html/content/public/Makefile.in b/content/html/content/public/Makefile.in index 5ef5259e747c..593944d08e93 100644 --- a/content/html/content/public/Makefile.in +++ b/content/html/content/public/Makefile.in @@ -22,7 +22,6 @@ EXPORTS = \ nsITextControlElement.h \ nsFormSubmission.h \ nsHTMLAudioElement.h \ - nsHTMLMediaElement.h \ nsHTMLVideoElement.h \ nsIHTMLCollection.h \ $(NULL) @@ -31,6 +30,7 @@ EXPORTS_NAMESPACES = mozilla/dom EXPORTS_mozilla/dom = \ HTMLCanvasElement.h \ + HTMLMediaElement.h \ $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/content/html/content/public/nsHTMLAudioElement.h b/content/html/content/public/nsHTMLAudioElement.h index 23d9d8c5dc68..962f5042c613 100644 --- a/content/html/content/public/nsHTMLAudioElement.h +++ b/content/html/content/public/nsHTMLAudioElement.h @@ -8,12 +8,12 @@ #include "nsIDOMHTMLAudioElement.h" #include "nsIJSNativeInitializer.h" -#include "nsHTMLMediaElement.h" +#include "mozilla/dom/HTMLMediaElement.h" typedef uint16_t nsMediaNetworkState; typedef uint16_t nsMediaReadyState; -class nsHTMLAudioElement : public nsHTMLMediaElement, +class nsHTMLAudioElement : public mozilla::dom::HTMLMediaElement, public nsIDOMHTMLAudioElement, public nsIJSNativeInitializer { @@ -34,8 +34,8 @@ public: NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC // nsIDOMHTMLMediaElement - using nsHTMLMediaElement::GetPaused; - NS_FORWARD_NSIDOMHTMLMEDIAELEMENT(nsHTMLMediaElement::) + using mozilla::dom::HTMLMediaElement::GetPaused; + NS_FORWARD_NSIDOMHTMLMEDIAELEMENT(mozilla::dom::HTMLMediaElement::) // nsIDOMHTMLAudioElement NS_DECL_NSIDOMHTMLAUDIOELEMENT diff --git a/content/html/content/public/nsHTMLVideoElement.h b/content/html/content/public/nsHTMLVideoElement.h index 9322c02347fb..1c20a69377e3 100644 --- a/content/html/content/public/nsHTMLVideoElement.h +++ b/content/html/content/public/nsHTMLVideoElement.h @@ -7,9 +7,9 @@ #define nsHTMLVideoElement_h__ #include "nsIDOMHTMLVideoElement.h" -#include "nsHTMLMediaElement.h" +#include "mozilla/dom/HTMLMediaElement.h" -class nsHTMLVideoElement : public nsHTMLMediaElement, +class nsHTMLVideoElement : public mozilla::dom::HTMLMediaElement, public nsIDOMHTMLVideoElement { public: @@ -31,8 +31,8 @@ public: NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC // nsIDOMHTMLMediaElement - using nsHTMLMediaElement::GetPaused; - NS_FORWARD_NSIDOMHTMLMEDIAELEMENT(nsHTMLMediaElement::) + using mozilla::dom::HTMLMediaElement::GetPaused; + NS_FORWARD_NSIDOMHTMLMEDIAELEMENT(mozilla::dom::HTMLMediaElement::) // nsIDOMHTMLVideoElement NS_DECL_NSIDOMHTMLVIDEOELEMENT diff --git a/content/html/content/src/nsHTMLMediaElement.cpp b/content/html/content/src/HTMLMediaElement.cpp similarity index 86% rename from content/html/content/src/nsHTMLMediaElement.cpp rename to content/html/content/src/HTMLMediaElement.cpp index 604e6e27a9b2..61d5d7f229c8 100644 --- a/content/html/content/src/nsHTMLMediaElement.cpp +++ b/content/html/content/src/HTMLMediaElement.cpp @@ -4,7 +4,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "nsHTMLMediaElement.h" +#include "mozilla/dom/HTMLMediaElement.h" #include "mozilla/MathAlgorithms.h" #include "mozilla/Util.h" @@ -93,12 +93,12 @@ static PRLogModuleInfo* gMediaElementEventsLog; #include "nsIPermissionManager.h" -using namespace mozilla; -using namespace mozilla::dom; using namespace mozilla::layers; - using mozilla::net::nsMediaFragmentURIParser; +namespace mozilla { +namespace dom { + // Number of milliseconds between timeupdate events as defined by spec #define TIMEUPDATE_MS 250 @@ -160,7 +160,7 @@ class nsMediaEvent : public nsRunnable { public: - nsMediaEvent(nsHTMLMediaElement* aElement) : + nsMediaEvent(HTMLMediaElement* aElement) : mElement(aElement), mLoadID(mElement->GetCurrentLoadID()) {} ~nsMediaEvent() {} @@ -172,7 +172,7 @@ protected: return mElement->GetCurrentLoadID() != mLoadID; } - nsRefPtr mElement; + nsRefPtr mElement; uint32_t mLoadID; }; @@ -182,7 +182,7 @@ private: nsString mName; public: - nsAsyncEventRunner(const nsAString& aName, nsHTMLMediaElement* aElement) : + nsAsyncEventRunner(const nsAString& aName, HTMLMediaElement* aElement) : nsMediaEvent(aElement), mName(aName) { } @@ -202,7 +202,7 @@ class nsSourceErrorEventRunner : public nsMediaEvent private: nsCOMPtr mSource; public: - nsSourceErrorEventRunner(nsHTMLMediaElement* aElement, + nsSourceErrorEventRunner(HTMLMediaElement* aElement, nsIContent* aSource) : nsMediaEvent(aElement), mSource(aSource) @@ -224,14 +224,14 @@ public: /** * There is a reference cycle involving this class: MediaLoadListener - * holds a reference to the nsHTMLMediaElement, which holds a reference + * holds a reference to the HTMLMediaElement, which holds a reference * to an nsIChannel, which holds a reference to this listener. * We break the reference cycle in OnStartRequest by clearing mElement. */ -class nsHTMLMediaElement::MediaLoadListener MOZ_FINAL : public nsIStreamListener, - public nsIChannelEventSink, - public nsIInterfaceRequestor, - public nsIObserver +class HTMLMediaElement::MediaLoadListener MOZ_FINAL : public nsIStreamListener, + public nsIChannelEventSink, + public nsIInterfaceRequestor, + public nsIObserver { NS_DECL_ISUPPORTS NS_DECL_NSIREQUESTOBSERVER @@ -241,7 +241,7 @@ class nsHTMLMediaElement::MediaLoadListener MOZ_FINAL : public nsIStreamListener NS_DECL_NSIINTERFACEREQUESTOR public: - MediaLoadListener(nsHTMLMediaElement* aElement) + MediaLoadListener(HTMLMediaElement* aElement) : mElement(aElement), mLoadID(aElement->GetCurrentLoadID()) { @@ -249,18 +249,18 @@ public: } private: - nsRefPtr mElement; + nsRefPtr mElement; nsCOMPtr mNextListener; uint32_t mLoadID; }; -NS_IMPL_ISUPPORTS5(nsHTMLMediaElement::MediaLoadListener, nsIRequestObserver, +NS_IMPL_ISUPPORTS5(HTMLMediaElement::MediaLoadListener, nsIRequestObserver, nsIStreamListener, nsIChannelEventSink, nsIInterfaceRequestor, nsIObserver) NS_IMETHODIMP -nsHTMLMediaElement::MediaLoadListener::Observe(nsISupports* aSubject, - const char* aTopic, const PRUnichar* aData) +HTMLMediaElement::MediaLoadListener::Observe(nsISupports* aSubject, + const char* aTopic, const PRUnichar* aData) { nsContentUtils::UnregisterShutdownObserver(this); @@ -269,9 +269,9 @@ nsHTMLMediaElement::MediaLoadListener::Observe(nsISupports* aSubject, return NS_OK; } -void nsHTMLMediaElement::ReportLoadError(const char* aMsg, - const PRUnichar** aParams, - uint32_t aParamCount) +void HTMLMediaElement::ReportLoadError(const char* aMsg, + const PRUnichar** aParams, + uint32_t aParamCount) { nsContentUtils::ReportToConsole(nsIScriptError::warningFlag, "Media", @@ -283,7 +283,7 @@ void nsHTMLMediaElement::ReportLoadError(const char* aMsg, } -NS_IMETHODIMP nsHTMLMediaElement::MediaLoadListener::OnStartRequest(nsIRequest* aRequest, nsISupports* aContext) +NS_IMETHODIMP HTMLMediaElement::MediaLoadListener::OnStartRequest(nsIRequest* aRequest, nsISupports* aContext) { nsContentUtils::UnregisterShutdownObserver(this); @@ -294,7 +294,7 @@ NS_IMETHODIMP nsHTMLMediaElement::MediaLoadListener::OnStartRequest(nsIRequest* // The element is only needed until we've had a chance to call // InitializeDecoderForChannel. So make sure mElement is cleared here. - nsRefPtr element; + nsRefPtr element; element.swap(mElement); if (mLoadID != element->GetCurrentLoadID()) { @@ -352,8 +352,8 @@ NS_IMETHODIMP nsHTMLMediaElement::MediaLoadListener::OnStartRequest(nsIRequest* return rv; } -NS_IMETHODIMP nsHTMLMediaElement::MediaLoadListener::OnStopRequest(nsIRequest* aRequest, nsISupports* aContext, - nsresult aStatus) +NS_IMETHODIMP HTMLMediaElement::MediaLoadListener::OnStopRequest(nsIRequest* aRequest, nsISupports* aContext, + nsresult aStatus) { if (mNextListener) { return mNextListener->OnStopRequest(aRequest, aContext, aStatus); @@ -362,11 +362,11 @@ NS_IMETHODIMP nsHTMLMediaElement::MediaLoadListener::OnStopRequest(nsIRequest* a } NS_IMETHODIMP -nsHTMLMediaElement::MediaLoadListener::OnDataAvailable(nsIRequest* aRequest, - nsISupports* aContext, - nsIInputStream* aStream, - uint64_t aOffset, - uint32_t aCount) +HTMLMediaElement::MediaLoadListener::OnDataAvailable(nsIRequest* aRequest, + nsISupports* aContext, + nsIInputStream* aStream, + uint64_t aOffset, + uint32_t aCount) { if (!mNextListener) { NS_ERROR("Must have a chained listener; OnStartRequest should have canceled this request"); @@ -375,10 +375,10 @@ nsHTMLMediaElement::MediaLoadListener::OnDataAvailable(nsIRequest* aRequest, return mNextListener->OnDataAvailable(aRequest, aContext, aStream, aOffset, aCount); } -NS_IMETHODIMP nsHTMLMediaElement::MediaLoadListener::AsyncOnChannelRedirect(nsIChannel* aOldChannel, - nsIChannel* aNewChannel, - uint32_t aFlags, - nsIAsyncVerifyRedirectCallback* cb) +NS_IMETHODIMP HTMLMediaElement::MediaLoadListener::AsyncOnChannelRedirect(nsIChannel* aOldChannel, + nsIChannel* aNewChannel, + uint32_t aFlags, + nsIAsyncVerifyRedirectCallback* cb) { // TODO is this really correct?? See bug #579329. if (mElement) @@ -391,15 +391,15 @@ NS_IMETHODIMP nsHTMLMediaElement::MediaLoadListener::AsyncOnChannelRedirect(nsIC return NS_OK; } -NS_IMETHODIMP nsHTMLMediaElement::MediaLoadListener::GetInterface(const nsIID & aIID, void **aResult) +NS_IMETHODIMP HTMLMediaElement::MediaLoadListener::GetInterface(const nsIID & aIID, void **aResult) { return QueryInterface(aIID, aResult); } -NS_IMPL_ADDREF_INHERITED(nsHTMLMediaElement, nsGenericHTMLElement) -NS_IMPL_RELEASE_INHERITED(nsHTMLMediaElement, nsGenericHTMLElement) +NS_IMPL_ADDREF_INHERITED(HTMLMediaElement, nsGenericHTMLElement) +NS_IMPL_RELEASE_INHERITED(HTMLMediaElement, nsGenericHTMLElement) -NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsHTMLMediaElement, nsGenericHTMLElement) +NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(HTMLMediaElement, nsGenericHTMLElement) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSrcStream) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSrcAttrStream) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSourcePointer) @@ -411,7 +411,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsHTMLMediaElement, nsGenericH } NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END -NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsHTMLMediaElement, nsGenericHTMLElement) +NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(HTMLMediaElement, nsGenericHTMLElement) if (tmp->mSrcStream) { // Need to EndMediaStreamPlayback to clear mStream and make sure everything // gets unhooked correctly. @@ -427,23 +427,23 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsHTMLMediaElement, nsGenericHTM } NS_IMPL_CYCLE_COLLECTION_UNLINK_END -NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsHTMLMediaElement) +NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(HTMLMediaElement) NS_INTERFACE_MAP_ENTRY(nsIObserver) NS_INTERFACE_MAP_ENTRY(nsIAudioChannelAgentCallback) NS_INTERFACE_MAP_END_INHERITING(nsGenericHTMLElement) // nsIDOMHTMLMediaElement -NS_IMPL_URI_ATTR(nsHTMLMediaElement, Src, src) -NS_IMPL_STRING_ATTR(nsHTMLMediaElement, Crossorigin, crossorigin) -NS_IMPL_BOOL_ATTR(nsHTMLMediaElement, Controls, controls) -NS_IMPL_BOOL_ATTR(nsHTMLMediaElement, Autoplay, autoplay) -NS_IMPL_BOOL_ATTR(nsHTMLMediaElement, Loop, loop) -NS_IMPL_BOOL_ATTR(nsHTMLMediaElement, DefaultMuted, muted) -NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(nsHTMLMediaElement, Preload, preload, NULL) -NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(nsHTMLMediaElement, MozAudioChannelType, mozaudiochannel, "normal") +NS_IMPL_URI_ATTR(HTMLMediaElement, Src, src) +NS_IMPL_STRING_ATTR(HTMLMediaElement, Crossorigin, crossorigin) +NS_IMPL_BOOL_ATTR(HTMLMediaElement, Controls, controls) +NS_IMPL_BOOL_ATTR(HTMLMediaElement, Autoplay, autoplay) +NS_IMPL_BOOL_ATTR(HTMLMediaElement, Loop, loop) +NS_IMPL_BOOL_ATTR(HTMLMediaElement, DefaultMuted, muted) +NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(HTMLMediaElement, Preload, preload, NULL) +NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(HTMLMediaElement, MozAudioChannelType, mozaudiochannel, "normal") NS_IMETHODIMP -nsHTMLMediaElement::GetMozSrcObject(nsIDOMMediaStream** aStream) +HTMLMediaElement::GetMozSrcObject(nsIDOMMediaStream** aStream) { NS_ASSERTION(!mSrcAttrStream || mSrcAttrStream->GetStream(), "MediaStream should have been set up properly"); @@ -453,7 +453,7 @@ nsHTMLMediaElement::GetMozSrcObject(nsIDOMMediaStream** aStream) } NS_IMETHODIMP -nsHTMLMediaElement::SetMozSrcObject(nsIDOMMediaStream* aStream) +HTMLMediaElement::SetMozSrcObject(nsIDOMMediaStream* aStream) { mSrcAttrStream = static_cast(aStream); Load(); @@ -461,7 +461,7 @@ nsHTMLMediaElement::SetMozSrcObject(nsIDOMMediaStream* aStream) } /* readonly attribute nsIDOMHTMLMediaElement mozAutoplayEnabled; */ -NS_IMETHODIMP nsHTMLMediaElement::GetMozAutoplayEnabled(bool *aAutoplayEnabled) +NS_IMETHODIMP HTMLMediaElement::GetMozAutoplayEnabled(bool *aAutoplayEnabled) { *aAutoplayEnabled = mAutoplayEnabled; @@ -469,7 +469,7 @@ NS_IMETHODIMP nsHTMLMediaElement::GetMozAutoplayEnabled(bool *aAutoplayEnabled) } /* readonly attribute nsIDOMMediaError error; */ -NS_IMETHODIMP nsHTMLMediaElement::GetError(nsIDOMMediaError * *aError) +NS_IMETHODIMP HTMLMediaElement::GetError(nsIDOMMediaError * *aError) { NS_IF_ADDREF(*aError = mError); @@ -477,7 +477,7 @@ NS_IMETHODIMP nsHTMLMediaElement::GetError(nsIDOMMediaError * *aError) } /* readonly attribute boolean ended; */ -NS_IMETHODIMP nsHTMLMediaElement::GetEnded(bool *aEnded) +NS_IMETHODIMP HTMLMediaElement::GetEnded(bool *aEnded) { if (mSrcStream) { *aEnded = GetSrcMediaStream()->IsFinished(); @@ -488,7 +488,7 @@ NS_IMETHODIMP nsHTMLMediaElement::GetEnded(bool *aEnded) } /* readonly attribute DOMString currentSrc; */ -NS_IMETHODIMP nsHTMLMediaElement::GetCurrentSrc(nsAString & aCurrentSrc) +NS_IMETHODIMP HTMLMediaElement::GetCurrentSrc(nsAString & aCurrentSrc) { nsAutoCString src; GetCurrentSpec(src); @@ -497,7 +497,7 @@ NS_IMETHODIMP nsHTMLMediaElement::GetCurrentSrc(nsAString & aCurrentSrc) } /* readonly attribute unsigned short networkState; */ -NS_IMETHODIMP nsHTMLMediaElement::GetNetworkState(uint16_t *aNetworkState) +NS_IMETHODIMP HTMLMediaElement::GetNetworkState(uint16_t *aNetworkState) { *aNetworkState = mNetworkState; @@ -505,9 +505,9 @@ NS_IMETHODIMP nsHTMLMediaElement::GetNetworkState(uint16_t *aNetworkState) } nsresult -nsHTMLMediaElement::OnChannelRedirect(nsIChannel *aChannel, - nsIChannel *aNewChannel, - uint32_t aFlags) +HTMLMediaElement::OnChannelRedirect(nsIChannel *aChannel, + nsIChannel *aNewChannel, + uint32_t aFlags) { NS_ASSERTION(aChannel == mChannel, "Channels should match!"); mChannel = aNewChannel; @@ -533,7 +533,7 @@ nsHTMLMediaElement::OnChannelRedirect(nsIChannel *aChannel, return NS_OK; } -void nsHTMLMediaElement::ShutdownDecoder() +void HTMLMediaElement::ShutdownDecoder() { RemoveMediaElementFromURITable(); NS_ASSERTION(mDecoder, "Must have decoder to shut down"); @@ -541,7 +541,7 @@ void nsHTMLMediaElement::ShutdownDecoder() mDecoder = nullptr; } -void nsHTMLMediaElement::AbortExistingLoads() +void HTMLMediaElement::AbortExistingLoads() { // Abort any already-running instance of the resource selection algorithm. mLoadWaitStatus = NOT_WAITING; @@ -610,7 +610,7 @@ void nsHTMLMediaElement::AbortExistingLoads() mIsRunningSelectResource = false; } -void nsHTMLMediaElement::NoSupportedMediaSourceError() +void HTMLMediaElement::NoSupportedMediaSourceError() { NS_ASSERTION(mDelayingLoadEvent, "Load event not delayed during source selection?"); @@ -621,7 +621,7 @@ void nsHTMLMediaElement::NoSupportedMediaSourceError() ChangeDelayLoadStatus(false); } -typedef void (nsHTMLMediaElement::*SyncSectionFn)(); +typedef void (HTMLMediaElement::*SyncSectionFn)(); // Runs a "synchronous section", a function that must run once the event loop // has reached a "stable state". See: @@ -631,7 +631,7 @@ class nsSyncSection : public nsMediaEvent private: SyncSectionFn mClosure; public: - nsSyncSection(nsHTMLMediaElement* aElement, + nsSyncSection(HTMLMediaElement* aElement, SyncSectionFn aClosure) : nsMediaEvent(aElement), mClosure(aClosure) @@ -652,7 +652,7 @@ static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID); // Asynchronously awaits a stable state, whereupon aClosure runs on the main // thread. This adds an event which run aClosure to the appshell's list of // sections synchronous the next time control returns to the event loop. -void AsyncAwaitStableState(nsHTMLMediaElement* aElement, +void AsyncAwaitStableState(HTMLMediaElement* aElement, SyncSectionFn aClosure) { nsCOMPtr event = new nsSyncSection(aElement, aClosure); @@ -660,25 +660,25 @@ void AsyncAwaitStableState(nsHTMLMediaElement* aElement, appShell->RunInStableState(event); } -void nsHTMLMediaElement::QueueLoadFromSourceTask() +void HTMLMediaElement::QueueLoadFromSourceTask() { ChangeDelayLoadStatus(true); mNetworkState = nsIDOMHTMLMediaElement::NETWORK_LOADING; - AsyncAwaitStableState(this, &nsHTMLMediaElement::LoadFromSourceChildren); + AsyncAwaitStableState(this, &HTMLMediaElement::LoadFromSourceChildren); } -void nsHTMLMediaElement::QueueSelectResourceTask() +void HTMLMediaElement::QueueSelectResourceTask() { // Don't allow multiple async select resource calls to be queued. if (mHaveQueuedSelectResource) return; mHaveQueuedSelectResource = true; mNetworkState = nsIDOMHTMLMediaElement::NETWORK_NO_SOURCE; - AsyncAwaitStableState(this, &nsHTMLMediaElement::SelectResourceWrapper); + AsyncAwaitStableState(this, &HTMLMediaElement::SelectResourceWrapper); } /* void load (); */ -NS_IMETHODIMP nsHTMLMediaElement::Load() +NS_IMETHODIMP HTMLMediaElement::Load() { if (mIsRunningLoadMethod) return NS_OK; @@ -692,7 +692,7 @@ NS_IMETHODIMP nsHTMLMediaElement::Load() return NS_OK; } -void nsHTMLMediaElement::ResetState() +void HTMLMediaElement::ResetState() { mMediaSize = nsIntSize(-1, -1); VideoFrameContainer* container = GetVideoFrameContainer(); @@ -714,14 +714,14 @@ static bool HasSourceChildren(nsIContent *aElement) return false; } -void nsHTMLMediaElement::SelectResourceWrapper() +void HTMLMediaElement::SelectResourceWrapper() { SelectResource(); mIsRunningSelectResource = false; mHaveQueuedSelectResource = false; } -void nsHTMLMediaElement::SelectResource() +void HTMLMediaElement::SelectResource() { if (!mSrcAttrStream && !HasAttr(kNameSpaceID_None, nsGkAtoms::src) && !HasSourceChildren(this)) { @@ -759,7 +759,7 @@ void nsHTMLMediaElement::SelectResource() "Should think we're not loading from source children by default"); mLoadingSrc = uri; - if (mPreloadAction == nsHTMLMediaElement::PRELOAD_NONE) { + if (mPreloadAction == HTMLMediaElement::PRELOAD_NONE) { // preload:none media, suspend the load here before we make any // network requests. SuspendLoad(); @@ -782,7 +782,7 @@ void nsHTMLMediaElement::SelectResource() } } -void nsHTMLMediaElement::NotifyLoadError() +void HTMLMediaElement::NotifyLoadError() { if (!mIsLoadingFromSourceChildren) { LOG(PR_LOG_DEBUG, ("NotifyLoadError(), no supported media error")); @@ -795,9 +795,9 @@ void nsHTMLMediaElement::NotifyLoadError() } } -void nsHTMLMediaElement::NotifyAudioAvailable(float* aFrameBuffer, - uint32_t aFrameBufferLength, - float aTime) +void HTMLMediaElement::NotifyAudioAvailable(float* aFrameBuffer, + uint32_t aFrameBufferLength, + float aTime) { // Auto manage the memory for the frame buffer, so that if we add an early // return-on-error here in future, we won't forget to release the memory. @@ -816,7 +816,7 @@ void nsHTMLMediaElement::NotifyAudioAvailable(float* aFrameBuffer, DispatchAudioAvailableEvent(frameBuffer.forget(), aFrameBufferLength, aTime); } -void nsHTMLMediaElement::LoadFromSourceChildren() +void HTMLMediaElement::LoadFromSourceChildren() { NS_ASSERTION(mDelayingLoadEvent, "Should delay load event (if in document) during load"); @@ -887,7 +887,7 @@ void nsHTMLMediaElement::LoadFromSourceChildren() NS_ASSERTION(mNetworkState == nsIDOMHTMLMediaElement::NETWORK_LOADING, "Network state should be loading"); - if (mPreloadAction == nsHTMLMediaElement::PRELOAD_NONE) { + if (mPreloadAction == HTMLMediaElement::PRELOAD_NONE) { // preload:none media, suspend the load here before we make any // network requests. SuspendLoad(); @@ -904,7 +904,7 @@ void nsHTMLMediaElement::LoadFromSourceChildren() NS_NOTREACHED("Execution should not reach here!"); } -void nsHTMLMediaElement::SuspendLoad() +void HTMLMediaElement::SuspendLoad() { mSuspendedForPreloadNone = true; mNetworkState = nsIDOMHTMLMediaElement::NETWORK_IDLE; @@ -912,7 +912,7 @@ void nsHTMLMediaElement::SuspendLoad() ChangeDelayLoadStatus(false); } -void nsHTMLMediaElement::ResumeLoad(PreloadAction aAction) +void HTMLMediaElement::ResumeLoad(PreloadAction aAction) { NS_ASSERTION(mSuspendedForPreloadNone, "Must be halted for preload:none to resume from preload:none suspended load."); @@ -939,7 +939,7 @@ static bool IsAutoplayEnabled() return Preferences::GetBool("media.autoplay.enabled"); } -void nsHTMLMediaElement::UpdatePreloadAction() +void HTMLMediaElement::UpdatePreloadAction() { PreloadAction nextAction = PRELOAD_UNDEFINED; // If autoplay is set, or we're playing, we should always preload data, @@ -947,31 +947,31 @@ void nsHTMLMediaElement::UpdatePreloadAction() if ((IsAutoplayEnabled() && HasAttr(kNameSpaceID_None, nsGkAtoms::autoplay)) || !mPaused) { - nextAction = nsHTMLMediaElement::PRELOAD_ENOUGH; + nextAction = HTMLMediaElement::PRELOAD_ENOUGH; } else { // Find the appropriate preload action by looking at the attribute. const nsAttrValue* val = mAttrsAndChildren.GetAttr(nsGkAtoms::preload, kNameSpaceID_None); uint32_t preloadDefault = Preferences::GetInt("media.preload.default", - nsHTMLMediaElement::PRELOAD_ATTR_METADATA); + HTMLMediaElement::PRELOAD_ATTR_METADATA); uint32_t preloadAuto = Preferences::GetInt("media.preload.auto", - nsHTMLMediaElement::PRELOAD_ENOUGH); + HTMLMediaElement::PRELOAD_ENOUGH); if (!val) { // Attribute is not set. Use the preload action specified by the // media.preload.default pref, or just preload metadata if not present. nextAction = static_cast(preloadDefault); } else if (val->Type() == nsAttrValue::eEnum) { PreloadAttrValue attr = static_cast(val->GetEnumValue()); - if (attr == nsHTMLMediaElement::PRELOAD_ATTR_EMPTY || - attr == nsHTMLMediaElement::PRELOAD_ATTR_AUTO) + if (attr == HTMLMediaElement::PRELOAD_ATTR_EMPTY || + attr == HTMLMediaElement::PRELOAD_ATTR_AUTO) { nextAction = static_cast(preloadAuto); - } else if (attr == nsHTMLMediaElement::PRELOAD_ATTR_METADATA) { - nextAction = nsHTMLMediaElement::PRELOAD_METADATA; - } else if (attr == nsHTMLMediaElement::PRELOAD_ATTR_NONE) { - nextAction = nsHTMLMediaElement::PRELOAD_NONE; + } else if (attr == HTMLMediaElement::PRELOAD_ATTR_METADATA) { + nextAction = HTMLMediaElement::PRELOAD_METADATA; + } else if (attr == HTMLMediaElement::PRELOAD_ATTR_NONE) { + nextAction = HTMLMediaElement::PRELOAD_NONE; } } else { // Use the suggested "missing value default" of "metadata", or the value @@ -988,7 +988,7 @@ void nsHTMLMediaElement::UpdatePreloadAction() } mPreloadAction = nextAction; - if (nextAction == nsHTMLMediaElement::PRELOAD_ENOUGH) { + if (nextAction == HTMLMediaElement::PRELOAD_ENOUGH) { if (mSuspendedForPreloadNone) { // Our load was previouly suspended due to the media having preload // value "none". The preload value has changed to preload:auto, so @@ -1000,7 +1000,7 @@ void nsHTMLMediaElement::UpdatePreloadAction() StopSuspendingAfterFirstFrame(); } - } else if (nextAction == nsHTMLMediaElement::PRELOAD_METADATA) { + } else if (nextAction == HTMLMediaElement::PRELOAD_METADATA) { // Ensure that the video can be suspended after first frame. mAllowSuspendAfterFirstFrame = true; if (mSuspendedForPreloadNone) { @@ -1013,7 +1013,7 @@ void nsHTMLMediaElement::UpdatePreloadAction() } } -nsresult nsHTMLMediaElement::LoadResource() +nsresult HTMLMediaElement::LoadResource() { NS_ASSERTION(mDelayingLoadEvent, "Should delay load event (if in document) during load"); @@ -1041,7 +1041,7 @@ nsresult nsHTMLMediaElement::LoadResource() // Set the media element's CORS mode only when loading a resource mCORSMode = AttrValueToCORSMode(GetParsedAttr(nsGkAtoms::crossorigin)); - nsHTMLMediaElement* other = LookupMediaElementURITable(mLoadingSrc); + HTMLMediaElement* other = LookupMediaElementURITable(mLoadingSrc); if (other && other->mDecoder) { // Clone it. nsresult rv = InitializeDecoderAsClone(other->mDecoder); @@ -1142,8 +1142,8 @@ nsresult nsHTMLMediaElement::LoadResource() return NS_OK; } -nsresult nsHTMLMediaElement::LoadWithChannel(nsIChannel *aChannel, - nsIStreamListener **aListener) +nsresult HTMLMediaElement::LoadWithChannel(nsIChannel *aChannel, + nsIStreamListener **aListener) { NS_ENSURE_ARG_POINTER(aChannel); NS_ENSURE_ARG_POINTER(aListener); @@ -1173,7 +1173,7 @@ nsresult nsHTMLMediaElement::LoadWithChannel(nsIChannel *aChannel, return NS_OK; } -NS_IMETHODIMP nsHTMLMediaElement::MozLoadFrom(nsIDOMHTMLMediaElement* aOther) +NS_IMETHODIMP HTMLMediaElement::MozLoadFrom(nsIDOMHTMLMediaElement* aOther) { NS_ENSURE_ARG_POINTER(aOther); @@ -1185,7 +1185,7 @@ NS_IMETHODIMP nsHTMLMediaElement::MozLoadFrom(nsIDOMHTMLMediaElement* aOther) mIsRunningLoadMethod = false; nsCOMPtr content = do_QueryInterface(aOther); - nsHTMLMediaElement* other = static_cast(content.get()); + HTMLMediaElement* other = static_cast(content.get()); if (!other || !other->mDecoder) return NS_OK; @@ -1205,7 +1205,7 @@ NS_IMETHODIMP nsHTMLMediaElement::MozLoadFrom(nsIDOMHTMLMediaElement* aOther) } /* readonly attribute unsigned short readyState; */ -NS_IMETHODIMP nsHTMLMediaElement::GetReadyState(uint16_t *aReadyState) +NS_IMETHODIMP HTMLMediaElement::GetReadyState(uint16_t *aReadyState) { *aReadyState = mReadyState; @@ -1213,7 +1213,7 @@ NS_IMETHODIMP nsHTMLMediaElement::GetReadyState(uint16_t *aReadyState) } /* readonly attribute boolean seeking; */ -NS_IMETHODIMP nsHTMLMediaElement::GetSeeking(bool *aSeeking) +NS_IMETHODIMP HTMLMediaElement::GetSeeking(bool *aSeeking) { *aSeeking = mDecoder && mDecoder->IsSeeking(); @@ -1221,7 +1221,7 @@ NS_IMETHODIMP nsHTMLMediaElement::GetSeeking(bool *aSeeking) } /* attribute double currentTime; */ -NS_IMETHODIMP nsHTMLMediaElement::GetCurrentTime(double *aCurrentTime) +NS_IMETHODIMP HTMLMediaElement::GetCurrentTime(double *aCurrentTime) { if (mSrcStream) { *aCurrentTime = MediaTimeToSeconds(GetSrcMediaStream()->GetCurrentTime()); @@ -1233,7 +1233,7 @@ NS_IMETHODIMP nsHTMLMediaElement::GetCurrentTime(double *aCurrentTime) return NS_OK; } -NS_IMETHODIMP nsHTMLMediaElement::SetCurrentTime(double aCurrentTime) +NS_IMETHODIMP HTMLMediaElement::SetCurrentTime(double aCurrentTime) { StopSuspendingAfterFirstFrame(); @@ -1291,7 +1291,7 @@ NS_IMETHODIMP nsHTMLMediaElement::SetCurrentTime(double aCurrentTime) } /* readonly attribute double duration; */ -NS_IMETHODIMP nsHTMLMediaElement::GetDuration(double *aDuration) +NS_IMETHODIMP HTMLMediaElement::GetDuration(double *aDuration) { if (mSrcStream) { *aDuration = std::numeric_limits::infinity(); @@ -1304,7 +1304,7 @@ NS_IMETHODIMP nsHTMLMediaElement::GetDuration(double *aDuration) } /* readonly attribute nsIDOMHTMLTimeRanges seekable; */ -NS_IMETHODIMP nsHTMLMediaElement::GetSeekable(nsIDOMTimeRanges** aSeekable) +NS_IMETHODIMP HTMLMediaElement::GetSeekable(nsIDOMTimeRanges** aSeekable) { nsRefPtr ranges = new TimeRanges(); if (mDecoder && mReadyState > nsIDOMHTMLMediaElement::HAVE_NOTHING) { @@ -1316,7 +1316,7 @@ NS_IMETHODIMP nsHTMLMediaElement::GetSeekable(nsIDOMTimeRanges** aSeekable) /* readonly attribute boolean paused; */ -NS_IMETHODIMP nsHTMLMediaElement::GetPaused(bool *aPaused) +NS_IMETHODIMP HTMLMediaElement::GetPaused(bool *aPaused) { *aPaused = mPaused; @@ -1324,7 +1324,7 @@ NS_IMETHODIMP nsHTMLMediaElement::GetPaused(bool *aPaused) } /* readonly attribute nsIDOMHTMLTimeRanges played; */ -NS_IMETHODIMP nsHTMLMediaElement::GetPlayed(nsIDOMTimeRanges** aPlayed) +NS_IMETHODIMP HTMLMediaElement::GetPlayed(nsIDOMTimeRanges** aPlayed) { TimeRanges* ranges = new TimeRanges(); NS_ADDREF(*aPlayed = ranges); @@ -1353,7 +1353,7 @@ NS_IMETHODIMP nsHTMLMediaElement::GetPlayed(nsIDOMTimeRanges** aPlayed) } /* void pause (); */ -NS_IMETHODIMP nsHTMLMediaElement::Pause() +NS_IMETHODIMP HTMLMediaElement::Pause() { if (mNetworkState == nsIDOMHTMLMediaElement::NETWORK_EMPTY) { LOG(PR_LOG_DEBUG, ("Loading due to Pause()")); @@ -1381,14 +1381,14 @@ NS_IMETHODIMP nsHTMLMediaElement::Pause() } /* attribute double volume; */ -NS_IMETHODIMP nsHTMLMediaElement::GetVolume(double *aVolume) +NS_IMETHODIMP HTMLMediaElement::GetVolume(double *aVolume) { *aVolume = mVolume; return NS_OK; } -NS_IMETHODIMP nsHTMLMediaElement::SetVolume(double aVolume) +NS_IMETHODIMP HTMLMediaElement::SetVolume(double aVolume) { if (!(aVolume >= 0.0 && aVolume <= 1.0)) return NS_ERROR_DOM_INDEX_SIZE_ERR; @@ -1414,7 +1414,7 @@ NS_IMETHODIMP nsHTMLMediaElement::SetVolume(double aVolume) } NS_IMETHODIMP -nsHTMLMediaElement::GetMozChannels(uint32_t *aMozChannels) +HTMLMediaElement::GetMozChannels(uint32_t *aMozChannels) { if (!mDecoder && !mAudioStream) { return NS_ERROR_DOM_INVALID_STATE_ERR; @@ -1425,7 +1425,7 @@ nsHTMLMediaElement::GetMozChannels(uint32_t *aMozChannels) } NS_IMETHODIMP -nsHTMLMediaElement::GetMozSampleRate(uint32_t *aMozSampleRate) +HTMLMediaElement::GetMozSampleRate(uint32_t *aMozSampleRate) { if (!mDecoder && !mAudioStream) { return NS_ERROR_DOM_INVALID_STATE_ERR; @@ -1443,9 +1443,9 @@ typedef struct { } MetadataIterCx; PLDHashOperator -nsHTMLMediaElement::BuildObjectFromTags(nsCStringHashKey::KeyType aKey, - nsCString aValue, - void* aUserArg) +HTMLMediaElement::BuildObjectFromTags(nsCStringHashKey::KeyType aKey, + nsCString aValue, + void* aUserArg) { MetadataIterCx* args = static_cast(aUserArg); @@ -1468,7 +1468,7 @@ nsHTMLMediaElement::BuildObjectFromTags(nsCStringHashKey::KeyType aKey, } NS_IMETHODIMP -nsHTMLMediaElement::MozGetMetadata(JSContext* cx, JS::Value* aValue) +HTMLMediaElement::MozGetMetadata(JSContext* cx, JS::Value* aValue) { if (mReadyState < nsIDOMHTMLMediaElement::HAVE_METADATA) { return NS_ERROR_DOM_INVALID_STATE_ERR; @@ -1492,7 +1492,7 @@ nsHTMLMediaElement::MozGetMetadata(JSContext* cx, JS::Value* aValue) } NS_IMETHODIMP -nsHTMLMediaElement::GetMozFrameBufferLength(uint32_t *aMozFrameBufferLength) +HTMLMediaElement::GetMozFrameBufferLength(uint32_t *aMozFrameBufferLength) { // The framebuffer (via MozAudioAvailable events) is only available // when reading vs. writing audio directly. @@ -1505,7 +1505,7 @@ nsHTMLMediaElement::GetMozFrameBufferLength(uint32_t *aMozFrameBufferLength) } NS_IMETHODIMP -nsHTMLMediaElement::SetMozFrameBufferLength(uint32_t aMozFrameBufferLength) +HTMLMediaElement::SetMozFrameBufferLength(uint32_t aMozFrameBufferLength) { if (!mDecoder) return NS_ERROR_DOM_INVALID_STATE_ERR; @@ -1514,14 +1514,14 @@ nsHTMLMediaElement::SetMozFrameBufferLength(uint32_t aMozFrameBufferLength) } /* attribute boolean muted; */ -NS_IMETHODIMP nsHTMLMediaElement::GetMuted(bool *aMuted) +NS_IMETHODIMP HTMLMediaElement::GetMuted(bool *aMuted) { *aMuted = mMuted; return NS_OK; } -void nsHTMLMediaElement::SetMutedInternal(bool aMuted) +void HTMLMediaElement::SetMutedInternal(bool aMuted) { float effectiveVolume = aMuted ? 0.0f : float(mVolume); @@ -1534,7 +1534,7 @@ void nsHTMLMediaElement::SetMutedInternal(bool aMuted) } } -NS_IMETHODIMP nsHTMLMediaElement::SetMuted(bool aMuted) +NS_IMETHODIMP HTMLMediaElement::SetMuted(bool aMuted) { if (aMuted == mMuted) return NS_OK; @@ -1548,7 +1548,7 @@ NS_IMETHODIMP nsHTMLMediaElement::SetMuted(bool aMuted) } already_AddRefed -nsHTMLMediaElement::CaptureStreamInternal(bool aFinishWhenEnded) +HTMLMediaElement::CaptureStreamInternal(bool aFinishWhenEnded) { nsIDOMWindow* window = OwnerDoc()->GetInnerWindow(); if (!window) { @@ -1575,7 +1575,7 @@ nsHTMLMediaElement::CaptureStreamInternal(bool aFinishWhenEnded) return result.forget(); } -NS_IMETHODIMP nsHTMLMediaElement::MozCaptureStream(nsIDOMMediaStream** aStream) +NS_IMETHODIMP HTMLMediaElement::MozCaptureStream(nsIDOMMediaStream** aStream) { *aStream = CaptureStreamInternal(false).get(); if (!*aStream) { @@ -1584,7 +1584,7 @@ NS_IMETHODIMP nsHTMLMediaElement::MozCaptureStream(nsIDOMMediaStream** aStream) return NS_OK; } -NS_IMETHODIMP nsHTMLMediaElement::MozCaptureStreamUntilEnded(nsIDOMMediaStream** aStream) +NS_IMETHODIMP HTMLMediaElement::MozCaptureStreamUntilEnded(nsIDOMMediaStream** aStream) { *aStream = CaptureStreamInternal(true).get(); if (!*aStream) { @@ -1593,7 +1593,7 @@ NS_IMETHODIMP nsHTMLMediaElement::MozCaptureStreamUntilEnded(nsIDOMMediaStream** return NS_OK; } -NS_IMETHODIMP nsHTMLMediaElement::GetMozAudioCaptured(bool *aCaptured) +NS_IMETHODIMP HTMLMediaElement::GetMozAudioCaptured(bool *aCaptured) { *aCaptured = mAudioCaptured; return NS_OK; @@ -1604,7 +1604,7 @@ public: MediaElementSetForURI(const nsIURI* aKey) : nsURIHashKey(aKey) {} MediaElementSetForURI(const MediaElementSetForURI& toCopy) : nsURIHashKey(toCopy), mElements(toCopy.mElements) {} - nsTArray mElements; + nsTArray mElements; }; typedef nsTHashtable MediaElementURITable; @@ -1618,7 +1618,7 @@ static MediaElementURITable* gElementTable; // Returns the number of times aElement appears in the media element table // for aURI. If this returns other than 0 or 1, there's a bug somewhere! static unsigned -MediaElementTableCount(nsHTMLMediaElement* aElement, nsIURI* aURI) +MediaElementTableCount(HTMLMediaElement* aElement, nsIURI* aURI) { if (!gElementTable || !aElement || !aURI) { return 0; @@ -1629,7 +1629,7 @@ MediaElementTableCount(nsHTMLMediaElement* aElement, nsIURI* aURI) } uint32_t count = 0; for (uint32_t i = 0; i < entry->mElements.Length(); ++i) { - nsHTMLMediaElement* elem = entry->mElements[i]; + HTMLMediaElement* elem = entry->mElements[i]; if (elem == aElement) { count++; } @@ -1639,7 +1639,7 @@ MediaElementTableCount(nsHTMLMediaElement* aElement, nsIURI* aURI) #endif void -nsHTMLMediaElement::AddMediaElementToURITable() +HTMLMediaElement::AddMediaElementToURITable() { NS_ASSERTION(mDecoder && mDecoder->GetResource(), "Call this only with decoder Load called"); NS_ASSERTION(MediaElementTableCount(this, mLoadingSrc) == 0, @@ -1655,7 +1655,7 @@ nsHTMLMediaElement::AddMediaElementToURITable() } void -nsHTMLMediaElement::RemoveMediaElementFromURITable() +HTMLMediaElement::RemoveMediaElementFromURITable() { NS_ASSERTION(MediaElementTableCount(this, mLoadingSrc) == 1, "Before remove, should have a single entry for element in element table"); @@ -1678,8 +1678,8 @@ nsHTMLMediaElement::RemoveMediaElementFromURITable() "After remove, should no longer have an entry in element table"); } -nsHTMLMediaElement* -nsHTMLMediaElement::LookupMediaElementURITable(nsIURI* aURI) +HTMLMediaElement* +HTMLMediaElement::LookupMediaElementURITable(nsIURI* aURI) { if (!gElementTable) return nullptr; @@ -1687,7 +1687,7 @@ nsHTMLMediaElement::LookupMediaElementURITable(nsIURI* aURI) if (!entry) return nullptr; for (uint32_t i = 0; i < entry->mElements.Length(); ++i) { - nsHTMLMediaElement* elem = entry->mElements[i]; + HTMLMediaElement* elem = entry->mElements[i]; bool equal; // Look for elements that have the same principal and CORS mode. // Ditto for anything else that could cause us to send different headers. @@ -1703,7 +1703,7 @@ nsHTMLMediaElement::LookupMediaElementURITable(nsIURI* aURI) return nullptr; } -nsHTMLMediaElement::nsHTMLMediaElement(already_AddRefed aNodeInfo) +HTMLMediaElement::HTMLMediaElement(already_AddRefed aNodeInfo) : nsGenericHTMLElement(aNodeInfo), mSrcStreamListener(nullptr), mCurrentLoadID(0), @@ -1768,7 +1768,7 @@ nsHTMLMediaElement::nsHTMLMediaElement(already_AddRefed aNodeInfo) NotifyOwnerDocumentActivityChanged(); } -nsHTMLMediaElement::~nsHTMLMediaElement() +HTMLMediaElement::~HTMLMediaElement() { NS_ASSERTION(!mHasSelfReference, "How can we be destroyed if we're still holding a self reference?"); @@ -1796,20 +1796,20 @@ nsHTMLMediaElement::~nsHTMLMediaElement() } void -nsHTMLMediaElement::GetItemValueText(nsAString& aValue) +HTMLMediaElement::GetItemValueText(nsAString& aValue) { // Can't call GetSrc because we don't have a JSContext GetURIAttr(nsGkAtoms::src, nullptr, aValue); } void -nsHTMLMediaElement::SetItemValueText(const nsAString& aValue) +HTMLMediaElement::SetItemValueText(const nsAString& aValue) { // Can't call SetSrc because we don't have a JSContext SetAttr(kNameSpaceID_None, nsGkAtoms::src, aValue, true); } -void nsHTMLMediaElement::StopSuspendingAfterFirstFrame() +void HTMLMediaElement::StopSuspendingAfterFirstFrame() { mAllowSuspendAfterFirstFrame = false; if (!mSuspendedAfterFirstFrame) @@ -1820,7 +1820,7 @@ void nsHTMLMediaElement::StopSuspendingAfterFirstFrame() } } -void nsHTMLMediaElement::SetPlayedOrSeeked(bool aValue) +void HTMLMediaElement::SetPlayedOrSeeked(bool aValue) { if (aValue == mHasPlayedOrSeeked) { return; @@ -1838,7 +1838,7 @@ void nsHTMLMediaElement::SetPlayedOrSeeked(bool aValue) NS_FRAME_IS_DIRTY); } -NS_IMETHODIMP nsHTMLMediaElement::Play() +NS_IMETHODIMP HTMLMediaElement::Play() { StopSuspendingAfterFirstFrame(); SetPlayedOrSeeked(true); @@ -1901,7 +1901,7 @@ NS_IMETHODIMP nsHTMLMediaElement::Play() return NS_OK; } -nsHTMLMediaElement::WakeLockBoolWrapper& nsHTMLMediaElement::WakeLockBoolWrapper::operator=(bool val) { +HTMLMediaElement::WakeLockBoolWrapper& HTMLMediaElement::WakeLockBoolWrapper::operator=(bool val) { if (mValue == val) return *this; if (!mWakeLock && !val && mOuter) { @@ -1918,17 +1918,17 @@ nsHTMLMediaElement::WakeLockBoolWrapper& nsHTMLMediaElement::WakeLockBoolWrapper return *this; } -bool nsHTMLMediaElement::ParseAttribute(int32_t aNamespaceID, - nsIAtom* aAttribute, - const nsAString& aValue, - nsAttrValue& aResult) +bool HTMLMediaElement::ParseAttribute(int32_t aNamespaceID, + nsIAtom* aAttribute, + const nsAString& aValue, + nsAttrValue& aResult) { // Mappings from 'preload' attribute strings to an enumeration. static const nsAttrValue::EnumTable kPreloadTable[] = { - { "", nsHTMLMediaElement::PRELOAD_ATTR_EMPTY }, - { "none", nsHTMLMediaElement::PRELOAD_ATTR_NONE }, - { "metadata", nsHTMLMediaElement::PRELOAD_ATTR_METADATA }, - { "auto", nsHTMLMediaElement::PRELOAD_ATTR_AUTO }, + { "", HTMLMediaElement::PRELOAD_ATTR_EMPTY }, + { "none", HTMLMediaElement::PRELOAD_ATTR_NONE }, + { "metadata", HTMLMediaElement::PRELOAD_ATTR_METADATA }, + { "auto", HTMLMediaElement::PRELOAD_ATTR_AUTO }, { 0 } }; @@ -1979,7 +1979,7 @@ bool nsHTMLMediaElement::ParseAttribute(int32_t aNamespaceID, aResult); } -bool nsHTMLMediaElement::CheckAudioChannelPermissions(const nsAString& aString) +bool HTMLMediaElement::CheckAudioChannelPermissions(const nsAString& aString) { #ifdef MOZ_B2G // Only normal channel doesn't need permission. @@ -2001,15 +2001,15 @@ bool nsHTMLMediaElement::CheckAudioChannelPermissions(const nsAString& aString) return true; } -void nsHTMLMediaElement::DoneCreatingElement() +void HTMLMediaElement::DoneCreatingElement() { if (HasAttr(kNameSpaceID_None, nsGkAtoms::muted)) mMuted = true; } -bool nsHTMLMediaElement::IsHTMLFocusable(bool aWithMouse, - bool *aIsFocusable, - int32_t *aTabIndex) +bool HTMLMediaElement::IsHTMLFocusable(bool aWithMouse, + bool *aIsFocusable, + int32_t *aTabIndex) { if (nsGenericHTMLElement::IsHTMLFocusable(aWithMouse, aIsFocusable, aTabIndex)) { return true; @@ -2019,14 +2019,14 @@ bool nsHTMLMediaElement::IsHTMLFocusable(bool aWithMouse, return false; } -int32_t nsHTMLMediaElement::TabIndexDefault() +int32_t HTMLMediaElement::TabIndexDefault() { return 0; } -nsresult nsHTMLMediaElement::SetAttr(int32_t aNameSpaceID, nsIAtom* aName, - nsIAtom* aPrefix, const nsAString& aValue, - bool aNotify) +nsresult HTMLMediaElement::SetAttr(int32_t aNameSpaceID, nsIAtom* aName, + nsIAtom* aPrefix, const nsAString& aValue, + bool aNotify) { nsresult rv = nsGenericHTMLElement::SetAttr(aNameSpaceID, aName, aPrefix, aValue, @@ -2053,8 +2053,8 @@ nsresult nsHTMLMediaElement::SetAttr(int32_t aNameSpaceID, nsIAtom* aName, return rv; } -nsresult nsHTMLMediaElement::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttr, - bool aNotify) +nsresult HTMLMediaElement::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttr, + bool aNotify) { nsresult rv = nsGenericHTMLElement::UnsetAttr(aNameSpaceID, aAttr, aNotify); if (NS_FAILED(rv)) @@ -2072,9 +2072,9 @@ nsresult nsHTMLMediaElement::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttr, return rv; } -nsresult nsHTMLMediaElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent, - nsIContent* aBindingParent, - bool aCompileEventHandlers) +nsresult HTMLMediaElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent, + nsIContent* aBindingParent, + bool aCompileEventHandlers) { nsresult rv = nsGenericHTMLElement::BindToTree(aDocument, aParent, @@ -2099,8 +2099,8 @@ nsresult nsHTMLMediaElement::BindToTree(nsIDocument* aDocument, nsIContent* aPar return rv; } -void nsHTMLMediaElement::UnbindFromTree(bool aDeep, - bool aNullParent) +void HTMLMediaElement::UnbindFromTree(bool aDeep, + bool aNullParent) { if (!mPaused && mNetworkState != nsIDOMHTMLMediaElement::NETWORK_EMPTY) Pause(); @@ -2109,7 +2109,7 @@ void nsHTMLMediaElement::UnbindFromTree(bool aDeep, /* static */ CanPlayStatus -nsHTMLMediaElement::GetCanPlay(const nsAString& aType) +HTMLMediaElement::GetCanPlay(const nsAString& aType) { nsContentTypeParser parser(aType); nsAutoString mimeType; @@ -2127,7 +2127,7 @@ nsHTMLMediaElement::GetCanPlay(const nsAString& aType) } NS_IMETHODIMP -nsHTMLMediaElement::CanPlayType(const nsAString& aType, nsAString& aResult) +HTMLMediaElement::CanPlayType(const nsAString& aType, nsAString& aResult) { switch (GetCanPlay(aType)) { case CANPLAY_NO: @@ -2149,7 +2149,7 @@ nsHTMLMediaElement::CanPlayType(const nsAString& aType, nsAString& aResult) return NS_OK; } -nsresult nsHTMLMediaElement::InitializeDecoderAsClone(MediaDecoder* aOriginal) +nsresult HTMLMediaElement::InitializeDecoderAsClone(MediaDecoder* aOriginal) { NS_ASSERTION(mLoadingSrc, "mLoadingSrc must already be set"); NS_ASSERTION(mDecoder == nullptr, "Shouldn't have a decoder"); @@ -2184,8 +2184,8 @@ nsresult nsHTMLMediaElement::InitializeDecoderAsClone(MediaDecoder* aOriginal) return FinishDecoderSetup(decoder, resource, nullptr, aOriginal); } -nsresult nsHTMLMediaElement::InitializeDecoderForChannel(nsIChannel *aChannel, - nsIStreamListener **aListener) +nsresult HTMLMediaElement::InitializeDecoderForChannel(nsIChannel *aChannel, + nsIStreamListener **aListener) { NS_ASSERTION(mLoadingSrc, "mLoadingSrc must already be set"); NS_ASSERTION(mDecoder == nullptr, "Shouldn't have a decoder"); @@ -2217,10 +2217,10 @@ nsresult nsHTMLMediaElement::InitializeDecoderForChannel(nsIChannel *aChannel, return FinishDecoderSetup(decoder, resource, aListener, nullptr); } -nsresult nsHTMLMediaElement::FinishDecoderSetup(MediaDecoder* aDecoder, - MediaResource* aStream, - nsIStreamListener **aListener, - MediaDecoder* aCloneDonor) +nsresult HTMLMediaElement::FinishDecoderSetup(MediaDecoder* aDecoder, + MediaResource* aStream, + nsIStreamListener **aListener, + MediaDecoder* aCloneDonor) { mNetworkState = nsIDOMHTMLMediaElement::NETWORK_LOADING; @@ -2284,13 +2284,13 @@ nsresult nsHTMLMediaElement::FinishDecoderSetup(MediaDecoder* aDecoder, return rv; } -class nsHTMLMediaElement::StreamListener : public MediaStreamListener { +class HTMLMediaElement::StreamListener : public MediaStreamListener { public: - StreamListener(nsHTMLMediaElement* aElement) : + StreamListener(HTMLMediaElement* aElement) : mElement(aElement), mHaveCurrentData(false), mBlocked(false), - mMutex("nsHTMLMediaElement::StreamListener"), + mMutex("HTMLMediaElement::StreamListener"), mPendingNotifyOutput(false), mDidHaveCurrentData(false) {} @@ -2388,7 +2388,7 @@ public: private: // These fields may only be accessed on the main thread - nsHTMLMediaElement* mElement; + HTMLMediaElement* mElement; bool mHaveCurrentData; bool mBlocked; @@ -2398,7 +2398,7 @@ private: bool mDidHaveCurrentData; }; -void nsHTMLMediaElement::SetupSrcMediaStreamPlayback(DOMMediaStream* aStream) +void HTMLMediaElement::SetupSrcMediaStreamPlayback(DOMMediaStream* aStream) { NS_ASSERTION(!mSrcStream && !mSrcStreamListener, "Should have been ended already"); @@ -2430,7 +2430,7 @@ void nsHTMLMediaElement::SetupSrcMediaStreamPlayback(DOMMediaStream* aStream) // to complete the setup by entering the HAVE_CURRENT_DATA state. } -void nsHTMLMediaElement::EndSrcMediaStreamPlayback() +void HTMLMediaElement::EndSrcMediaStreamPlayback() { GetSrcMediaStream()->RemoveListener(mSrcStreamListener); // Kill its reference to this element @@ -2451,7 +2451,7 @@ void nsHTMLMediaElement::EndSrcMediaStreamPlayback() mSrcStream = nullptr; } -nsresult nsHTMLMediaElement::NewURIFromString(const nsAutoString& aURISpec, nsIURI** aURI) +nsresult HTMLMediaElement::NewURIFromString(const nsAutoString& aURISpec, nsIURI** aURI) { NS_ENSURE_ARG_POINTER(aURI); @@ -2483,7 +2483,7 @@ nsresult nsHTMLMediaElement::NewURIFromString(const nsAutoString& aURISpec, nsIU return NS_OK; } -void nsHTMLMediaElement::ProcessMediaFragmentURI() +void HTMLMediaElement::ProcessMediaFragmentURI() { nsMediaFragmentURIParser parser(mLoadingSrc); @@ -2497,11 +2497,11 @@ void nsHTMLMediaElement::ProcessMediaFragmentURI() } } -void nsHTMLMediaElement::MetadataLoaded(int aChannels, - int aRate, - bool aHasAudio, - bool aHasVideo, - const MetadataTags* aTags) +void HTMLMediaElement::MetadataLoaded(int aChannels, + int aRate, + bool aHasAudio, + bool aHasVideo, + const MetadataTags* aTags) { mChannels = aChannels; mRate = aRate; @@ -2523,7 +2523,7 @@ void nsHTMLMediaElement::MetadataLoaded(int aChannels, } } -void nsHTMLMediaElement::FirstFrameLoaded(bool aResourceFullyLoaded) +void HTMLMediaElement::FirstFrameLoaded(bool aResourceFullyLoaded) { ChangeReadyState(aResourceFullyLoaded ? nsIDOMHTMLMediaElement::HAVE_ENOUGH_DATA : @@ -2535,7 +2535,7 @@ void nsHTMLMediaElement::FirstFrameLoaded(bool aResourceFullyLoaded) if (mDecoder && mAllowSuspendAfterFirstFrame && mPaused && !aResourceFullyLoaded && !HasAttr(kNameSpaceID_None, nsGkAtoms::autoplay) && - mPreloadAction == nsHTMLMediaElement::PRELOAD_METADATA) { + mPreloadAction == HTMLMediaElement::PRELOAD_METADATA) { mSuspendedAfterFirstFrame = true; mDecoder->Suspend(); } else if (mLoadedFirstFrame && @@ -2555,7 +2555,7 @@ void nsHTMLMediaElement::FirstFrameLoaded(bool aResourceFullyLoaded) } } -void nsHTMLMediaElement::ResourceLoaded() +void HTMLMediaElement::ResourceLoaded() { NS_ASSERTION(!mSrcStream, "Don't call this for streams"); @@ -2575,12 +2575,12 @@ void nsHTMLMediaElement::ResourceLoaded() DispatchAsyncEvent(NS_LITERAL_STRING("suspend")); } -void nsHTMLMediaElement::NetworkError() +void HTMLMediaElement::NetworkError() { Error(nsIDOMMediaError::MEDIA_ERR_NETWORK); } -void nsHTMLMediaElement::DecodeError() +void HTMLMediaElement::DecodeError() { nsAutoString src; GetCurrentSrc(src); @@ -2604,12 +2604,12 @@ void nsHTMLMediaElement::DecodeError() } } -void nsHTMLMediaElement::LoadAborted() +void HTMLMediaElement::LoadAborted() { Error(nsIDOMMediaError::MEDIA_ERR_ABORTED); } -void nsHTMLMediaElement::Error(uint16_t aErrorCode) +void HTMLMediaElement::Error(uint16_t aErrorCode) { NS_ASSERTION(aErrorCode == nsIDOMMediaError::MEDIA_ERR_DECODE || aErrorCode == nsIDOMMediaError::MEDIA_ERR_NETWORK || @@ -2628,7 +2628,7 @@ void nsHTMLMediaElement::Error(uint16_t aErrorCode) ChangeDelayLoadStatus(false); } -void nsHTMLMediaElement::PlaybackEnded() +void HTMLMediaElement::PlaybackEnded() { // We changed state which can affect AddRemoveSelfReference AddRemoveSelfReference(); @@ -2659,14 +2659,14 @@ void nsHTMLMediaElement::PlaybackEnded() DispatchAsyncEvent(NS_LITERAL_STRING("ended")); } -void nsHTMLMediaElement::SeekStarted() +void HTMLMediaElement::SeekStarted() { DispatchAsyncEvent(NS_LITERAL_STRING("seeking")); ChangeReadyState(nsIDOMHTMLMediaElement::HAVE_METADATA); FireTimeUpdate(false); } -void nsHTMLMediaElement::SeekCompleted() +void HTMLMediaElement::SeekCompleted() { mPlayingBeforeSeek = false; SetPlayedOrSeeked(true); @@ -2675,12 +2675,12 @@ void nsHTMLMediaElement::SeekCompleted() AddRemoveSelfReference(); } -void nsHTMLMediaElement::NotifySuspendedByCache(bool aIsSuspended) +void HTMLMediaElement::NotifySuspendedByCache(bool aIsSuspended) { mDownloadSuspendedByCache = aIsSuspended; } -void nsHTMLMediaElement::DownloadSuspended() +void HTMLMediaElement::DownloadSuspended() { DispatchAsyncEvent(NS_LITERAL_STRING("progress")); if (mBegun) { @@ -2690,7 +2690,7 @@ void nsHTMLMediaElement::DownloadSuspended() } } -void nsHTMLMediaElement::DownloadResumed(bool aForceNetworkLoading) +void HTMLMediaElement::DownloadResumed(bool aForceNetworkLoading) { if (mBegun || aForceNetworkLoading) { mNetworkState = nsIDOMHTMLMediaElement::NETWORK_LOADING; @@ -2698,19 +2698,19 @@ void nsHTMLMediaElement::DownloadResumed(bool aForceNetworkLoading) } } -void nsHTMLMediaElement::DownloadStalled() +void HTMLMediaElement::DownloadStalled() { if (mNetworkState == nsIDOMHTMLMediaElement::NETWORK_LOADING) { DispatchAsyncEvent(NS_LITERAL_STRING("stalled")); } } -bool nsHTMLMediaElement::ShouldCheckAllowOrigin() +bool HTMLMediaElement::ShouldCheckAllowOrigin() { return mCORSMode != CORS_NONE; } -void nsHTMLMediaElement::UpdateReadyStateForData(MediaDecoderOwner::NextFrameStatus aNextFrame) +void HTMLMediaElement::UpdateReadyStateForData(MediaDecoderOwner::NextFrameStatus aNextFrame) { if (mReadyState < nsIDOMHTMLMediaElement::HAVE_METADATA) { // aNextFrame might have a next frame because the decoder can advance @@ -2779,7 +2779,7 @@ static const char* gReadyStateToString[] = { }; #endif -void nsHTMLMediaElement::ChangeReadyState(nsMediaReadyState aState) +void HTMLMediaElement::ChangeReadyState(nsMediaReadyState aState) { nsMediaReadyState oldState = mReadyState; mReadyState = aState; @@ -2832,7 +2832,7 @@ void nsHTMLMediaElement::ChangeReadyState(nsMediaReadyState aState) } } -bool nsHTMLMediaElement::CanActivateAutoplay() +bool HTMLMediaElement::CanActivateAutoplay() { return mAutoplaying && mPaused && @@ -2841,7 +2841,7 @@ bool nsHTMLMediaElement::CanActivateAutoplay() !IsEditable(); } -void nsHTMLMediaElement::NotifyAutoplayDataReady() +void HTMLMediaElement::NotifyAutoplayDataReady() { if (CanActivateAutoplay()) { mPaused = false; @@ -2862,7 +2862,7 @@ void nsHTMLMediaElement::NotifyAutoplayDataReady() } } -VideoFrameContainer* nsHTMLMediaElement::GetVideoFrameContainer() +VideoFrameContainer* HTMLMediaElement::GetVideoFrameContainer() { // If we have loaded the metadata, and the size of the video is still // (-1, -1), the media has no video. Don't go a create a video frame @@ -2891,9 +2891,9 @@ VideoFrameContainer* nsHTMLMediaElement::GetVideoFrameContainer() return mVideoFrameContainer; } -nsresult nsHTMLMediaElement::DispatchAudioAvailableEvent(float* aFrameBuffer, - uint32_t aFrameBufferLength, - float aTime) +nsresult HTMLMediaElement::DispatchAudioAvailableEvent(float* aFrameBuffer, + uint32_t aFrameBufferLength, + float aTime) { // Auto manage the memory for the frame buffer. If we fail and return // an error, this ensures we free the memory in the frame buffer. Otherwise @@ -2920,7 +2920,7 @@ nsresult nsHTMLMediaElement::DispatchAudioAvailableEvent(float* aFrameBuffer, return target->DispatchEvent(event, &dummy); } -nsresult nsHTMLMediaElement::DispatchEvent(const nsAString& aName) +nsresult HTMLMediaElement::DispatchEvent(const nsAString& aName) { LOG_EVENT(PR_LOG_DEBUG, ("%p Dispatching event %s", this, NS_ConvertUTF16toUTF8(aName).get())); @@ -2939,7 +2939,7 @@ nsresult nsHTMLMediaElement::DispatchEvent(const nsAString& aName) false); } -nsresult nsHTMLMediaElement::DispatchAsyncEvent(const nsAString& aName) +nsresult HTMLMediaElement::DispatchAsyncEvent(const nsAString& aName) { LOG_EVENT(PR_LOG_DEBUG, ("%p Queuing event %s", this, NS_ConvertUTF16toUTF8(aName).get())); @@ -2949,7 +2949,7 @@ nsresult nsHTMLMediaElement::DispatchAsyncEvent(const nsAString& aName) return NS_OK; } -nsresult nsHTMLMediaElement::DispatchPendingMediaEvents() +nsresult HTMLMediaElement::DispatchPendingMediaEvents() { NS_ASSERTION(!mEventDeliveryPaused, "Must not be in bfcache when dispatching pending media events"); @@ -2963,7 +2963,7 @@ nsresult nsHTMLMediaElement::DispatchPendingMediaEvents() return NS_OK; } -bool nsHTMLMediaElement::IsPotentiallyPlaying() const +bool HTMLMediaElement::IsPotentiallyPlaying() const { // TODO: // playback has not stopped due to errors, @@ -2975,7 +2975,7 @@ bool nsHTMLMediaElement::IsPotentiallyPlaying() const !IsPlaybackEnded(); } -bool nsHTMLMediaElement::IsPlaybackEnded() const +bool HTMLMediaElement::IsPlaybackEnded() const { // TODO: // the current playback position is equal to the effective end of the media resource. @@ -2984,7 +2984,7 @@ bool nsHTMLMediaElement::IsPlaybackEnded() const mDecoder ? mDecoder->IsEnded() : false; } -already_AddRefed nsHTMLMediaElement::GetCurrentPrincipal() +already_AddRefed HTMLMediaElement::GetCurrentPrincipal() { if (mDecoder) { return mDecoder->GetCurrentPrincipal(); @@ -2996,7 +2996,7 @@ already_AddRefed nsHTMLMediaElement::GetCurrentPrincipal() return nullptr; } -void nsHTMLMediaElement::NotifyDecoderPrincipalChanged() +void HTMLMediaElement::NotifyDecoderPrincipalChanged() { for (uint32_t i = 0; i < mOutputStreams.Length(); ++i) { OutputMediaStream* ms = &mOutputStreams[i]; @@ -3005,12 +3005,12 @@ void nsHTMLMediaElement::NotifyDecoderPrincipalChanged() } } -void nsHTMLMediaElement::UpdateMediaSize(nsIntSize size) +void HTMLMediaElement::UpdateMediaSize(nsIntSize size) { mMediaSize = size; } -void nsHTMLMediaElement::SuspendOrResumeElement(bool aPauseElement, bool aSuspendEvents) +void HTMLMediaElement::SuspendOrResumeElement(bool aPauseElement, bool aSuspendEvents) { if (aPauseElement != mPausedForInactiveDocumentOrChannel) { mPausedForInactiveDocumentOrChannel = aPauseElement; @@ -3039,7 +3039,7 @@ void nsHTMLMediaElement::SuspendOrResumeElement(bool aPauseElement, bool aSuspen } } -void nsHTMLMediaElement::NotifyOwnerDocumentActivityChanged() +void HTMLMediaElement::NotifyOwnerDocumentActivityChanged() { nsIDocument* ownerDoc = OwnerDoc(); #ifdef MOZ_B2G @@ -3061,7 +3061,7 @@ void nsHTMLMediaElement::NotifyOwnerDocumentActivityChanged() AddRemoveSelfReference(); } -void nsHTMLMediaElement::AddRemoveSelfReference() +void HTMLMediaElement::AddRemoveSelfReference() { // XXX we could release earlier here in many situations if we examined // which event listeners are attached. Right now we assume there is a @@ -3092,7 +3092,7 @@ void nsHTMLMediaElement::AddRemoveSelfReference() // Dispatch Release asynchronously so that we don't destroy this object // inside a call stack of method calls on this object nsCOMPtr event = - NS_NewRunnableMethod(this, &nsHTMLMediaElement::DoRemoveSelfReference); + NS_NewRunnableMethod(this, &HTMLMediaElement::DoRemoveSelfReference); NS_DispatchToMainThread(event); } } @@ -3100,15 +3100,15 @@ void nsHTMLMediaElement::AddRemoveSelfReference() UpdateAudioChannelPlayingState(); } -void nsHTMLMediaElement::DoRemoveSelfReference() +void HTMLMediaElement::DoRemoveSelfReference() { // We don't need the shutdown observer anymore. Unregistering releases // its reference to us, which we were using as our self-reference. nsContentUtils::UnregisterShutdownObserver(this); } -nsresult nsHTMLMediaElement::Observe(nsISupports* aSubject, - const char* aTopic, const PRUnichar* aData) +nsresult HTMLMediaElement::Observe(nsISupports* aSubject, + const char* aTopic, const PRUnichar* aData) { NS_ENSURE_TRUE(nsContentUtils::IsCallerChrome(), NS_ERROR_NOT_AVAILABLE); @@ -3120,12 +3120,12 @@ nsresult nsHTMLMediaElement::Observe(nsISupports* aSubject, } bool -nsHTMLMediaElement::IsNodeOfType(uint32_t aFlags) const +HTMLMediaElement::IsNodeOfType(uint32_t aFlags) const { return !(aFlags & ~(eCONTENT | eMEDIA)); } -void nsHTMLMediaElement::DispatchAsyncSourceError(nsIContent* aSourceElement) +void HTMLMediaElement::DispatchAsyncSourceError(nsIContent* aSourceElement) { LOG_EVENT(PR_LOG_DEBUG, ("%p Queuing simple source error event", this)); @@ -3133,7 +3133,7 @@ void nsHTMLMediaElement::DispatchAsyncSourceError(nsIContent* aSourceElement) NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL); } -void nsHTMLMediaElement::NotifyAddedSource() +void HTMLMediaElement::NotifyAddedSource() { // If a source element is inserted as a child of a media element // that has no src attribute and whose networkState has the value @@ -3152,7 +3152,7 @@ void nsHTMLMediaElement::NotifyAddedSource() } } -nsIContent* nsHTMLMediaElement::GetNextSource() +nsIContent* HTMLMediaElement::GetNextSource() { nsCOMPtr thisDomNode = do_QueryObject(this); @@ -3202,7 +3202,7 @@ nsIContent* nsHTMLMediaElement::GetNextSource() return nullptr; } -void nsHTMLMediaElement::ChangeDelayLoadStatus(bool aDelay) +void HTMLMediaElement::ChangeDelayLoadStatus(bool aDelay) { if (mDelayingLoadEvent == aDelay) return; @@ -3229,7 +3229,7 @@ void nsHTMLMediaElement::ChangeDelayLoadStatus(bool aDelay) AddRemoveSelfReference(); } -already_AddRefed nsHTMLMediaElement::GetDocumentLoadGroup() +already_AddRefed HTMLMediaElement::GetDocumentLoadGroup() { if (!OwnerDoc()->IsActive()) { NS_WARNING("Load group requested for media element in inactive document."); @@ -3238,12 +3238,12 @@ already_AddRefed nsHTMLMediaElement::GetDocumentLoadGroup() } nsresult -nsHTMLMediaElement::CopyInnerTo(Element* aDest) +HTMLMediaElement::CopyInnerTo(Element* aDest) { nsresult rv = nsGenericHTMLElement::CopyInnerTo(aDest); NS_ENSURE_SUCCESS(rv, rv); if (aDest->OwnerDoc()->IsStaticDocument()) { - nsHTMLMediaElement* dest = static_cast(aDest); + HTMLMediaElement* dest = static_cast(aDest); if (mPrintSurface) { dest->mPrintSurface = mPrintSurface; dest->mMediaSize = mMediaSize; @@ -3255,7 +3255,7 @@ nsHTMLMediaElement::CopyInnerTo(Element* aDest) nsIContent* content = static_cast(frame)->GetPosterImage(); element = content ? content->AsElement() : NULL; } else { - element = const_cast(this); + element = const_cast(this); } nsLayoutUtils::SurfaceFromElementResult res = @@ -3268,7 +3268,7 @@ nsHTMLMediaElement::CopyInnerTo(Element* aDest) return rv; } -nsresult nsHTMLMediaElement::GetBuffered(nsIDOMTimeRanges** aBuffered) +nsresult HTMLMediaElement::GetBuffered(nsIDOMTimeRanges** aBuffered) { nsRefPtr ranges = new TimeRanges(); if (mReadyState > nsIDOMHTMLMediaElement::HAVE_NOTHING && mDecoder) { @@ -3280,7 +3280,7 @@ nsresult nsHTMLMediaElement::GetBuffered(nsIDOMTimeRanges** aBuffered) return NS_OK; } -void nsHTMLMediaElement::SetRequestHeaders(nsIHttpChannel* aChannel) +void HTMLMediaElement::SetRequestHeaders(nsIHttpChannel* aChannel) { // Send Accept header for video and audio types only (Bug 489071) SetAcceptHeader(aChannel); @@ -3304,7 +3304,7 @@ void nsHTMLMediaElement::SetRequestHeaders(nsIHttpChannel* aChannel) aChannel->SetReferrer(OwnerDoc()->GetDocumentURI()); } -void nsHTMLMediaElement::FireTimeUpdate(bool aPeriodic) +void HTMLMediaElement::FireTimeUpdate(bool aPeriodic) { NS_ASSERTION(NS_IsMainThread(), "Should be on main thread."); @@ -3332,7 +3332,7 @@ void nsHTMLMediaElement::FireTimeUpdate(bool aPeriodic) } } -void nsHTMLMediaElement::GetCurrentSpec(nsCString& aString) +void HTMLMediaElement::GetCurrentSpec(nsCString& aString) { if (mLoadingSrc) { mLoadingSrc->GetSpec(aString); @@ -3342,7 +3342,7 @@ void nsHTMLMediaElement::GetCurrentSpec(nsCString& aString) } /* attribute double initialTime; */ -NS_IMETHODIMP nsHTMLMediaElement::GetInitialTime(double *aTime) +NS_IMETHODIMP HTMLMediaElement::GetInitialTime(double *aTime) { // If there is no start fragment then the initalTime is zero. // Clamp to duration if it is greater than duration. @@ -3358,7 +3358,7 @@ NS_IMETHODIMP nsHTMLMediaElement::GetInitialTime(double *aTime) } /* attribute double mozFragmentEnd; */ -NS_IMETHODIMP nsHTMLMediaElement::GetMozFragmentEnd(double *aTime) +NS_IMETHODIMP HTMLMediaElement::GetMozFragmentEnd(double *aTime) { double duration = 0.0; nsresult rv = GetDuration(&duration); @@ -3370,7 +3370,7 @@ NS_IMETHODIMP nsHTMLMediaElement::GetMozFragmentEnd(double *aTime) return NS_OK; } -void nsHTMLMediaElement::NotifyAudioAvailableListener() +void HTMLMediaElement::NotifyAudioAvailableListener() { if (mDecoder) { mDecoder->NotifyAudioAvailableListener(); @@ -3392,13 +3392,13 @@ static double ClampPlaybackRate(double aPlaybackRate) } /* attribute double defaultPlaybackRate; */ -NS_IMETHODIMP nsHTMLMediaElement::GetDefaultPlaybackRate(double* aDefaultPlaybackRate) +NS_IMETHODIMP HTMLMediaElement::GetDefaultPlaybackRate(double* aDefaultPlaybackRate) { *aDefaultPlaybackRate = mDefaultPlaybackRate; return NS_OK; } -NS_IMETHODIMP nsHTMLMediaElement::SetDefaultPlaybackRate(double aDefaultPlaybackRate) +NS_IMETHODIMP HTMLMediaElement::SetDefaultPlaybackRate(double aDefaultPlaybackRate) { if (aDefaultPlaybackRate < 0) { return NS_ERROR_NOT_IMPLEMENTED; @@ -3410,13 +3410,13 @@ NS_IMETHODIMP nsHTMLMediaElement::SetDefaultPlaybackRate(double aDefaultPlayback } /* attribute double playbackRate; */ -NS_IMETHODIMP nsHTMLMediaElement::GetPlaybackRate(double* aPlaybackRate) +NS_IMETHODIMP HTMLMediaElement::GetPlaybackRate(double* aPlaybackRate) { *aPlaybackRate = mPlaybackRate; return NS_OK; } -NS_IMETHODIMP nsHTMLMediaElement::SetPlaybackRate(double aPlaybackRate) +NS_IMETHODIMP HTMLMediaElement::SetPlaybackRate(double aPlaybackRate) { // Changing the playback rate of a media that has more than two channels is // not supported. @@ -3444,13 +3444,13 @@ NS_IMETHODIMP nsHTMLMediaElement::SetPlaybackRate(double aPlaybackRate) } /* attribute bool mozPreservesPitch; */ -NS_IMETHODIMP nsHTMLMediaElement::GetMozPreservesPitch(bool* aPreservesPitch) +NS_IMETHODIMP HTMLMediaElement::GetMozPreservesPitch(bool* aPreservesPitch) { *aPreservesPitch = mPreservesPitch; return NS_OK; } -NS_IMETHODIMP nsHTMLMediaElement::SetMozPreservesPitch(bool aPreservesPitch) +NS_IMETHODIMP HTMLMediaElement::SetMozPreservesPitch(bool aPreservesPitch) { mPreservesPitch = aPreservesPitch; if (mDecoder) { @@ -3459,15 +3459,15 @@ NS_IMETHODIMP nsHTMLMediaElement::SetMozPreservesPitch(bool aPreservesPitch) return NS_OK; } -ImageContainer* nsHTMLMediaElement::GetImageContainer() +ImageContainer* HTMLMediaElement::GetImageContainer() { VideoFrameContainer* container = GetVideoFrameContainer(); return container ? container->GetImageContainer() : nullptr; } -nsresult nsHTMLMediaElement::UpdateChannelMuteState(bool aCanPlay) +nsresult HTMLMediaElement::UpdateChannelMuteState(bool aCanPlay) { - // Only on B2G we mute the nsHTMLMediaElement following the rules of + // Only on B2G we mute the HTMLMediaElement following the rules of // AudioChannelService. #ifdef MOZ_B2G // We have to mute this channel: @@ -3485,9 +3485,9 @@ nsresult nsHTMLMediaElement::UpdateChannelMuteState(bool aCanPlay) return NS_OK; } -void nsHTMLMediaElement::UpdateAudioChannelPlayingState() +void HTMLMediaElement::UpdateAudioChannelPlayingState() { - // The nsHTMLMediaElement is registered to the AudioChannelService only on B2G. + // The HTMLMediaElement is registered to the AudioChannelService only on B2G. #ifdef MOZ_B2G bool playingThroughTheAudioChannel = (!mPaused && @@ -3525,10 +3525,13 @@ void nsHTMLMediaElement::UpdateAudioChannelPlayingState() } /* void canPlayChanged (in boolean canPlay); */ -NS_IMETHODIMP nsHTMLMediaElement::CanPlayChanged(bool canPlay) +NS_IMETHODIMP HTMLMediaElement::CanPlayChanged(bool canPlay) { NS_ENSURE_TRUE(nsContentUtils::IsCallerChrome(), NS_ERROR_NOT_AVAILABLE); UpdateChannelMuteState(canPlay); return NS_OK; } + +} // namespace dom +} // namespace mozilla diff --git a/content/html/content/src/HTMLSourceElement.cpp b/content/html/content/src/HTMLSourceElement.cpp index e0918341e8c6..6a6d4cc044f8 100644 --- a/content/html/content/src/HTMLSourceElement.cpp +++ b/content/html/content/src/HTMLSourceElement.cpp @@ -70,7 +70,7 @@ HTMLSourceElement::BindToTree(nsIDocument *aDocument, if (!aParent || !aParent->IsNodeOfType(nsINode::eMEDIA)) return NS_OK; - nsHTMLMediaElement* media = static_cast(aParent); + HTMLMediaElement* media = static_cast(aParent); media->NotifyAddedSource(); return NS_OK; diff --git a/content/html/content/src/HTMLSourceElement.h b/content/html/content/src/HTMLSourceElement.h index 69e5ecdfe82e..0025905d647f 100644 --- a/content/html/content/src/HTMLSourceElement.h +++ b/content/html/content/src/HTMLSourceElement.h @@ -9,7 +9,7 @@ #include "nsIDOMHTMLSourceElement.h" #include "nsGenericHTMLElement.h" -#include "nsHTMLMediaElement.h" +#include "mozilla/dom/HTMLMediaElement.h" namespace mozilla { namespace dom { diff --git a/content/html/content/src/Makefile.in b/content/html/content/src/Makefile.in index 5ece96e1171c..1c8f0d1f0c9f 100644 --- a/content/html/content/src/Makefile.in +++ b/content/html/content/src/Makefile.in @@ -161,7 +161,7 @@ EXPORTS_mozilla/dom += \ CPPSRCS += \ nsHTMLAudioElement.cpp \ - nsHTMLMediaElement.cpp \ + HTMLMediaElement.cpp \ MediaError.cpp \ HTMLSourceElement.cpp \ TimeRanges.cpp \ diff --git a/content/html/content/src/MediaError.cpp b/content/html/content/src/MediaError.cpp index 076a06cc6885..413932564d51 100644 --- a/content/html/content/src/MediaError.cpp +++ b/content/html/content/src/MediaError.cpp @@ -21,7 +21,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(MediaError) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMMediaError) NS_INTERFACE_MAP_END -MediaError::MediaError(nsHTMLMediaElement* aParent, uint16_t aCode) +MediaError::MediaError(HTMLMediaElement* aParent, uint16_t aCode) : mParent(aParent) , mCode(aCode) { diff --git a/content/html/content/src/MediaError.h b/content/html/content/src/MediaError.h index 7ee64eb66a24..f9ff9923fc10 100644 --- a/content/html/content/src/MediaError.h +++ b/content/html/content/src/MediaError.h @@ -8,7 +8,7 @@ #define mozilla_dom_MediaError_h #include "nsIDOMMediaError.h" -#include "nsHTMLMediaElement.h" +#include "mozilla/dom/HTMLMediaElement.h" #include "nsWrapperCache.h" #include "nsISupports.h" #include "mozilla/Attributes.h" @@ -20,7 +20,7 @@ class MediaError MOZ_FINAL : public nsIDOMMediaError, public nsWrapperCache { public: - MediaError(nsHTMLMediaElement* aParent, uint16_t aCode); + MediaError(HTMLMediaElement* aParent, uint16_t aCode); // nsISupports NS_DECL_CYCLE_COLLECTING_ISUPPORTS @@ -29,7 +29,7 @@ public: // nsIDOMMediaError NS_DECL_NSIDOMMEDIAERROR - nsHTMLMediaElement* GetParentObject() const + HTMLMediaElement* GetParentObject() const { return mParent; } @@ -42,7 +42,7 @@ public: } private: - nsRefPtr mParent; + nsRefPtr mParent; // Error code const uint16_t mCode; diff --git a/content/html/content/src/TimeRanges.cpp b/content/html/content/src/TimeRanges.cpp index d1735f643836..5facecced9e0 100644 --- a/content/html/content/src/TimeRanges.cpp +++ b/content/html/content/src/TimeRanges.cpp @@ -6,7 +6,7 @@ #include "mozilla/dom/TimeRanges.h" #include "mozilla/dom/TimeRangesBinding.h" -#include "nsHTMLMediaElement.h" +#include "mozilla/dom/HTMLMediaElement.h" #include "nsContentUtils.h" #include "nsDOMClassInfoID.h" #include "nsError.h" diff --git a/content/html/content/src/nsHTMLAudioElement.cpp b/content/html/content/src/nsHTMLAudioElement.cpp index 562c3819eeff..da0908e1606f 100644 --- a/content/html/content/src/nsHTMLAudioElement.cpp +++ b/content/html/content/src/nsHTMLAudioElement.cpp @@ -50,8 +50,8 @@ NS_NewHTMLAudioElement(already_AddRefed aNodeInfo, return new nsHTMLAudioElement(nodeInfo.forget()); } -NS_IMPL_ADDREF_INHERITED(nsHTMLAudioElement, nsHTMLMediaElement) -NS_IMPL_RELEASE_INHERITED(nsHTMLAudioElement, nsHTMLMediaElement) +NS_IMPL_ADDREF_INHERITED(nsHTMLAudioElement, HTMLMediaElement) +NS_IMPL_RELEASE_INHERITED(nsHTMLAudioElement, HTMLMediaElement) DOMCI_NODE_DATA(HTMLAudioElement, nsHTMLAudioElement) @@ -59,14 +59,14 @@ NS_INTERFACE_TABLE_HEAD(nsHTMLAudioElement) NS_HTML_CONTENT_INTERFACE_TABLE3(nsHTMLAudioElement, nsIDOMHTMLMediaElement, nsIDOMHTMLAudioElement, nsIJSNativeInitializer) NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLAudioElement, - nsHTMLMediaElement) + HTMLMediaElement) NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLAudioElement) NS_IMPL_ELEMENT_CLONE(nsHTMLAudioElement) nsHTMLAudioElement::nsHTMLAudioElement(already_AddRefed aNodeInfo) - : nsHTMLMediaElement(aNodeInfo) + : HTMLMediaElement(aNodeInfo) { } diff --git a/content/html/content/src/nsHTMLVideoElement.cpp b/content/html/content/src/nsHTMLVideoElement.cpp index 4bf51a55584e..0d79fc92a64f 100644 --- a/content/html/content/src/nsHTMLVideoElement.cpp +++ b/content/html/content/src/nsHTMLVideoElement.cpp @@ -37,15 +37,15 @@ using namespace mozilla::dom; NS_IMPL_NS_NEW_HTML_ELEMENT(Video) -NS_IMPL_ADDREF_INHERITED(nsHTMLVideoElement, nsHTMLMediaElement) -NS_IMPL_RELEASE_INHERITED(nsHTMLVideoElement, nsHTMLMediaElement) +NS_IMPL_ADDREF_INHERITED(nsHTMLVideoElement, HTMLMediaElement) +NS_IMPL_RELEASE_INHERITED(nsHTMLVideoElement, HTMLMediaElement) DOMCI_NODE_DATA(HTMLVideoElement, nsHTMLVideoElement) NS_INTERFACE_TABLE_HEAD(nsHTMLVideoElement) NS_HTML_CONTENT_INTERFACE_TABLE2(nsHTMLVideoElement, nsIDOMHTMLMediaElement, nsIDOMHTMLVideoElement) NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLVideoElement, - nsHTMLMediaElement) + HTMLMediaElement) NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLVideoElement) NS_IMPL_ELEMENT_CLONE(nsHTMLVideoElement) @@ -70,7 +70,7 @@ NS_IMETHODIMP nsHTMLVideoElement::GetVideoHeight(uint32_t *aVideoHeight) } nsHTMLVideoElement::nsHTMLVideoElement(already_AddRefed aNodeInfo) - : nsHTMLMediaElement(aNodeInfo) + : HTMLMediaElement(aNodeInfo) { } @@ -99,8 +99,8 @@ nsHTMLVideoElement::ParseAttribute(int32_t aNamespaceID, return aResult.ParseSpecialIntValue(aValue); } - return nsHTMLMediaElement::ParseAttribute(aNamespaceID, aAttribute, aValue, - aResult); + return HTMLMediaElement::ParseAttribute(aNamespaceID, aAttribute, aValue, + aResult); } static void @@ -180,7 +180,7 @@ NS_IMETHODIMP nsHTMLVideoElement::GetMozPresentedFrames(uint32_t *aMozPresentedF NS_IMETHODIMP nsHTMLVideoElement::GetMozPaintedFrames(uint32_t *aMozPaintedFrames) { NS_ASSERTION(NS_IsMainThread(), "Should be on main thread."); - ImageContainer* container = GetImageContainer(); + layers::ImageContainer* container = GetImageContainer(); *aMozPaintedFrames = container ? container->GetPaintCount() : 0; return NS_OK; } diff --git a/content/html/document/src/VideoDocument.cpp b/content/html/document/src/VideoDocument.cpp index c14e1c2d1ef6..6496d95c8b7c 100644 --- a/content/html/document/src/VideoDocument.cpp +++ b/content/html/document/src/VideoDocument.cpp @@ -7,7 +7,7 @@ #include "nsGkAtoms.h" #include "nsNodeInfoManager.h" #include "nsContentCreatorFunctions.h" -#include "nsHTMLMediaElement.h" +#include "mozilla/dom/HTMLMediaElement.h" #include "nsIDocumentInlines.h" #include "nsContentUtils.h" #include "mozilla/dom/Element.h" @@ -101,9 +101,9 @@ VideoDocument::CreateSyntheticVideoDocument(nsIChannel* aChannel, nsIDOMNode::ELEMENT_NODE); NS_ENSURE_TRUE(nodeInfo, NS_ERROR_FAILURE); - nsRefPtr element = - static_cast(NS_NewHTMLVideoElement(nodeInfo.forget(), - NOT_FROM_PARSER)); + nsRefPtr element = + static_cast(NS_NewHTMLVideoElement(nodeInfo.forget(), + NOT_FROM_PARSER)); if (!element) return NS_ERROR_OUT_OF_MEMORY; element->SetAutoplay(true); diff --git a/content/media/MediaDecoderOwner.h b/content/media/MediaDecoderOwner.h index 03f148ac6819..e3774e4220ec 100644 --- a/content/media/MediaDecoderOwner.h +++ b/content/media/MediaDecoderOwner.h @@ -7,12 +7,14 @@ #define MediaDecoderOwner_h_ #include "AbstractMediaDecoder.h" -class nsHTMLMediaElement; - namespace mozilla { class VideoFrameContainer; +namespace dom { +class HTMLMediaElement; +} + class MediaDecoderOwner { public: @@ -34,9 +36,9 @@ public: */ virtual void FireTimeUpdate(bool aPeriodic) = 0; - // Get the nsHTMLMediaElement object if the decoder is being used from an + // Get the HTMLMediaElement object if the decoder is being used from an // HTML media element, and null otherwise. - virtual nsHTMLMediaElement* GetMediaElement() + virtual dom::HTMLMediaElement* GetMediaElement() { return nullptr; } diff --git a/content/media/MediaDecoderReader.h b/content/media/MediaDecoderReader.h index 198bd2eb49ae..8b2fe5047e38 100644 --- a/content/media/MediaDecoderReader.h +++ b/content/media/MediaDecoderReader.h @@ -14,7 +14,7 @@ #include "ImageLayers.h" #include "AudioSampleFormat.h" #include "MediaResource.h" -#include "nsHTMLMediaElement.h" +#include "mozilla/dom/HTMLMediaElement.h" namespace mozilla { diff --git a/content/media/MediaResource.cpp b/content/media/MediaResource.cpp index b458e32b6d37..ba9e7ad1442b 100644 --- a/content/media/MediaResource.cpp +++ b/content/media/MediaResource.cpp @@ -23,7 +23,7 @@ #include "nsIStreamListener.h" #include "nsIScriptSecurityManager.h" #include "nsCrossSiteListenerProxy.h" -#include "nsHTMLMediaElement.h" +#include "mozilla/dom/HTMLMediaElement.h" #include "nsError.h" #include "nsICachingChannel.h" #include "nsURILoader.h" @@ -152,7 +152,7 @@ ChannelMediaResource::OnStartRequest(nsIRequest* aRequest) MediaDecoderOwner* owner = mDecoder->GetMediaOwner(); NS_ENSURE_TRUE(owner, NS_ERROR_FAILURE); - nsHTMLMediaElement* element = owner->GetMediaElement(); + HTMLMediaElement* element = owner->GetMediaElement(); NS_ENSURE_TRUE(element, NS_ERROR_FAILURE); nsresult status; nsresult rv = aRequest->GetStatus(&status); @@ -610,7 +610,7 @@ nsresult ChannelMediaResource::OpenChannel(nsIStreamListener** aStreamListener) // an authorizing Access-Control header. MediaDecoderOwner* owner = mDecoder->GetMediaOwner(); NS_ENSURE_TRUE(owner, NS_ERROR_FAILURE); - nsHTMLMediaElement* element = owner->GetMediaElement(); + HTMLMediaElement* element = owner->GetMediaElement(); NS_ENSURE_TRUE(element, NS_ERROR_FAILURE); if (element->ShouldCheckAllowOrigin()) { nsRefPtr crossSiteListener = @@ -669,7 +669,7 @@ void ChannelMediaResource::SetupChannelHeaders() if (!owner) { return; } - nsHTMLMediaElement* element = owner->GetMediaElement(); + HTMLMediaElement* element = owner->GetMediaElement(); if (!element) { return; } @@ -818,7 +818,7 @@ void ChannelMediaResource::Suspend(bool aCloseImmediately) // Shutting down; do nothing. return; } - nsHTMLMediaElement* element = owner->GetMediaElement(); + HTMLMediaElement* element = owner->GetMediaElement(); if (!element) { // Shutting down; do nothing. return; @@ -853,7 +853,7 @@ void ChannelMediaResource::Resume() // Shutting down; do nothing. return; } - nsHTMLMediaElement* element = owner->GetMediaElement(); + HTMLMediaElement* element = owner->GetMediaElement(); if (!element) { // Shutting down; do nothing. return; @@ -902,7 +902,7 @@ ChannelMediaResource::RecreateChannel() // The decoder is being shut down, so don't bother opening a new channel return NS_OK; } - nsHTMLMediaElement* element = owner->GetMediaElement(); + HTMLMediaElement* element = owner->GetMediaElement(); if (!element) { // The decoder is being shut down, so don't bother opening a new channel return NS_OK; @@ -1430,7 +1430,7 @@ nsresult FileMediaResource::Open(nsIStreamListener** aStreamListener) // web server. MediaDecoderOwner* owner = mDecoder->GetMediaOwner(); NS_ENSURE_TRUE(owner, NS_ERROR_FAILURE); - nsHTMLMediaElement* element = owner->GetMediaElement(); + HTMLMediaElement* element = owner->GetMediaElement(); NS_ENSURE_TRUE(element, NS_ERROR_FAILURE); rv = nsContentUtils::GetSecurityManager()-> @@ -1495,7 +1495,7 @@ MediaResource* FileMediaResource::CloneData(MediaDecoder* aDecoder) // The decoder is being shut down, so we can't clone return nullptr; } - nsHTMLMediaElement* element = owner->GetMediaElement(); + HTMLMediaElement* element = owner->GetMediaElement(); if (!element) { // The decoder is being shut down, so we can't clone return nullptr; @@ -1610,7 +1610,7 @@ void BaseMediaResource::MoveLoadsToBackground() { NS_WARNING("Null owner in MediaResource::MoveLoadsToBackground()"); return; } - nsHTMLMediaElement* element = owner->GetMediaElement(); + HTMLMediaElement* element = owner->GetMediaElement(); if (!element) { NS_WARNING("Null element in MediaResource::MoveLoadsToBackground()"); return; diff --git a/content/media/VideoFrameContainer.cpp b/content/media/VideoFrameContainer.cpp index f015d83106db..83ba71cf77df 100644 --- a/content/media/VideoFrameContainer.cpp +++ b/content/media/VideoFrameContainer.cpp @@ -6,7 +6,7 @@ #include "VideoFrameContainer.h" -#include "nsHTMLMediaElement.h" +#include "mozilla/dom/HTMLMediaElement.h" #include "nsIFrame.h" #include "nsDisplayList.h" #include "nsSVGEffects.h" @@ -16,7 +16,7 @@ using namespace mozilla::layers; namespace mozilla { -VideoFrameContainer::VideoFrameContainer(nsHTMLMediaElement* aElement, +VideoFrameContainer::VideoFrameContainer(dom::HTMLMediaElement* aElement, already_AddRefed aContainer) : mElement(aElement), mImageContainer(aContainer), mMutex("nsVideoFrameContainer"), diff --git a/content/media/VideoFrameContainer.h b/content/media/VideoFrameContainer.h index fc2f719b165d..8690570d9ea4 100644 --- a/content/media/VideoFrameContainer.h +++ b/content/media/VideoFrameContainer.h @@ -14,10 +14,12 @@ #include "nsCOMPtr.h" #include "nsAutoPtr.h" -class nsHTMLMediaElement; - namespace mozilla { +namespace dom { +class HTMLMediaElement; +} + namespace layers { class Image; class ImageContainer; @@ -34,12 +36,12 @@ class ImageContainer; */ class VideoFrameContainer { public: - typedef mozilla::layers::ImageContainer ImageContainer; - typedef mozilla::layers::Image Image; + typedef layers::ImageContainer ImageContainer; + typedef layers::Image Image; NS_INLINE_DECL_THREADSAFE_REFCOUNTING(VideoFrameContainer) - VideoFrameContainer(nsHTMLMediaElement* aElement, + VideoFrameContainer(dom::HTMLMediaElement* aElement, already_AddRefed aContainer); ~VideoFrameContainer(); @@ -61,7 +63,7 @@ public: protected: // Non-addreffed pointer to the element. The element calls ForgetElement // to clear this reference when the element is destroyed. - nsHTMLMediaElement* mElement; + dom::HTMLMediaElement* mElement; nsRefPtr mImageContainer; // mMutex protects all the fields below. diff --git a/content/media/dash/DASHDecoder.cpp b/content/media/dash/DASHDecoder.cpp index a0313ba3ee23..34333351a5c6 100644 --- a/content/media/dash/DASHDecoder.cpp +++ b/content/media/dash/DASHDecoder.cpp @@ -10,11 +10,11 @@ * DASH is an adaptive bitrate streaming technology where a multimedia file is * partitioned into one or more segments and delivered to a client using HTTP. * - * Interaction with MediaDecoderStateMachine, nsHTMLMediaElement, + * Interaction with MediaDecoderStateMachine, HTMLMediaElement, * ChannelMediaResource and sub-decoders (WebMDecoder). * * - * MediaDecoderStateMachine nsHTMLMediaElement + * MediaDecoderStateMachine HTMLMediaElement * 1 / \ 1 / 1 * / \ / * 1 / \ 1 / 1 @@ -81,7 +81,7 @@ * -- At this point the Segment media stream downloads are managed by * individual |ChannelMediaResource|s and |WebMReader|s. * A single |DASHDecoder| and |MediaDecoderStateMachine| manage them - * and communicate to |nsHTMLMediaElement|. + * and communicate to |HTMLMediaElement|. * * Each |DASHRepDecoder| gets init range and index range from its MPD * |Representation|. |DASHRepDecoder| uses ChannelMediaResource to start the @@ -565,7 +565,7 @@ DASHDecoder::CreateSubChannel(nsIURI* aUrl, nsIChannel** aChannel) NS_ENSURE_ARG(aUrl); NS_ENSURE_TRUE(mOwner, NS_ERROR_NULL_POINTER); - nsHTMLMediaElement* element = mOwner->GetMediaElement(); + HTMLMediaElement* element = mOwner->GetMediaElement(); NS_ENSURE_TRUE(element, NS_ERROR_NULL_POINTER); nsCOMPtr loadGroup = diff --git a/content/media/dash/DASHReader.cpp b/content/media/dash/DASHReader.cpp index 51c5bb8fa3bd..f30da45fae5f 100644 --- a/content/media/dash/DASHReader.cpp +++ b/content/media/dash/DASHReader.cpp @@ -196,7 +196,7 @@ DASHReader::ReadMetadata(VideoInfo* aInfo, // Read metadata for all video streams. for (uint i = 0; i < mVideoReaders.Length(); i++) { // Use an nsAutoPtr here to ensure |tags| memory does not leak. - nsAutoPtr tags; + nsAutoPtr tags; rv = mVideoReaders[i]->ReadMetadata(&videoInfo, getter_Transfers(tags)); NS_ENSURE_SUCCESS(rv, rv); // Use metadata from current video sub reader to populate aInfo. diff --git a/content/media/ogg/OggCodecState.h b/content/media/ogg/OggCodecState.h index 66e8fffa7f44..ff06f9425659 100644 --- a/content/media/ogg/OggCodecState.h +++ b/content/media/ogg/OggCodecState.h @@ -17,7 +17,7 @@ #include #include "opus/opus_multistream.h" // For MOZ_SAMPLE_TYPE_* -#include "nsHTMLMediaElement.h" +#include "mozilla/dom/HTMLMediaElement.h" #include "MediaDecoderStateMachine.h" #include "MediaDecoderReader.h" #endif diff --git a/content/media/plugins/MediaPluginHost.cpp b/content/media/plugins/MediaPluginHost.cpp index 300e483c3ca9..db88a828d3f4 100644 --- a/content/media/plugins/MediaPluginHost.cpp +++ b/content/media/plugins/MediaPluginHost.cpp @@ -7,7 +7,7 @@ #include "mozilla/TimeStamp.h" #include "mozilla/dom/TimeRanges.h" #include "MediaResource.h" -#include "nsHTMLMediaElement.h" +#include "mozilla/dom/HTMLMediaElement.h" #include "MediaPluginHost.h" #include "nsXPCOMStrings.h" #include "nsISeekableStream.h" diff --git a/content/media/test/test_playback_rate.html b/content/media/test/test_playback_rate.html index 6a2e65119fa4..e29455c4c1b4 100644 --- a/content/media/test/test_playback_rate.html +++ b/content/media/test/test_playback_rate.html @@ -33,7 +33,7 @@ function checkPlaybackRate(wallclock, media, expected, threshold) { return false; } -// Those value are expected to match those at the top of nsHTMLMediaElement.cpp. +// Those value are expected to match those at the top of HTMLMediaElement.cpp. let VERY_SLOW_RATE = 0.1, SLOW_RATE = 0.25, FAST_RATE = 5, diff --git a/content/media/wave/WaveReader.cpp b/content/media/wave/WaveReader.cpp index 2c9346bfb385..c913e43fa686 100644 --- a/content/media/wave/WaveReader.cpp +++ b/content/media/wave/WaveReader.cpp @@ -140,7 +140,7 @@ nsresult WaveReader::ReadMetadata(VideoInfo* aInfo, return NS_ERROR_FAILURE; } - nsAutoPtr tags; + nsAutoPtr tags; bool loadAllChunks = LoadAllChunks(tags); if (!loadAllChunks) { @@ -531,7 +531,7 @@ WaveReader::GetNextChunk(uint32_t* aChunk, uint32_t* aChunkSize) bool WaveReader::LoadListChunk(uint32_t aChunkSize, - nsAutoPtr &aTags) + nsAutoPtr &aTags) { // List chunks are always word (two byte) aligned. NS_ABORT_IF_FALSE(mDecoder->GetResource()->Tell() % 2 == 0, @@ -564,7 +564,7 @@ WaveReader::LoadListChunk(uint32_t aChunkSize, const char* const end = chunk.get() + aChunkSize; - aTags = new nsHTMLMediaElement::MetadataTags; + aTags = new HTMLMediaElement::MetadataTags; aTags->Init(); while (p + 8 < end) { @@ -605,7 +605,7 @@ WaveReader::LoadListChunk(uint32_t aChunkSize, } bool -WaveReader::LoadAllChunks(nsAutoPtr &aTags) +WaveReader::LoadAllChunks(nsAutoPtr &aTags) { // Chunks are always word (two byte) aligned. NS_ABORT_IF_FALSE(mDecoder->GetResource()->Tell() % 2 == 0, diff --git a/content/media/wave/WaveReader.h b/content/media/wave/WaveReader.h index f7c9aa8c131c..fdd6e7373ec6 100644 --- a/content/media/wave/WaveReader.h +++ b/content/media/wave/WaveReader.h @@ -53,8 +53,8 @@ private: bool GetNextChunk(uint32_t* aChunk, uint32_t* aChunkSize); bool LoadFormatChunk(uint32_t aChunkSize); bool FindDataOffset(uint32_t aChunkSize); - bool LoadListChunk(uint32_t aChunkSize, nsAutoPtr &aTags); - bool LoadAllChunks(nsAutoPtr &aTags); + bool LoadListChunk(uint32_t aChunkSize, nsAutoPtr &aTags); + bool LoadAllChunks(nsAutoPtr &aTags); // Returns the number of seconds that aBytes represents based on the // current audio parameters. e.g. 176400 bytes is 1 second at 16-bit diff --git a/content/media/webaudio/MediaBufferDecoder.cpp b/content/media/webaudio/MediaBufferDecoder.cpp index d3a5af5f7f18..a850178623f6 100644 --- a/content/media/webaudio/MediaBufferDecoder.cpp +++ b/content/media/webaudio/MediaBufferDecoder.cpp @@ -397,7 +397,7 @@ MediaDecodeTask::CreateReader() mBufferDecoder = new BufferDecoder(resource); // If you change this list to add support for new decoders, please consider - // updating nsHTMLMediaElement::CreateDecoder as well. + // updating HTMLMediaElement::CreateDecoder as well. mDecoderReader = DecoderTraits::CreateReader(mContentType, mBufferDecoder); diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 902bd0ce87a7..f3baafe8bc24 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -117,7 +117,7 @@ #include "gfxImageSurface.h" #include "gfxContext.h" #ifdef MOZ_MEDIA -#include "nsHTMLMediaElement.h" +#include "mozilla/dom/HTMLMediaElement.h" #endif #include "nsSMILAnimationController.h" #include "SVGContentUtils.h" diff --git a/layout/generic/nsVideoFrame.cpp b/layout/generic/nsVideoFrame.cpp index 805d79446968..bf7c45385b57 100644 --- a/layout/generic/nsVideoFrame.cpp +++ b/layout/generic/nsVideoFrame.cpp @@ -399,8 +399,8 @@ public: // cheap (i.e. hardware accelerated). return LAYER_ACTIVE; } - nsHTMLMediaElement* elem = - static_cast(mFrame->GetContent()); + HTMLMediaElement* elem = + static_cast(mFrame->GetContent()); return elem->IsPotentiallyPlaying() ? LAYER_ACTIVE_FORCE : LAYER_INACTIVE; } };