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 GMPVideoEncoderProxy_h_
7 : #define GMPVideoEncoderProxy_h_
8 :
9 : #include "nsTArray.h"
10 : #include "gmp-video-encode.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 GMPVideoEncoderCallbackProxy : public GMPCallbackBase {
18 : public:
19 0 : virtual ~GMPVideoEncoderCallbackProxy() {}
20 : virtual void Encoded(GMPVideoEncodedFrame* aEncodedFrame,
21 : const nsTArray<uint8_t>& aCodecSpecificInfo) = 0;
22 : virtual void Error(GMPErr aError) = 0;
23 : };
24 :
25 : // A proxy to GMPVideoEncoder in the child process.
26 : // GMPVideoEncoderParent exposes this to users the GMP.
27 : // This enables Gecko to pass nsTArrays to the child GMP and avoid
28 : // an extra copy when doing so.
29 :
30 : // The consumer must call Close() when done with the codec, or when
31 : // Terminated() is called by the GMP plugin indicating an abnormal shutdown
32 : // of the underlying plugin. After calling Close(), the consumer must
33 : // not access this again.
34 :
35 : // This interface is not thread-safe and must only be used from GMPThread.
36 0 : class GMPVideoEncoderProxy {
37 : public:
38 : virtual GMPErr InitEncode(const GMPVideoCodec& aCodecSettings,
39 : const nsTArray<uint8_t>& aCodecSpecific,
40 : GMPVideoEncoderCallbackProxy* aCallback,
41 : int32_t aNumberOfCores,
42 : uint32_t aMaxPayloadSize) = 0;
43 : virtual GMPErr Encode(mozilla::GMPUniquePtr<GMPVideoi420Frame> aInputFrame,
44 : const nsTArray<uint8_t>& aCodecSpecificInfo,
45 : const nsTArray<GMPVideoFrameType>& aFrameTypes) = 0;
46 : virtual GMPErr SetChannelParameters(uint32_t aPacketLoss, uint32_t aRTT) = 0;
47 : virtual GMPErr SetRates(uint32_t aNewBitRate, uint32_t aFrameRate) = 0;
48 : virtual GMPErr SetPeriodicKeyFrames(bool aEnable) = 0;
49 : virtual uint32_t GetPluginId() const = 0;
50 :
51 : // Call to tell GMP/plugin the consumer will no longer use this
52 : // interface/codec.
53 : virtual void Close() = 0;
54 : };
55 :
56 : #endif // GMPVideoEncoderProxy_h_
|