xref: /aosp_15_r20/frameworks/av/services/mediacodec/main_swcodecservice.cpp (revision ec779b8e0859a360c3d303172224686826e6e0e1)
1*ec779b8eSAndroid Build Coastguard Worker /*
2*ec779b8eSAndroid Build Coastguard Worker **
3*ec779b8eSAndroid Build Coastguard Worker ** Copyright 2018, The Android Open Source Project
4*ec779b8eSAndroid Build Coastguard Worker **
5*ec779b8eSAndroid Build Coastguard Worker ** Licensed under the Apache License, Version 2.0 (the "License");
6*ec779b8eSAndroid Build Coastguard Worker ** you may not use this file except in compliance with the License.
7*ec779b8eSAndroid Build Coastguard Worker ** You may obtain a copy of the License at
8*ec779b8eSAndroid Build Coastguard Worker **
9*ec779b8eSAndroid Build Coastguard Worker **     http://www.apache.org/licenses/LICENSE-2.0
10*ec779b8eSAndroid Build Coastguard Worker **
11*ec779b8eSAndroid Build Coastguard Worker ** Unless required by applicable law or agreed to in writing, software
12*ec779b8eSAndroid Build Coastguard Worker ** distributed under the License is distributed on an "AS IS" BASIS,
13*ec779b8eSAndroid Build Coastguard Worker ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14*ec779b8eSAndroid Build Coastguard Worker ** See the License for the specific language governing permissions and
15*ec779b8eSAndroid Build Coastguard Worker ** limitations under the License.
16*ec779b8eSAndroid Build Coastguard Worker */
17*ec779b8eSAndroid Build Coastguard Worker 
18*ec779b8eSAndroid Build Coastguard Worker #include <android-base/logging.h>
19*ec779b8eSAndroid Build Coastguard Worker 
20*ec779b8eSAndroid Build Coastguard Worker // from LOCAL_C_INCLUDES
21*ec779b8eSAndroid Build Coastguard Worker #include "minijail.h"
22*ec779b8eSAndroid Build Coastguard Worker #include <hidl/HidlTransportSupport.h>
23*ec779b8eSAndroid Build Coastguard Worker 
24*ec779b8eSAndroid Build Coastguard Worker using namespace android;
25*ec779b8eSAndroid Build Coastguard Worker 
26*ec779b8eSAndroid Build Coastguard Worker // kSystemSeccompPolicyPath points to the policy for the swcodecs themselves and
27*ec779b8eSAndroid Build Coastguard Worker // is part of the updates. kVendorSeccompPolicyPath points to any additional
28*ec779b8eSAndroid Build Coastguard Worker // policies that the vendor may need for the device.
29*ec779b8eSAndroid Build Coastguard Worker static const char kSystemSeccompPolicyPath[] =
30*ec779b8eSAndroid Build Coastguard Worker         "/apex/com.android.media.swcodec/etc/seccomp_policy/mediaswcodec.policy";
31*ec779b8eSAndroid Build Coastguard Worker static const char kVendorSeccompPolicyPath[] =
32*ec779b8eSAndroid Build Coastguard Worker         "/vendor/etc/seccomp_policy/mediaswcodec.policy";
33*ec779b8eSAndroid Build Coastguard Worker 
34*ec779b8eSAndroid Build Coastguard Worker extern "C" void RegisterCodecServices();
35*ec779b8eSAndroid Build Coastguard Worker 
main(int argc __unused,char ** argv)36*ec779b8eSAndroid Build Coastguard Worker int main(int argc __unused, char** argv)
37*ec779b8eSAndroid Build Coastguard Worker {
38*ec779b8eSAndroid Build Coastguard Worker     LOG(INFO) << "media swcodec service starting";
39*ec779b8eSAndroid Build Coastguard Worker     signal(SIGPIPE, SIG_IGN);
40*ec779b8eSAndroid Build Coastguard Worker     SetUpMinijail(kSystemSeccompPolicyPath, kVendorSeccompPolicyPath);
41*ec779b8eSAndroid Build Coastguard Worker     strcpy(argv[0], "media.swcodec");
42*ec779b8eSAndroid Build Coastguard Worker 
43*ec779b8eSAndroid Build Coastguard Worker     RegisterCodecServices();
44*ec779b8eSAndroid Build Coastguard Worker }
45