Merge pull request #26126 from stephan49/fix-pipewire-unlock-error
[xbmc.git] / xbmc / video / guilib / VideoPlayActionProcessor.h
blob11a7d3a799dc04b1a30ed365bf61edc16c8064d8
1 /*
2 * Copyright (C) 2023 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 "video/guilib/VideoAction.h"
13 #include <memory>
15 class CFileItem;
17 namespace KODI::VIDEO::GUILIB
19 class CVideoPlayActionProcessor
21 public:
22 explicit CVideoPlayActionProcessor(const std::shared_ptr<CFileItem>& item) : m_item(item) {}
23 virtual ~CVideoPlayActionProcessor() = default;
25 bool ProcessDefaultAction();
26 bool ProcessAction(Action action);
28 void SetChoosePlayer() { m_choosePlayer = true; }
29 void SetChooseStackPart() { m_chooseStackPart = true; }
31 bool UserCancelled() const { return m_userCancelled; }
33 static Action ChoosePlayOrResume(const CFileItem& item);
35 protected:
36 virtual Action GetDefaultAction();
37 virtual bool Process(Action action);
39 virtual bool OnResumeSelected();
40 virtual bool OnPlaySelected();
42 void Play(const std::string& player);
44 std::shared_ptr<CFileItem> m_item;
45 bool m_userCancelled{false};
46 bool m_choosePlayer{false};
47 bool m_chooseStackPart{false};
48 unsigned int m_chosenStackPart{0};
50 private:
51 CVideoPlayActionProcessor() = delete;
52 unsigned int ChooseStackPart() const;
53 Action ChoosePlayOrResume() const;
54 static Action ChoosePlayOrResume(const std::string& resumeString);
55 void SetResumeData();
56 void SetStartData();
58 } // namespace KODI::VIDEO::GUILIB