Kodi Development 19.0
for Binary and Script based Add-Ons
Player.h
1/*
2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
8
9#pragma once
10
11#include "AddonCallback.h"
12#include "AddonString.h"
13#include "Alternative.h"
14#include "Exception.h"
15#include "InfoTagMusic.h"
16#include "InfoTagRadioRDS.h"
17#include "InfoTagVideo.h"
18#include "ListItem.h"
19#include "PlayList.h"
20#include "cores/IPlayerCallback.h"
21#include "swighelper.h"
22
23#include <vector>
24
25namespace XBMCAddon
26{
27 namespace xbmc
28 {
29 XBMCCOMMONS_STANDARD_EXCEPTION(PlayerException);
30
31 typedef Alternative<String, const PlayList* > PlayParameter;
32
33 // This class is a merge of what was previously in xbmcmodule/player.h
34 // and xbmcmodule/PythonPlayer.h without the python references. The
35 // queuing and handling of asynchronous callbacks is done internal to
36 // this class.
37
38 //
58 //
59 class Player : public AddonCallback, public IPlayerCallback
60 {
61 private:
62 int iPlayList;
63
64 void playStream(const String& item = emptyString, const XBMCAddon::xbmcgui::ListItem* listitem = NULL, bool windowed = false);
65 void playPlaylist(const PlayList* playlist = NULL,
66 bool windowed = false, int startpos=-1);
67 void playCurrent(bool windowed = false);
68
69 public:
70#if !defined SWIG && !defined DOXYGEN_SHOULD_SKIP_THIS
71 static PlayParameter defaultPlayParameter;
72#endif
73
74#ifndef DOXYGEN_SHOULD_SKIP_THIS
75 // Construct a Player proxying the given generated binding. The
76 // construction of a Player needs to identify whether or not any
77 // callbacks will be executed asynchronously or not.
78 explicit Player();
79 ~Player(void) override;
80#endif
81
82#ifdef DOXYGEN_SHOULD_USE_THIS
118 play(...);
119#else
120 void play(const PlayParameter& item = Player::defaultPlayParameter,
121 const XBMCAddon::xbmcgui::ListItem* listitem = NULL, bool windowed = false, int startpos = -1);
122#endif
123
124#ifdef DOXYGEN_SHOULD_USE_THIS
131#else
132 void stop();
133#endif
134
135#ifdef DOXYGEN_SHOULD_USE_THIS
142#else
143 void pause();
144#endif
145
146#ifdef DOXYGEN_SHOULD_USE_THIS
153#else
154 void playnext();
155#endif
156
157#ifdef DOXYGEN_SHOULD_USE_THIS
164#else
165 void playprevious();
166#endif
167
168#ifdef DOXYGEN_SHOULD_USE_THIS
177#else
178 void playselected(int selected);
179#endif
180
181 //
192 //
193
194#ifdef DOXYGEN_SHOULD_USE_THIS
207#else
208 virtual void onPlayBackStarted();
209#endif
210
211
212#ifdef DOXYGEN_SHOULD_USE_THIS
224#else
225 virtual void onAVStarted();
226#endif
227
228
229#ifdef DOXYGEN_SHOULD_USE_THIS
241#else
242 virtual void onAVChange();
243#endif
244
245#ifdef DOXYGEN_SHOULD_USE_THIS
254#else
255 virtual void onPlayBackEnded();
256#endif
257
258#ifdef DOXYGEN_SHOULD_USE_THIS
267#else
268 virtual void onPlayBackStopped();
269#endif
270
271#ifdef DOXYGEN_SHOULD_USE_THIS
280#else
281 virtual void onPlayBackError();
282#endif
283
284#ifdef DOXYGEN_SHOULD_USE_THIS
293#else
294 virtual void onPlayBackPaused();
295#endif
296
297#ifdef DOXYGEN_SHOULD_USE_THIS
306#else
307 virtual void onPlayBackResumed();
308#endif
309
310#ifdef DOXYGEN_SHOULD_USE_THIS
319#else
320 virtual void onQueueNextItem();
321#endif
322
323#ifdef DOXYGEN_SHOULD_USE_THIS
337#else
338 virtual void onPlayBackSpeedChanged(int speed);
339#endif
340
341#ifdef DOXYGEN_SHOULD_USE_THIS
353#else
354 virtual void onPlayBackSeek(int time, int seekOffset);
355#endif
356
357#ifdef DOXYGEN_SHOULD_USE_THIS
368#else
369 virtual void onPlayBackSeekChapter(int chapter);
370#endif
372
373#ifdef DOXYGEN_SHOULD_USE_THIS
382#else
383 bool isPlaying();
384#endif
385
386#ifdef DOXYGEN_SHOULD_USE_THIS
395#else
396 bool isPlayingAudio();
397#endif
398
399#ifdef DOXYGEN_SHOULD_USE_THIS
408#else
409 bool isPlayingVideo();
410#endif
411
412#ifdef DOXYGEN_SHOULD_USE_THIS
422#else
423 bool isPlayingRDS();
424#endif
425
426#ifdef DOXYGEN_SHOULD_USE_THIS
440#else
441 bool isExternalPlayer();
442#endif
443
444#ifdef DOXYGEN_SHOULD_USE_THIS
457#else
458 String getPlayingFile();
459#endif
460
461#ifdef DOXYGEN_SHOULD_USE_THIS
474#else
475 double getTime();
476#endif
477
478#ifdef DOXYGEN_SHOULD_USE_THIS
492#else
493 void seekTime(double seekTime);
494#endif
495
496#ifdef DOXYGEN_SHOULD_USE_THIS
505#else
506 void setSubtitles(const char* subtitleFile);
507#endif
508
509#ifdef DOXYGEN_SHOULD_USE_THIS
528#else
529 void showSubtitles(bool bVisible);
530#endif
531
532#ifdef DOXYGEN_SHOULD_USE_THIS
541#else
542 String getSubtitles();
543#endif
544
545#ifdef DOXYGEN_SHOULD_USE_THIS
554#else
555 std::vector<String> getAvailableSubtitleStreams();
556#endif
557
558#ifdef DOXYGEN_SHOULD_USE_THIS
577#else
578 void setSubtitleStream(int iStream);
579#endif
580
581 // Player_UpdateInfoTag
582#ifdef DOXYGEN_SHOULD_USE_THIS
605#else
607#endif
608
609
610#ifdef DOXYGEN_SHOULD_USE_THIS
623#else
625#endif
626
627 // Player_GetMusicInfoTag
628#ifdef DOXYGEN_SHOULD_USE_THIS
641#else
643#endif
644
645#ifdef DOXYGEN_SHOULD_USE_THIS
659#else
661#endif
662
663#ifdef DOXYGEN_SHOULD_USE_THIS
676#else
677 double getTotalTime();
678#endif
679
680#ifdef DOXYGEN_SHOULD_USE_THIS
689#else
690 std::vector<String> getAvailableAudioStreams();
691#endif
692
693#ifdef DOXYGEN_SHOULD_USE_THIS
712#else
713 void setAudioStream(int iStream);
714#endif
715
716#ifdef DOXYGEN_SHOULD_USE_THIS
725#else
726 std::vector<String> getAvailableVideoStreams();
727#endif
728
729#ifdef DOXYGEN_SHOULD_USE_THIS
748#else
749 void setVideoStream(int iStream);
750#endif
751
752#if !defined SWIG && !defined DOXYGEN_SHOULD_SKIP_THIS
753 void OnPlayBackStarted(const CFileItem& file) override;
754 void OnAVStarted(const CFileItem& file) override;
755 void OnAVChange() override;
756 void OnPlayBackEnded() override;
757 void OnPlayBackStopped() override;
758 void OnPlayBackError() override;
759 void OnPlayBackPaused() override;
760 void OnPlayBackResumed() override;
761 void OnQueueNextItem() override;
762 void OnPlayBackSpeedChanged(int iSpeed) override;
763 void OnPlayBackSeek(int64_t iTime, int64_t seekOffset) override;
764 void OnPlayBackSeekChapter(int iChapter) override;
765#endif
766
767 protected:
768 };
769 }
770}
771
Definition: InfoTagMusic.h:44
Definition: InfoTagRadioRDS.h:53
Definition: InfoTagVideo.h:45
Definition: PlayList.h:50
Definition: Player.h:60
Definition: ListItem.h:51
onPlayBackSeekChapter(...)
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
onPlayBackPaused()
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
onPlayBackStopped()
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
onPlayBackError()
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
onAVStarted()
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
onPlayBackResumed()
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
onAVChange()
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
onPlayBackSeek(...)
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
onPlayBackStarted()
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
onPlayBackEnded()
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
onQueueNextItem()
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
onPlayBackSpeedChanged(int speed)
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
getVideoInfoTag()
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
setSubtitles(...)
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
getAvailableVideoStreams()
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
getMusicInfoTag()
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
isExternalPlayer()
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
playselected(...)
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
isPlayingVideo()
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
showSubtitles(...)
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
isPlayingAudio()
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
isPlaying()
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
getTime()
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
setVideoStream(...)
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
setAudioStream(...)
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
getAvailableAudioStreams()
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
updateInfoTag()
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
play(...)
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
stop()
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
getRadioRDSInfoTag()
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
pause()
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
setSubtitleStream(...)
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
seekTime(...)
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
getTotalTime()
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
getSubtitles()
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
playprevious()
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
playnext()
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
getAvailableSubtitleStreams()
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
isPlayingRDS()
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...
getPlayingFile()
<h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font co...