Merge pull request #4594 from FernetMenta/paplayer
[xbmc.git] / xbmc / ApplicationPlayer.h
blob21a0b7a44c140acdb6626a8292e6d6db3036eb78
1 #pragma once
3 /*
4 * Copyright (C) 2005-2013 Team XBMC
5 * http://xbmc.org
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)
10 * any later version.
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/>.
23 #include <boost/shared_ptr.hpp>
24 #include "threads/SingleLock.h"
25 #include "cores/playercorefactory/PlayerCoreFactory.h"
27 typedef enum
29 PLAYBACK_CANCELED = -1,
30 PLAYBACK_FAIL = 0,
31 PLAYBACK_OK = 1,
32 } PlayBackRet;
34 namespace PVR
36 class CPVRChannel;
39 class IAudioCallback;
40 class CAction;
41 class CPlayerOptions;
42 class CStreamDetails;
44 struct SPlayerAudioStreamInfo;
45 struct SPlayerVideoStreamInfo;
46 struct SPlayerSubtitleStreamInfo;
47 struct TextCacheStruct_t;
49 class CApplicationPlayer
51 boost::shared_ptr<IPlayer> m_pPlayer;
52 unsigned int m_iPlayerOPSeq; // used to detect whether an OpenFile request on player is canceled by us.
53 PLAYERCOREID m_eCurrentPlayer;
55 CCriticalSection m_player_lock;
57 public:
58 CApplicationPlayer();
60 int m_iPlaySpeed;
62 // player management
63 void CloseFile(bool reopen = false);
64 void ClosePlayer();
65 void ClosePlayerGapless(PLAYERCOREID newCore);
66 void CreatePlayer(PLAYERCOREID newCore, IPlayerCallback& callback);
67 PLAYERCOREID GetCurrentPlayer() const { return m_eCurrentPlayer; }
68 boost::shared_ptr<IPlayer> GetInternal() const;
69 int GetPlaySpeed() const;
70 bool HasPlayer() const;
71 PlayBackRet OpenFile(const CFileItem& item, const CPlayerOptions& options);
72 void ResetPlayer() { m_eCurrentPlayer = EPC_NONE; }
73 void SetPlaySpeed(int iSpeed, bool bApplicationMuted);
75 // proxy calls
76 int AddSubtitle(const CStdString& strSubPath);
77 bool CanPause();
78 bool CanRecord();
79 bool CanSeek();
80 bool ControlsVolume() const;
81 void DoAudioWork();
82 void GetAudioCapabilities(std::vector<int> &audioCaps);
83 void GetAudioInfo( CStdString& strAudioInfo);
84 int GetAudioStream();
85 int GetAudioStreamCount();
86 void GetAudioStreamInfo(int index, SPlayerAudioStreamInfo &info);
87 int GetCacheLevel() const;
88 float GetCachePercentage() const;
89 int GetChapterCount();
90 int GetChapter();
91 void GetChapterName(CStdString& strChapterName);
92 void GetDeinterlaceMethods(std::vector<int> &deinterlaceMethods);
93 void GetDeinterlaceModes(std::vector<int> &deinterlaceModes);
94 void GetGeneralInfo( CStdString& strVideoInfo);
95 float GetPercentage() const;
96 CStdString GetPlayerState();
97 CStdString GetPlayingTitle();
98 void GetRenderFeatures(std::vector<int> &renderFeatures);
99 void GetScalingMethods(std::vector<int> &scalingMethods);
100 bool GetStreamDetails(CStreamDetails &details);
101 int GetSubtitle();
102 void GetSubtitleCapabilities(std::vector<int> &subCaps);
103 int GetSubtitleCount();
104 void GetSubtitleStreamInfo(int index, SPlayerSubtitleStreamInfo &info);
105 bool GetSubtitleVisible();
106 TextCacheStruct_t* GetTeletextCache();
107 int64_t GetTime() const;
108 int64_t GetTotalTime() const;
109 void GetVideoInfo( CStdString& strVideoInfo);
110 void GetVideoStreamInfo(SPlayerVideoStreamInfo &info);
111 bool HasAudio() const;
112 bool HasMenu() const;
113 bool HasVideo() const;
114 bool IsCaching() const;
115 bool IsInMenu() const;
116 bool IsPaused() const;
117 bool IsPausedPlayback() const;
118 bool IsPassthrough() const;
119 bool IsPlaying() const;
120 bool IsPlayingAudio() const;
121 bool IsPlayingVideo() const;
122 bool IsRecording() const;
123 void LoadPage(int p, int sp, unsigned char* buffer);
124 bool OnAction(const CAction &action);
125 void OnNothingToQueueNotify();
126 void Pause();
127 bool QueueNextFile(const CFileItem &file);
128 bool Record(bool bOnOff);
129 void RegisterAudioCallback(IAudioCallback* pCallback);
130 void Seek(bool bPlus = true, bool bLargeStep = false, bool bChapterOverride = false);
131 int SeekChapter(int iChapter);
132 void SeekPercentage(float fPercent = 0);
133 bool SeekScene(bool bPlus = true);
134 void SeekTime(int64_t iTime = 0);
135 void SetAudioStream(int iStream);
136 void SetAVDelay(float fValue = 0.0f);
137 void SetDynamicRangeCompression(long drc);
138 void SetMute(bool bOnOff);
139 bool SetPlayerState(CStdString state);
140 void SetSubtitle(int iStream);
141 void SetSubTitleDelay(float fValue = 0.0f);
142 void SetSubtitleVisible(bool bVisible);
143 void SetVolume(float volume);
144 bool SwitchChannel(const PVR::CPVRChannel &channel);
145 void ToFFRW(int iSpeed = 0);
146 void UnRegisterAudioCallback();