kodi
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<const CPVREpgInfoTag>& epgTag,
40  TIME_FORMAT format) const;
41  std::string GetEpgEventElapsedTime(const std::shared_ptr<const CPVREpgInfoTag>& epgTag,
42  TIME_FORMAT format) const;
43  std::string GetEpgEventRemainingTime(const std::shared_ptr<const CPVREpgInfoTag>& epgTag,
44  TIME_FORMAT format) const;
45  std::string GetEpgEventFinishTime(const std::shared_ptr<const CPVREpgInfoTag>& epgTag,
46  TIME_FORMAT format) const;
47  std::string GetEpgEventSeekTime(int iSeekSize, TIME_FORMAT format) const;
48 
49  // GUI info ints
50  int GetTimeshiftProgress() const;
51  int GetTimeshiftProgressDuration() const;
52  int GetTimeshiftProgressPlayPosition() const;
53  int GetTimeshiftProgressEpgStart() const;
54  int GetTimeshiftProgressEpgEnd() const;
55  int GetTimeshiftProgressBufferStart() const;
56  int GetTimeshiftProgressBufferEnd() const;
57 
58  int GetEpgEventDuration(const std::shared_ptr<const CPVREpgInfoTag>& epgTag) const;
59  int GetEpgEventProgress(const std::shared_ptr<const CPVREpgInfoTag>& epgTag) const;
60 
61  // GUI info bools
62  bool IsTimeshifting() const;
63 
64  private:
65  void UpdatePlayingTag();
66  void UpdateTimeshiftData();
67  void UpdateTimeshiftProgressData();
68 
69  static std::string TimeToTimeString(time_t datetime, TIME_FORMAT format, bool withSeconds);
70 
71  int GetElapsedTime() const;
72  int GetRemainingTime(const std::shared_ptr<const CPVREpgInfoTag>& epgTag) const;
73 
74  mutable CCriticalSection m_critSection;
75 
76  std::shared_ptr<const CPVREpgInfoTag> m_playingEpgTag;
77  std::shared_ptr<const CPVRChannel> m_playingChannel;
78 
79  time_t m_iStartTime;
80  unsigned int m_iDuration;
81  time_t m_iTimeshiftStartTime;
82  time_t m_iTimeshiftEndTime;
83  time_t m_iTimeshiftPlayTime;
84  unsigned int m_iTimeshiftOffset;
85 
86  time_t m_iTimeshiftProgressStartTime;
87  time_t m_iTimeshiftProgressEndTime;
88  unsigned int m_iTimeshiftProgressDuration;
89  };
90 
91 } // namespace PVR
Definition: ContextMenuManager.h:24
Definition: PVRGUITimesInfo.h:21