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.
11 #include "cores/VideoPlayer/Buffers/VideoBuffer.h"
12 #include "cores/VideoPlayer/VideoRenderers/RenderInfo.h"
13 #include "cores/VideoSettings.h"
14 #include "threads/CriticalSection.h"
24 using CreateProcessControl
= CProcessInfo
* (*)();
29 static CProcessInfo
* CreateInstance();
30 static void RegisterProcessControl(const std::string
& id
, CreateProcessControl createFunc
);
31 virtual ~CProcessInfo() = default;
32 void SetDataCache(CDataCacheCore
*cache
);
35 void ResetVideoCodecInfo();
36 void SetVideoDecoderName(const std::string
&name
, bool isHw
);
37 std::string
GetVideoDecoderName();
38 bool IsVideoHwDecoder();
39 void SetVideoDeintMethod(const std::string
&method
);
40 std::string
GetVideoDeintMethod();
41 void SetVideoPixelFormat(const std::string
&pixFormat
);
42 std::string
GetVideoPixelFormat();
43 void SetVideoStereoMode(const std::string
&mode
);
44 std::string
GetVideoStereoMode();
45 void SetVideoDimensions(int width
, int height
);
46 void GetVideoDimensions(int &width
, int &height
);
47 void SetVideoFps(float fps
);
49 void SetVideoDAR(float dar
);
51 void SetVideoInterlaced(bool interlaced
);
52 bool GetVideoInterlaced();
53 virtual EINTERLACEMETHOD
GetFallbackDeintMethod();
54 virtual void SetSwDeinterlacingMethods();
55 void UpdateDeinterlacingMethods(std::list
<EINTERLACEMETHOD
> &methods
);
56 bool Supports(EINTERLACEMETHOD method
) const;
57 void SetDeinterlacingMethodDefault(EINTERLACEMETHOD method
);
58 EINTERLACEMETHOD
GetDeinterlacingMethodDefault() const;
59 CVideoBufferManager
& GetVideoBufferManager();
60 std::vector
<AVPixelFormat
> GetPixFormats();
61 void SetPixFormats(std::vector
<AVPixelFormat
> &formats
);
64 void ResetAudioCodecInfo();
65 void SetAudioDecoderName(const std::string
&name
);
66 std::string
GetAudioDecoderName();
67 void SetAudioChannels(const std::string
&channels
);
68 std::string
GetAudioChannels();
69 void SetAudioSampleRate(int sampleRate
);
70 int GetAudioSampleRate();
71 void SetAudioBitsPerSample(int bitsPerSample
);
72 int GetAudioBitsPerSample();
73 virtual bool AllowDTSHDDecode();
74 virtual bool WantsRawPassthrough() { return false; }
77 void SetRenderClockSync(bool enabled
);
78 bool IsRenderClockSync();
79 void UpdateRenderInfo(CRenderInfo
&info
);
80 void UpdateRenderBuffers(int queued
, int discard
, int free
);
81 void GetRenderBuffers(int &queued
, int &discard
, int &free
);
82 virtual std::vector
<AVPixelFormat
> GetRenderFormats();
86 * @brief Notifies that a seek operation has finished
87 * @param offset - the seek offset
89 void SeekFinished(int64_t offset
);
91 void SetStateSeeking(bool active
);
93 void SetStateRealtime(bool state
);
94 bool IsRealtimeStream();
95 void SetSpeed(float speed
);
96 void SetNewSpeed(float speed
);
98 void SetFrameAdvance(bool fa
);
99 bool IsFrameAdvance();
100 void SetTempo(float tempo
);
101 void SetNewTempo(float tempo
);
103 bool IsTempoAllowed(float tempo
);
104 virtual float MinTempoPlatform();
105 virtual float MaxTempoPlatform();
106 void SetLevelVQ(int level
);
108 void SetGuiRender(bool gui
);
110 void SetVideoRender(bool video
);
111 bool GetVideoRender();
112 unsigned int GetMaxPassthroughOffSyncDuration() const;
114 void SetPlayTimes(time_t start
, int64_t current
, int64_t min
, int64_t max
);
115 int64_t GetMaxTime();
118 CVideoSettings
GetVideoSettings();
119 void SetVideoSettings(CVideoSettings
&settings
);
120 CVideoSettingsLocked
& GetVideoSettingsLocked();
124 static std::map
<std::string
, CreateProcessControl
> m_processControls
;
125 CDataCacheCore
*m_dataCache
= nullptr;
128 bool m_videoIsHWDecoder
;
129 std::string m_videoDecoderName
;
130 std::string m_videoDeintMethod
;
131 std::string m_videoPixelFormat
;
132 std::string m_videoStereoMode
;
137 bool m_videoIsInterlaced
;
138 std::list
<EINTERLACEMETHOD
> m_deintMethods
;
139 EINTERLACEMETHOD m_deintMethodDefault
;
140 mutable CCriticalSection m_videoCodecSection
;
141 CVideoBufferManager m_videoBufferManager
;
142 std::vector
<AVPixelFormat
> m_pixFormats
;
145 std::string m_audioDecoderName
;
146 std::string m_audioChannels
;
147 int m_audioSampleRate
;
148 int m_audioBitsPerSample
;
149 CCriticalSection m_audioCodecSection
;
152 CCriticalSection m_renderSection
;
154 CRenderInfo m_renderInfo
;
155 int m_renderBufQueued
= 0;
156 int m_renderBufFree
= 0;
157 int m_renderBufDiscard
= 0;
160 CCriticalSection m_stateSection
;
162 std::atomic_int m_levelVQ
;
163 std::atomic_bool m_renderGuiLayer
;
164 std::atomic_bool m_renderVideoLayer
;
174 bool m_realTimeStream
;
177 CCriticalSection m_settingsSection
;
178 CVideoSettings m_videoSettings
;
179 std::unique_ptr
<CVideoSettingsLocked
> m_videoSettingsLocked
;