LCOV - code coverage report
Current view: top level - dom/media/platforms/agnostic - VPXDecoder.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 2 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 1 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             : #if !defined(VPXDecoder_h_)
       7             : #define VPXDecoder_h_
       8             : 
       9             : #include "PlatformDecoderModule.h"
      10             : #include "mozilla/Span.h"
      11             : 
      12             : #include <stdint.h>
      13             : #define VPX_DONT_DEFINE_STDINT_TYPES
      14             : #include "vpx/vp8dx.h"
      15             : #include "vpx/vpx_codec.h"
      16             : #include "vpx/vpx_decoder.h"
      17             : 
      18             : namespace mozilla {
      19             : 
      20             : class VPXDecoder : public MediaDataDecoder
      21             : {
      22             : public:
      23             :   explicit VPXDecoder(const CreateDecoderParams& aParams);
      24             : 
      25             :   RefPtr<InitPromise> Init() override;
      26             :   RefPtr<DecodePromise> Decode(MediaRawData* aSample) override;
      27             :   RefPtr<DecodePromise> Drain() override;
      28             :   RefPtr<FlushPromise> Flush() override;
      29             :   RefPtr<ShutdownPromise> Shutdown() override;
      30           0 :   const char* GetDescriptionName() const override
      31             :   {
      32           0 :     return "libvpx video decoder";
      33             :   }
      34             : 
      35             :   enum Codec: uint8_t
      36             :   {
      37             :     VP8 = 1 << 0,
      38             :     VP9 = 1 << 1,
      39             :     Unknown = 1 << 7,
      40             :   };
      41             : 
      42             :   // Return true if aMimeType is a one of the strings used by our demuxers to
      43             :   // identify VPX of the specified type. Does not parse general content type
      44             :   // strings, i.e. white space matters.
      45             :   static bool IsVPX(const nsACString& aMimeType, uint8_t aCodecMask=VP8|VP9);
      46             :   static bool IsVP8(const nsACString& aMimeType);
      47             :   static bool IsVP9(const nsACString& aMimeType);
      48             : 
      49             :   // Return true if a sample is a keyframe for the specified codec.
      50             :   static bool IsKeyframe(Span<const uint8_t> aBuffer, Codec aCodec);
      51             : 
      52             :   // Return the frame dimensions for a sample for the specified codec.
      53             :   static nsIntSize GetFrameSize(Span<const uint8_t> aBuffer, Codec aCodec);
      54             : 
      55             : private:
      56             :   ~VPXDecoder();
      57             :   RefPtr<DecodePromise> ProcessDecode(MediaRawData* aSample);
      58             :   MediaResult DecodeAlpha(vpx_image_t** aImgAlpha, const MediaRawData* aSample);
      59             : 
      60             :   const RefPtr<layers::ImageContainer> mImageContainer;
      61             :   RefPtr<layers::KnowsCompositor> mImageAllocator;
      62             :   const RefPtr<TaskQueue> mTaskQueue;
      63             : 
      64             :   // VPx decoder state
      65             :   vpx_codec_ctx_t mVPX;
      66             : 
      67             :   // VPx alpha decoder state
      68             :   vpx_codec_ctx_t mVPXAlpha;
      69             : 
      70             :   const VideoInfo& mInfo;
      71             : 
      72             :   const Codec mCodec;
      73             : };
      74             : 
      75             : } // namespace mozilla
      76             : 
      77             : #endif

Generated by: LCOV version 1.13