18c77b71bSopenharmony_ci/*
28c77b71bSopenharmony_ci * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
38c77b71bSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
48c77b71bSopenharmony_ci * you may not use this file except in compliance with the License.
58c77b71bSopenharmony_ci * You may obtain a copy of the License at
68c77b71bSopenharmony_ci *
78c77b71bSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
88c77b71bSopenharmony_ci *
98c77b71bSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
108c77b71bSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
118c77b71bSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
128c77b71bSopenharmony_ci * See the License for the specific language governing permissions and
138c77b71bSopenharmony_ci * limitations under the License.
148c77b71bSopenharmony_ci */
158c77b71bSopenharmony_ci#include "hal_camera.h"
168c77b71bSopenharmony_ci#include "samgr_lite.h"
178c77b71bSopenharmony_ci#ifndef ENABLE_PASSTHROUGH_MODE
188c77b71bSopenharmony_ci#include "player_server.h"
198c77b71bSopenharmony_ci#endif
208c77b71bSopenharmony_ci#include "camera_server.h"
218c77b71bSopenharmony_ci#include "recorder_service.h"
228c77b71bSopenharmony_ci#include "audio_capturer_server.h"
238c77b71bSopenharmony_ci#include "ohos_init.h"
248c77b71bSopenharmony_ci
258c77b71bSopenharmony_ci#include <csignal>
268c77b71bSopenharmony_ci#include <cstdint>
278c77b71bSopenharmony_ci#include <iostream>
288c77b71bSopenharmony_ci#include <unistd.h>
298c77b71bSopenharmony_ci
308c77b71bSopenharmony_ciusing namespace OHOS;
318c77b71bSopenharmony_ciusing namespace OHOS::Media;
328c77b71bSopenharmony_ciextern "C" void __attribute__((weak)) OHOS_SystemInit(void)
338c77b71bSopenharmony_ci{
348c77b71bSopenharmony_ci    SAMGR_Bootstrap();
358c77b71bSopenharmony_ci}
368c77b71bSopenharmony_ci
378c77b71bSopenharmony_ciusing namespace std;
388c77b71bSopenharmony_ciint main()
398c77b71bSopenharmony_ci{
408c77b71bSopenharmony_ci    OHOS_SystemInit();
418c77b71bSopenharmony_ci#ifdef SUPPORT_CAMERA_LITE
428c77b71bSopenharmony_ci    cout << "Camera server start." << endl;
438c77b71bSopenharmony_ci    CameraServer::GetInstance()->InitCameraServer();
448c77b71bSopenharmony_ci#endif
458c77b71bSopenharmony_ci#ifndef ENABLE_PASSTHROUGH_MODE
468c77b71bSopenharmony_ci    cout << "Player server start" << endl;
478c77b71bSopenharmony_ci    PlayerServer::GetInstance()->PlayerServerInit();
488c77b71bSopenharmony_ci
498c77b71bSopenharmony_ci    cout << "AudioCapturer server start" << endl;
508c77b71bSopenharmony_ci    AudioCapturerServer::GetInstance()->AudioCapturerServerInit();
518c77b71bSopenharmony_ci#endif
528c77b71bSopenharmony_ci    cout << "Media server initialize succeed." << endl;
538c77b71bSopenharmony_ci
548c77b71bSopenharmony_ci    sigset_t signalSet;
558c77b71bSopenharmony_ci    sigemptyset(&signalSet);
568c77b71bSopenharmony_ci    sigaddset(&signalSet, SIGABRT);
578c77b71bSopenharmony_ci    sigaddset(&signalSet, SIGINT);
588c77b71bSopenharmony_ci    sigaddset(&signalSet, SIGTERM);
598c77b71bSopenharmony_ci
608c77b71bSopenharmony_ci    int32_t sig;
618c77b71bSopenharmony_ci    sigwait(&signalSet, &sig);
628c77b71bSopenharmony_ci    return 0;
638c77b71bSopenharmony_ci}
648c77b71bSopenharmony_ci#ifndef ENABLE_PASSTHROUGH_MODE
658c77b71bSopenharmony_ciSYSEX_SERVICE_INIT(RecorderServiceReg);
668c77b71bSopenharmony_ciSYSEX_SERVICE_INIT(AudioCapturerServiceReg);
678c77b71bSopenharmony_ci#endif
68