本文整理汇总了C++中mlt::Producer类的典型用法代码示例。如果您正苦于以下问题:C++ Producer类的具体用法?C++ Producer怎么用?C++ Producer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Producer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: duplicateFilters
void BinController::duplicateFilters(Mlt::Producer original, Mlt::Producer clone)
{
Mlt::Service clipService(original.get_service());
Mlt::Service dupService(clone.get_service());
//delete original;
//delete clone;
int ct = 0;
Mlt::Filter *filter = clipService.filter(ct);
while (filter) {
// Only duplicate Kdenlive filters, and skip the fade in effects
//fprintf(stderr, "CHKNG FILTER: %s\n", filter->get("kdenlive_id"));
if (filter->is_valid()/* && strcmp(filter->get("kdenlive_id"), "") && strcmp(filter->get("kdenlive_id"), "fadein") && strcmp(filter->get("kdenlive_id"), "fade_from_black")*/) {
// looks like there is no easy way to duplicate a filter,
// so we will create a new one and duplicate its properties
Mlt::Filter *dup = new Mlt::Filter(*original.profile(), filter->get("mlt_service"));
if (dup && dup->is_valid()) {
Mlt::Properties entries(filter->get_properties());
for (int i = 0; i < entries.count(); ++i) {
dup->set(entries.get_name(i), entries.get(i));
}
dupService.attach(*dup);
}
}
ct++;
filter = clipService.filter(ct);
}
}
示例2: newProducer
Mlt::Producer* JackProducerWidget::newProducer(Mlt::Profile& profile)
{
Mlt::Producer* p = new Mlt::Producer(profile, "jack:Shotcut");
p->set(kBackgroundCaptureProperty, 1);
p->set(kShotcutCaptionProperty, "JACK");
return p;
}
示例3: create
bool MltPreview::create(const QString &path, int width, int height, QImage &img)
{
Mlt::Profile *profile = new Mlt::Profile("dv_pal");
Mlt::Producer *producer = new Mlt::Producer(*profile, path.toUtf8().data());
if (producer->is_blank()) {
delete producer;
return false;
}
int frame = 75;
uint variance = 10;
int ct = 1;
//img = getFrame(producer, frame, width, height);
while (variance <= 40 && ct < 4) {
img = getFrame(producer, frame, width, height);
variance = imageVariance(img);
frame += 100 * ct;
ct++;
}
delete producer;
delete profile;
return (img.isNull() == false);
}
示例4: producer
Mlt::Producer* IsingWidget::producer(Mlt::Profile& profile)
{
Mlt::Producer* p = new Mlt::Producer(profile, "frei0r.ising0r");
p->set(kParamTemperature, ui->tempSpinner->text().toLatin1().constData());
p->set(kParamBorderGrowth, ui->borderGrowthSpinner->text().toLatin1().constData());
p->set(kParamSpontaneous, ui->spontGrowthSpinner->text().toLatin1().constData());
return p;
}
示例5: producer
Mlt::Producer* DecklinkProducerWidget::producer(Mlt::Profile& profile)
{
Mlt::Producer* p = new Mlt::Producer(profile,
QString("consumer:decklink:%1").arg(ui->deviceCombo->currentIndex()).toAscii().constData());
if (p->is_valid())
p->set("profile", ui->profileCombo->itemData(ui->profileCombo->currentIndex()).toString().toAscii().constData());
return p;
}
示例6: selectTrackHead
void TimelineDock::selectTrackHead(int trackIndex)
{
if (trackIndex >= 0) {
int i = m_model.trackList().at(trackIndex).mlt_index;
Mlt::Producer* producer = m_model.tractor()->track(i);
if (producer && producer->is_valid())
emit trackSelected(producer);
delete producer;
}
}
示例7: on_durationSpinBox_editingFinished
void ImageProducerWidget::on_durationSpinBox_editingFinished()
{
if (!m_producer)
return;
if (ui->durationSpinBox->value() == m_producer->get_out() + 1)
return;
Mlt::Producer* p = producer(MLT.profile());
p->pass_list(*m_producer, "force_aspect_ratio, shotcut_aspect_num, shotcut_aspect_den,"
"shotcut_resource, resource, ttl, shotcut_sequence");
reopen(p);
}
示例8: openClip
void TimelineDock::openClip(int trackIndex, int clipIndex)
{
Q_ASSERT(trackIndex >= 0 && clipIndex >= 0);
QScopedPointer<Mlt::ClipInfo> info(getClipInfo(trackIndex, clipIndex));
if (info) {
QString xml = MLT.XML(info->producer);
Mlt::Producer* p = new Mlt::Producer(MLT.profile(), "xml-string", xml.toUtf8().constData());
p->set_in_and_out(info->frame_in, info->frame_out);
emit clipOpened(p);
}
}
示例9: undo
void ClearCommand::undo()
{
m_model.close();
Mlt::Producer* producer = new Mlt::Producer(MLT.profile(), "xml-string", m_xml.toUtf8().constData());
if (producer->is_valid()) {
producer->set("resource", "<playlist>");
MAIN.open(producer);
MLT.pause();
MAIN.seekPlaylist(0);
}
}
示例10: producer
Mlt::Producer* PlasmaWidget::producer(Mlt::Profile& profile)
{
Mlt::Producer* p = new Mlt::Producer(profile, "frei0r.plasma");
p->set(kParamSpeed1, ui->speed1Spinner->text().toAscii().constData());
p->set(kParamSpeed2, ui->speed2Spinner->text().toAscii().constData());
p->set(kParamSpeed3, ui->speed3Spinner->text().toAscii().constData());
p->set(kParamSpeed4, ui->speed4Spinner->text().toAscii().constData());
p->set(kParamMove1, ui->move1Spinner->text().toAscii().constData());
p->set(kParamMove2, ui->move2Spinner->text().toAscii().constData());
return p;
}
示例11:
QMimeData *PlaylistModel::mimeData(const QModelIndexList &indexes) const
{
QMimeData *mimeData = new QMimeData;
Mlt::ClipInfo* info = m_playlist->clip_info(indexes.first().row());
if (info) {
Mlt::Producer* producer = info->producer;
producer->set_in_and_out(info->frame_in, info->frame_out);
mimeData->setData(Mlt::XmlMimeType, MLT.saveXML("string", producer).toUtf8());
producer->set_in_and_out(0, -1);
delete info;
}
return mimeData;
}
示例12: cacheKey
QString ThumbnailProvider::cacheKey(Mlt::Producer& producer, int frameNumber)
{
QString time = producer.frames_to_time(frameNumber, mlt_time_clock);
// Reduce the precision to centiseconds to increase chance for cache hit
// without much loss of accuracy.
time = time.left(time.size() - 1);
QString key = QString("%1 %2")
.arg(producer.get("resource"))
.arg(time);
QCryptographicHash hash(QCryptographicHash::Sha1);
hash.addData(key.toUtf8());
return hash.result().toHex();
}
示例13: on_sequenceCheckBox_clicked
void ImageProducerWidget::on_sequenceCheckBox_clicked(bool checked)
{
QString resource = m_producer->get("resource");
ui->repeatSpinBox->setEnabled(checked);
if (checked && !m_producer->get(kShotcutResourceProperty))
m_producer->set(kShotcutResourceProperty, resource.toUtf8().constData());
m_producer->set(kShotcutSequenceProperty, checked);
m_producer->set("ttl", ui->repeatSpinBox->value());
if (checked) {
QFileInfo info(resource);
QString name(info.fileName());
QString begin = "";
int i = name.length();
int count = 0;
// find the last numeric digit
for (; i && !name[i - 1].isDigit(); i--) {};
// count the digits and build the begin value
for (; i && name[i - 1].isDigit(); i--, count++)
begin.prepend(name[i - 1]);
if (count) {
m_producer->set("begin", begin.toLatin1().constData());
int j = begin.toInt();
name.replace(i, count, begin.prepend('%').append('d'));
resource = info.path() + "/" + name;
m_producer->set("resource", resource.toUtf8().constData());
// Count the number of consecutive files.
MAIN.showStatusMessage(tr("Getting length of image sequence..."));
name = info.fileName();
name.replace(i, count, "%1");
resource = info.path().append('/').append(name);
for (i = j; QFile::exists(resource.arg(i, count, 10, QChar('0'))); ++i);
i -= j;
m_producer->set("length", i);
ui->durationSpinBox->setValue(i);
MAIN.showStatusMessage(tr("Reloading image sequence..."));
}
}
else {
m_producer->set("resource", m_producer->get(kShotcutResourceProperty));
m_producer->set("length", qRound(MLT.profile().fps() * 600));
ui->durationSpinBox->setValue(qRound(MLT.profile().fps() * Settings.imageDuration()));
}
Mlt::Producer* p = producer(MLT.profile());
p->pass_list(*m_producer, "force_aspect_ratio,"
kAspectRatioNumerator "," kAspectRatioDenominator ","
kShotcutResourceProperty ", resource, ttl, length," kShotcutSequenceProperty);
reopen(p);
}
示例14: newProducer
Mlt::Producer* AlsaWidget::newProducer(Mlt::Profile& profile)
{
QString s("alsa:%1");
if (ui->lineEdit->text().isEmpty())
s = s.arg("default");
else
s = s.arg(ui->lineEdit->text());
if (ui->alsaChannelsSpinBox->value() > 0)
s += QString("?channels=%1").arg(ui->alsaChannelsSpinBox->value());
Mlt::Producer* p = new Mlt::Producer(profile, s.toUtf8().constData());
p->set(kBackgroundCaptureProperty, 1);
p->set(kShotcutCaptionProperty, "ALSA");
return p;
}
示例15: getBinProducer
Mlt::Producer *BinController::getBinVideoProducer(const QString &id)
{
QString videoId = id + "_video";
if (!m_extraClipList.contains(videoId)) {
// create clone
QString originalId = id.section(QStringLiteral("_"), 0, 0);
Mlt::Producer *original = getBinProducer(originalId);
Mlt::Producer *videoOnly = cloneProducer(*original);
videoOnly->set("audio_index", -1);
videoOnly->set("id", videoId.toUtf8().constData());
m_extraClipList.insert(videoId, videoOnly);
return videoOnly;
}
return m_extraClipList.value(videoId);
}