Ticket #1753: mythmediamonitor.patch
File mythmediamonitor.patch, 5.3 KB (added by , 18 years ago) |
---|
-
mythcdrom.cpp
33 33 #elif defined(__FreeBSD__) 34 34 return new MythCDROMFreeBSD(par, devicePath, SuperMount, AllowEject); 35 35 #elif defined(CONFIG_DARWIN) 36 return new MythCDROM (par, devicePath, SuperMount, AllowEject);36 return new MythCDROMDarwin(par, devicePath, SuperMount, AllowEject); 37 37 #else 38 38 return NULL; 39 39 #endif -
mythmediamonitor.h
47 47 { 48 48 Q_OBJECT 49 49 friend class MonitorThread; 50 50 friend class MonitorThreadDarwin; 51 51 52 protected: 52 53 MediaMonitor(QObject* par, unsigned long interval, bool allowEject); 53 54 … … 56 57 57 58 bool IsActive(void) const { return m_Active; } 58 59 59 v oid StartMonitoring(void);60 virtual void StartMonitoring(void); 60 61 void StopMonitoring(void); 61 62 void ChooseAndEjectMedia(void); 62 63 … … 82 83 bool CheckMountable(void); 83 84 bool FindPartitions(const QString &dev, bool checkPartitions); 84 85 85 bool AddDevice(MythMediaDevice* pDevice);86 virtual bool AddDevice(MythMediaDevice* pDevice); 86 87 bool AddDevice(const char* dev); 87 88 bool AddDevice(struct fstab* mep); 88 89 bool RemoveDevice(const QString &dev); … … 98 99 QMap<MythMediaDevice*, int> m_UseCount; 99 100 100 101 bool m_Active; 101 MonitorThread m_Thread; 102 MonitorThread *m_Thread; 103 unsigned long m_MonitorPollingInterval; 102 104 bool m_AllowEject; 103 105 int m_fifo; 104 106 -
mythcdrom.h
58 58 virtual MediaError unlock(void); 59 59 }; 60 60 61 class MythCDROMDarwin: public MythCDROM 62 { 63 public: 64 MythCDROMDarwin(QObject* par, const char* DevicePath, bool SuperMount, 65 bool AllowEject): 66 MythCDROM(par, DevicePath, SuperMount, AllowEject) { 67 } 68 69 virtual bool openDevice(); 70 virtual MediaError testMedia(void); 71 virtual bool mediaChanged(void); 72 virtual bool checkOK(void); 73 virtual MediaStatus checkMedia(void); 74 virtual MediaError eject(bool open_close = true); 75 virtual MediaError lock(void); 76 virtual MediaError unlock(void); 77 }; 78 61 79 #endif -
libmyth.pro
72 72 } 73 73 74 74 macx { 75 HEADERS += audiooutputca.h screensaver-osx.h DisplayResOSX.h 76 SOURCES += audiooutputca.cpp screensaver-osx.cpp DisplayResOSX.cpp 75 HEADERS += audiooutputca.h screensaver-osx.h DisplayResOSX.h mythmediamonitor-darwin.h 76 SOURCES += audiooutputca.cpp screensaver-osx.cpp DisplayResOSX.cpp mythmediamonitor-darwin.cpp 77 77 HEADERS += util-osx.h 78 78 SOURCES += util-osx.cpp 79 79 SOURCES += mythcdrom-darwin.cpp 80 80 81 using_appleremote { 81 82 HEADERS += AppleRemote.h AppleRemoteListener.h lircevent.h 82 83 SOURCES += AppleRemote.cpp AppleRemoteListener.cpp lircevent.cpp 83 84 } 84 85 85 86 # Mac OS X Frameworks 86 FWKS = ApplicationServices AudioUnit Carbon CoreAudio IOKit 87 FWKS = ApplicationServices AudioUnit Carbon CoreAudio IOKit DiskArbitration 87 88 88 89 # The following trick is tidier, and shortens the command line, but it 89 90 # depends on the shell expanding Csh-style braces. Luckily, Bash & Zsh do. -
mythmediamonitor.cpp
25 25 #include <qdir.h> 26 26 #include <qfile.h> 27 27 28 #ifdef Q_OS_MACX 29 #include "mythmediamonitor-darwin.h" 30 #endif // Q_OS_MACX 31 28 32 // MythTV headers 29 33 #include "mythmediamonitor.h" 30 34 #include "mythcontext.h" … … 87 91 88 92 if (gContext->GetNumSetting("MonitorDrives")) 89 93 { 94 #ifdef Q_OS_MACX 95 c_monitor = new MediaMonitorDarwin(NULL, 500, true); 96 #else 90 97 c_monitor = new MediaMonitor(NULL, 500, true); 98 #endif // Q_OS_MACX 91 99 c_monitor->CheckFileSystemTable(); 92 100 c_monitor->CheckMountable(); 93 101 } … … 199 207 200 208 MediaMonitor::MediaMonitor(QObject* par, unsigned long interval, 201 209 bool allowEject) 202 : QObject(par), m_Active(false), m_Thread( this,interval),210 : QObject(par), m_Active(false), m_Thread(NULL), m_MonitorPollingInterval(interval), 203 211 m_AllowEject(allowEject), m_fifo(-1) 204 212 { 205 213 } 206 214 207 215 MediaMonitor::~MediaMonitor() 208 216 { 217 if (m_Thread) 218 { 219 delete m_Thread; 220 m_Thread = NULL; 221 } 222 209 223 if (m_fifo > 0) 210 224 { 211 225 close(m_fifo); … … 742 756 if (m_Active) 743 757 return; 744 758 759 if (!m_Thread) 760 { 761 m_Thread = new MonitorThread(this, m_MonitorPollingInterval); 762 } 745 763 m_Active = true; 746 m_Thread .start();764 m_Thread->start(); 747 765 } 748 766 749 767 /** \fn MediaMonitor::StopMonitoring(void) … … 756 774 return; 757 775 758 776 m_Active = false; 759 m_Thread .wait();777 m_Thread->wait(); 760 778 } 761 779 762 780 /** \fn MediaMonitor::ValidateAndLock(MythMediaDevice *pMedia)