4 * Copyright (C) 2005-2015 Team XBMC
7 * This Program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
12 * This Program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with XBMC; see the file COPYING. If not, see
19 * <http://www.gnu.org/licenses/>.
24 // Thread running in the background to detect a CD change and the filesystem
26 // by Bobbin007 in 2003
32 #include "threads/CriticalSection.h"
34 #include "threads/Thread.h"
38 namespace MEDIA_DETECT
43 class CDetectDVDMedia
: public CThread
47 virtual ~CDetectDVDMedia();
49 virtual void OnStartup();
50 virtual void OnExit();
51 virtual void Process();
53 static void WaitMediaReady();
54 static bool IsDiscInDrive();
55 static int DriveReady();
56 static CCdInfo
* GetCdInfo();
57 static CEvent m_evAutorun
;
59 static const std::string
&GetDVDLabel();
60 static const std::string
&GetDVDPath();
62 static void UpdateState();
68 void DetectMediaType();
69 void SetNewDVDShareUrl( const std::string
& strNewUrl
, bool bCDDA
, const std::string
& strDiscLabel
);
72 static CCriticalSection m_muReadingMedia
;
74 static int m_DriveState
;
75 static time_t m_LastPoll
;
76 static CDetectDVDMedia
* m_pInstance
;
78 static CCdInfo
* m_pCdInfo
;
83 DWORD m_dwLastTrayState
;
85 static std::string m_diskLabel
;
86 static std::string m_diskPath
;
88 std::shared_ptr
<CLibcdio
> m_cdio
;