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 : public std::enable_shared_from_this<PullModeAudioPlaybackDelegate>
32 : {
33 : public:
34 : explicit PullModeAudioPlaybackDelegate(GstElement *sink);
35 186 : ~PullModeAudioPlaybackDelegate() override = default;
36 :
37 : GstStateChangeReturn changeState(GstStateChange transition) override;
38 : gboolean handleEvent(GstPad *pad, GstObject *parent, GstEvent *event) override;
39 : void getProperty(const Property &type, GValue *value) override;
40 : void setProperty(const Property &type, const GValue *value) override;
41 : void handleQos(uint64_t processed, uint64_t dropped) const override;
42 :
43 : private:
44 : std::unique_ptr<firebolt::rialto::IMediaPipeline::MediaSource> createMediaSource(GstCaps *caps) const;
45 :
46 : private:
47 : std::atomic<double> m_targetVolume{kDefaultVolume};
48 : std::atomic_bool m_mute{kDefaultMute};
49 : std::atomic_bool m_isVolumeQueued{false};
50 : std::atomic_bool m_isMuteQueued{false};
51 : std::atomic_bool m_lowLatency{kDefaultLowLatency};
52 : std::atomic_bool m_isLowLatencyQueued{false};
53 : std::atomic_bool m_sync{kDefaultSync};
54 : std::atomic_bool m_isSyncQueued{false};
55 : std::atomic_bool m_syncOff{kDefaultSyncOff};
56 : std::atomic_bool m_isSyncOffQueued{false};
57 : std::atomic<int32_t> m_streamSyncMode{kDefaultStreamSyncMode};
58 : std::atomic_bool m_isStreamSyncModeQueued{false};
59 : AudioFadeConfig m_audioFadeConfig{};
60 : std::mutex m_audioFadeConfigMutex{};
61 : std::atomic_bool m_isAudioFadeQueued{false};
62 : std::atomic<uint32_t> m_bufferingLimit{kDefaultBufferingLimit};
63 : std::atomic_bool m_isBufferingLimitQueued{false};
64 : std::atomic_bool m_useBuffering{kDefaultUseBuffering};
65 : std::atomic_bool m_isUseBufferingQueued{false};
66 : };
|