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.
11 #include "input/actions/interfaces/IActionListener.h"
12 #include "settings/lib/ISettingCallback.h"
13 #include "threads/CriticalSection.h"
14 #include "utils/Stopwatch.h"
20 struct IntegerSettingOption
;
28 class CSeekHandler
: public ISettingCallback
, public KODI::ACTION::IActionListener
31 CSeekHandler() = default;
32 ~CSeekHandler() override
;
34 static void SettingOptionsSeekStepsFiller(const std::shared_ptr
<const CSetting
>& setting
,
35 std::vector
<IntegerSettingOption
>& list
,
39 void OnSettingChanged(const std::shared_ptr
<const CSetting
>& setting
) override
;
40 bool OnAction(const CAction
&action
) override
;
42 void Seek(bool forward
, float amount
, float duration
= 0, bool analogSeek
= false, SeekType type
= SEEK_TYPE_VIDEO
);
43 void SeekSeconds(int seconds
);
48 int GetSeekSize() const;
49 bool InProgress() const;
51 bool HasTimeCode() const { return m_timeCodePosition
> 0; }
52 int GetTimeCodeSeconds() const;
55 CSeekHandler(const CSeekHandler
&) = delete;
56 CSeekHandler
& operator=(CSeekHandler
const&) = delete;
57 bool SeekTimeCode(const CAction
&action
);
58 void ChangeTimeCode(int remote
);
61 static const int analogSeekDelay
= 500;
63 void SetSeekSize(double seekSize
);
64 int GetSeekStepSize(SeekType type
, int step
);
66 int m_seekDelay
= 500;
67 std::map
<SeekType
, int > m_seekDelays
;
68 bool m_requireSeek
= false;
69 bool m_seekChanged
= false;
70 bool m_analogSeek
= false;
71 double m_seekSize
= 0;
73 std::map
<SeekType
, std::vector
<int> > m_forwardSeekSteps
;
74 std::map
<SeekType
, std::vector
<int> > m_backwardSeekSteps
;
76 CStopWatch m_timerTimeCode
;
77 int m_timeCodeStamp
[6];
78 int m_timeCodePosition
;
80 CCriticalSection m_critSection
;