[cosmetics] update date in GPL header
[vuplus_xbmc] / xbmc / storage / DetectDVDType.h
1 #pragma once
2
3 /*
4  *      Copyright (C) 2005-2013 Team XBMC
5  *      http://www.xbmc.org
6  *
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)
10  *  any later version.
11  *
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.
16  *
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/>.
20  *
21  */
22
23 //  CDetectDVDMedia   -  Thread running in the background to detect a CD change
24 //       and the filesystem
25 //
26 // by Bobbin007 in 2003
27 //
28 //
29 //
30
31 #include "system.h"
32
33 #ifdef HAS_DVD_DRIVE
34
35 #include "threads/CriticalSection.h"
36
37 #include "threads/Thread.h"
38 #include "utils/StdString.h"
39 #include "boost/shared_ptr.hpp"
40
41 namespace MEDIA_DETECT
42 {
43 class CCdInfo;
44 class CLibcdio;
45
46 class CDetectDVDMedia : public CThread
47 {
48 public:
49   CDetectDVDMedia();
50   virtual ~CDetectDVDMedia();
51
52   virtual void OnStartup();
53   virtual void OnExit();
54   virtual void Process();
55
56   static void WaitMediaReady();
57   static bool IsDiscInDrive();
58   static int DriveReady();
59   static CCdInfo* GetCdInfo();
60   static CEvent m_evAutorun;
61
62   static const CStdString &GetDVDLabel();
63   static const CStdString &GetDVDPath();
64
65   static void UpdateState();
66 protected:
67   void UpdateDvdrom();
68   DWORD GetTrayState();
69
70
71   void DetectMediaType();
72   void SetNewDVDShareUrl( const CStdString& strNewUrl, bool bCDDA, const CStdString& strDiscLabel );
73
74 private:
75   static CCriticalSection m_muReadingMedia;
76
77   static int m_DriveState;
78   static time_t m_LastPoll;
79   static CDetectDVDMedia* m_pInstance;
80
81   static CCdInfo* m_pCdInfo;
82
83   bool m_bStartup;
84   bool m_bAutorun;
85   DWORD m_dwTrayState;
86   DWORD m_dwTrayCount;
87   DWORD m_dwLastTrayState;
88
89   static CStdString m_diskLabel;
90   static CStdString m_diskPath;
91
92   boost::shared_ptr<CLibcdio> m_cdio;
93 };
94 }
95 #endif