xbmc
PVRGUITimesInfo.h
1 /*
2  * Copyright (C) 2012-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 "threads/CriticalSection.h"
12 #include "utils/TimeFormat.h"
13 
14 #include <memory>
15 
16 namespace PVR
17 {
18  class CPVRChannel;
19  class CPVREpgInfoTag;
20 
22  {
23  public:
25  virtual ~CPVRGUITimesInfo() = default;
26 
27  void Reset();
28  void Update();
29 
30  // GUI info labels
31  std::string GetTimeshiftStartTime(TIME_FORMAT format) const;
32  std::string GetTimeshiftEndTime(TIME_FORMAT format) const;
33  std::string GetTimeshiftPlayTime(TIME_FORMAT format) const;
34  std::string GetTimeshiftOffset(TIME_FORMAT format) const;
35  std::string GetTimeshiftProgressDuration(TIME_FORMAT format) const;
36  std::string GetTimeshiftProgressStartTime(TIME_FORMAT format) const;
37  std::string GetTimeshiftProgressEndTime(TIME_FORMAT format) const;
38 
39  std::string GetEpgEventDuration(const std::shared_ptr<CPVREpgInfoTag>& epgTag, TIME_FORMAT format) const;
40  std::string GetEpgEventElapsedTime(const std::shared_ptr<CPVREpgInfoTag>& epgTag, TIME_FORMAT format) const;
41  std::string GetEpgEventRemainingTime(const std::shared_ptr<CPVREpgInfoTag>& epgTag, TIME_FORMAT format) const;
42  std::string GetEpgEventFinishTime(const std::shared_ptr<CPVREpgInfoTag>& epgTag, TIME_FORMAT format) const;
43  std::string GetEpgEventSeekTime(int iSeekSize, TIME_FORMAT format) const;
44 
45  // GUI info ints
46  int GetTimeshiftProgress() const;
47  int GetTimeshiftProgressDuration() const;
48  int GetTimeshiftProgressPlayPosition() const;
49  int GetTimeshiftProgressEpgStart() const;
50  int GetTimeshiftProgressEpgEnd() const;
51  int GetTimeshiftProgressBufferStart() const;
52  int GetTimeshiftProgressBufferEnd() const;
53 
54  int GetEpgEventDuration(const std::shared_ptr<CPVREpgInfoTag>& epgTag) const;
55  int GetEpgEventProgress(const std::shared_ptr<CPVREpgInfoTag>& epgTag) const;
56 
57  // GUI info bools
58  bool IsTimeshifting() const;
59 
60  private:
61  void UpdatePlayingTag();
62  void UpdateTimeshiftData();
63  void UpdateTimeshiftProgressData();
64 
65  static std::string TimeToTimeString(time_t datetime, TIME_FORMAT format, bool withSeconds);
66 
67  int GetElapsedTime() const;
68  int GetRemainingTime(const std::shared_ptr<CPVREpgInfoTag>& epgTag) const;
69 
70  mutable CCriticalSection m_critSection;
71 
72  std::shared_ptr<CPVREpgInfoTag> m_playingEpgTag;
73  std::shared_ptr<CPVRChannel> m_playingChannel;
74 
75  time_t m_iStartTime;
76  unsigned int m_iDuration;
77  time_t m_iTimeshiftStartTime;
78  time_t m_iTimeshiftEndTime;
79  time_t m_iTimeshiftPlayTime;
80  unsigned int m_iTimeshiftOffset;
81 
82  time_t m_iTimeshiftProgressStartTime;
83  time_t m_iTimeshiftProgressEndTime;
84  unsigned int m_iTimeshiftProgressDuration;
85  };
86 
87 } // namespace PVR
Definition: ContextMenuManager.h:24
Definition: PVRGUITimesInfo.h:21