Line data Source code
1 : /*
2 : * Copyright (C) 2025 Sky UK
3 : *
4 : * This library is free software; you can redistribute it and/or
5 : * modify it under the terms of the GNU Lesser General Public
6 : * License as published by the Free Software Foundation;
7 : * version 2.1 of the License.
8 : *
9 : * This library is distributed in the hope that it will be useful,
10 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 : * Lesser General Public License for more details.
13 : *
14 : * You should have received a copy of the GNU Lesser General Public
15 : * License along with this library; if not, write to the Free Software
16 : * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 : */
18 :
19 : #pragma once
20 :
21 : #include "PullModePlaybackDelegate.h"
22 :
23 : struct AudioFadeConfig
24 : {
25 : double volume;
26 : uint32_t duration;
27 : firebolt::rialto::EaseType easeType;
28 : };
29 :
30 : class PullModeAudioPlaybackDelegate : public PullModePlaybackDelegate
31 : {
32 : public:
33 : explicit PullModeAudioPlaybackDelegate(GstElement *sink);
34 185 : ~PullModeAudioPlaybackDelegate() override = default;
35 :
36 : GstStateChangeReturn changeState(GstStateChange transition) override;
37 : gboolean handleEvent(GstEvent *event) override;
38 : void getProperty(const Property &type, GValue *value) override;
39 : void setProperty(const Property &type, const GValue *value) override;
40 : void handleQos(uint64_t processed, uint64_t dropped) const override;
41 :
42 : private:
43 : std::unique_ptr<firebolt::rialto::IMediaPipeline::MediaSource> createMediaSource(GstCaps *caps) const;
44 :
45 : private:
46 : std::atomic<double> m_targetVolume{kDefaultVolume};
47 : std::atomic_bool m_mute{kDefaultMute};
48 : std::atomic_bool m_isVolumeQueued{false};
49 : std::atomic_bool m_isMuteQueued{false};
50 : std::atomic_bool m_lowLatency{kDefaultLowLatency};
51 : std::atomic_bool m_isLowLatencyQueued{false};
52 : std::atomic_bool m_sync{kDefaultSync};
53 : std::atomic_bool m_isSyncQueued{false};
54 : std::atomic_bool m_syncOff{kDefaultSyncOff};
55 : std::atomic_bool m_isSyncOffQueued{false};
56 : std::atomic<int32_t> m_streamSyncMode{kDefaultStreamSyncMode};
57 : std::atomic_bool m_isStreamSyncModeQueued{false};
58 : AudioFadeConfig m_audioFadeConfig{};
59 : std::mutex m_audioFadeConfigMutex{};
60 : std::atomic_bool m_isAudioFadeQueued{false};
61 : std::atomic<uint32_t> m_bufferingLimit{kDefaultBufferingLimit};
62 : std::atomic_bool m_isBufferingLimitQueued{false};
63 : std::atomic_bool m_useBuffering{kDefaultUseBuffering};
64 : std::atomic_bool m_isUseBufferingQueued{false};
65 : };
|