1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 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 7 #ifndef MOZILLA_GFX_GPUVIDEOTEXTURECLIENT_H 8 #define MOZILLA_GFX_GPUVIDEOTEXTURECLIENT_H 9 10 #include "mozilla/layers/TextureClient.h" 11 12 namespace mozilla { 13 namespace gfx { 14 class SourceSurface; 15 } 16 17 namespace layers { 18 class IGPUVideoSurfaceManager; 19 20 class GPUVideoTextureData : public TextureData { 21 public: 22 GPUVideoTextureData(IGPUVideoSurfaceManager* aManager, 23 const SurfaceDescriptorGPUVideo& aSD, 24 const gfx::IntSize& aSize); 25 virtual ~GPUVideoTextureData(); 26 27 void FillInfo(TextureData::Info& aInfo) const override; 28 Lock(OpenMode)29 bool Lock(OpenMode) override { return true; }; 30 Unlock()31 void Unlock() override{}; 32 33 bool Serialize(SurfaceDescriptor& aOutDescriptor) override; 34 35 void Deallocate(LayersIPCChannel* aAllocator) override; 36 37 void Forget(LayersIPCChannel* aAllocator) override; 38 39 already_AddRefed<gfx::SourceSurface> GetAsSourceSurface(); 40 AsGPUVideoTextureData()41 GPUVideoTextureData* AsGPUVideoTextureData() override { return this; } 42 43 protected: 44 RefPtr<IGPUVideoSurfaceManager> mManager; 45 SurfaceDescriptorGPUVideo mSD; 46 gfx::IntSize mSize; 47 48 public: decltype(mSD)49 const decltype(mSD)& SD() const { return mSD; } 50 }; 51 52 } // namespace layers 53 } // namespace mozilla 54 55 #endif // MOZILLA_GFX_GPUVIDEOTEXTURECLIENT_H 56