diff --git a/services/audio_service/BUILD.gn b/services/audio_service/BUILD.gn index b489dda26c00179481a24557724893c78de0a1ae..5c751f0c90fc3f0d6b91d05d58469412df1592d5 100644 --- a/services/audio_service/BUILD.gn +++ b/services/audio_service/BUILD.gn @@ -400,6 +400,7 @@ audio_ohos_library("audio_process_service") { "server/src/audio_workgroup_callback.cpp", "server/src/audio_workgroup.cpp", "server/src/audio_resource_service.cpp", + "server/src/audio_injector_service.cpp", ] if (!audio_framework_feature_new_engine_flag) { diff --git a/services/audio_service/server/include/audio_injector_service.h b/services/audio_service/server/include/audio_injector_service.h new file mode 100644 index 0000000000000000000000000000000000000000..0b5dd8c84f76d25f4cffabdf40853c4e762c229f --- /dev/null +++ b/services/audio_service/server/include/audio_injector_service.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * 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 AUDIO_INJECTOR_SERVICE_H +#define AUDIO_INJECTOR_SERVICE_H + +#include "audio_module_info.h" + +namespace OHOS { +namespace AudioStandard { +class AudioInjectorService { +public: + static AudioInjectorService& GetInstance() + { + static AudioInjectorService instance; + return instance; + } + int32_t UpdateAudioInfo(AudioModuleInfo &info); + int32_t PeekAudioData(const uint32_t sinkPortIndex, uint8_t *buffer, const size_t bufferSize, + AudioStreamInfo &streamInfo); + void SetSinkPortIdx(uint32_t sinkPortIdx); + int32_t GetSinkPortIdx(); +private: + AudioInjectorService(); + AudioInjectorService(const AudioInjectorService&) = delete; + AudioInjectorService& operator=(const AudioInjectorService&) = delete; +private: + AudioModuleInfo moudleInfo_; + uint32_t sinkPortIndex_; +}; +} // namespace AudioStandard +} // namespace OHOS +#endif // AUDIO_INJECTOR_SERVICE_H \ No newline at end of file diff --git a/services/audio_service/server/src/audio_injector_service.cpp b/services/audio_service/server/src/audio_injector_service.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a106310563e2a8abad0d2116fee4eb9352ac65f5 --- /dev/null +++ b/services/audio_service/server/src/audio_injector_service.cpp @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * 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. + */ +#include "audio_injector_service.h" + +namespace OHOS { +namespace AudioStandard { +AudioInjectorService::AudioInjectorService() +{ +} + +int32_t AudioInjectorService::UpdateAudioInfo(AudioModuleInfo &info) +{ + return 0; +} + +int32_t AudioInjectorService::PeekAudioData(const uint32_t sinkPortIndex, uint8_t *buffer, const size_t bufferSize, + AudioStreamInfo &streamInfo) +{ + return 0; +} + +void AudioInjectorService::SetSinkPortIdx(uint32_t sinkPortIdx) +{ + sinkPortIndex_ = sinkPortIdx; +} + +int32_t AudioInjectorService::GetSinkPortIdx() +{ + return sinkPortIndex_; +} +} // namespace AudioStandard +} // namespace OHOS \ No newline at end of file