Pawin Vongmasa | 3665390 | 2018-11-15 00:10:25 -0800 | [diff] [blame] | 1 | /* |
| 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 Vongmasa | e55ed3f | 2018-11-28 03:39:57 -0800 | [diff] [blame] | 18 | #define LOG_TAG "CodecServiceRegistrant" |
| 19 | |
| 20 | #include <android-base/logging.h> |
Pawin Vongmasa | 3665390 | 2018-11-15 00:10:25 -0800 | [diff] [blame] | 21 | |
| 22 | #include <C2PlatformSupport.h> |
| 23 | #include <codec2/hidl/1.0/ComponentStore.h> |
| 24 | #include <media/CodecServiceRegistrant.h> |
Pawin Vongmasa | 3665390 | 2018-11-15 00:10:25 -0800 | [diff] [blame] | 25 | |
| 26 | extern "C" void RegisterCodecServices() { |
Pawin Vongmasa | d0f0e14 | 2018-11-15 03:36:28 -0800 | [diff] [blame] | 27 | using namespace ::android::hardware::media::c2::V1_0; |
Pawin Vongmasa | e55ed3f | 2018-11-28 03:39:57 -0800 | [diff] [blame] | 28 | LOG(INFO) << "Creating software Codec2 service..."; |
Pawin Vongmasa | 3665390 | 2018-11-15 00:10:25 -0800 | [diff] [blame] | 29 | android::sp<IComponentStore> store = |
| 30 | new utils::ComponentStore( |
| 31 | android::GetCodec2PlatformComponentStore()); |
| 32 | if (store == nullptr) { |
Pawin Vongmasa | e55ed3f | 2018-11-28 03:39:57 -0800 | [diff] [blame] | 33 | LOG(ERROR) << |
| 34 | "Cannot create software Codec2 service."; |
Pawin Vongmasa | 3665390 | 2018-11-15 00:10:25 -0800 | [diff] [blame] | 35 | } else { |
| 36 | if (store->registerAsService("software") != android::OK) { |
Pawin Vongmasa | e55ed3f | 2018-11-28 03:39:57 -0800 | [diff] [blame] | 37 | LOG(ERROR) << |
| 38 | "Cannot register software Codec2 service."; |
Pawin Vongmasa | 3665390 | 2018-11-15 00:10:25 -0800 | [diff] [blame] | 39 | } else { |
Pawin Vongmasa | e55ed3f | 2018-11-28 03:39:57 -0800 | [diff] [blame] | 40 | LOG(INFO) << |
| 41 | "Software Codec2 service created."; |
Pawin Vongmasa | 3665390 | 2018-11-15 00:10:25 -0800 | [diff] [blame] | 42 | } |
| 43 | } |
| 44 | } |
| 45 | |