|
MythTV master
|
#include <libmythbase/mythmedia.h>
Signals | |
| void | statusChanged (MythMediaStatus oldStatus, MythMediaDevice *pMedia) |
Public Member Functions | |
| MythMediaDevice (QObject *par, QString DevicePath, bool SuperMount, bool AllowEject) | |
| const QString & | getMountPath () const |
| void | setMountPath (const char *path) |
| const QString & | getDevicePath () const |
| const QString & | getRealDevice () const |
| const QString & | getDeviceModel () const |
| void | setDeviceModel (const char *model) |
| MythMediaStatus | getStatus () const |
| const QString & | getVolumeID () const |
| void | setVolumeID (const char *vol) |
| const QString & | getKeyID () const |
| bool | getAllowEject () const |
| bool | getLocked () const |
| bool | isDeviceOpen () const |
| bool | isUsable () const |
| Is this device "ready", for a plugin to access? More... | |
| MythMediaType | getMediaType () const |
| bool | isSuperMount () const |
| virtual MythMediaError | testMedia () |
| virtual bool | openDevice () |
| virtual bool | closeDevice () |
| virtual bool | isSameDevice (const QString &path) |
| virtual void | setSpeed (int speed) |
| virtual void | setDeviceSpeed (const char *, int) |
| virtual MythMediaStatus | checkMedia ()=0 |
| virtual MythMediaError | eject (bool open_close=true) |
| virtual MythMediaError | lock () |
| virtual MythMediaError | unlock () |
| virtual bool | performMountCmd (bool DoMount) |
| bool | mount () |
| bool | unmount () |
| bool | isMounted (bool bVerify=true) |
| Tells us if m_devicePath is a mounted device. More... | |
| bool | findMountPath () |
| Try to find a mount of m_devicePath in the mounts file. More... | |
| void | clearData () |
| QString | MediaTypeString () |
Static Public Member Functions | |
| static void | RegisterMediaExtensions (uint mediatype, const QString &extensions) |
| Used to register media types with extensions. More... | |
| static QString | MediaTypeString (uint type) |
Static Public Attributes | |
| static const std::array< const QString, 9 > | kMediaStatusStrings |
| static const std::array< const QString, 3 > | kMediaErrorStrings |
Protected Member Functions | |
| ~MythMediaDevice () override=default | |
| virtual void | onDeviceMounted (void) |
| Override this to perform any post mount logic. More... | |
| virtual void | onDeviceUnmounted () |
| Override this to perform any post unmount logic. More... | |
| MythMediaType | DetectMediaType (void) |
| Returns guessed media type based on file extensions. More... | |
| bool | ScanMediaType (const QString &directory, ext_cnt_t &cnt) |
| Recursively scan directories and create an associative array with the number of times we've seen each extension. More... | |
| MythMediaStatus | setStatus (MythMediaStatus newStat, bool CloseIt=false) |
Protected Attributes | |
| QString | m_deviceModel |
| The device Manufacturer/Model. Read/write. More... | |
| QString | m_devicePath |
| The path to this media's device. More... | |
| QString | m_keyID |
| KeyID of the media. More... | |
| QString | m_mountPath |
| The path to this media's mount point. More... | |
| QString | m_realDevice |
| If m_devicePath is a symlink, its target. More... | |
| QString | m_volumeID |
| The volume ID of the media. Read/write. More... | |
| MythMediaStatus | m_status {MEDIASTAT_UNKNOWN} |
| The status of the media as of the last call to checkMedia. More... | |
| MythMediaType | m_mediaType {MEDIATYPE_UNKNOWN} |
| The type of media. Read only. More... | |
| bool | m_allowEject |
| Allow the user to eject the media?. Read only. More... | |
| bool | m_locked {false} |
| Is this media locked?. Read only. More... | |
| bool | m_superMount |
| Is this a supermount device?. More... | |
| int | m_deviceHandle {-1} |
| A file handle for opening and closing the device, ioctls(), et c. More... | |
Static Private Attributes | |
| static ext_to_media_t | s_ext_to_media |
| Map of extension to media type. More... | |
Friends | |
| class | MediaMonitorDarwin |
| class | MonitorThreadDarwin |
Definition at line 48 of file mythmedia.h.
| MythMediaDevice::MythMediaDevice | ( | QObject * | par, |
| QString | DevicePath, | ||
| bool | SuperMount, | ||
| bool | AllowEject | ||
| ) |
Definition at line 76 of file mythmedia.cpp.
|
overrideprotecteddefault |
|
pure virtual |
Implemented in MythCDROMLinux, MythCDROM, and MythHDD.
Referenced by MediaMonitor::CheckDevices().
| void MythMediaDevice::clearData | ( | ) |
Definition at line 511 of file mythmedia.cpp.
Referenced by MythHDD::checkMedia(), and MediaMonitor::mediaStatusChanged().
|
virtual |
Definition at line 96 of file mythmedia.cpp.
Referenced by MythCDROMLinux::checkMedia(), performMountCmd(), setStatus(), MythCDROMFreeBSD::testMedia(), and MythCDROMLinux::testMedia().
|
protected |
Returns guessed media type based on file extensions.
Definition at line 218 of file mythmedia.cpp.
|
virtual |
Reimplemented in MythCDROMFreeBSD, MythCDROMLinux, and MythHDD.
Definition at line 311 of file mythmedia.cpp.
Referenced by MediaMonitor::AttemptEject(), and Ripper::ejectCD().
| bool MythMediaDevice::findMountPath | ( | ) |
Try to find a mount of m_devicePath in the mounts file.
Definition at line 368 of file mythmedia.cpp.
Referenced by MediaMonitor::GetMountPath(), isMounted(), and performMountCmd().
|
inline |
Definition at line 77 of file mythmedia.h.
|
inline |
Definition at line 67 of file mythmedia.h.
Referenced by ImageManagerFe::DeviceEvent().
|
inline |
Definition at line 61 of file mythmedia.h.
Referenced by MediaMonitorUnix::AddDevice(), MediaMonitorWindows::AddDevice(), Device::Close(), TV::customEvent(), setStatus(), and MediaMonitor::shouldIgnore().
|
inline |
Definition at line 75 of file mythmedia.h.
|
inline |
Definition at line 79 of file mythmedia.h.
|
inline |
Definition at line 91 of file mythmedia.h.
Referenced by ImageManagerFe::DeviceEvent(), MediaMonitor::eventFilter(), MediaMonitor::JumpToMediaHandler(), and MythThemedMenu::mediaEvent().
|
inline |
Definition at line 58 of file mythmedia.h.
Referenced by ImageManagerFe::DeviceEvent(), MediaMonitor::GetMountPath(), handleMedia(), and MediaMonitor::shouldIgnore().
|
inline |
Definition at line 63 of file mythmedia.h.
Referenced by LookupModel(), and MediaMonitor::shouldIgnore().
|
inline |
Definition at line 70 of file mythmedia.h.
Referenced by MediaMonitor::AttemptEject(), TV::customEvent(), ImageManagerFe::DeviceEvent(), MediaMonitor::eventFilter(), handleGalleryMedia(), handleMedia(), MythThemedMenu::mediaEvent(), and MediaMonitor::mediaStatusChanged().
|
inline |
Definition at line 72 of file mythmedia.h.
Referenced by ImageManagerFe::DeviceEvent(), and handleMedia().
| bool MythMediaDevice::isDeviceOpen | ( | ) | const |
Definition at line 108 of file mythmedia.cpp.
Referenced by MythCDROMLinux::checkMedia(), closeDevice(), MythCDROMFreeBSD::eject(), MythCDROMLinux::eject(), openDevice(), performMountCmd(), MythCDROMFreeBSD::testMedia(), MythCDROMLinux::testMedia(), MythCDROMFreeBSD::unlock(), and MythCDROMLinux::unlock().
Tells us if m_devicePath is a mounted device.
Definition at line 360 of file mythmedia.cpp.
Referenced by MediaMonitor::AttemptEject(), MythCDROMLinux::checkMedia(), MythHDD::checkMedia(), performMountCmd(), setStatus(), MythCDROMFreeBSD::testMedia(), and MythCDROMLinux::testMedia().
|
virtual |
Reimplemented in MythCDROMLinux.
Definition at line 323 of file mythmedia.cpp.
|
inline |
Definition at line 93 of file mythmedia.h.
|
inline |
Is this device "ready", for a plugin to access?
Definition at line 84 of file mythmedia.h.
Referenced by MythCDROMLinux::checkMedia(), MediaMonitor::eventFilter(), and handleDVDMedia().
|
virtual |
Reimplemented in MythCDROMFreeBSD, and MythCDROMLinux.
Definition at line 339 of file mythmedia.cpp.
Referenced by musicbrainzngs.musicbrainz._rate_limit::__call__(), MythCDROMFreeBSD::lock(), and MythCDROMLinux::lock().
| QString MythMediaDevice::MediaTypeString | ( | ) |
Definition at line 518 of file mythmedia.cpp.
Referenced by MythCDROMLinux::checkMedia(), DetectMediaType(), MediaMonitor::JumpToMediaHandler(), MediaMonitor::mediaStatusChanged(), MediaTypeString(), performMountCmd(), and MediaMonitor::RegisterMediaHandler().
|
static |
Definition at line 523 of file mythmedia.cpp.
|
inline |
Definition at line 107 of file mythmedia.h.
Referenced by MythCDROMLinux::checkMedia(), MythHDD::checkMedia(), and MonitorThreadDarwin::diskInsert().
|
inlineprotectedvirtual |
Override this to perform any post mount logic.
Reimplemented in MythCDROM.
Definition at line 133 of file mythmedia.h.
Referenced by MythHDD::checkMedia(), MythCDROM::onDeviceMounted(), and performMountCmd().
|
inlineprotectedvirtual |
Override this to perform any post unmount logic.
Definition at line 141 of file mythmedia.h.
Referenced by performMountCmd().
|
virtual |
Definition at line 84 of file mythmedia.cpp.
Referenced by MythCDROMLinux::checkMedia(), MythCDROMFreeBSD::eject(), MythCDROMLinux::eject(), lock(), MythCDROMFreeBSD::testMedia(), MythCDROMLinux::testMedia(), MythCDROMFreeBSD::unlock(), and MythCDROMLinux::unlock().
Definition at line 113 of file mythmedia.cpp.
|
static |
Used to register media types with extensions.
| mediatype | MythMediaType flag. |
| extensions | Comma separated list of extensions like 'mp3,ogg,flac'. |
Definition at line 303 of file mythmedia.cpp.
Referenced by MediaMonitor::RegisterMediaHandler().
Recursively scan directories and create an associative array with the number of times we've seen each extension.
Definition at line 269 of file mythmedia.cpp.
Referenced by DetectMediaType(), and ScanMediaType().
|
inline |
Definition at line 68 of file mythmedia.h.
Referenced by MediaMonitorWindows::AddDevice(), MonitorThreadDarwin::diskInsert(), and LookupModel().
|
inlinevirtual |
Reimplemented in MythCDROMDarwin, MythCDROMLinux, and MythCDROM.
Definition at line 100 of file mythmedia.h.
Referenced by setSpeed().
|
inline |
Definition at line 59 of file mythmedia.h.
Referenced by MediaMonitorUnix::AddDevice(), MonitorThreadDarwin::diskInsert(), and MonitorThreadDarwin::diskRename().
|
virtual |
Definition at line 334 of file mythmedia.cpp.
Referenced by MediaMonitor::SetCDSpeed().
|
protected |
Definition at line 465 of file mythmedia.cpp.
Referenced by MediaMonitorDarwin::AddDevice(), MythCDROMLinux::checkMedia(), MythCDROM::checkMedia(), MythHDD::checkMedia(), MonitorThreadDarwin::diskInsert(), MonitorThreadDarwin::diskRemove(), MonitorThreadDarwin::diskRename(), and MythHDD::eject().
|
inline |
Definition at line 73 of file mythmedia.h.
Referenced by MonitorThreadDarwin::diskInsert(), MonitorThreadDarwin::diskRename(), and MediaMonitorWindows::MediaMonitorWindows().
|
signal |
|
inlinevirtual |
Reimplemented in MythCDROMFreeBSD, and MythCDROMLinux.
Definition at line 95 of file mythmedia.h.
Referenced by MediaMonitorUnix::AddDevice().
|
virtual |
Reimplemented in MythCDROMFreeBSD, and MythCDROMLinux.
Definition at line 352 of file mythmedia.cpp.
Referenced by MediaMonitor::AttemptEject(), MythCDROM::onDeviceMounted(), MythCDROMFreeBSD::unlock(), and MythCDROMLinux::unlock().
|
inline |
Definition at line 108 of file mythmedia.h.
Referenced by MediaMonitor::AttemptEject(), MythCDROM::onDeviceMounted(), and setStatus().
|
friend |
Definition at line 51 of file mythmedia.h.
|
friend |
Definition at line 52 of file mythmedia.h.
|
static |
Definition at line 118 of file mythmedia.h.
|
static |
Definition at line 117 of file mythmedia.h.
Referenced by MythCDROMLinux::checkMedia(), MediaMonitor::mediaStatusChanged(), and setStatus().
|
protected |
Allow the user to eject the media?. Read only.
Definition at line 165 of file mythmedia.h.
Referenced by MythCDROMLinux::checkMedia(), and MythCDROM::onDeviceMounted().
|
protected |
A file handle for opening and closing the device, ioctls(), et c.
This should be private, but a subclass of a subclass needs it (MythCDRomLinux)
Definition at line 175 of file mythmedia.h.
Referenced by MythCDROMLinux::checkMedia(), MythCDROMLinux::checkOK(), closeDevice(), MythCDROMLinux::driveStatus(), MythCDROMFreeBSD::eject(), MythCDROMLinux::ejectCDROM(), MythCDROMLinux::hasWritableMedia(), isDeviceOpen(), MythCDROMFreeBSD::lock(), MythCDROMLinux::lock(), MythCDROMLinux::mediaChanged(), openDevice(), MythCDROMLinux::SCSIstatus(), MythCDROMFreeBSD::unlock(), and MythCDROMLinux::unlock().
|
protected |
The device Manufacturer/Model. Read/write.
Definition at line 148 of file mythmedia.h.
|
protected |
The path to this media's device.
(e.g. /dev/cdrom) Read only
Definition at line 149 of file mythmedia.h.
Referenced by MythCDROMLinux::checkMedia(), MythHDD::checkMedia(), MythCDROMLinux::driveStatus(), eject(), MythCDROMLinux::ejectSCSI(), findMountPath(), MythCDROMLinux::hasWritableMedia(), isSameDevice(), MythCDROMLinux::isSameDevice(), MythHDD::MythHDD(), MythMediaDevice(), openDevice(), performMountCmd(), MythCDROMLinux::SCSIstatus(), setSpeed(), and MythCDROMLinux::testMedia().
|
protected |
KeyID of the media.
Read only (For ISO9660, volumeid + creation_date)
Definition at line 151 of file mythmedia.h.
Referenced by MythCDROMLinux::checkMedia(), and clearData().
Is this media locked?. Read only.
Definition at line 166 of file mythmedia.h.
|
protected |
The type of media. Read only.
Definition at line 162 of file mythmedia.h.
Referenced by MythCDROMLinux::checkMedia(), clearData(), MediaTypeString(), MythHDD::MythHDD(), and MythCDROM::onDeviceMounted().
|
protected |
The path to this media's mount point.
(e.g. /mnt/cdrom) Read/write
Definition at line 153 of file mythmedia.h.
Referenced by MythHDD::checkMedia(), DetectMediaType(), findMountPath(), and MythCDROM::onDeviceMounted().
|
protected |
If m_devicePath is a symlink, its target.
(e.g. /dev/hdc) Read only
Definition at line 155 of file mythmedia.h.
Referenced by findMountPath(), and MythMediaDevice().
|
protected |
The status of the media as of the last call to checkMedia.
Read only
Definition at line 159 of file mythmedia.h.
Referenced by MythCDROMLinux::checkMedia(), MythHDD::checkMedia(), isMounted(), MythHDD::MythHDD(), MythCDROM::onDeviceMounted(), and setStatus().
|
protected |
Is this a supermount device?.
Read only The OS handles mounting/unmounting of 'supermount' devices. Myth only need to give derived classes a chance to perform their mount/unmount logic.
Definition at line 168 of file mythmedia.h.
Referenced by performMountCmd().
|
protected |
The volume ID of the media. Read/write.
Definition at line 157 of file mythmedia.h.
Referenced by MythCDROMLinux::checkMedia(), MythHDD::checkMedia(), and clearData().
|
staticprivate |
Map of extension to media type.
Definition at line 180 of file mythmedia.h.
Referenced by DetectMediaType(), and RegisterMediaExtensions().