summaryrefslogtreecommitdiffstats
path: root/xbmc/cores/ExternalPlayer/ExternalPlayer.h
blob: c8f39d5c58b4a71f4ced57c513529c4d50dcc00d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*
 *  Copyright (C) 2005-2018 Team Kodi
 *  This file is part of Kodi - https://kodi.tv
 *
 *  SPDX-License-Identifier: GPL-2.0-or-later
 *  See LICENSES/README.md for more information.
 */

#pragma once

#include "FileItem.h"
#include "cores/IPlayer.h"
#include "threads/Thread.h"

#include <string>
#include <vector>

class CGUIDialogOK;

class CExternalPlayer : public IPlayer, public CThread
{
public:
  enum WARP_CURSOR { WARP_NONE = 0, WARP_TOP_LEFT, WARP_TOP_RIGHT, WARP_BOTTOM_RIGHT, WARP_BOTTOM_LEFT, WARP_CENTER };

  explicit CExternalPlayer(IPlayerCallback& callback);
  ~CExternalPlayer() override;
  bool Initialize(TiXmlElement* pConfig) override;
  bool OpenFile(const CFileItem& file, const CPlayerOptions &options) override;
  bool CloseFile(bool reopen = false) override;
  bool IsPlaying() const override;
  void Pause() override;
  bool HasVideo() const override;
  bool HasAudio() const override;
  bool CanSeek() const override;
  void Seek(bool bPlus, bool bLargeStep, bool bChapterOverride) override;
  void SeekPercentage(float iPercent) override;
  void SetVolume(float volume) override {}
  void SetDynamicRangeCompression(long drc) override {}
  void SetAVDelay(float fValue = 0.0f) override;
  float GetAVDelay() override;

  void SetSubTitleDelay(float fValue = 0.0f) override;
  float GetSubTitleDelay() override;

  void SeekTime(int64_t iTime) override;
  void SetSpeed(float speed) override;
  void DoAudioWork() override {}

  bool SetPlayerState(const std::string& state) override;

#if defined(TARGET_WINDOWS_DESKTOP)
  bool ExecuteAppW32(const char* strPath, const char* strSwitches);
  //static void CALLBACK AppFinished(void* closure, BOOLEAN TimerOrWaitFired);
#elif defined(TARGET_ANDROID)
  bool ExecuteAppAndroid(const char* strSwitches,const char* strPath);
#elif defined(TARGET_POSIX)
  bool ExecuteAppLinux(const char* strSwitches);
#endif

private:
  void GetCustomRegexpReplacers(TiXmlElement *pRootElement, std::vector<std::string>& settings);
  void Process() override;

  bool m_bAbortRequest;
  bool m_bIsPlaying;
  std::chrono::time_point<std::chrono::steady_clock> m_playbackStartTime;
  float m_speed;
  int m_time;
  std::string m_launchFilename;
#if defined(TARGET_WINDOWS_DESKTOP)
  POINT m_ptCursorpos;
  PROCESS_INFORMATION m_processInfo;
#endif
  CGUIDialogOK* m_dialog;
#if defined(TARGET_WINDOWS_DESKTOP)
  int m_xPos;
  int m_yPos;
#endif
  std::string m_filename;
  std::string m_args;
  bool m_hideconsole;
  bool m_hidexbmc;
  bool m_islauncher;
  bool m_playOneStackItem;
  WARP_CURSOR m_warpcursor;
  int m_playCountMinTime;
  std::vector<std::string> m_filenameReplacers;
  CFileItem m_file;
};