本文整理汇总了C++中MythMediaDevice::setStatus方法的典型用法代码示例。如果您正苦于以下问题:C++ MythMediaDevice::setStatus方法的具体用法?C++ MythMediaDevice::setStatus怎么用?C++ MythMediaDevice::setStatus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MythMediaDevice
的用法示例。
在下文中一共展示了MythMediaDevice::setStatus方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: diskRename
/**
* \brief Deal with the user, or another program, renaming a volume
*
* iTunes has a habit of renaming the disk volumes and track files
* after it looks up a disk on the GraceNote CDDB.
*/
void MonitorThreadDarwin::diskRename(const char *devName, const char *volName)
{
LOG(VB_MEDIA, LOG_DEBUG,
QString("MonitorThreadDarwin::diskRename(%1,%2)")
.arg(devName).arg(volName));
MythMediaDevice *pDevice = m_Monitor->GetMedia(devName);
if (m_Monitor->ValidateAndLock(pDevice))
{
// Send message to plugins to ignore this drive:
if (m_Monitor->m_SendEvent)
pDevice->setStatus(MEDIASTAT_NODISK);
pDevice->setVolumeID(volName);
pDevice->setMountPath((QString("/Volumes/") + volName).toLatin1());
// Plugins can now use it again:
if (m_Monitor->m_SendEvent)
pDevice->setStatus(MEDIASTAT_USEABLE);
m_Monitor->Unlock(pDevice);
}
else
LOG(VB_MEDIA, LOG_INFO,
QString("Couldn't find MythMediaDevice: %1").arg(devName));
}
示例2: diskInsert
/**
* \brief Create a MythMedia instance and insert in MythMediaMonitor list
*
* We are a friend class of MythMediaMonitor,
* so that we can add or remove from its list of media objects.
*/
void MonitorThreadDarwin::diskInsert(const char *devName,
const char *volName,
QString model, bool isCDorDVD)
{
MythMediaDevice *media;
QString msg = "MonitorThreadDarwin::diskInsert";
LOG(VB_MEDIA, LOG_DEBUG, msg + QString("(%1,%2,'%3',%4)")
.arg(devName).arg(volName).arg(model).arg(isCDorDVD));
if (isCDorDVD)
media = MythCDROM::get(NULL, devName, true, m_Monitor->m_AllowEject);
else
media = MythHDD::Get(NULL, devName, true, false);
if (!media)
{
LOG(VB_GENERAL, LOG_ALERT, msg + "Couldn't create MythMediaDevice.");
return;
}
// We store the volume name for user activities like ChooseAndEjectMedia().
media->setVolumeID(volName);
media->setDeviceModel(model.toLatin1()); // Same for the Manufacturer and model
// Mac OS X devices are pre-mounted here:
QString mnt = "/Volumes/"; mnt += volName;
media->setMountPath(mnt.toLatin1());
int attempts = 0;
QDir d(mnt);
while (!d.exists())
{
LOG(VB_MEDIA, LOG_WARNING,
(msg + "() - Waiting for mount '%1' to become stable.").arg(mnt));
usleep(120000);
if ( ++attempts > 4 )
usleep(200000);
if ( attempts > 8 )
{
delete media;
LOG(VB_MEDIA, LOG_ALERT, msg + "() - Giving up");
return;
}
}
media->setStatus(MEDIASTAT_MOUNTED);
// This is checked in AddDevice(), but checking earlier means
// we can avoid scanning all the files to determine its type
if (m_Monitor->shouldIgnore(media))
return;
// We want to use MythMedia's code to work out the mediaType.
// media->onDeviceMounted() is protected,
// so to call it indirectly, we pretend to mount it here.
media->mount();
m_Monitor->AddDevice(media);
}
示例3: diskRemove
void MonitorThreadDarwin::diskRemove(QString devName)
{
LOG(VB_MEDIA, LOG_DEBUG,
QString("MonitorThreadDarwin::diskRemove(%1)").arg(devName));
if (m_Monitor->m_SendEvent)
{
MythMediaDevice *pDevice = m_Monitor->GetMedia(devName);
if (pDevice) // Probably should ValidateAndLock() here?
pDevice->setStatus(MEDIASTAT_NODISK);
else
LOG(VB_MEDIA, LOG_INFO,
"Couldn't find MythMediaDevice: " + devName);
}
m_Monitor->RemoveDevice(devName);
}