xbmc
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 
25 namespace 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
83  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
125  stop();
131 #else
132  void stop();
133 #endif
134 
135 #ifdef DOXYGEN_SHOULD_USE_THIS
136  pause();
142 #else
143  void pause();
144 #endif
145 
146 #ifdef DOXYGEN_SHOULD_USE_THIS
147  playnext();
153 #else
154  void playnext();
155 #endif
156 
157 #ifdef DOXYGEN_SHOULD_USE_THIS
158  playprevious();
164 #else
165  void playprevious();
166 #endif
167 
168 #ifdef DOXYGEN_SHOULD_USE_THIS
169  playselected(...);
177 #else
178  void playselected(int selected);
179 #endif
180 
181  //
192  //
193 
194 #ifdef DOXYGEN_SHOULD_USE_THIS
195  onPlayBackStarted();
207 #else
208  virtual void onPlayBackStarted();
209 #endif
210 
211 
212 #ifdef DOXYGEN_SHOULD_USE_THIS
213  onAVStarted();
224 #else
225  virtual void onAVStarted();
226 #endif
227 
228 
229 #ifdef DOXYGEN_SHOULD_USE_THIS
230  onAVChange();
241 #else
242  virtual void onAVChange();
243 #endif
244 
245 #ifdef DOXYGEN_SHOULD_USE_THIS
246  onPlayBackEnded();
254 #else
255  virtual void onPlayBackEnded();
256 #endif
257 
258 #ifdef DOXYGEN_SHOULD_USE_THIS
259  onPlayBackStopped();
267 #else
268  virtual void onPlayBackStopped();
269 #endif
270 
271 #ifdef DOXYGEN_SHOULD_USE_THIS
272  onPlayBackError();
280 #else
281  virtual void onPlayBackError();
282 #endif
283 
284 #ifdef DOXYGEN_SHOULD_USE_THIS
285  onPlayBackPaused();
293 #else
294  virtual void onPlayBackPaused();
295 #endif
296 
297 #ifdef DOXYGEN_SHOULD_USE_THIS
298  onPlayBackResumed();
306 #else
307  virtual void onPlayBackResumed();
308 #endif
309 
310 #ifdef DOXYGEN_SHOULD_USE_THIS
311  onQueueNextItem();
319 #else
320  virtual void onQueueNextItem();
321 #endif
322 
323 #ifdef DOXYGEN_SHOULD_USE_THIS
324  onPlayBackSpeedChanged(int speed);
337 #else
338  virtual void onPlayBackSpeedChanged(int speed);
339 #endif
340 
341 #ifdef DOXYGEN_SHOULD_USE_THIS
342  onPlayBackSeek(...);
353 #else
354  virtual void onPlayBackSeek(int time, int seekOffset);
355 #endif
356 
357 #ifdef DOXYGEN_SHOULD_USE_THIS
358  onPlayBackSeekChapter(...);
368 #else
369  virtual void onPlayBackSeekChapter(int chapter);
370 #endif
371 
373 #ifdef DOXYGEN_SHOULD_USE_THIS
374  isPlaying();
382 #else
383  bool isPlaying();
384 #endif
385 
386 #ifdef DOXYGEN_SHOULD_USE_THIS
387  isPlayingAudio();
395 #else
396  bool isPlayingAudio();
397 #endif
398 
399 #ifdef DOXYGEN_SHOULD_USE_THIS
400  isPlayingVideo();
408 #else
409  bool isPlayingVideo();
410 #endif
411 
412 #ifdef DOXYGEN_SHOULD_USE_THIS
413  isPlayingRDS();
422 #else
423  bool isPlayingRDS();
424 #endif
425 
426 #ifdef DOXYGEN_SHOULD_USE_THIS
427  isExternalPlayer();
440 #else
441  bool isExternalPlayer();
442 #endif
443 
444 #ifdef DOXYGEN_SHOULD_USE_THIS
445  getPlayingFile();
457 #else
458  String getPlayingFile();
459 #endif
460 
461 #ifdef DOXYGEN_SHOULD_USE_THIS
462  getPlayingItem();
474 #else
475  XBMCAddon::xbmcgui::ListItem* getPlayingItem();
476 #endif
477 
478 #ifdef DOXYGEN_SHOULD_USE_THIS
479  getTime();
491 #else
492  double getTime();
493 #endif
494 
495 #ifdef DOXYGEN_SHOULD_USE_THIS
496  seekTime(...);
509 #else
510  void seekTime(double seekTime);
511 #endif
512 
513 #ifdef DOXYGEN_SHOULD_USE_THIS
514  setSubtitles(...);
522 #else
523  void setSubtitles(const char* subtitleFile);
524 #endif
525 
526 #ifdef DOXYGEN_SHOULD_USE_THIS
527  showSubtitles(...);
545 #else
546  void showSubtitles(bool bVisible);
547 #endif
548 
549 #ifdef DOXYGEN_SHOULD_USE_THIS
550  getSubtitles();
558 #else
559  String getSubtitles();
560 #endif
561 
562 #ifdef DOXYGEN_SHOULD_USE_THIS
563  getAvailableSubtitleStreams();
571 #else
572  std::vector<String> getAvailableSubtitleStreams();
573 #endif
574 
575 #ifdef DOXYGEN_SHOULD_USE_THIS
576  setSubtitleStream(...);
594 #else
595  void setSubtitleStream(int iStream);
596 #endif
597 
598  // Player_UpdateInfoTag
599 #ifdef DOXYGEN_SHOULD_USE_THIS
600  updateInfoTag();
622 #else
623  void updateInfoTag(const XBMCAddon::xbmcgui::ListItem* item);
624 #endif
625 
626 
627 #ifdef DOXYGEN_SHOULD_USE_THIS
628  getVideoInfoTag();
640 #else
641  InfoTagVideo* getVideoInfoTag();
642 #endif
643 
644  // Player_GetMusicInfoTag
645 #ifdef DOXYGEN_SHOULD_USE_THIS
646  getMusicInfoTag();
658 #else
659  InfoTagMusic* getMusicInfoTag();
660 #endif
661 
662 #ifdef DOXYGEN_SHOULD_USE_THIS
663  getRadioRDSInfoTag();
676 #else
677  InfoTagRadioRDS* getRadioRDSInfoTag();
678 #endif
679 
680 #ifdef DOXYGEN_SHOULD_USE_THIS
681  getTotalTime();
693 #else
694  double getTotalTime();
695 #endif
696 
697 #ifdef DOXYGEN_SHOULD_USE_THIS
698  getAvailableAudioStreams();
706 #else
707  std::vector<String> getAvailableAudioStreams();
708 #endif
709 
710 #ifdef DOXYGEN_SHOULD_USE_THIS
711  setAudioStream(...);
729 #else
730  void setAudioStream(int iStream);
731 #endif
732 
733 #ifdef DOXYGEN_SHOULD_USE_THIS
734  getAvailableVideoStreams();
742 #else
743  std::vector<String> getAvailableVideoStreams();
744 #endif
745 
746 #ifdef DOXYGEN_SHOULD_USE_THIS
747  setVideoStream(...);
765 #else
766  void setVideoStream(int iStream);
767 #endif
768 
769 #if !defined SWIG && !defined DOXYGEN_SHOULD_SKIP_THIS
770  void OnPlayBackStarted(const CFileItem& file) override;
771  void OnAVStarted(const CFileItem& file) override;
772  void OnAVChange() override;
773  void OnPlayBackEnded() override;
774  void OnPlayBackStopped() override;
775  void OnPlayBackError() override;
776  void OnPlayBackPaused() override;
777  void OnPlayBackResumed() override;
778  void OnQueueNextItem() override;
779  void OnPlayBackSpeedChanged(int iSpeed) override;
780  void OnPlayBackSeek(int64_t iTime, int64_t seekOffset) override;
781  void OnPlayBackSeekChapter(int iChapter) override;
782 #endif
783 
784  protected:
785  };
786  }
787 }
788 
Definition: InfoTagRadioRDS.h:52
Definition: Player.h:59
Definition: InfoTagVideo.h:858
Defining LOG_LIFECYCLE_EVENTS will log all instantiations, deletions and also reference countings (in...
Definition: Addon.cpp:25
Definition: IPlayerCallback.h:18
Definition: PlayList.h:49
Definition: ListItem.h:52
This class is the superclass for all API classes that are expected to be able to handle cross-languag...
Definition: AddonCallback.h:23
Definition: InfoTagMusic.h:47
Represents a file on a share.
Definition: FileItem.h:102