michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim: set ts=8 sts=2 et sw=2 tw=80: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "BufferDecoder.h" michael@0: michael@0: #include "nsISupports.h" michael@0: #include "MediaResource.h" michael@0: michael@0: namespace mozilla { michael@0: michael@0: #ifdef PR_LOGGING michael@0: extern PRLogModuleInfo* gMediaDecoderLog; michael@0: #endif michael@0: michael@0: NS_IMPL_ISUPPORTS0(BufferDecoder) michael@0: michael@0: BufferDecoder::BufferDecoder(MediaResource* aResource) michael@0: : mReentrantMonitor("BufferDecoder") michael@0: , mResource(aResource) michael@0: { michael@0: MOZ_ASSERT(NS_IsMainThread()); michael@0: MOZ_COUNT_CTOR(BufferDecoder); michael@0: #ifdef PR_LOGGING michael@0: if (!gMediaDecoderLog) { michael@0: gMediaDecoderLog = PR_NewLogModule("MediaDecoder"); michael@0: } michael@0: #endif michael@0: } michael@0: michael@0: BufferDecoder::~BufferDecoder() michael@0: { michael@0: // The dtor may run on any thread, we cannot be sure. michael@0: MOZ_COUNT_DTOR(BufferDecoder); michael@0: } michael@0: michael@0: void michael@0: BufferDecoder::BeginDecoding(nsIThread* aDecodeThread) michael@0: { michael@0: MOZ_ASSERT(!mDecodeThread && aDecodeThread); michael@0: mDecodeThread = aDecodeThread; michael@0: } michael@0: michael@0: ReentrantMonitor& michael@0: BufferDecoder::GetReentrantMonitor() michael@0: { michael@0: return mReentrantMonitor; michael@0: } michael@0: michael@0: bool michael@0: BufferDecoder::IsShutdown() const michael@0: { michael@0: // BufferDecoder cannot be shut down. michael@0: return false; michael@0: } michael@0: michael@0: bool michael@0: BufferDecoder::OnStateMachineThread() const michael@0: { michael@0: // BufferDecoder doesn't have the concept of a state machine. michael@0: return true; michael@0: } michael@0: michael@0: bool michael@0: BufferDecoder::OnDecodeThread() const michael@0: { michael@0: MOZ_ASSERT(mDecodeThread, "Forgot to call BeginDecoding?"); michael@0: return IsCurrentThread(mDecodeThread); michael@0: } michael@0: michael@0: MediaResource* michael@0: BufferDecoder::GetResource() const michael@0: { michael@0: return mResource; michael@0: } michael@0: michael@0: void michael@0: BufferDecoder::NotifyBytesConsumed(int64_t aBytes, int64_t aOffset) michael@0: { michael@0: // ignore michael@0: } michael@0: michael@0: void michael@0: BufferDecoder::NotifyDecodedFrames(uint32_t aParsed, uint32_t aDecoded) michael@0: { michael@0: // ignore michael@0: } michael@0: michael@0: int64_t michael@0: BufferDecoder::GetEndMediaTime() const michael@0: { michael@0: // unknown michael@0: return -1; michael@0: } michael@0: michael@0: int64_t michael@0: BufferDecoder::GetMediaDuration() michael@0: { michael@0: // unknown michael@0: return -1; michael@0: } michael@0: michael@0: void michael@0: BufferDecoder::SetMediaDuration(int64_t aDuration) michael@0: { michael@0: // ignore michael@0: } michael@0: michael@0: void michael@0: BufferDecoder::UpdateEstimatedMediaDuration(int64_t aDuration) michael@0: { michael@0: // ignore michael@0: } michael@0: michael@0: void michael@0: BufferDecoder::SetMediaSeekable(bool aMediaSeekable) michael@0: { michael@0: // ignore michael@0: } michael@0: michael@0: void michael@0: BufferDecoder::SetTransportSeekable(bool aTransportSeekable) michael@0: { michael@0: // ignore michael@0: } michael@0: michael@0: VideoFrameContainer* michael@0: BufferDecoder::GetVideoFrameContainer() michael@0: { michael@0: // no video frame michael@0: return nullptr; michael@0: } michael@0: michael@0: layers::ImageContainer* michael@0: BufferDecoder::GetImageContainer() michael@0: { michael@0: // no image container michael@0: return nullptr; michael@0: } michael@0: michael@0: bool michael@0: BufferDecoder::IsTransportSeekable() michael@0: { michael@0: return false; michael@0: } michael@0: michael@0: bool michael@0: BufferDecoder::IsMediaSeekable() michael@0: { michael@0: return false; michael@0: } michael@0: michael@0: void michael@0: BufferDecoder::MetadataLoaded(int aChannels, int aRate, bool aHasAudio, bool aHasVideo, MetadataTags* aTags) michael@0: { michael@0: // ignore michael@0: } michael@0: michael@0: void michael@0: BufferDecoder::QueueMetadata(int64_t aTime, int aChannels, int aRate, bool aHasAudio, bool aHasVideo, MetadataTags* aTags) michael@0: { michael@0: // ignore michael@0: } michael@0: michael@0: void michael@0: BufferDecoder::SetMediaEndTime(int64_t aTime) michael@0: { michael@0: // ignore michael@0: } michael@0: michael@0: void michael@0: BufferDecoder::UpdatePlaybackPosition(int64_t aTime) michael@0: { michael@0: // ignore michael@0: } michael@0: michael@0: void michael@0: BufferDecoder::OnReadMetadataCompleted() michael@0: { michael@0: // ignore michael@0: } michael@0: michael@0: void michael@0: BufferDecoder::NotifyWaitingForResourcesStatusChanged() michael@0: { michael@0: // ignore michael@0: } michael@0: michael@0: MediaDecoderOwner* michael@0: BufferDecoder::GetOwner() michael@0: { michael@0: // unknown michael@0: return nullptr; michael@0: } michael@0: michael@0: } // namespace mozilla