1 // Copyright 2018 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef ANDROID_C2_ARC_VIDEO_ACCELERATOR_FACTORY_H 6 #define ANDROID_C2_ARC_VIDEO_ACCELERATOR_FACTORY_H 7 8 #include <media/arcvideobridge/IArcVideoBridge.h> 9 #include <utils/Singleton.h> 10 11 #include <components/arc/common/video.mojom.h> 12 #include <components/arc/common/video_decode_accelerator.mojom.h> 13 #include <components/arc/common/video_encode_accelerator.mojom.h> 14 15 namespace android { 16 // Helper class to create message pipe to the ArcVideoAccelerator. 17 // This class should only be used in the Mojo thread. 18 class C2ArcVideoAcceleratorFactory : public Singleton<C2ArcVideoAcceleratorFactory> { 19 public: 20 bool createVideoDecodeAccelerator(::arc::mojom::VideoDecodeAcceleratorRequest request); 21 bool createVideoEncodeAccelerator(::arc::mojom::VideoEncodeAcceleratorRequest request); 22 bool createVideoProtectedBufferAllocator( 23 ::arc::mojom::VideoProtectedBufferAllocatorRequest request); 24 int32_t hostVersion() const; 25 26 private: 27 C2ArcVideoAcceleratorFactory(); 28 29 uint32_t mHostVersion; 30 sp<IArcVideoBridge> mArcVideoBridge; 31 ::arc::mojom::VideoAcceleratorFactoryPtr mRemoteFactory; 32 33 friend class Singleton<C2ArcVideoAcceleratorFactory>; 34 }; 35 } // namespace android 36 37 #endif // ANDROID_C2_ARC_VIDEO_ACCELERATOR_FACTORY_H 38