4 * Copyright (C) 2005-2013 Team XBMC
7 * This Program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
12 * This Program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with XBMC; see the file COPYING. If not, see
19 * <http://www.gnu.org/licenses/>.
27 #include "threads/CriticalSection.h"
28 #include "threads/SystemClock.h"
29 #include "guilib/Resolution.h"
30 #include "cores/IPlayer.h"
34 PLAYBACK_CANCELED
= -1,
42 typedef std::shared_ptr
<PVR::CPVRChannel
> CPVRChannelPtr
;
49 struct SPlayerAudioStreamInfo
;
50 struct SPlayerVideoStreamInfo
;
51 struct SPlayerSubtitleStreamInfo
;
52 struct TextCacheStruct_t
;
54 class CApplicationPlayer
56 std::shared_ptr
<IPlayer
> m_pPlayer
;
57 unsigned int m_iPlayerOPSeq
; // used to detect whether an OpenFile request on player is canceled by us.
59 CCriticalSection m_player_lock
;
62 XbmcThreads::EndTime m_audioStreamUpdate
;
64 XbmcThreads::EndTime m_videoStreamUpdate
;
66 XbmcThreads::EndTime m_subtitleStreamUpdate
;
67 int m_iSubtitleStream
;
68 XbmcThreads::EndTime m_speedUpdate
;
75 void CloseFile(bool reopen
= false);
77 void ClosePlayerGapless(std::string
&playername
);
78 void CreatePlayer(const std::string
&player
, IPlayerCallback
& callback
);
79 std::string
GetCurrentPlayer();
81 bool HasPlayer() const;
82 PlayBackRet
OpenFile(const CFileItem
& item
, const CPlayerOptions
& options
);
83 void SetPlaySpeed(float speed
);
86 void Render(bool clear
, uint32_t alpha
= 255, bool gui
= true);
88 void SetRenderViewMode(int mode
);
89 float GetRenderAspectRatio();
90 void TriggerUpdateResolution();
91 bool IsRenderingVideo();
92 bool IsRenderingGuiLayer();
93 bool IsRenderingVideoLayer();
94 bool Supports(EINTERLACEMETHOD method
);
95 EINTERLACEMETHOD
GetDeinterlacingMethodDefault();
96 bool Supports(ESCALINGMETHOD method
);
97 bool Supports(ERENDERFEATURE feature
);
98 unsigned int RenderCaptureAlloc();
99 void RenderCapture(unsigned int captureId
, unsigned int width
, unsigned int height
, int flags
= 0);
100 void RenderCaptureRelease(unsigned int captureId
);
101 bool RenderCaptureGetPixels(unsigned int captureId
, unsigned int millis
, uint8_t *buffer
, unsigned int size
);
102 bool IsExternalPlaying();
105 void AddSubtitle(const std::string
& strSubPath
);
110 void GetAudioCapabilities(std::vector
<int> &audioCaps
);
111 int GetAudioStream();
112 int GetAudioStreamCount();
113 void GetAudioStreamInfo(int index
, SPlayerAudioStreamInfo
&info
);
114 int GetCacheLevel() const;
115 float GetCachePercentage() const;
116 int GetChapterCount();
118 void GetChapterName(std::string
& strChapterName
, int chapterIdx
=-1);
119 int64_t GetChapterPos(int chapterIdx
=-1);
120 float GetPercentage() const;
121 std::string
GetPlayerState();
122 std::string
GetPlayingTitle();
123 int GetPreferredPlaylist() const;
124 bool GetStreamDetails(CStreamDetails
&details
);
126 void GetSubtitleCapabilities(std::vector
<int> &subCaps
);
127 int GetSubtitleCount();
128 void GetSubtitleStreamInfo(int index
, SPlayerSubtitleStreamInfo
&info
);
129 bool GetSubtitleVisible();
130 TextCacheStruct_t
* GetTeletextCache();
131 std::string
GetRadioText(unsigned int line
);
132 int64_t GetTime() const;
133 int64_t GetTotalTime() const;
134 int GetVideoStream();
135 int GetVideoStreamCount();
136 void GetVideoStreamInfo(int streamId
, SPlayerVideoStreamInfo
&info
);
137 bool HasAudio() const;
138 bool HasMenu() const;
139 bool HasVideo() const;
141 bool IsCaching() const;
142 bool IsInMenu() const;
144 bool IsPausedPlayback();
145 bool IsPassthrough() const;
146 bool IsPlaying() const;
147 bool IsPlayingAudio() const;
148 bool IsPlayingVideo() const;
149 bool IsPlayingRDS() const;
150 bool IsRecording() const;
151 void LoadPage(int p
, int sp
, unsigned char* buffer
);
152 bool OnAction(const CAction
&action
);
153 void OnNothingToQueueNotify();
155 bool QueueNextFile(const CFileItem
&file
);
156 bool Record(bool bOnOff
);
157 void Seek(bool bPlus
= true, bool bLargeStep
= false, bool bChapterOverride
= false);
158 int SeekChapter(int iChapter
);
159 void SeekPercentage(float fPercent
= 0);
160 bool SeekScene(bool bPlus
= true);
161 void SeekTime(int64_t iTime
= 0);
162 void SeekTimeRelative(int64_t iTime
= 0);
163 void SetAudioStream(int iStream
);
164 void SetAVDelay(float fValue
= 0.0f
);
165 void SetDynamicRangeCompression(long drc
);
166 void SetMute(bool bOnOff
);
167 bool SetPlayerState(const std::string
& state
);
168 void SetSubtitle(int iStream
);
169 void SetSubTitleDelay(float fValue
= 0.0f
);
170 void SetSubtitleVisible(bool bVisible
);
171 void SetTime(int64_t time
);
172 void SetTotalTime(int64_t time
);
173 void SetVideoStream(int iStream
);
174 void SetVolume(float volume
);
175 bool SwitchChannel(const PVR::CPVRChannelPtr
&channel
);
176 void SetSpeed(float speed
);
177 bool SupportsTempo();
180 std::shared_ptr
<IPlayer
> GetInternal() const;