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