kodi
ExternalPlayer.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 "FileItem.h"
12 #include "cores/IPlayer.h"
13 #include "threads/Thread.h"
14 
15 #include <string>
16 #include <vector>
17 
18 class CGUIDialogOK;
19 
20 class CExternalPlayer : public IPlayer, public CThread
21 {
22 public:
23  enum WARP_CURSOR { WARP_NONE = 0, WARP_TOP_LEFT, WARP_TOP_RIGHT, WARP_BOTTOM_RIGHT, WARP_BOTTOM_LEFT, WARP_CENTER };
24 
25  explicit CExternalPlayer(IPlayerCallback& callback);
26  ~CExternalPlayer() override;
27  bool Initialize(TiXmlElement* pConfig) override;
28  bool OpenFile(const CFileItem& file, const CPlayerOptions &options) override;
29  bool CloseFile(bool reopen = false) override;
30  bool IsPlaying() const override;
31  void Pause() override;
32  bool HasVideo() const override;
33  bool HasAudio() const override;
34  bool CanSeek() const override;
35  void Seek(bool bPlus, bool bLargeStep, bool bChapterOverride) override;
36  void SeekPercentage(float iPercent) override;
37  void SetVolume(float volume) override {}
38  void SetDynamicRangeCompression(long drc) override {}
39  void SetAVDelay(float fValue = 0.0f) override;
40  float GetAVDelay() override;
41 
42  void SetSubTitleDelay(float fValue = 0.0f) override;
43  float GetSubTitleDelay() override;
44 
45  void SeekTime(int64_t iTime) override;
46  void SetSpeed(float speed) override;
47 
48  bool SetPlayerState(const std::string& state) override;
49 
50 #if defined(TARGET_WINDOWS_DESKTOP)
51  bool ExecuteAppW32(const char* strPath, const char* strSwitches);
52  //static void CALLBACK AppFinished(void* closure, BOOLEAN TimerOrWaitFired);
53 #elif defined(TARGET_ANDROID)
54  bool ExecuteAppAndroid(const char* strSwitches,const char* strPath);
55 #elif defined(TARGET_POSIX)
56  bool ExecuteAppLinux(const char* strSwitches);
57 #endif
58 
59 private:
60  void GetCustomRegexpReplacers(TiXmlElement *pRootElement, std::vector<std::string>& settings);
61  void Process() override;
62 
63  bool m_bAbortRequest;
64  bool m_bIsPlaying;
65  std::chrono::time_point<std::chrono::steady_clock> m_playbackStartTime;
66  float m_speed;
67  int m_time;
68  std::string m_launchFilename;
69 #if defined(TARGET_WINDOWS_DESKTOP)
70  POINT m_ptCursorpos;
71  PROCESS_INFORMATION m_processInfo;
72 #endif
73  CGUIDialogOK* m_dialog;
74 #if defined(TARGET_WINDOWS_DESKTOP)
75  int m_xPos;
76  int m_yPos;
77 #endif
78  std::string m_filename;
79  std::string m_args;
80  bool m_hideconsole;
81  bool m_hidexbmc;
82  bool m_islauncher;
83  bool m_playOneStackItem;
84  WARP_CURSOR m_warpcursor;
85  int m_playCountMinTime;
86  std::vector<std::string> m_filenameReplacers;
87  CFileItem m_file;
88 };
Definition: Thread.h:44
Definition: ExternalPlayer.h:20
Definition: IPlayer.h:87
Definition: IPlayerCallback.h:18
Definition: GUIDialogOK.h:19
Definition: settings.py:1
Definition: IPlayer.h:31
Represents a file on a share.
Definition: FileItem.h:102