xbmc
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  void DoAudioWork() override {}
48 
49  bool SetPlayerState(const std::string& state) override;
50 
51 #if defined(TARGET_WINDOWS_DESKTOP)
52  bool ExecuteAppW32(const char* strPath, const char* strSwitches);
53  //static void CALLBACK AppFinished(void* closure, BOOLEAN TimerOrWaitFired);
54 #elif defined(TARGET_ANDROID)
55  bool ExecuteAppAndroid(const char* strSwitches,const char* strPath);
56 #elif defined(TARGET_POSIX)
57  bool ExecuteAppLinux(const char* strSwitches);
58 #endif
59 
60 private:
61  void GetCustomRegexpReplacers(TiXmlElement *pRootElement, std::vector<std::string>& settings);
62  void Process() override;
63 
64  bool m_bAbortRequest;
65  bool m_bIsPlaying;
66  std::chrono::time_point<std::chrono::steady_clock> m_playbackStartTime;
67  float m_speed;
68  int m_time;
69  std::string m_launchFilename;
70 #if defined(TARGET_WINDOWS_DESKTOP)
71  POINT m_ptCursorpos;
72  PROCESS_INFORMATION m_processInfo;
73 #endif
74  CGUIDialogOK* m_dialog;
75 #if defined(TARGET_WINDOWS_DESKTOP)
76  int m_xPos;
77  int m_yPos;
78 #endif
79  std::string m_filename;
80  std::string m_args;
81  bool m_hideconsole;
82  bool m_hidexbmc;
83  bool m_islauncher;
84  bool m_playOneStackItem;
85  WARP_CURSOR m_warpcursor;
86  int m_playCountMinTime;
87  std::vector<std::string> m_filenameReplacers;
88  CFileItem m_file;
89 };
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