[videodb] remove unused seasons table from episode_view
[xbmc.git] / xbmc / cores / VideoPlayer / VideoPlayerAudio.h
blobd52fbd5b70312e9ee1850978598936c2074a8c91
1 /*
2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #pragma once
11 #include "AudioSinkAE.h"
12 #include "DVDClock.h"
13 #include "DVDMessageQueue.h"
14 #include "DVDStreamInfo.h"
15 #include "IVideoPlayer.h"
16 #include "cores/VideoPlayer/Interface/TimingConstants.h"
17 #include "threads/SystemClock.h"
18 #include "threads/Thread.h"
19 #include "utils/BitstreamStats.h"
21 #include <list>
22 #include <mutex>
23 #include <utility>
26 class CVideoPlayer;
27 class CDVDAudioCodec;
28 class CDVDAudioCodec;
30 class CVideoPlayerAudio : public CThread, public IDVDStreamPlayerAudio
32 public:
33 CVideoPlayerAudio(CDVDClock* pClock,
34 CDVDMessageQueue& parent,
35 CProcessInfo& processInfo,
36 double messageQueueTimeSize);
37 ~CVideoPlayerAudio() override;
39 bool OpenStream(CDVDStreamInfo hints) override;
40 void CloseStream(bool bWaitForBuffers) override;
42 void SetSpeed(int speed) override;
43 void Flush(bool sync) override;
45 // waits until all available data has been rendered
46 bool AcceptsData() const override;
47 bool HasData() const override { return m_messageQueue.GetDataSize() > 0; }
48 int GetLevel() const override { return m_messageQueue.GetLevel(); }
49 bool IsInited() const override { return m_messageQueue.IsInited(); }
50 void SendMessage(std::shared_ptr<CDVDMsg> pMsg, int priority = 0) override
52 m_messageQueue.Put(pMsg, priority);
54 void FlushMessages() override { m_messageQueue.Flush(); }
56 void SetDynamicRangeCompression(long drc) override { m_audioSink.SetDynamicRangeCompression(drc); }
57 float GetDynamicRangeAmplification() const override { return 0.0f; }
59 std::string GetPlayerInfo() override;
60 int GetAudioChannels() override;
62 double GetCurrentPts() override
64 std::unique_lock<CCriticalSection> lock(m_info_section);
65 return m_info.pts;
68 bool IsStalled() const override { return m_stalled; }
69 bool IsPassthrough() const override;
71 protected:
73 void OnStartup() override;
74 void OnExit() override;
75 void Process() override;
77 bool ProcessDecoderOutput(DVDAudioFrame &audioframe);
78 void UpdatePlayerInfo();
79 void OpenStream(CDVDStreamInfo& hints, std::unique_ptr<CDVDAudioCodec> codec);
80 //! Switch codec if needed. Called when the sample rate gotten from the
81 //! codec changes, in which case we may want to switch passthrough on/off.
82 bool SwitchCodecIfNeeded();
83 void SetSyncType(bool passthrough);
85 CDVDMessageQueue m_messageQueue;
86 CDVDMessageQueue& m_messageParent;
88 // holds stream information for current playing stream
89 CDVDStreamInfo m_streaminfo;
91 double m_audioClock;
93 CAudioSinkAE m_audioSink; // audio output device
94 CDVDClock* m_pClock; // dvd master clock
95 std::unique_ptr<CDVDAudioCodec> m_pAudioCodec; // audio codec
96 BitstreamStats m_audioStats;
98 int m_speed;
99 bool m_stalled;
100 bool m_paused;
101 IDVDStreamPlayer::ESyncState m_syncState;
102 XbmcThreads::EndTime<> m_syncTimer;
104 int m_synctype;
105 int m_prevsynctype;
107 bool m_prevskipped;
108 double m_maxspeedadjust;
110 struct SInfo
112 std::string info;
113 double pts = DVD_NOPTS_VALUE;
114 bool passthrough = false;
117 mutable CCriticalSection m_info_section;
118 SInfo m_info;
120 bool m_displayReset = false;
121 unsigned int m_disconAdjustTimeMs = 50; // maximum sync-off before adjusting
122 int m_disconAdjustCounter = 0;