本文整理汇总了C++中MythMediaDevice::testMedia方法的典型用法代码示例。如果您正苦于以下问题:C++ MythMediaDevice::testMedia方法的具体用法?C++ MythMediaDevice::testMedia怎么用?C++ MythMediaDevice::testMedia使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MythMediaDevice
的用法示例。
在下文中一共展示了MythMediaDevice::testMedia方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddDevice
// Given a fstab entry to a media device determine what type of device it is
bool MediaMonitorUnix::AddDevice(struct fstab * mep)
{
if (!mep)
return false;
#ifndef Q_OS_ANDROID
QString devicePath( mep->fs_spec );
#if 0
LOG(VB_GENERAL, LOG_DEBUG, "AddDevice - " + devicePath);
#endif
MythMediaDevice* pDevice = NULL;
struct stat sbuf;
bool is_supermount = false;
bool is_cdrom = false;
if (stat(mep->fs_spec, &sbuf) < 0)
return false;
// Can it be mounted?
if ( ! ( ((strstr(mep->fs_mntops, "owner") &&
(sbuf.st_mode & S_IRUSR)) || strstr(mep->fs_mntops, "user")) &&
(strstr(mep->fs_vfstype, MNTTYPE_ISO9660) ||
strstr(mep->fs_vfstype, MNTTYPE_UDF) ||
strstr(mep->fs_vfstype, MNTTYPE_AUTO)) ) )
{
if (strstr(mep->fs_mntops, MNTTYPE_ISO9660) &&
strstr(mep->fs_vfstype, MNTTYPE_SUPERMOUNT))
{
is_supermount = true;
}
else
{
return false;
}
}
if (strstr(mep->fs_mntops, MNTTYPE_ISO9660) ||
strstr(mep->fs_vfstype, MNTTYPE_ISO9660) ||
strstr(mep->fs_vfstype, MNTTYPE_UDF) ||
strstr(mep->fs_vfstype, MNTTYPE_AUTO))
{
is_cdrom = true;
#if 0
LOG(VB_GENERAL, LOG_DEBUG, "Device is a CDROM");
#endif
}
if (!is_supermount)
{
if (is_cdrom)
pDevice = MythCDROM::get(this, mep->fs_spec,
is_supermount, m_AllowEject);
}
else
{
char *dev = 0;
int len = 0;
dev = strstr(mep->fs_mntops, SUPER_OPT_DEV);
if (dev == NULL)
return false;
dev += sizeof(SUPER_OPT_DEV)-1;
while (dev[len] != ',' && dev[len] != ' ' && dev[len] != 0)
len++;
if (dev[len] != 0)
{
char devstr[256];
strncpy(devstr, dev, len);
devstr[len] = 0;
if (is_cdrom)
pDevice = MythCDROM::get(this, devstr,
is_supermount, m_AllowEject);
}
else
return false;
}
if (pDevice)
{
pDevice->setMountPath(mep->fs_file);
if (pDevice->testMedia() == MEDIAERR_OK)
{
if (AddDevice(pDevice))
return true;
}
pDevice->deleteLater();
}
#endif
return false;
}