[videodb] remove unused seasons table from episode_view
[xbmc.git] / xbmc / application / ApplicationPlayer.h
blobccee506bd62d10fabf994bea1a51683553d6b787
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 "SeekHandler.h"
12 #include "application/IApplicationComponent.h"
13 #include "cores/IPlayer.h"
14 #include "cores/MenuType.h"
15 #include "playlists/PlayListTypes.h"
16 #include "threads/CriticalSection.h"
17 #include "threads/SystemClock.h"
19 #include <memory>
20 #include <string>
21 #include <vector>
23 class CAction;
24 class CPlayerCoreFactory;
25 class CPlayerOptions;
26 class CStreamDetails;
28 struct AudioStreamInfo;
29 struct VideoStreamInfo;
30 struct SubtitleStreamInfo;
31 struct TextCacheStruct_t;
33 class CApplicationPlayer : public IApplicationComponent
35 public:
36 CApplicationPlayer() = default;
38 // player management
39 void ClosePlayer();
40 void ResetPlayer();
41 std::string GetCurrentPlayer() const;
42 float GetPlaySpeed() const;
43 float GetPlayTempo() const;
44 bool HasPlayer() const;
45 bool OpenFile(const CFileItem& item, const CPlayerOptions& options,
46 const CPlayerCoreFactory &factory,
47 const std::string &playerName, IPlayerCallback& callback);
48 void OpenNext(const CPlayerCoreFactory &factory);
49 void SetPlaySpeed(float speed);
50 void SetTempo(float tempo);
51 void FrameAdvance(int frames);
53 void FrameMove();
54 void Render(bool clear, uint32_t alpha = 255, bool gui = true);
55 void FlushRenderer();
56 void SetRenderViewMode(int mode, float zoom, float par, float shift, bool stretch);
57 float GetRenderAspectRatio() const;
58 bool GetRects(CRect& source, CRect& dest, CRect& view) const;
59 unsigned int GetOrientation() const;
60 void TriggerUpdateResolution();
61 bool IsRenderingVideo() const;
62 bool IsRenderingGuiLayer() const;
63 bool IsRenderingVideoLayer() const;
64 bool Supports(EINTERLACEMETHOD method) const;
65 EINTERLACEMETHOD GetDeinterlacingMethodDefault() const;
66 bool Supports(ESCALINGMETHOD method) const;
67 bool Supports(ERENDERFEATURE feature) const;
68 unsigned int RenderCaptureAlloc();
69 void RenderCapture(unsigned int captureId, unsigned int width, unsigned int height, int flags = 0);
70 void RenderCaptureRelease(unsigned int captureId);
71 bool RenderCaptureGetPixels(unsigned int captureId, unsigned int millis, uint8_t *buffer, unsigned int size);
72 bool IsExternalPlaying() const;
73 bool IsRemotePlaying() const;
75 /*!
76 * \brief Get the name of the player in use
77 * \return the player name if a player is active, otherwise it returns an empty string
79 std::string GetName() const;
81 // proxy calls
82 void AddSubtitle(const std::string& strSubPath);
83 bool CanPause() const;
84 bool CanSeek() const;
85 int GetAudioDelay() const;
86 void GetAudioCapabilities(std::vector<int>& audioCaps) const;
87 int GetAudioStream();
88 int GetAudioStreamCount() const;
89 void GetAudioStreamInfo(int index, AudioStreamInfo& info) const;
90 int GetCacheLevel() const;
91 float GetCachePercentage() const;
92 int GetChapterCount() const;
93 int GetChapter() const;
94 void GetChapterName(std::string& strChapterName, int chapterIdx = -1) const;
95 int64_t GetChapterPos(int chapterIdx = -1) const;
96 float GetPercentage() const;
97 std::string GetPlayerState();
98 KODI::PLAYLIST::Id GetPreferredPlaylist() const;
99 int GetSubtitleDelay() const;
100 int GetSubtitle();
101 void GetSubtitleCapabilities(std::vector<int>& subCaps) const;
102 int GetSubtitleCount() const;
103 void GetSubtitleStreamInfo(int index, SubtitleStreamInfo& info) const;
104 bool GetSubtitleVisible() const;
105 bool HasTeletextCache() const;
106 std::shared_ptr<TextCacheStruct_t> GetTeletextCache();
107 int64_t GetTime() const;
108 int64_t GetMinTime() const;
109 int64_t GetMaxTime() const;
110 time_t GetStartTime() const;
111 int64_t GetTotalTime() const;
112 int GetVideoStream();
113 int GetVideoStreamCount() const;
114 void GetVideoStreamInfo(int streamId, VideoStreamInfo& info) const;
115 int GetPrograms(std::vector<ProgramInfo>& programs);
116 void SetProgram(int progId);
117 int GetProgramsCount() const;
118 bool HasAudio() const;
121 * \brief Get the supported menu type
122 * \return The supported menu type
124 MenuType GetSupportedMenuType() const;
126 bool HasVideo() const;
127 bool HasGame() const;
128 bool HasRDS() const;
129 bool IsCaching() const;
130 bool IsInMenu() const;
131 bool IsPaused() const;
132 bool IsPausedPlayback() const;
133 bool IsPassthrough() const;
134 bool IsPlaying() const;
135 bool IsPlayingAudio() const;
136 bool IsPlayingVideo() const;
137 bool IsPlayingGame() const;
138 bool IsPlayingRDS() const;
139 void LoadPage(int p, int sp, unsigned char* buffer);
140 bool OnAction(const CAction &action);
141 void OnNothingToQueueNotify();
142 void Pause();
143 bool QueueNextFile(const CFileItem &file);
144 void Seek(bool bPlus = true, bool bLargeStep = false, bool bChapterOverride = false);
145 int SeekChapter(int iChapter);
146 void SeekPercentage(float fPercent = 0);
147 bool SeekScene(Direction seekDirection);
148 void SeekTime(int64_t iTime = 0);
149 void SeekTimeRelative(int64_t iTime = 0);
150 void SetAudioStream(int iStream);
151 void SetAVDelay(float fValue = 0.0f);
152 void SetDynamicRangeCompression(long drc);
153 void SetMute(bool bOnOff);
154 bool SetPlayerState(const std::string& state);
155 void SetSubtitle(int iStream);
156 void SetSubTitleDelay(float fValue = 0.0f);
157 void SetSubtitleVisible(bool bVisible);
160 * \brief Set the subtitle vertical position,
161 * it depends on current screen resolution
162 * \param value The subtitle position in pixels
163 * \param save If true, the value will be saved to resolution info
165 void SetSubtitleVerticalPosition(const int value, bool save);
167 void SetTime(int64_t time);
168 void SetTotalTime(int64_t time);
169 void SetVideoStream(int iStream);
170 void SetVolume(float volume);
171 void SetSpeed(float speed);
172 bool SupportsTempo() const;
174 CVideoSettings GetVideoSettings() const;
175 void SetVideoSettings(CVideoSettings& settings);
177 CSeekHandler& GetSeekHandler();
178 const CSeekHandler& GetSeekHandler() const;
180 void SetUpdateStreamDetails();
183 * \copydoc IPlayer::HasGameAgent
185 bool HasGameAgent() const;
187 private:
188 std::shared_ptr<const IPlayer> GetInternal() const;
189 std::shared_ptr<IPlayer> GetInternal();
190 void CreatePlayer(const CPlayerCoreFactory &factory, const std::string &player, IPlayerCallback& callback);
191 void CloseFile(bool reopen = false);
193 std::shared_ptr<IPlayer> m_pPlayer;
194 mutable CCriticalSection m_playerLock;
195 CSeekHandler m_seekHandler;
197 // cache player state
198 XbmcThreads::EndTime<> m_audioStreamUpdate;
199 int m_iAudioStream;
200 XbmcThreads::EndTime<> m_videoStreamUpdate;
201 int m_iVideoStream;
202 XbmcThreads::EndTime<> m_subtitleStreamUpdate;
203 int m_iSubtitleStream;
205 struct SNextItem
207 std::shared_ptr<CFileItem> pItem;
208 CPlayerOptions options = {};
209 std::string playerName;
210 IPlayerCallback *callback = nullptr;
211 } m_nextItem;