• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
18 #define LOG_TAG "C2SoftwareCodecServiceRegistrant"
19 
20 #include <C2PlatformSupport.h>
21 #include <codec2/hidl/1.0/ComponentStore.h>
22 #include <media/CodecServiceRegistrant.h>
23 #include <media/stagefright/omx/1.0/Omx.h>
24 #include <log/log.h>
25 
RegisterCodecServices()26 extern "C" void RegisterCodecServices() {
27     using namespace ::hardware::google::media::c2::V1_0;
28     android::sp<IComponentStore> store =
29         new utils::ComponentStore(
30                 android::GetCodec2PlatformComponentStore());
31     if (store == nullptr) {
32         ALOGE("Cannot create Codec2's IComponentStore software service.");
33     } else {
34         if (store->registerAsService("software") != android::OK) {
35             ALOGE("Cannot register Codec2's "
36                     "IComponentStore software service.");
37         } else {
38             ALOGI("Codec2's IComponentStore software service created.");
39         }
40     }
41 
42     // Default codec services
43     using namespace ::android::hardware::media::omx::V1_0;
44     android::sp<IOmx> omx = new implementation::Omx();
45     if (omx == nullptr) {
46         ALOGE("Cannot create IOmx HAL service.");
47     } else if (omx->registerAsService() != android::OK) {
48         ALOGE("Cannot register IOmx HAL service.");
49     }
50 
51 }
52 
53