summaryrefslogtreecommitdiffstats
path: root/xbmc/network/upnp/UPnPPlayer.h
blob: aafd8c48a415d01eb0847248bf187955c7d891aa (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
/*
 *  Copyright (c) 2006 elupus (Joakim Plate)
 *  Copyright (C) 2006-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 "cores/IPlayer.h"
#include "guilib/DispResource.h"
#include "threads/SystemClock.h"
#include "utils/logtypes.h"

#include <string>

class PLT_MediaController;

namespace UPNP
{

class CUPnPPlayerController;

class CUPnPPlayer
  : public IPlayer, public IRenderLoop
{
public:
  CUPnPPlayer(IPlayerCallback& callback, const char* uuid);
  ~CUPnPPlayer() override;

  bool OpenFile(const CFileItem& file, const CPlayerOptions& options) override;
  bool QueueNextFile(const CFileItem &file) override;
  bool CloseFile(bool reopen = false) override;
  bool IsPlaying() const override;
  void Pause() override;
  bool HasVideo() const override { return false; }
  bool HasAudio() const override { return false; }
  void Seek(bool bPlus, bool bLargeStep, bool bChapterOverride) override;
  void SeekPercentage(float fPercent = 0) override;
  void SetVolume(float volume) override;

  int SeekChapter(int iChapter) override { return -1; }

  void SeekTime(int64_t iTime = 0) override;
  void SetSpeed(float speed = 0) override;

  bool IsCaching() const override { return false; }
  int GetCacheLevel() const override { return -1; }
  void DoAudioWork() override;
  bool OnAction(const CAction &action) override;

  void FrameMove() override;

  int PlayFile(const CFileItem& file,
               const CPlayerOptions& options,
               XbmcThreads::EndTime<>& timeout);

private:
  bool IsPaused() const;
  int64_t GetTime();
  int64_t GetTotalTime();
  float GetPercentage();

  PLT_MediaController* m_control;
  CUPnPPlayerController* m_delegate;
  std::string m_current_uri;
  std::string m_current_meta;
  bool m_started;
  bool m_stopremote;
  XbmcThreads::EndTime<> m_updateTimer;

  Logger m_logger;
};

} /* namespace UPNP */