GMPVideoPlaneImpl.h (1485B)
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 GMPVideoPlaneImpl_h_ 7 #define GMPVideoPlaneImpl_h_ 8 9 #include "gmp-video-plane.h" 10 #include "nsTArray.h" 11 12 namespace mozilla::gmp { 13 14 class GMPPlaneData; 15 16 class GMPPlaneImpl final : public GMPPlane { 17 public: 18 GMPPlaneImpl() = default; 19 GMPPlaneImpl(nsTArray<uint8_t>&& aArrayBuffer, 20 const GMPPlaneData& aPlaneData); 21 virtual ~GMPPlaneImpl() = default; 22 23 bool InitPlaneData(nsTArray<uint8_t>& aArrayBuffer, GMPPlaneData& aPlaneData); 24 25 // GMPPlane 26 GMPErr CreateEmptyPlane(int32_t aAllocatedSize, int32_t aStride, 27 int32_t aPlaneSize) override; 28 GMPErr Copy(const GMPPlane& aPlane) override; 29 GMPErr Copy(int32_t aSize, int32_t aStride, const uint8_t* aBuffer) override; 30 void Swap(GMPPlane& aPlane) override; 31 int32_t AllocatedSize() const override; 32 void ResetSize() override; 33 bool IsZeroSize() const override; 34 int32_t Stride() const override; 35 const uint8_t* Buffer() const override; 36 uint8_t* Buffer() override; 37 void Destroy() override; 38 39 private: 40 GMPErr MaybeResize(int32_t aNewSize); 41 42 nsTArray<uint8_t> mArrayBuffer; 43 int32_t mSize = 0; 44 int32_t mStride = 0; 45 }; 46 47 } // namespace mozilla::gmp 48 49 #endif // GMPVideoPlaneImpl_h_