blob: 58db801ed25b5df63afef62f5a77c14b012d2f4c [file] [log] [blame]
Pawin Vongmasa36653902018-11-15 00:10:25 -08001/*
2 * Copyright 2018 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17//#define LOG_NDEBUG 0
Pawin Vongmasae55ed3f2018-11-28 03:39:57 -080018#define LOG_TAG "CodecServiceRegistrant"
19
20#include <android-base/logging.h>
Pawin Vongmasa36653902018-11-15 00:10:25 -080021
22#include <C2PlatformSupport.h>
Pawin Vongmasabf69de92019-10-29 06:21:27 -070023#include <codec2/hidl/1.1/ComponentStore.h>
Pawin Vongmasa36653902018-11-15 00:10:25 -080024#include <media/CodecServiceRegistrant.h>
Pawin Vongmasa36653902018-11-15 00:10:25 -080025
26extern "C" void RegisterCodecServices() {
Pawin Vongmasabf69de92019-10-29 06:21:27 -070027 using namespace ::android::hardware::media::c2::V1_1;
Pawin Vongmasae55ed3f2018-11-28 03:39:57 -080028 LOG(INFO) << "Creating software Codec2 service...";
Pawin Vongmasa36653902018-11-15 00:10:25 -080029 android::sp<IComponentStore> store =
30 new utils::ComponentStore(
31 android::GetCodec2PlatformComponentStore());
32 if (store == nullptr) {
Pawin Vongmasae55ed3f2018-11-28 03:39:57 -080033 LOG(ERROR) <<
34 "Cannot create software Codec2 service.";
Pawin Vongmasa36653902018-11-15 00:10:25 -080035 } else {
36 if (store->registerAsService("software") != android::OK) {
Pawin Vongmasae55ed3f2018-11-28 03:39:57 -080037 LOG(ERROR) <<
38 "Cannot register software Codec2 service.";
Pawin Vongmasa36653902018-11-15 00:10:25 -080039 } else {
Pawin Vongmasae55ed3f2018-11-28 03:39:57 -080040 LOG(INFO) <<
41 "Software Codec2 service created.";
Pawin Vongmasa36653902018-11-15 00:10:25 -080042 }
43 }
44}
45