#include <mythmediamonitor.h>

Definition at line 41 of file mythmediamonitor.h.
Public Slots | |
| void | mediaStatusChanged (MediaStatus oldStatus, MythMediaDevice *pMedia) |
Public Member Functions | |
| ~MediaMonitor () | |
| bool | IsActive (void) const |
| virtual void | StartMonitoring (void) |
| Start the monitoring thread if needed. | |
| void | StopMonitoring (void) |
| Stop the monitoring thread if needed. | |
| void | ChooseAndEjectMedia (void) |
| Unmounts and ejects removable media devices. | |
| bool | ValidateAndLock (MythMediaDevice *pMedia) |
| Validates the MythMediaDevice and increments its reference count. | |
| void | Unlock (MythMediaDevice *pMedia) |
| decrements the MythMediaDevices reference count | |
| QValueList< MythMediaDevice * > | GetMedias (MediaType mediatype) |
| Ask for available media. | |
| MythMediaDevice * | GetMedia (const QString &path) |
| Get media device by pathname. | |
| void | MonitorRegisterExtensions (uint mediaType, const QString &extensions) |
| Register the extension list on all known devices. | |
| virtual QStringList | GetCDROMBlockDevices (void)=0 |
Static Public Member Functions | |
| static MediaMonitor * | GetMediaMonitor (void) |
| static QString | GetMountPath (const QString &devPath) |
| If the device is being monitored, return its mountpoint. | |
| static void | SetCDSpeed (const char *device, int speed) |
| static QString | defaultCDdevice () |
| CDDevice, user-selected drive, or /dev/cdrom. | |
| static QString | defaultVCDdevice () |
| VCDDeviceLocation, user-selected drive, or /dev/cdrom. | |
| static QString | defaultDVDdevice () |
| DVDDeviceLocation, user-selected drive, or /dev/dvd. | |
| static QString | defaultCDWriter () |
| CDWriterDeviceLocation, user-selected drive, or /dev/cdrom. | |
| static QString | defaultDVDWriter () |
| MythArchiveDVDLocation, user-selected drive, or /dev/dvd. | |
Protected Member Functions | |
| MediaMonitor (QObject *par, unsigned long interval, bool allowEject) | |
| Lookup some settings, and do OS-specific stuff in sub-classes. | |
| void | CheckDevices (void) |
| Poll the devices in our list. | |
| virtual void | CheckDeviceNotifications (void) |
| virtual bool | AddDevice (MythMediaDevice *pDevice)=0 |
| bool | RemoveDevice (const QString &dev) |
| Remove a device from the media monitor. | |
| bool | shouldIgnore (MythMediaDevice *device) |
| Check user preferences to see if this device should be monitored. | |
| const QString | listDevices (void) |
| A string summarising the current devices, for debugging. | |
| MythMediaDevice * | selectDrivePopup (const QString label, bool mounted=false) |
| Popup a dialog box for the user to select one drive. | |
Static Protected Member Functions | |
| static QString | defaultDevice (const QString setting, const QString label, char *hardCodedDefault) |
Protected Attributes | |
| QMutex | m_DevicesLock |
| QValueList< MythMediaDevice * > | m_Devices |
| QValueList< MythMediaDevice * > | m_RemovedDevices |
| QMap< MythMediaDevice *, int > | m_UseCount |
| QStringList | m_IgnoreList |
| bool | m_Active |
| Was MonitorThread started? | |
| bool | m_SendEvent |
| Send MediaEvent to plugins? | |
| bool | m_StartThread |
| Should we actually monitor? | |
| MonitorThread * | m_Thread |
| unsigned long | m_MonitorPollingInterval |
| bool | m_AllowEject |
Static Protected Attributes | |
| static MediaMonitor * | c_monitor = NULL |
Friends | |
| class | MonitorThread |
| class | MonitorThreadDarwin |
| MediaMonitor::MediaMonitor | ( | QObject * | par, | |
| unsigned long | interval, | |||
| bool | allowEject | |||
| ) | [protected] |
Lookup some settings, and do OS-specific stuff in sub-classes.
Definition at line 266 of file mythmediamonitor.cpp.
| MediaMonitor::~MediaMonitor | ( | ) |
Definition at line 318 of file mythmediamonitor.cpp.
| bool MediaMonitor::IsActive | ( | void | ) | const [inline] |
| void MediaMonitor::StartMonitoring | ( | void | ) | [virtual] |
Start the monitoring thread if needed.
Reimplemented in MediaMonitorDarwin.
Definition at line 383 of file mythmediamonitor.cpp.
Referenced by main(), and Ripper::~Ripper().
| void MediaMonitor::StopMonitoring | ( | void | ) |
Stop the monitoring thread if needed.
Definition at line 403 of file mythmediamonitor.cpp.
Referenced by main(), and Ripper::Ripper().
| void MediaMonitor::ChooseAndEjectMedia | ( | void | ) |
Unmounts and ejects removable media devices.
If no media devices are known to the MediaMonitor this function does nothing. If a single device is known, it is unmounted and ejected if possible. If multiple devices are known, a popup box is display so the user can choose which device to eject.
Definition at line 190 of file mythmediamonitor.cpp.
Referenced by myth_eject().
| MediaMonitor * MediaMonitor::GetMediaMonitor | ( | void | ) | [static] |
Definition at line 57 of file mythmediamonitor.cpp.
Referenced by VideoListImp::buildFsysList(), MythMainWindow::customEvent(), defaultDevice(), Ripper::ejectCD(), IconView::HandleEscape(), IconView::HandleMediaDeviceSelect(), IconView::HandleSettings(), IconView::HandleShowDevices(), main(), myth_eject(), Ripper::Ripper(), SetCDSpeed(), IconView::SetupMediaMonitor(), and Ripper::~Ripper().
| QString MediaMonitor::GetMountPath | ( | const QString & | devPath | ) | [static] |
If the device is being monitored, return its mountpoint.
A convenience function for plugins. (Only currently needed for Mac OS X, which mounts Audio CDs)
Definition at line 489 of file mythmediamonitor.cpp.
| void MediaMonitor::SetCDSpeed | ( | const char * | device, | |
| int | speed | |||
| ) | [static] |
Definition at line 75 of file mythmediamonitor.cpp.
Referenced by CdDecoder::setCDSpeed(), and DVDRingBufferPriv::SetDVDSpeed().
| bool MediaMonitor::ValidateAndLock | ( | MythMediaDevice * | pMedia | ) |
Validates the MythMediaDevice and increments its reference count.
Returns true if pMedia device is valid, otherwise returns false. If this function returns false the caller should gracefully recover.
NOTE: This function can block.
Definition at line 424 of file mythmediamonitor.cpp.
Referenced by VideoListImp::buildFsysList(), MythMainWindow::customEvent(), Ripper::ejectCD(), GetMountPath(), IconView::HandleMediaDeviceSelect(), IconView::HandleMediaEscape(), IconView::HandleShowDevices(), SetCDSpeed(), and IconView::SetupMediaMonitor().
| void MediaMonitor::Unlock | ( | MythMediaDevice * | pMedia | ) |
decrements the MythMediaDevices reference count
Definition at line 441 of file mythmediamonitor.cpp.
Referenced by VideoListImp::buildFsysList(), MythMainWindow::customEvent(), Ripper::ejectCD(), GetMountPath(), IconView::HandleMediaDeviceSelect(), IconView::HandleMediaEscape(), IconView::HandleShowDevices(), SetCDSpeed(), and IconView::SetupMediaMonitor().
| QValueList< MythMediaDevice * > MediaMonitor::GetMedias | ( | MediaType | mediatype | ) |
Ask for available media.
Must be locked with ValidateAndLock().
This method returns a list of MythMediaDevice pointers which match the given mediatype.
It is potentially unsafe to use the pointers returned by this function. The devices may be removed and their associated MythMediaDevice objects destroyed. It is the responsibility of the caller to ensure that the pointers are validated and the reference count is incremented by calling MediaMonitor::ValidateAndLock() before the the returned pointer is dereferenced and MediaMonitor::Unlock() when done.
Definition at line 524 of file mythmediamonitor.cpp.
Referenced by VideoListImp::buildFsysList(), IconView::HandleMediaEscape(), and IconView::HandleShowDevices().
| MythMediaDevice * MediaMonitor::GetMedia | ( | const QString & | path | ) |
Get media device by pathname.
Must be locked with ValidateAndLock().
Definition at line 464 of file mythmediamonitor.cpp.
Referenced by Ripper::ejectCD(), GetMountPath(), and SetCDSpeed().
| void MediaMonitor::MonitorRegisterExtensions | ( | uint | mediaType, | |
| const QString & | extensions | |||
| ) |
Register the extension list on all known devices.
Definition at line 548 of file mythmediamonitor.cpp.
| QString MediaMonitor::defaultCDdevice | ( | ) | [static] |
CDDevice, user-selected drive, or /dev/cdrom.
Definition at line 682 of file mythmediamonitor.cpp.
Referenced by chooseCD().
| QString MediaMonitor::defaultVCDdevice | ( | ) | [static] |
VCDDeviceLocation, user-selected drive, or /dev/cdrom.
Definition at line 690 of file mythmediamonitor.cpp.
Referenced by playVCD().
| QString MediaMonitor::defaultDVDdevice | ( | ) | [static] |
DVDDeviceLocation, user-selected drive, or /dev/dvd.
Definition at line 699 of file mythmediamonitor.cpp.
Referenced by DVDRipBox::DVDRipBox(), playDVD(), startDVDRipper(), and TitleDialog::viewTitle().
| QString MediaMonitor::defaultCDWriter | ( | ) | [static] |
CDWriterDeviceLocation, user-selected drive, or /dev/cdrom.
Definition at line 708 of file mythmediamonitor.cpp.
Referenced by DatabaseBox::BlankCDRW(), and Playlist::CreateCDMP3().
| QString MediaMonitor::defaultDVDWriter | ( | ) | [static] |
MythArchiveDVDLocation, user-selected drive, or /dev/dvd.
This should also look for drives with blanks or RWs in them, but Nigel hasn't worked out how to do this tidily (yet).
Definition at line 720 of file mythmediamonitor.cpp.
| virtual QStringList MediaMonitor::GetCDROMBlockDevices | ( | void | ) | [pure virtual] |
Implemented in MediaMonitorDarwin, MediaMonitorUnix, and MediaMonitorWindows.
| void MediaMonitor::mediaStatusChanged | ( | MediaStatus | oldStatus, | |
| MythMediaDevice * | pMedia | |||
| ) | [slot] |
Definition at line 563 of file mythmediamonitor.cpp.
Referenced by MediaMonitorWindows::AddDevice(), MediaMonitorUnix::AddDevice(), and MediaMonitorDarwin::AddDevice().
| void MediaMonitor::CheckDevices | ( | void | ) | [protected] |
Poll the devices in our list.
Reimplemented in MediaMonitorUnix.
Definition at line 364 of file mythmediamonitor.cpp.
| virtual void MediaMonitor::CheckDeviceNotifications | ( | void | ) | [inline, protected, virtual] |
Reimplemented in MediaMonitorUnix.
Definition at line 88 of file mythmediamonitor.h.
Referenced by CheckDevices().
| virtual bool MediaMonitor::AddDevice | ( | MythMediaDevice * | pDevice | ) | [protected, pure virtual] |
Implemented in MediaMonitorDarwin, MediaMonitorUnix, and MediaMonitorWindows.
| bool MediaMonitor::RemoveDevice | ( | const QString & | dev | ) | [protected] |
Remove a device from the media monitor.
This function is usually called after a hotpluggable device is unplugged.
| dev | path to device special file to remove. |
Definition at line 331 of file mythmediamonitor.cpp.
Referenced by MediaMonitorUnix::CheckDeviceNotifications().
| bool MediaMonitor::shouldIgnore | ( | MythMediaDevice * | device | ) | [protected] |
Check user preferences to see if this device should be monitored.
Definition at line 604 of file mythmediamonitor.cpp.
Referenced by MediaMonitorUnix::AddDevice(), and MediaMonitorDarwin::AddDevice().
| const QString MediaMonitor::listDevices | ( | void | ) | [protected] |
A string summarising the current devices, for debugging.
Definition at line 732 of file mythmediamonitor.cpp.
Referenced by MediaMonitorUnix::MediaMonitorUnix(), and MediaMonitorWindows::MediaMonitorWindows().
| QString MediaMonitor::defaultDevice | ( | const QString | setting, | |
| const QString | label, | |||
| char * | hardCodedDefault | |||
| ) | [static, protected] |
Definition at line 638 of file mythmediamonitor.cpp.
Referenced by defaultCDdevice(), defaultCDWriter(), defaultDVDdevice(), defaultDVDWriter(), and defaultVCDdevice().
| MythMediaDevice * MediaMonitor::selectDrivePopup | ( | const QString | label, | |
| bool | showMounted = false | |||
| ) | [protected] |
Popup a dialog box for the user to select one drive.
Has to iterate through all devices to check if any are suitable, prevent drawing a list if there is only one drive, et cetera
Definition at line 128 of file mythmediamonitor.cpp.
Referenced by ChooseAndEjectMedia(), and defaultDevice().
friend class MonitorThread [friend] |
friend class MonitorThreadDarwin [friend] |
Definition at line 45 of file mythmediamonitor.h.
Referenced by MediaMonitorDarwin::StartMonitoring().
QMutex MediaMonitor::m_DevicesLock [protected] |
Definition at line 100 of file mythmediamonitor.h.
Referenced by MediaMonitorWindows::AddDevice(), MediaMonitorUnix::AddDevice(), GetMedia(), GetMedias(), RemoveDevice(), selectDrivePopup(), Unlock(), and ValidateAndLock().
QValueList<MythMediaDevice*> MediaMonitor::m_Devices [protected] |
Definition at line 101 of file mythmediamonitor.h.
Referenced by MediaMonitorWindows::AddDevice(), MediaMonitorUnix::AddDevice(), MediaMonitorDarwin::AddDevice(), CheckDevices(), MediaMonitorUnix::CheckFileSystemTable(), GetMedia(), GetMedias(), listDevices(), MonitorRegisterExtensions(), RemoveDevice(), selectDrivePopup(), MediaMonitorDarwin::StartMonitoring(), and ValidateAndLock().
QValueList<MythMediaDevice*> MediaMonitor::m_RemovedDevices [protected] |
QMap<MythMediaDevice*, int> MediaMonitor::m_UseCount [protected] |
Definition at line 103 of file mythmediamonitor.h.
Referenced by MediaMonitorWindows::AddDevice(), MediaMonitorUnix::AddDevice(), MediaMonitorDarwin::AddDevice(), RemoveDevice(), Unlock(), and ValidateAndLock().
QStringList MediaMonitor::m_IgnoreList [protected] |
Definition at line 106 of file mythmediamonitor.h.
Referenced by MediaMonitor(), and shouldIgnore().
bool MediaMonitor::m_Active [protected] |
Was MonitorThread started?
Definition at line 108 of file mythmediamonitor.h.
Referenced by mediaStatusChanged(), StartMonitoring(), MediaMonitorDarwin::StartMonitoring(), and StopMonitoring().
bool MediaMonitor::m_SendEvent [protected] |
Send MediaEvent to plugins?
Definition at line 109 of file mythmediamonitor.h.
Referenced by MediaMonitorDarwin::AddDevice(), MediaMonitor(), and mediaStatusChanged().
bool MediaMonitor::m_StartThread [protected] |
Should we actually monitor?
Definition at line 110 of file mythmediamonitor.h.
Referenced by MediaMonitor(), StartMonitoring(), and MediaMonitorDarwin::StartMonitoring().
MonitorThread* MediaMonitor::m_Thread [protected] |
Definition at line 112 of file mythmediamonitor.h.
Referenced by StartMonitoring(), MediaMonitorDarwin::StartMonitoring(), StopMonitoring(), and ~MediaMonitor().
unsigned long MediaMonitor::m_MonitorPollingInterval [protected] |
Definition at line 113 of file mythmediamonitor.h.
Referenced by StartMonitoring(), and MediaMonitorDarwin::StartMonitoring().
bool MediaMonitor::m_AllowEject [protected] |
Definition at line 114 of file mythmediamonitor.h.
Referenced by MediaMonitorUnix::AddDevice(), and MediaMonitorUnix::FindPartitions().
MediaMonitor * MediaMonitor::c_monitor = NULL [static, protected] |
Definition at line 116 of file mythmediamonitor.h.
Referenced by defaultDevice(), GetMediaMonitor(), and GetMountPath().
1.5.5