Go to the documentation of this file. 1 #ifndef MYTH_MEDIA_MONITOR_H
2 #define MYTH_MEDIA_MONITOR_H
6 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
9 #include <QRecursiveMutex>
11 #include <QWaitCondition>
41 void run(
void)
override;
56 virtual void deleteLater(
void);
59 virtual void StartMonitoring(
void);
60 void StopMonitoring(
void);
61 void ChooseAndEjectMedia(
void);
62 void EjectMedia(
const QString &path);
65 static QString GetMountPath(
const QString& devPath);
66 static void SetCDSpeed(
const char *device,
int speed);
74 QList<MythMediaDevice*> GetRemovable(
bool showMounted =
false,
75 bool showUsable =
false);
76 QList<MythMediaDevice*> GetMedias(
unsigned mediatypes);
79 void RegisterMediaHandler(
const QString &destination,
80 const QString &description,
83 const QString &extensions);
87 static QString defaultCDdevice();
88 static QString defaultVCDdevice();
89 static QString defaultDVDdevice();
90 static QString defaultCDWriter();
91 static QString defaultDVDWriter();
93 static void ejectOpticalDisc(
void);
95 virtual QStringList GetCDROMBlockDevices(
void) = 0;
101 MediaMonitor(QObject *par,
unsigned long interval,
bool allowEject);
105 void CheckDevices(
void);
108 bool RemoveDevice(
const QString &dev);
110 bool eventFilter(QObject *obj, QEvent *event)
override;
112 QString listDevices(
void);
114 static QString defaultDevice(
const QString &setting,
115 const QString &label,
116 const char *hardCodedDefault);
118 bool showMounted =
false,
119 bool showUsable =
false);
122 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
123 QMutex m_devicesLock {QMutex::Recursive};
134 bool volatile m_active {
false};
147 const QString& description,
150 const QString& extensions)
153 callback, mediaType, extensions);
157 #endif // MYTH_MEDIA_MONITOR_H
MonitorThread(MediaMonitor *pMon, unsigned long interval)
void(* callback)(MythMediaDevice *mediadevice)
void run(void) override
Runs the Qt event loop unless we have a QRunnable, in which case we run the runnable run instead.
bool wait(std::chrono::milliseconds time=std::chrono::milliseconds::max())
Wait for the MThread to exit, with a maximum timeout.
~MonitorThread() override
QDateTime m_lastCheckTime
QPointer< MediaMonitor > m_monitor
void setMonitor(MediaMonitor *pMon)
Stores details of media handlers.
This is a wrapper around QThread that does several additional things.
MThreadInternal * m_thread