Loading media/libmedia/include/media/CodecServiceRegistrant.h 0 → 100644 +23 −0 Original line number Diff line number Diff line /* * Copyright (C) 2018 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CODEC_SERVICE_REGISTRANT_H_ #define CODEC_SERVICE_REGISTRANT_H_ typedef void (*RegisterCodecServicesFunc)(); #endif // CODEC_SERVICE_REGISTRANT_H_ services/mediacodec/main_codecservice.cpp +33 −13 Original line number Diff line number Diff line Loading @@ -25,6 +25,9 @@ #include <media/stagefright/omx/1.0/Omx.h> #include <media/stagefright/omx/1.0/OmxStore.h> #include <media/CodecServiceRegistrant.h> #include <dlfcn.h> using namespace android; // Must match location in Android.mk. Loading @@ -45,6 +48,22 @@ int main(int argc __unused, char** argv) ::android::hardware::configureRpcThreadpool(64, false); // Registration of customized codec services void *registrantLib = dlopen( "libmedia_codecserviceregistrant.so", RTLD_NOW | RTLD_LOCAL); if (registrantLib) { RegisterCodecServicesFunc registerCodecServices = reinterpret_cast<RegisterCodecServicesFunc>( dlsym(registrantLib, "RegisterCodecServices")); if (registerCodecServices) { registerCodecServices(); } else { LOG(WARNING) << "Cannot register additional services " "-- corrupted library."; } } else { // Default codec services using namespace ::android::hardware::media::omx::V1_0; sp<IOmxStore> omxStore = new implementation::OmxStore(); if (omxStore == nullptr) { Loading @@ -60,6 +79,7 @@ int main(int argc __unused, char** argv) } else { LOG(INFO) << "IOmx HAL service created."; } } ::android::hardware::joinRpcThreadpool(); } Loading
media/libmedia/include/media/CodecServiceRegistrant.h 0 → 100644 +23 −0 Original line number Diff line number Diff line /* * Copyright (C) 2018 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CODEC_SERVICE_REGISTRANT_H_ #define CODEC_SERVICE_REGISTRANT_H_ typedef void (*RegisterCodecServicesFunc)(); #endif // CODEC_SERVICE_REGISTRANT_H_
services/mediacodec/main_codecservice.cpp +33 −13 Original line number Diff line number Diff line Loading @@ -25,6 +25,9 @@ #include <media/stagefright/omx/1.0/Omx.h> #include <media/stagefright/omx/1.0/OmxStore.h> #include <media/CodecServiceRegistrant.h> #include <dlfcn.h> using namespace android; // Must match location in Android.mk. Loading @@ -45,6 +48,22 @@ int main(int argc __unused, char** argv) ::android::hardware::configureRpcThreadpool(64, false); // Registration of customized codec services void *registrantLib = dlopen( "libmedia_codecserviceregistrant.so", RTLD_NOW | RTLD_LOCAL); if (registrantLib) { RegisterCodecServicesFunc registerCodecServices = reinterpret_cast<RegisterCodecServicesFunc>( dlsym(registrantLib, "RegisterCodecServices")); if (registerCodecServices) { registerCodecServices(); } else { LOG(WARNING) << "Cannot register additional services " "-- corrupted library."; } } else { // Default codec services using namespace ::android::hardware::media::omx::V1_0; sp<IOmxStore> omxStore = new implementation::OmxStore(); if (omxStore == nullptr) { Loading @@ -60,6 +79,7 @@ int main(int argc __unused, char** argv) } else { LOG(INFO) << "IOmx HAL service created."; } } ::android::hardware::joinRpcThreadpool(); }