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); }
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); }