LCOV - code coverage report
Current view: top level - dom/media - AbstractMediaDecoder.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 18 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 9 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* vim:set ts=2 sw=2 sts=2 et cindent: */
       3             : /* This Source Code Form is subject to the terms of the Mozilla Public
       4             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       5             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #ifndef AbstractMediaDecoder_h_
       8             : #define AbstractMediaDecoder_h_
       9             : 
      10             : #include "mozilla/Attributes.h"
      11             : #include "mozilla/StateMirroring.h"
      12             : 
      13             : #include "FrameStatistics.h"
      14             : #include "MediaEventSource.h"
      15             : #include "MediaInfo.h"
      16             : #include "nsISupports.h"
      17             : #include "nsDataHashtable.h"
      18             : #include "nsThreadUtils.h"
      19             : 
      20             : namespace mozilla {
      21             : 
      22             : namespace layers {
      23             : class ImageContainer;
      24             : class KnowsCompositor;
      25             : } // namespace layers
      26             : 
      27             : class AbstractThread;
      28             : class MediaResource;
      29             : class ReentrantMonitor;
      30             : class VideoFrameContainer;
      31             : class MediaDecoderOwner;
      32             : class CDMProxy;
      33             : class GMPCrashHelper;
      34             : 
      35             : typedef nsDataHashtable<nsCStringHashKey, nsCString> MetadataTags;
      36             : 
      37             : /**
      38             :  * The AbstractMediaDecoder class describes the public interface for a media decoder
      39             :  * and is used by the MediaReader classes.
      40             :  */
      41           0 : class AbstractMediaDecoder : public nsIObserver
      42             : {
      43             : public:
      44             :   // Increments the parsed, decoded and dropped frame counters by the passed in
      45             :   // counts.
      46             :   // Can be called on any thread.
      47             :   virtual void NotifyDecodedFrames(const FrameStatisticsData& aStats) = 0;
      48             : 
      49             :   // Returns an event that will be notified when the owning document changes state
      50             :   // and we might have a new compositor. If this new compositor requires us to
      51             :   // recreate our decoders, then we expect the existing decoderis to return an
      52             :   // error independently of this.
      53             :   virtual MediaEventSource<RefPtr<layers::KnowsCompositor>>*
      54           0 :   CompositorUpdatedEvent()
      55             :   {
      56           0 :     return nullptr;
      57             :   }
      58             : 
      59             :   // Notify the media decoder that a decryption key is required before emitting
      60             :   // further output. This only needs to be overridden for decoders that expect
      61             :   // encryption, such as the MediaSource decoder.
      62           0 :   virtual void NotifyWaitingForKey() { }
      63             : 
      64             :   // Return an event that will be notified when a decoder is waiting for a
      65             :   // decryption key before it can return more output.
      66           0 :   virtual MediaEventSource<void>* WaitingForKeyEvent()
      67             :   {
      68           0 :     return nullptr;
      69             :   }
      70             : 
      71             :   // Return an abstract thread on which to run main thread runnables.
      72             :   virtual AbstractThread* AbstractMainThread() const = 0;
      73             : 
      74             : public:
      75             :   virtual VideoFrameContainer* GetVideoFrameContainer() = 0;
      76             :   virtual mozilla::layers::ImageContainer* GetImageContainer() = 0;
      77             : 
      78             :   // Returns the owner of this decoder or null when the decoder is shutting
      79             :   // down. The owner should only be used on the main thread.
      80             :   virtual MediaDecoderOwner* GetOwner() const = 0;
      81             : 
      82             :   // Set by Reader if the current audio track can be offloaded
      83           0 :   virtual void SetPlatformCanOffloadAudio(bool aCanOffloadAudio) { }
      84             : 
      85           0 :   virtual already_AddRefed<GMPCrashHelper> GetCrashHelper() { return nullptr; }
      86             : 
      87             :   // Stack based class to assist in notifying the frame statistics of
      88             :   // parsed and decoded frames. Use inside video demux & decode functions
      89             :   // to ensure all parsed and decoded frames are reported on all return paths.
      90             :   class AutoNotifyDecoded
      91             :   {
      92             :   public:
      93           0 :     explicit AutoNotifyDecoded(AbstractMediaDecoder* aDecoder)
      94           0 :       : mDecoder(aDecoder)
      95             :     {
      96           0 :     }
      97           0 :     ~AutoNotifyDecoded()
      98           0 :     {
      99           0 :       if (mDecoder) {
     100           0 :         mDecoder->NotifyDecodedFrames(mStats);
     101             :       }
     102           0 :     }
     103             : 
     104             :     FrameStatisticsData mStats;
     105             : 
     106             :   private:
     107             :     AbstractMediaDecoder* mDecoder;
     108             :   };
     109             : 
     110             :   // Classes directly inheriting from AbstractMediaDecoder do not support
     111             :   // Observe and it should never be called directly.
     112           0 :   NS_IMETHOD Observe(nsISupports* aSubject, const char* aTopic,
     113             :                      const char16_t* aData) override
     114             :   {
     115           0 :     MOZ_CRASH("Forbidden method");
     116             :     return NS_OK;
     117             :   }
     118             : };
     119             : 
     120             : } // namespace mozilla
     121             : 
     122             : #endif
     123             : 

Generated by: LCOV version 1.13