• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2022 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 
16 #ifndef AUDIO_CAPTURER_FILE_SOURCE_H
17 #define AUDIO_CAPTURER_FILE_SOURCE_H
18 
19 #include <cstdint>
20 #include <cstdio>
21 #include "audio_info.h"
22 #include "i_audio_capturer_source.h"
23 
24 namespace OHOS {
25 namespace AudioStandard {
26 class AudioCapturerFileSource : public IAudioCapturerSource {
27 public:
28     AudioCapturerFileSource();
29     ~AudioCapturerFileSource();
30     int32_t Init(IAudioSourceAttr &atrr) override;
31     bool IsInited(void) override;
32     void DeInit(void) override;
33 
34     int32_t Start(void) override;
35     int32_t Stop(void) override;
36     int32_t Flush(void) override;
37     int32_t Reset(void) override;
38     int32_t Pause(void) override;
39     int32_t Resume(void) override;
40     int32_t CaptureFrame(char *frame, uint64_t requestBytes, uint64_t &replyBytes) override;
41     int32_t SetVolume(float left, float right) override;
42     int32_t GetVolume(float &left, float &right) override;
43     int32_t SetMute(bool isMute) override;
44     int32_t GetMute(bool &isMute) override;
45     int32_t SetAudioScene(AudioScene audioScene, DeviceType activeDevice) override;
46     int32_t SetInputRoute(DeviceType deviceType) override;
47     uint64_t GetTransactionId() override;
48 private:
49     bool capturerInited_ = false;
50     FILE *filePtr = nullptr;
51 };
52 }  // namespace AudioStandard
53 }  // namespace OHOS
54 #endif // AUDIO_CAPTURER_FILE_SOURCE_H
55