Debian Codegraph @

xbmc/storage/DetectDVDType.h

raw
1 /*
2 * Copyright (C) 2005-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 // CDetectDVDMedia
12 // Thread running in the background to detect a CD change and the filesystem
13 //
14 // by Bobbin007 in 2003
15
16 #include "PlatformDefs.h"
17
18 #ifdef HAS_OPTICAL_DRIVE
19
20 #include "storage/discs/IDiscDriveHandler.h"
21 #include "threads/CriticalSection.h"
22 #include "threads/Thread.h"
23 #include "utils/DiscsUtils.h"
24
25 #include <memory>
26 #include <string>
27
28 namespace MEDIA_DETECT
29 {
30 class CCdInfo;
31 class CLibcdio;
32
33 class CDetectDVDMedia : public CThread
34 {
35 public:
36 CDetectDVDMedia();
37 ~CDetectDVDMedia() override;
38
39 void OnStartup() override;
40 void OnExit() override;
41 void Process() override;
42
43 static void WaitMediaReady();
44 static bool IsDiscInDrive();
45 static bool DriveReady();
46 static DriveState GetDriveState();
47 static CCdInfo* GetCdInfo();
48 static CEvent m_evAutorun;
49
50 static const std::string &GetDVDLabel();
51 static const std::string &GetDVDPath();
52
53 static void UpdateState();
54 protected:
55 void UpdateDvdrom();
56 DriveState PollDriveState();
57
58
59 void DetectMediaType();
60 void SetNewDVDShareUrl( const std::string& strNewUrl, bool bCDDA, const std::string& strDiscLabel );
61
62 void Clear();
63
64 private:
65 static CCriticalSection m_muReadingMedia;
66
67 static DriveState m_DriveState;
68 static time_t m_LastPoll;
69 static CDetectDVDMedia* m_pInstance;
70
71 static CCdInfo* m_pCdInfo;
72
73 bool m_bStartup = true; // Do not autorun on startup
74 bool m_bAutorun = false;
75 TrayState m_TrayState{TrayState::UNDEFINED};
76 TrayState m_LastTrayState{TrayState::UNDEFINED};
77 DriveState m_LastDriveState{DriveState::NONE};
78
79 static std::string m_diskLabel;
80 static std::string m_diskPath;
81
82 std::shared_ptr<CLibcdio> m_cdio;
83
84 /*! \brief Stores the DiscInfo of the current disk */
85 static UTILS::DISCS::DiscInfo m_discInfo;
86 };
87 }
88 #endif