1 /* 2 * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #include "hal_camera.h" 16 #include "samgr_lite.h" 17 #ifndef ENABLE_PASSTHROUGH_MODE 18 #include "player_server.h" 19 #endif 20 #include "camera_server.h" 21 #include "recorder_service.h" 22 #include "audio_capturer_server.h" 23 #include "ohos_init.h" 24 25 #include <csignal> 26 #include <cstdint> 27 #include <iostream> 28 #include <unistd.h> 29 30 using namespace OHOS; 31 using namespace OHOS::Media; OHOS_SystemInit(void)32extern "C" void __attribute__((weak)) OHOS_SystemInit(void) 33 { 34 SAMGR_Bootstrap(); 35 } 36 37 using namespace std; main()38int main() 39 { 40 OHOS_SystemInit(); 41 42 cout << "Camera server start." << endl; 43 CameraServer::GetInstance()->InitCameraServer(); 44 #ifndef ENABLE_PASSTHROUGH_MODE 45 cout << "Player server start" << endl; 46 PlayerServer::GetInstance()->PlayerServerInit(); 47 48 cout << "AudioCapturer server start" << endl; 49 AudioCapturerServer::GetInstance()->AudioCapturerServerInit(); 50 #endif 51 cout << "Media server initialize succeed." << endl; 52 53 sigset_t signalSet; 54 sigemptyset(&signalSet); 55 sigaddset(&signalSet, SIGABRT); 56 sigaddset(&signalSet, SIGINT); 57 sigaddset(&signalSet, SIGTERM); 58 59 int32_t sig; 60 sigwait(&signalSet, &sig); 61 return 0; 62 } 63 #ifndef ENABLE_PASSTHROUGH_MODE 64 SYSEX_SERVICE_INIT(RecorderServiceReg); 65 SYSEX_SERVICE_INIT(AudioCapturerServiceReg); 66 #endif 67