content/media/BufferDecoder.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/media/BufferDecoder.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,198 @@
     1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* vim: set ts=8 sts=2 et sw=2 tw=80: */
     1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#include "BufferDecoder.h"
    1.11 +
    1.12 +#include "nsISupports.h"
    1.13 +#include "MediaResource.h"
    1.14 +
    1.15 +namespace mozilla {
    1.16 +
    1.17 +#ifdef PR_LOGGING
    1.18 +extern PRLogModuleInfo* gMediaDecoderLog;
    1.19 +#endif
    1.20 +
    1.21 +NS_IMPL_ISUPPORTS0(BufferDecoder)
    1.22 +
    1.23 +BufferDecoder::BufferDecoder(MediaResource* aResource)
    1.24 +  : mReentrantMonitor("BufferDecoder")
    1.25 +  , mResource(aResource)
    1.26 +{
    1.27 +  MOZ_ASSERT(NS_IsMainThread());
    1.28 +  MOZ_COUNT_CTOR(BufferDecoder);
    1.29 +#ifdef PR_LOGGING
    1.30 +  if (!gMediaDecoderLog) {
    1.31 +    gMediaDecoderLog = PR_NewLogModule("MediaDecoder");
    1.32 +  }
    1.33 +#endif
    1.34 +}
    1.35 +
    1.36 +BufferDecoder::~BufferDecoder()
    1.37 +{
    1.38 +  // The dtor may run on any thread, we cannot be sure.
    1.39 +  MOZ_COUNT_DTOR(BufferDecoder);
    1.40 +}
    1.41 +
    1.42 +void
    1.43 +BufferDecoder::BeginDecoding(nsIThread* aDecodeThread)
    1.44 +{
    1.45 +  MOZ_ASSERT(!mDecodeThread && aDecodeThread);
    1.46 +  mDecodeThread = aDecodeThread;
    1.47 +}
    1.48 +
    1.49 +ReentrantMonitor&
    1.50 +BufferDecoder::GetReentrantMonitor()
    1.51 +{
    1.52 +  return mReentrantMonitor;
    1.53 +}
    1.54 +
    1.55 +bool
    1.56 +BufferDecoder::IsShutdown() const
    1.57 +{
    1.58 +  // BufferDecoder cannot be shut down.
    1.59 +  return false;
    1.60 +}
    1.61 +
    1.62 +bool
    1.63 +BufferDecoder::OnStateMachineThread() const
    1.64 +{
    1.65 +  // BufferDecoder doesn't have the concept of a state machine.
    1.66 +  return true;
    1.67 +}
    1.68 +
    1.69 +bool
    1.70 +BufferDecoder::OnDecodeThread() const
    1.71 +{
    1.72 +  MOZ_ASSERT(mDecodeThread, "Forgot to call BeginDecoding?");
    1.73 +  return IsCurrentThread(mDecodeThread);
    1.74 +}
    1.75 +
    1.76 +MediaResource*
    1.77 +BufferDecoder::GetResource() const
    1.78 +{
    1.79 +  return mResource;
    1.80 +}
    1.81 +
    1.82 +void
    1.83 +BufferDecoder::NotifyBytesConsumed(int64_t aBytes, int64_t aOffset)
    1.84 +{
    1.85 +  // ignore
    1.86 +}
    1.87 +
    1.88 +void
    1.89 +BufferDecoder::NotifyDecodedFrames(uint32_t aParsed, uint32_t aDecoded)
    1.90 +{
    1.91 +  // ignore
    1.92 +}
    1.93 +
    1.94 +int64_t
    1.95 +BufferDecoder::GetEndMediaTime() const
    1.96 +{
    1.97 +  // unknown
    1.98 +  return -1;
    1.99 +}
   1.100 +
   1.101 +int64_t
   1.102 +BufferDecoder::GetMediaDuration()
   1.103 +{
   1.104 +  // unknown
   1.105 +  return -1;
   1.106 +}
   1.107 +
   1.108 +void
   1.109 +BufferDecoder::SetMediaDuration(int64_t aDuration)
   1.110 +{
   1.111 +  // ignore
   1.112 +}
   1.113 +
   1.114 +void
   1.115 +BufferDecoder::UpdateEstimatedMediaDuration(int64_t aDuration)
   1.116 +{
   1.117 +  // ignore
   1.118 +}
   1.119 +
   1.120 +void
   1.121 +BufferDecoder::SetMediaSeekable(bool aMediaSeekable)
   1.122 +{
   1.123 +  // ignore
   1.124 +}
   1.125 +
   1.126 +void
   1.127 +BufferDecoder::SetTransportSeekable(bool aTransportSeekable)
   1.128 +{
   1.129 +  // ignore
   1.130 +}
   1.131 +
   1.132 +VideoFrameContainer*
   1.133 +BufferDecoder::GetVideoFrameContainer()
   1.134 +{
   1.135 +  // no video frame
   1.136 +  return nullptr;
   1.137 +}
   1.138 +
   1.139 +layers::ImageContainer*
   1.140 +BufferDecoder::GetImageContainer()
   1.141 +{
   1.142 +  // no image container
   1.143 +  return nullptr;
   1.144 +}
   1.145 +
   1.146 +bool
   1.147 +BufferDecoder::IsTransportSeekable()
   1.148 +{
   1.149 +  return false;
   1.150 +}
   1.151 +
   1.152 +bool
   1.153 +BufferDecoder::IsMediaSeekable()
   1.154 +{
   1.155 +  return false;
   1.156 +}
   1.157 +
   1.158 +void
   1.159 +BufferDecoder::MetadataLoaded(int aChannels, int aRate, bool aHasAudio, bool aHasVideo, MetadataTags* aTags)
   1.160 +{
   1.161 +  // ignore
   1.162 +}
   1.163 +
   1.164 +void
   1.165 +BufferDecoder::QueueMetadata(int64_t aTime, int aChannels, int aRate, bool aHasAudio, bool aHasVideo, MetadataTags* aTags)
   1.166 +{
   1.167 +  // ignore
   1.168 +}
   1.169 +
   1.170 +void
   1.171 +BufferDecoder::SetMediaEndTime(int64_t aTime)
   1.172 +{
   1.173 +  // ignore
   1.174 +}
   1.175 +
   1.176 +void
   1.177 +BufferDecoder::UpdatePlaybackPosition(int64_t aTime)
   1.178 +{
   1.179 +  // ignore
   1.180 +}
   1.181 +
   1.182 +void
   1.183 +BufferDecoder::OnReadMetadataCompleted()
   1.184 +{
   1.185 +  // ignore
   1.186 +}
   1.187 +
   1.188 +void
   1.189 +BufferDecoder::NotifyWaitingForResourcesStatusChanged()
   1.190 +{
   1.191 +  // ignore
   1.192 +}
   1.193 +
   1.194 +MediaDecoderOwner*
   1.195 +BufferDecoder::GetOwner()
   1.196 +{
   1.197 +  // unknown
   1.198 +  return nullptr;
   1.199 +}
   1.200 +
   1.201 +} // namespace mozilla

mercurial