LCOV - code coverage report
Current view: top level - dom/media/platforms/agnostic/gmp - GMPVideoDecoder.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 15 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 11 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             : #if !defined(GMPVideoDecoder_h_)
       8             : #define GMPVideoDecoder_h_
       9             : 
      10             : #include "GMPVideoDecoderProxy.h"
      11             : #include "ImageContainer.h"
      12             : #include "MediaDataDecoderProxy.h"
      13             : #include "MediaInfo.h"
      14             : #include "PlatformDecoderModule.h"
      15             : #include "mozIGeckoMediaPluginService.h"
      16             : 
      17             : namespace mozilla {
      18             : 
      19           0 : struct GMPVideoDecoderParams
      20             : {
      21             :   explicit GMPVideoDecoderParams(const CreateDecoderParams& aParams);
      22             : 
      23             :   const VideoInfo& mConfig;
      24             :   TaskQueue* mTaskQueue;
      25             :   layers::ImageContainer* mImageContainer;
      26             :   layers::LayersBackend mLayersBackend;
      27             :   RefPtr<GMPCrashHelper> mCrashHelper;
      28             : };
      29             : 
      30           0 : class GMPVideoDecoder : public MediaDataDecoder,
      31             :                         public GMPVideoDecoderCallbackProxy
      32             : {
      33             : public:
      34             :   explicit GMPVideoDecoder(const GMPVideoDecoderParams& aParams);
      35             : 
      36             :   RefPtr<InitPromise> Init() override;
      37             :   RefPtr<DecodePromise> Decode(MediaRawData* aSample) override;
      38             :   RefPtr<DecodePromise> Drain() override;
      39             :   RefPtr<FlushPromise> Flush() override;
      40             :   RefPtr<ShutdownPromise> Shutdown() override;
      41           0 :   const char* GetDescriptionName() const override
      42             :   {
      43           0 :     return "GMP video decoder";
      44             :   }
      45           0 :   ConversionRequired NeedsConversion() const override
      46             :   {
      47           0 :     return mConvertToAnnexB ? ConversionRequired::kNeedAnnexB
      48           0 :                             : ConversionRequired::kNeedAVCC;
      49             :   }
      50             : 
      51             :   // GMPVideoDecoderCallbackProxy
      52             :   // All those methods are called on the GMP thread.
      53             :   void Decoded(GMPVideoi420Frame* aDecodedFrame) override;
      54             :   void ReceivedDecodedReferenceFrame(const uint64_t aPictureId) override;
      55             :   void ReceivedDecodedFrame(const uint64_t aPictureId) override;
      56             :   void InputDataExhausted() override;
      57             :   void DrainComplete() override;
      58             :   void ResetComplete() override;
      59             :   void Error(GMPErr aErr) override;
      60             :   void Terminated() override;
      61             : 
      62             : protected:
      63             :   virtual void InitTags(nsTArray<nsCString>& aTags);
      64             :   virtual nsCString GetNodeId();
      65           0 :   virtual uint32_t DecryptorId() const { return 0; }
      66             :   virtual GMPUniquePtr<GMPVideoEncodedFrame> CreateFrame(MediaRawData* aSample);
      67             :   virtual const VideoInfo& GetConfig() const;
      68             : 
      69             : private:
      70             : 
      71           0 :   class GMPInitDoneCallback : public GetGMPVideoDecoderCallback
      72             :   {
      73             :   public:
      74           0 :     explicit GMPInitDoneCallback(GMPVideoDecoder* aDecoder)
      75           0 :       : mDecoder(aDecoder)
      76             :     {
      77           0 :     }
      78             : 
      79           0 :     void Done(GMPVideoDecoderProxy* aGMP, GMPVideoHost* aHost) override
      80             :     {
      81           0 :       mDecoder->GMPInitDone(aGMP, aHost);
      82           0 :     }
      83             : 
      84             :   private:
      85             :     RefPtr<GMPVideoDecoder> mDecoder;
      86             :   };
      87             :   void GMPInitDone(GMPVideoDecoderProxy* aGMP, GMPVideoHost* aHost);
      88             : 
      89             :   const VideoInfo mConfig;
      90             :   nsCOMPtr<mozIGeckoMediaPluginService> mMPS;
      91             :   GMPVideoDecoderProxy* mGMP;
      92             :   GMPVideoHost* mHost;
      93             :   bool mConvertNALUnitLengths;
      94             :   MozPromiseHolder<InitPromise> mInitPromise;
      95             :   RefPtr<GMPCrashHelper> mCrashHelper;
      96             : 
      97             :   int64_t mLastStreamOffset = 0;
      98             :   RefPtr<layers::ImageContainer> mImageContainer;
      99             : 
     100             :   MozPromiseHolder<DecodePromise> mDecodePromise;
     101             :   MozPromiseHolder<DecodePromise> mDrainPromise;
     102             :   MozPromiseHolder<FlushPromise> mFlushPromise;
     103             :   DecodedData mDecodedData;
     104             :   bool mConvertToAnnexB = false;
     105             : };
     106             : 
     107             : } // namespace mozilla
     108             : 
     109             : #endif // GMPVideoDecoder_h_

Generated by: LCOV version 1.13