• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 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 
16 #ifndef AUDIO_SINK_SV_IMPL_H
17 #define AUDIO_SINK_SV_IMPL_H
18 
19 #include "audio_sink.h"
20 #include "audio_renderer.h"
21 #include "audio_system_manager.h"
22 #include "audio_errors.h"
23 
24 namespace OHOS {
25 namespace Media {
26 class AudioSinkSvImpl : public AudioSink {
27 public:
28     AudioSinkSvImpl();
29     virtual ~AudioSinkSvImpl();
30 
31     GstCaps *GetCaps() override;
32     int32_t SetVolume(float volume) override;
33     int32_t GetVolume(float &volume) override;
34     int32_t GetMaxVolume(float &volume) override;
35     int32_t GetMinVolume(float &volume) override;
36     int32_t Prepare() override;
37     int32_t Start() override;
38     int32_t Stop() override;
39     int32_t Pause() override;
40     int32_t Drain() override;
41     int32_t Flush() override;
42     int32_t Release() override;
43     int32_t SetParameters(uint32_t bitsPerSample, uint32_t channels, uint32_t sampleRate) override;
44     int32_t GetParameters(uint32_t &bitsPerSample, uint32_t &channels, uint32_t &sampleRate) override;
45     int32_t GetMinimumBufferSize(uint32_t &bufferSize) override;
46     int32_t GetMinimumFrameCount(uint32_t &frameCount) override;
47     int32_t Write(uint8_t *buffer, size_t size) override;
48     int32_t GetAudioTime(uint64_t &time) override;
49     int32_t GetLatency(uint64_t &latency) const override;
50     int32_t SetParameter(int32_t &param) override;
51     bool Writeable() const override;
52 
53 private:
54     std::unique_ptr<OHOS::AudioStandard::AudioRenderer> audioRenderer_;
55     void InitChannelRange(GstCaps *caps) const;
56     void InitRateRange(GstCaps *caps) const;
57 };
58 } // namespace Media
59 } // namespace OHOS
60 #endif // AUDIO_SINK_SV_IMPL_H
61