[video] fix selection after changing video or extra art
[xbmc.git] / xbmc / pvr / guilib / guiinfo / PVRGUITimesInfo.h
blob73b194f78ee05c2ff3a1f2eaf0c00a24c65b9ede
1 /*
2 * Copyright (C) 2012-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #pragma once
11 #include "threads/CriticalSection.h"
12 #include "utils/TimeFormat.h"
14 #include <memory>
16 namespace PVR
18 class CPVRChannel;
19 class CPVREpgInfoTag;
21 class CPVRGUITimesInfo
23 public:
24 CPVRGUITimesInfo();
25 virtual ~CPVRGUITimesInfo() = default;
27 void Reset();
28 void Update();
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;
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;
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;
58 int GetEpgEventDuration(const std::shared_ptr<const CPVREpgInfoTag>& epgTag) const;
59 int GetEpgEventProgress(const std::shared_ptr<const CPVREpgInfoTag>& epgTag) const;
61 // GUI info bools
62 bool IsTimeshifting() const;
64 private:
65 void UpdatePlayingTag();
66 void UpdateTimeshiftData();
67 void UpdateTimeshiftProgressData();
69 static std::string TimeToTimeString(time_t datetime, TIME_FORMAT format, bool withSeconds);
71 int GetElapsedTime() const;
72 int GetRemainingTime(const std::shared_ptr<const CPVREpgInfoTag>& epgTag) const;
74 mutable CCriticalSection m_critSection;
76 std::shared_ptr<const CPVREpgInfoTag> m_playingEpgTag;
77 std::shared_ptr<const CPVRChannel> m_playingChannel;
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;
86 time_t m_iTimeshiftProgressStartTime;
87 time_t m_iTimeshiftProgressEndTime;
88 unsigned int m_iTimeshiftProgressDuration;
91 } // namespace PVR