本文整理汇总了C++中MythMediaDevice::setVolumeID方法的典型用法代码示例。如果您正苦于以下问题:C++ MythMediaDevice::setVolumeID方法的具体用法?C++ MythMediaDevice::setVolumeID怎么用?C++ MythMediaDevice::setVolumeID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MythMediaDevice
的用法示例。
在下文中一共展示了MythMediaDevice::setVolumeID方法的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: MediaMonitor
/**
* \class MediaMonitorWindows
*
* I am assuming, for now, that everything on Windows uses drive letters
* (e.g. C:, D:). That is probably wrong, though. (other APIs?)
*/
MediaMonitorWindows::MediaMonitorWindows(QObject* par,
unsigned long interval,
bool allowEject)
: MediaMonitor(par, interval, allowEject)
{
char strDrives[128];
if (!::GetLogicalDriveStrings(sizeof(strDrives), strDrives))
return;
for (char *driveName = strDrives; *driveName;
driveName += strlen(driveName) + 1)
{
uint type = ::GetDriveType(driveName);
if (type != DRIVE_REMOVABLE && type != DRIVE_CDROM)
continue;
MythMediaDevice *media = NULL;
if (type == DRIVE_CDROM)
media = MythCDROM::get(this, driveName, false, allowEject);
else
media = MythHDD::Get(this, driveName, false, allowEject);
if (!media)
{
VERBOSE(VB_IMPORTANT,
"Error. Couldn't create MythMediaDevice.");
return;
}
// We store the volume name to improve
// user activities like ChooseAndEjectMedia().
char volumeName[MAX_PATH];
if (GetVolumeInformation(driveName, volumeName, MAX_PATH,
NULL, NULL, NULL, NULL, NULL))
{
media->setVolumeID(volumeName);
}
AddDevice(media);
}
VERBOSE(VB_MEDIA, "Initial device list: " + listDevices());
}