MythTV
master
|
#include <mediamonitor-unix.h>
Public Member Functions | |
MediaMonitorUnix (QObject *par, unsigned long interval, bool allowEject) | |
void | deleteLater (void) override |
![]() | |
bool | IsActive (void) const |
virtual void | StartMonitoring (void) |
Start the monitoring thread if needed. More... | |
void | StopMonitoring (void) |
Stop the monitoring thread if needed. More... | |
void | ChooseAndEjectMedia (void) |
Unmounts and ejects removable media devices. More... | |
void | EjectMedia (const QString &path) |
bool | ValidateAndLock (MythMediaDevice *pMedia) |
Validates the MythMediaDevice and increments its reference count. More... | |
void | Unlock (MythMediaDevice *pMedia) |
decrements the MythMediaDevices reference count More... | |
QList< MythMediaDevice * > | GetRemovable (bool showMounted=false, bool showUsable=false) |
Generate a list of removable drives. More... | |
QList< MythMediaDevice * > | GetMedias (unsigned mediatypes) |
Ask for available media. Must be locked with ValidateAndLock(). More... | |
MythMediaDevice * | GetMedia (const QString &path) |
Get media device by pathname. Must be locked with ValidateAndLock(). More... | |
void | RegisterMediaHandler (const QString &destination, const QString &description, void(*callback)(MythMediaDevice *), int mediaType, const QString &extensions) |
Register a handler for media related events. More... | |
void | JumpToMediaHandler (MythMediaDevice *pMedia) |
Find a relevant jump point for this type of media. More... | |
Protected Member Functions | |
~MediaMonitorUnix () override=default | |
void | CheckDeviceNotifications (void) override |
Checks the named pipe, kUDEV_FIFO, for hotplug events from the udev system. More... | |
bool | CheckFileSystemTable (void) |
bool | CheckMountable (void) |
Search /sys/block for valid removable media devices. More... | |
bool | CheckRemovable (const QString &dev) |
Is /sys/block/dev a removable device? More... | |
bool | FindPartitions (const QString &dev, bool checkPartitions) |
Creates MythMedia instances for sysfs removable media devices. More... | |
bool | AddDevice (MythMediaDevice *pDevice) override |
Given a media device, add it to our collection. More... | |
bool | AddDevice (struct fstab *mep) |
QString | GetDeviceFile (const QString &sysfs) |
Returns the device special file associated with the /sys/block node. More... | |
QStringList | GetCDROMBlockDevices (void) override |
![]() | |
MediaMonitor (QObject *par, unsigned long interval, bool allowEject) | |
Lookup some settings, and do OS-specific stuff in sub-classes. More... | |
~MediaMonitor () override=default | |
void | CheckDevices (void) |
Poll the devices in our list. More... | |
bool | RemoveDevice (const QString &dev) |
Remove a device from the media monitor. More... | |
bool | shouldIgnore (const MythMediaDevice *device) |
Check user preferences to see if this device should be monitored. More... | |
bool | eventFilter (QObject *obj, QEvent *event) override |
Installed into the main window's event chain, so that the main thread can safely jump to plugin code. More... | |
QString | listDevices (void) |
A string summarising the current devices, for debugging. More... | |
MythMediaDevice * | selectDrivePopup (const QString &label, bool showMounted=false, bool showUsable=false) |
List removable drives, let the user select one. More... | |
Protected Attributes | |
int | m_fifo {-1} |
![]() | |
QMutex | m_devicesLock |
QList< MythMediaDevice * > | m_devices |
QList< MythMediaDevice * > | m_removedDevices |
QMap< MythMediaDevice *, int > | m_useCount |
QStringList | m_ignoreList |
bool volatile | m_active {false} |
Was MonitorThread started? More... | |
QWaitCondition | m_wait |
MonitorThread * | m_thread {nullptr} |
unsigned long | m_monitorPollingInterval |
bool | m_allowEject |
QMap< QString, MHData > | m_handlerMap |
Registered Media Handlers. More... | |
Static Protected Attributes | |
static const char * | kUDEV_FIFO = "/tmp/mythtv_media" |
![]() | |
static MediaMonitor * | s_monitor = nullptr |
Additional Inherited Members | |
![]() | |
void | mediaStatusChanged (MythMediaStatus oldStatus, MythMediaDevice *pMedia) const |
Slot which is called when the device status changes and posts a media event to the mainwindow. More... | |
![]() | |
static MediaMonitor * | GetMediaMonitor (void) |
static QString | GetMountPath (const QString &devPath) |
If the device is being monitored, return its mountpoint. More... | |
static void | SetCDSpeed (const char *device, int speed) |
static QString | defaultCDdevice () |
CDDevice, user-selected drive, or /dev/cdrom. More... | |
static QString | defaultVCDdevice () |
VCDDeviceLocation, user-selected drive, or /dev/cdrom. More... | |
static QString | defaultDVDdevice () |
DVDDeviceLocation, user-selected drive, or /dev/dvd. More... | |
static QString | defaultCDWriter () |
CDWriterDeviceLocation, user-selected drive, or /dev/cdrom. More... | |
static QString | defaultDVDWriter () |
MythArchiveDVDLocation, user-selected drive, or /dev/dvd. More... | |
static void | ejectOpticalDisc (void) |
Eject a disk, unmount a drive, open a tray. More... | |
![]() | |
static void | AttemptEject (MythMediaDevice *device) |
static QString | defaultDevice (const QString &setting, const QString &label, const char *hardCodedDefault) |
Definition at line 16 of file mediamonitor-unix.h.
MediaMonitorUnix::MediaMonitorUnix | ( | QObject * | par, |
unsigned long | interval, | ||
bool | allowEject | ||
) |
Definition at line 116 of file mediamonitor-unix.cpp.
|
overrideprotecteddefault |
|
overridevirtual |
Reimplemented from MediaMonitor.
Definition at line 134 of file mediamonitor-unix.cpp.
|
overrideprotectedvirtual |
Checks the named pipe, kUDEV_FIFO, for hotplug events from the udev system.
NOTE: Currently only Linux w/udev 0.71+ provides these events.
Reimplemented from MediaMonitor.
Definition at line 844 of file mediamonitor-unix.cpp.
|
protected |
Definition at line 148 of file mediamonitor-unix.cpp.
Referenced by MediaMonitorUnix().
|
protected |
Search /sys/block for valid removable media devices.
This function creates MediaDevice instances for valid removable media devices found under the /sys/block filesystem in Linux. CD and DVD devices are created as MythCDROM instances. MythHDD instances will be created for each partition on removable hard disk devices, if they exist. Otherwise a single MythHDD instance will be created for the entire disc.
NOTE: Floppy disks are ignored.
Definition at line 198 of file mediamonitor-unix.cpp.
Referenced by MediaMonitorUnix().
|
protected |
Is /sys/block/dev a removable device?
Definition at line 304 of file mediamonitor-unix.cpp.
Referenced by CheckDeviceNotifications(), and CheckMountable().
Creates MythMedia instances for sysfs removable media devices.
Block devices are represented as directories in sysfs with directories for each partition underneath the parent device directory.
This function recursively calls itself to find all partitions on a block device and creates a MythHDD instance for each partition found. If no partitions are found and the device is a CD or DVD device a MythCDROM instance is created. Otherwise a MythHDD instance is created for the entire block device.
dev | path to sysfs block device. |
checkPartitions | check for partitions on block device. |
Definition at line 776 of file mediamonitor-unix.cpp.
Referenced by CheckDeviceNotifications(), and CheckMountable().
|
overrideprotectedvirtual |
Given a media device, add it to our collection.
Implements MediaMonitor.
Definition at line 564 of file mediamonitor-unix.cpp.
Referenced by AddDevice(), CheckFileSystemTable(), CheckMountable(), and FindPartitions().
|
protected |
Definition at line 628 of file mediamonitor-unix.cpp.
|
protected |
Returns the device special file associated with the /sys/block node.
sysfs | system filesystem path of removable block device. |
Definition at line 338 of file mediamonitor-unix.cpp.
Referenced by FindPartitions().
|
overrideprotectedvirtual |
Implements MediaMonitor.
Definition at line 430 of file mediamonitor-unix.cpp.
Referenced by FindPartitions().
|
protected |
Definition at line 54 of file mediamonitor-unix.h.
Referenced by CheckDeviceNotifications(), CheckMountable(), and deleteLater().
|
staticprotected |
Definition at line 55 of file mediamonitor-unix.h.
Referenced by CheckMountable(), and deleteLater().