本文整理汇总了C++中mlt::Producer::get_parent方法的典型用法代码示例。如果您正苦于以下问题:C++ Producer::get_parent方法的具体用法?C++ Producer::get_parent怎么用?C++ Producer::get_parent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mlt::Producer
的用法示例。
在下文中一共展示了Producer::get_parent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: data
QVariant PlaylistModel::data(const QModelIndex &index, int role) const
{
switch (role) {
case Qt::DisplayRole:
case Qt::ToolTipRole: {
const Mlt::ClipInfo* info = m_playlist->clip_info(index.row());
switch (index.column()) {
case COLUMN_INDEX:
return QString::number(index.row() + 1);
case COLUMN_RESOURCE: {
QString result = QString::fromUtf8(info->resource);
if (result == "<producer>" && info->producer
&& info->producer->is_valid() && info->producer->get("mlt_service"))
result = QString::fromUtf8(info->producer->get("mlt_service"));
// Use basename for display
if (role == Qt::DisplayRole && result.startsWith('/'))
result = QFileInfo(result).fileName();
return result;
}
case COLUMN_IN:
if (info->producer && info->producer->is_valid()) {
info->producer->set("_shotcut_time", info->frame_in);
return info->producer->get_time("_shotcut_time");
} else
return "";
case COLUMN_DURATION:
if (info->producer && info->producer->is_valid()) {
info->producer->set("_shotcut_time", info->frame_count);
return info->producer->get_time("_shotcut_time");
} else
return "";
case COLUMN_START:
if (info->producer && info->producer->is_valid()) {
info->producer->set("_shotcut_time", info->start);
return info->producer->get_time("_shotcut_time");
}
else
return "";
default:
break;
}
delete info;
break;
}
case Qt::DecorationRole:
if (index.column() == COLUMN_THUMBNAIL) {
Mlt::Producer* producer = m_playlist->get_clip(index.row());
Mlt::Producer parent(producer->get_parent());
int width = THUMBNAIL_HEIGHT * MLT.profile().dar();
QString setting = m_settings.value("playlist/thumbnails").toString();
QImage image;
if (setting == "wide")
image = QImage(width * 2, THUMBNAIL_HEIGHT, QImage::Format_ARGB32_Premultiplied);
else if (setting == "tall")
image = QImage(width, THUMBNAIL_HEIGHT * 2, QImage::Format_ARGB32_Premultiplied);
else if (setting == "large")
image = QImage(width * 2, THUMBNAIL_HEIGHT * 2, QImage::Format_ARGB32_Premultiplied);
else
image = QImage(width, THUMBNAIL_HEIGHT, QImage::Format_ARGB32_Premultiplied);
if (parent.is_valid() && parent.get_data(kThumbnailInProperty)) {
QPainter painter(&image);
image.fill(QColor(Qt::black).rgb());
// draw the in thumbnail
QImage* thumb = (QImage*) parent.get_data(kThumbnailInProperty);
QRect rect = thumb->rect();
if (setting != "large") {
rect.setWidth(width);
rect.setHeight(THUMBNAIL_HEIGHT);
}
painter.drawImage(rect, *thumb);
if ((setting == "wide" || setting == "tall") && parent.get_data(kThumbnailOutProperty)) {
// draw the out thumbnail
thumb = (QImage*) parent.get_data(kThumbnailOutProperty);
if (setting == "wide") {
rect.setWidth(width * 2);
rect.setLeft(width);
}
else if (setting == "tall") {
rect.setHeight(THUMBNAIL_HEIGHT * 2);
rect.setTop(THUMBNAIL_HEIGHT);
}
painter.drawImage(rect, *thumb);
}
painter.end();
}
else {
image.fill(QColor(Qt::gray).rgb());
}
delete producer;
return image;
}
break;
default:
break;
}
return QVariant();
//.........这里部分代码省略.........