GMPVideoDecoderProxy.h (2115B)
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 #ifndef GMPVideoDecoderProxy_h_ 7 #define GMPVideoDecoderProxy_h_ 8 9 #include "GMPCallbackBase.h" 10 #include "GMPNativeTypes.h" 11 #include "GMPUtils.h" 12 #include "gmp-video-decode.h" 13 #include "gmp-video-frame-encoded.h" 14 #include "gmp-video-frame-i420.h" 15 #include "nsTArray.h" 16 17 class GMPVideoDecoderCallbackProxy : public GMPCallbackBase, 18 public GMPVideoDecoderCallback { 19 public: 20 virtual ~GMPVideoDecoderCallbackProxy() = default; 21 }; 22 23 // A proxy to GMPVideoDecoder in the child process. 24 // GMPVideoDecoderParent exposes this to users the GMP. 25 // This enables Gecko to pass nsTArrays to the child GMP and avoid 26 // an extra copy when doing so. 27 28 // The consumer must call Close() when done with the codec, or when 29 // Terminated() is called by the GMP plugin indicating an abnormal shutdown 30 // of the underlying plugin. After calling Close(), the consumer must 31 // not access this again. 32 33 // This interface is not thread-safe and must only be used from GMPThread. 34 class GMPVideoDecoderProxy { 35 public: 36 virtual nsresult InitDecode(const GMPVideoCodec& aCodecSettings, 37 const nsTArray<uint8_t>& aCodecSpecific, 38 GMPVideoDecoderCallbackProxy* aCallback, 39 int32_t aCoreCount) = 0; 40 virtual nsresult Decode( 41 mozilla::GMPUniquePtr<GMPVideoEncodedFrame> aInputFrame, 42 bool aMissingFrames, const nsTArray<uint8_t>& aCodecSpecificInfo, 43 int64_t aRenderTimeMs = -1) = 0; 44 virtual nsresult Reset() = 0; 45 virtual nsresult Drain() = 0; 46 virtual uint32_t GetPluginId() const = 0; 47 virtual GMPPluginType GetPluginType() const = 0; 48 49 // Call to tell GMP/plugin the consumer will no longer use this 50 // interface/codec. 51 virtual void Close() = 0; 52 53 virtual nsCString GetDisplayName() const = 0; 54 }; 55 56 #endif