本文整理汇总了C++中MetadataLookup::SetVideoContentType方法的典型用法代码示例。如果您正苦于以下问题:C++ MetadataLookup::SetVideoContentType方法的具体用法?C++ MetadataLookup::SetVideoContentType怎么用?C++ MetadataLookup::SetVideoContentType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MetadataLookup
的用法示例。
在下文中一共展示了MetadataLookup::SetVideoContentType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doGetRecording
void ImportFile::doGetRecording(void)
{
MythUIButtonListItem *item = m_recordingButtonList->GetItemCurrent();
if (!item)
return;
ImportItem *i = item->GetData().value<ImportItem *>();
if (!i)
return;
uint duration = 60; //i->actualDuration;
QString videoFile = getTempDirectory() + "work/video.ts";
QString mxmlFile = getTempDirectory() + "work/video.mxml";
// record the mp4 video stream
QString recCommand = QString("mythffmpeg -y -i %1 -t %2 -acodec copy -vcodec copy %3")
.arg(STREAMURL).arg(duration).arg(videoFile);
QScopedPointer<MythSystem> cmd(MythSystem::Create(recCommand, kMSRunShell));
cmd->Wait(0);
if (cmd.data()->GetExitCode() != GENERIC_EXIT_OK)
{
LOG(VB_GENERAL, LOG_ERR, QString("ERROR - ffmpeg exited with result: %1").arg(cmd.data()->GetExitCode()));
return;
}
// create a mxml file with the metadata for this recording
QStringList categories(i->category.split(','));
MetadataLookup *lookup = new MetadataLookup(kMetadataVideo, kProbableTelevision, QVariant(), kLookupSearch, false, false, false, false, false,
"", videoFile, i->title, categories, 0.0, i->subtitle, "", i->description, i->season, i->episode,
i->startTime, 0, i->chanNo, i->chanSign, i->chanName,
i->certification, i->startTime.date().year(), i->startTime.date(), i->duration / 60, i->duration,
"", PeopleMap(), "", ArtworkMap(), DownloadMap());
if (i->category == "Movies")
lookup->SetVideoContentType(kContentMovie);
else
lookup->SetVideoContentType(kContentTelevision);
QDomDocument mxmlDoc = CreateMetadataXML(lookup);
// save the mxml to the file
QFile f(mxmlFile);
if (!f.open(QIODevice::WriteOnly))
{
LOG(VB_GENERAL, LOG_ERR, QString("ImportFile: Failed to open mxml file for writing - %1").arg(mxmlFile));
return;
}
QTextStream t(&f);
t << mxmlDoc.toString(4);
f.close();
// workout where to save the file in the Video storage group
QString dstFile = filenameFromMetadataLookup(lookup);
QString saveFilename;
// copy the recording to the Video storage group
saveFilename = gCoreContext->GenMythURL(gCoreContext->GetMasterHostName(), 0, dstFile + ".mp4", "Videos");
bool result = RemoteFile::CopyFile(videoFile, saveFilename);
if (!result)
{
LOG(VB_GENERAL, LOG_ERR, QString("ImportFile: Failed to copy video file to %1").arg(saveFilename));
return;
}
// copy the metadata xml file to the Video storage group
saveFilename = gCoreContext->GenMythURL(gCoreContext->GetMasterHostName(), 0, dstFile + ".mxml", "Videos");
result = RemoteFile::CopyFile(mxmlFile, saveFilename);
if (!result)
{
LOG(VB_GENERAL, LOG_ERR, QString("ImportFile: Failed to copy xml file to %1").arg(saveFilename));
return;
}
}