// Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. //#define LOG_NDEBUG 0 #define LOG_TAG "V4L2ComponentStore" #include #include #include #include #include #include #include #include #include #include #include namespace android { // static std::shared_ptr V4L2ComponentStore::Create() { ALOGV("%s()", __func__); static std::mutex mutex; static std::weak_ptr platformStore; std::lock_guard lock(mutex); std::shared_ptr store = platformStore.lock(); if (store != nullptr) return store; auto builder = ComponentStore::Builder("android.componentStore.v4l2"); builder.encoder(V4L2ComponentName::kH264Encoder, VideoCodec::H264, &V4L2ComponentFactory::create); builder.encoder(V4L2ComponentName::kVP8Encoder, VideoCodec::VP8, &V4L2ComponentFactory::create); builder.encoder(V4L2ComponentName::kVP9Encoder, VideoCodec::VP9, &V4L2ComponentFactory::create); builder.decoder(V4L2ComponentName::kH264Decoder, VideoCodec::H264, &V4L2ComponentFactory::create); builder.decoder(V4L2ComponentName::kVP8Decoder, VideoCodec::VP8, &V4L2ComponentFactory::create); builder.decoder(V4L2ComponentName::kVP9Decoder, VideoCodec::VP9, &V4L2ComponentFactory::create); builder.decoder(V4L2ComponentName::kHEVCDecoder, VideoCodec::HEVC, &V4L2ComponentFactory::create); builder.decoder(V4L2ComponentName::kH264SecureDecoder, VideoCodec::H264, &V4L2ComponentFactory::create); builder.decoder(V4L2ComponentName::kVP8SecureDecoder, VideoCodec::VP8, &V4L2ComponentFactory::create); builder.decoder(V4L2ComponentName::kVP9SecureDecoder, VideoCodec::VP9, &V4L2ComponentFactory::create); builder.decoder(V4L2ComponentName::kHEVCSecureDecoder, VideoCodec::HEVC, &V4L2ComponentFactory::create); store = std::shared_ptr(std::move(builder).build()); platformStore = store; return store; } } // namespace android