Line data Source code
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 "nsTArray.h"
10 : #include "gmp-video-decode.h"
11 : #include "gmp-video-frame-i420.h"
12 : #include "gmp-video-frame-encoded.h"
13 :
14 : #include "GMPCallbackBase.h"
15 : #include "GMPUtils.h"
16 :
17 0 : class GMPVideoDecoderCallbackProxy : public GMPCallbackBase,
18 : public GMPVideoDecoderCallback
19 : {
20 : public:
21 0 : virtual ~GMPVideoDecoderCallbackProxy() {}
22 : };
23 :
24 : // A proxy to GMPVideoDecoder in the child process.
25 : // GMPVideoDecoderParent exposes this to users the GMP.
26 : // This enables Gecko to pass nsTArrays to the child GMP and avoid
27 : // an extra copy when doing so.
28 :
29 : // The consumer must call Close() when done with the codec, or when
30 : // Terminated() is called by the GMP plugin indicating an abnormal shutdown
31 : // of the underlying plugin. After calling Close(), the consumer must
32 : // not access this again.
33 :
34 : // This interface is not thread-safe and must only be used from GMPThread.
35 0 : class GMPVideoDecoderProxy {
36 : public:
37 : virtual nsresult InitDecode(const GMPVideoCodec& aCodecSettings,
38 : const nsTArray<uint8_t>& aCodecSpecific,
39 : GMPVideoDecoderCallbackProxy* aCallback,
40 : int32_t aCoreCount) = 0;
41 : virtual nsresult Decode(mozilla::GMPUniquePtr<GMPVideoEncodedFrame> aInputFrame,
42 : bool aMissingFrames,
43 : const nsTArray<uint8_t>& aCodecSpecificInfo,
44 : int64_t aRenderTimeMs = -1) = 0;
45 : virtual nsresult Reset() = 0;
46 : virtual nsresult Drain() = 0;
47 : virtual uint32_t GetPluginId() 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 const nsCString& GetDisplayName() const = 0;
54 : };
55 :
56 : #endif
|