Ejemplo n.º 1
0
void ClipController::updateProducer(const QString &id, Mlt::Producer* producer)
{
    //TODO replace all track producers
    Q_UNUSED(id)

    Mlt::Properties passProperties;
    // Keep track of necessary properties
    QString proxy = producer->get("kdenlive:proxy");
    if (proxy.length() > 2) {
        // This is a proxy producer, read original url from kdenlive property
        m_usesProxy = true;
    }
    else m_usesProxy = false;
    passProperties.pass_list(*m_properties, getPassPropertiesList(m_usesProxy));
    delete m_properties;
    delete m_masterProducer;
    m_masterProducer = producer;
    m_properties = new Mlt::Properties(producer->get_properties());
    // Pass properties from previous producer
    m_properties->pass_list(passProperties, getPassPropertiesList(m_usesProxy));
    if (!m_masterProducer->is_valid()) qDebug()<<"// WARNING, USING INVALID PRODUCER";
    else {
        // URL and name shoule not be updated otherwise when proxying a clip we cannot find back the original url
        /*m_url = QUrl::fromLocalFile(m_masterProducer->get("resource"));
        if (m_url.isValid()) {
            m_name = m_url.fileName();
        }
        */
    }
}
Ejemplo n.º 2
0
void MainWindow::open(const QString& url, const Mlt::Properties* properties)
{
    if (url.endsWith(".mlt") || url.endsWith(".xml")) {
        // only check for a modified project when loading a project, not a simple producer
        if (!continueModified())
            return;
        // close existing project
        if (m_playlistDock->model()->playlist())
            m_playlistDock->model()->close();
        // let the new project change the profile
        MLT.profile().set_explicit(false);
    }
    else if (!m_playlistDock->model()->playlist()) {
        if (!continueModified())
            return;
        setCurrentFile("");
    }
    if (!MLT.open(url.toUtf8().constData())) {
        Mlt::Properties* props = const_cast<Mlt::Properties*>(properties);
        if (props && props->is_valid())
            mlt_properties_inherit(MLT.producer()->get_properties(), props->get_properties());
        open(MLT.producer());
        m_recentDock->add(url.toUtf8().constData());
    }
    else {
        ui->statusBar->showMessage(tr("Failed to open ") + url, STATUS_TIMEOUT_MS);
    }
}
Ejemplo n.º 3
0
Mlt::Properties* DecklinkProducerWidget::getPreset() const
{
    Mlt::Properties* p = new Mlt::Properties;
    p->set("card", ui->deviceCombo->currentIndex());
    p->set("profile", ui->profileCombo->currentIndex());
    return p;
}
Ejemplo n.º 4
0
Mlt::Properties* IsingWidget::getPreset() const
{
    Mlt::Properties* p = new Mlt::Properties;
    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;
}
Ejemplo n.º 5
0
void AlsaWidget::loadPreset(Mlt::Properties& p)
{
    QString s(p.get("resource"));
    int i = s.indexOf(':');
    if (i > -1)
        ui->lineEdit->setText(s.mid(i + 1));
    if (p.get("channels"))
        ui->alsaChannelsSpinBox->setValue(p.get_int("channels"));
}
Ejemplo n.º 6
0
void PlasmaWidget::loadPreset(Mlt::Properties& p)
{
    ui->speed1Spinner->setValue(p.get_double(kParamSpeed1));
    ui->speed2Spinner->setValue(p.get_double(kParamSpeed2));
    ui->speed3Spinner->setValue(p.get_double(kParamSpeed3));
    ui->speed4Spinner->setValue(p.get_double(kParamSpeed4));
    ui->move1Spinner->setValue(p.get_double(kParamMove1));
    ui->move2Spinner->setValue(p.get_double(kParamMove2));
}
Ejemplo n.º 7
0
QMap <QString, QString> ClipController::getPropertiesFromPrefix(const QString &prefix, bool withPrefix)
{
    Mlt::Properties subProperties;
    subProperties.pass_values(*m_properties, prefix.toUtf8().constData());
    QMap <QString,QString> subclipsData;
    for (int i = 0; i < subProperties.count(); i++) {
        subclipsData.insert(withPrefix ? QString(prefix + subProperties.get_name(i)) : subProperties.get_name(i), subProperties.get(i));
    }
    return subclipsData;
}
Ejemplo n.º 8
0
Mlt::Properties* PlasmaWidget::getPreset() const
{
    Mlt::Properties* p = new Mlt::Properties;
    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;
}
Ejemplo n.º 9
0
Mlt::Properties CountProducerWidget::getPreset() const
{
    Mlt::Properties p;
    p.set("direction", currentDirection().toLatin1().constData());
    p.set("style", currentStyle().toLatin1().constData());
    p.set("sound", currentSound().toLatin1().constData());
    p.set("background", currentBackground().toLatin1().constData());
    p.set("drop", ui->dropCheckBox->isChecked());
    setLength(&p, ui->durationSpinBox->value());
    return p;
}
Ejemplo n.º 10
0
Mlt::Properties AlsaWidget::getPreset() const
{
    Mlt::Properties p;
    QString s("alsa:%1");
    if (ui->lineEdit->text().isEmpty())
        s = s.arg("default");
    else
        s = s.arg(ui->lineEdit->text());
    p.set("resource", s.toUtf8().constData());
    p.set("channels", ui->alsaChannelsSpinBox->value());
    return p;
}
Ejemplo n.º 11
0
void BinController::saveDocumentProperties(const QMap <QString, QString> props, const QMap <double, QString> guidesData)
{
    // Clear previous properites
    Mlt::Properties playlistProps(m_binPlaylist->get_properties());
    Mlt::Properties docProperties;
    docProperties.pass_values(playlistProps, "kdenlive:docproperties.");
    for (int i = 0; i < docProperties.count(); i++) {
        QString propName = QStringLiteral("kdenlive:docproperties.") + docProperties.get_name(i);
        playlistProps.set(propName.toUtf8().constData(), (char *)NULL);
    }
    // Clear previous guides
    Mlt::Properties guideProperties;
    guideProperties.pass_values(playlistProps, "kdenlive:guide.");
    for (int i = 0; i < guideProperties.count(); i++) {
        QString propName = QStringLiteral("kdenlive:guide.") + guideProperties.get_name(i);
        playlistProps.set(propName.toUtf8().constData(), (char *)NULL);
    }

    QMapIterator<QString, QString> i(props);
    while (i.hasNext()) {
        i.next();
        playlistProps.set(("kdenlive:docproperties." + i.key()).toUtf8().constData(), i.value().toUtf8().constData());
    }

    // Append guides
    QMapIterator<double, QString> g(guidesData);
    QLocale locale;
    while (g.hasNext()) {
        g.next();
        QString propertyName = "kdenlive:guide." + locale.toString(g.key());
        playlistProps.set(propertyName.toUtf8().constData(), g.value().toUtf8().constData());
    }
}
Ejemplo n.º 12
0
void TransitionHandler::cloneProperties(Mlt::Properties &dest, Mlt::Properties &source)
{
    int count = source.count();
    int i = 0;
    for ( i = 0; i < count; i ++ )
    {
        char *value = source.get(i);
        if ( value != NULL )
        {
            char *name = source.get_name( i );
            if (name != NULL && name[0] != '_') dest.set(name, value);
        }
    }
}
Ejemplo n.º 13
0
QUuid Controller::ensureHasUuid(Mlt::Properties& properties) const
{
    if (properties.get(kUuidProperty)) {
        return uuid(properties);
    } else {
        QUuid newUid = QUuid::createUuid();
        setUuid(properties, newUid);
        return newUid;
    }
}
Ejemplo n.º 14
0
EncodeDock::EncodeDock(QWidget *parent) :
    QDockWidget(parent),
    ui(new Ui::EncodeDock),
    m_presets(Mlt::Repository::presets()),
    m_immediateJob(0),
    m_profiles(Mlt::Profile::list())
{
    LOG_DEBUG() << "begin";
    ui->setupUi(this);
    ui->stopCaptureButton->hide();
    ui->videoCodecThreadsSpinner->setMaximum(QThread::idealThreadCount());
    if (QThread::idealThreadCount() < 3)
        ui->parallelCheckbox->setHidden(true);
    toggleViewAction()->setIcon(windowIcon());

    connect(ui->videoBitrateCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(on_videoBufferDurationChanged()));
    connect(ui->videoBufferSizeSpinner, SIGNAL(valueChanged(double)), this, SLOT(on_videoBufferDurationChanged()));

    m_presetsModel.setSourceModel(new QStandardItemModel(this));
    m_presetsModel.setFilterCaseSensitivity(Qt::CaseInsensitive);
    ui->presetsTree->setModel(&m_presetsModel);
    loadPresets();

    // populate the combos
    Mlt::Consumer c(MLT.profile(), "avformat");
    c.set("f", "list");
    c.set("acodec", "list");
    c.set("vcodec", "list");
    c.start();
    c.stop();

    Mlt::Properties* p = new Mlt::Properties(c.get_data("f"));
    ui->formatCombo->blockSignals(true);
    for (int i = 0; i < p->count(); i++)
        ui->formatCombo->addItem(p->get(i));
    delete p;
    ui->formatCombo->model()->sort(0);
    ui->formatCombo->insertItem(0, tr("Automatic from extension"));
    ui->formatCombo->blockSignals(false);

    p = new Mlt::Properties(c.get_data("acodec"));
    for (int i = 0; i < p->count(); i++)
        ui->audioCodecCombo->addItem(p->get(i));
    delete p;
    ui->audioCodecCombo->model()->sort(0);
    ui->audioCodecCombo->insertItem(0, tr("Default for format"));

    p = new Mlt::Properties(c.get_data("vcodec"));
    for (int i = 0; i < p->count(); i++)
        ui->videoCodecCombo->addItem(p->get(i));
    delete p;
    ui->videoCodecCombo->model()->sort(0);
    ui->videoCodecCombo->insertItem(0, tr("Default for format"));

    on_resetButton_clicked();

    LOG_DEBUG() << "end";
}
Ejemplo n.º 15
0
Mlt::Properties Video4LinuxWidget::getPreset() const
{
    Mlt::Properties p;
    p.set("device", ui->v4lLineEdit->text().toLatin1().constData());
    p.set("width", ui->v4lWidthSpinBox->value());
    p.set("height", ui->v4lHeightSpinBox->value());
    p.set("framerate", ui->v4lFramerateSpinBox->value());
    p.set("standard", ui->v4lStandardCombo->currentText().toLatin1().constData());
    p.set("channel", ui->v4lChannelSpinBox->value());
    p.set("audio_ix", ui->v4lAudioComboBox->currentIndex());
    return p;
}
Ejemplo n.º 16
0
EncodeDock::EncodeDock(QWidget *parent) :
    QDockWidget(parent),
    ui(new Ui::EncodeDock),
    m_presets(Mlt::Repository::presets()),
    m_immediateJob(0),
    m_profiles(Mlt::Profile::list())
{
    qDebug() << "begin";
    ui->setupUi(this);
#ifdef Q_OS_UNIX
    ui->stopCaptureButton->hide();
#else
    delete ui->stopCaptureButton;
#endif
    ui->videoCodecThreadsSpinner->setMaximum(QThread::idealThreadCount());
    toggleViewAction()->setIcon(windowIcon());

    m_presetsModel.setSourceModel(new QStandardItemModel(this));
    m_presetsModel.setFilterCaseSensitivity(Qt::CaseInsensitive);
    ui->presetsTree->setModel(&m_presetsModel);
    loadPresets();

    // populate the combos
    Mlt::Consumer c(MLT.profile(), "avformat");
    c.set("f", "list");
    c.set("acodec", "list");
    c.set("vcodec", "list");
    c.start();
    c.stop();

    Mlt::Properties* p = new Mlt::Properties(c.get_data("f"));
    for (int i = 0; i < p->count(); i++)
        ui->formatCombo->addItem(p->get(i));
    delete p;
    ui->formatCombo->model()->sort(0);
    ui->formatCombo->insertItem(0, tr("Automatic from extension"));
    ui->formatCombo->setCurrentIndex(0);

    p = new Mlt::Properties(c.get_data("acodec"));
    for (int i = 0; i < p->count(); i++)
        ui->audioCodecCombo->addItem(p->get(i));
    delete p;
    ui->audioCodecCombo->model()->sort(0);
    ui->audioCodecCombo->insertItem(0, tr("Default for format"));
    ui->audioCodecCombo->setCurrentIndex(0);

    p = new Mlt::Properties(c.get_data("vcodec"));
    for (int i = 0; i < p->count(); i++)
        ui->videoCodecCombo->addItem(p->get(i));
    delete p;
    ui->videoCodecCombo->model()->sort(0);
    ui->videoCodecCombo->insertItem(0, tr("Default for format"));
    ui->videoCodecCombo->setCurrentIndex(0);
    on_audioRateControlCombo_activated(ui->audioRateControlCombo->currentIndex());
    on_videoRateControlCombo_activated(ui->videoRateControlCombo->currentIndex());
    qDebug() << "end";
}
Ejemplo n.º 17
0
void Video4LinuxWidget::loadPreset(Mlt::Properties& p)
{
    ui->v4lLineEdit->setText(p.get("device"));
    ui->v4lWidthSpinBox->setValue(p.get_int("width"));
    ui->v4lHeightSpinBox->setValue(p.get_int("height"));
    ui->v4lFramerateSpinBox->setValue(p.get_double("framerate"));
    QString s(p.get("standard"));
    for (int i = 0; i < ui->v4lStandardCombo->count(); i++) {
        if (ui->v4lStandardCombo->itemText(i) == s) {
            ui->v4lStandardCombo->setCurrentIndex(i);
            break;
        }
    }
    ui->v4lChannelSpinBox->setValue(p.get_int("channel"));
    ui->v4lAudioComboBox->setCurrentIndex(p.get_int("audio_ix"));
    on_v4lAudioComboBox_activated(p.get_int("audio_ix"));
}
Ejemplo n.º 18
0
EncodeDock::EncodeDock(QWidget *parent) :
    QDockWidget(parent),
    ui(new Ui::EncodeDock),
    m_presets(Mlt::Repository::presets()),
    m_immediateJob(0),
    m_profiles(Mlt::Profile::list())
{
    ui->setupUi(this);
#ifdef Q_WS_X11
    ui->stopCaptureButton->hide();
#else
    delete ui->stopCaptureButton;
#endif
    ui->videoCodecThreadsSpinner->setMaximum(QThread::idealThreadCount());
    toggleViewAction()->setIcon(QIcon::fromTheme("media-record", windowIcon()));
    ui->addPresetButton->setIcon(QIcon::fromTheme("list-add", ui->addPresetButton->icon()));
    ui->removePresetButton->setIcon(QIcon::fromTheme("list-remove", ui->removePresetButton->icon()));
    ui->reloadSignalButton->setIcon(QIcon::fromTheme("view-refresh", ui->reloadSignalButton->icon()));

    loadPresets();

    // populate the combos
    Mlt::Consumer c(MLT.profile(), "avformat");
    c.set("f", "list");
    c.set("acodec", "list");
    c.set("vcodec", "list");
    c.start();
    c.stop();
    Mlt::Properties* p = new Mlt::Properties(c.get_data("f"));
    ui->formatCombo->addItem(tr("Automatic from extension"));
    for (int i = 0; i < p->count(); i++)
        ui->formatCombo->addItem(p->get(i));
    delete p;
    p = new Mlt::Properties(c.get_data("acodec"));
    ui->audioCodecCombo->addItem(tr("Default for format"));
    for (int i = 0; i < p->count(); i++)
        ui->audioCodecCombo->addItem(p->get(i));
    delete p;
    p = new Mlt::Properties(c.get_data("vcodec"));
    ui->videoCodecCombo->addItem(tr("Default for format"));
    for (int i = 0; i < p->count(); i++)
        ui->videoCodecCombo->addItem(p->get(i));
    delete p;
}
Ejemplo n.º 19
0
QMap<double,QString> BinController::takeGuidesData()
{
    QLocale locale;
    // Load guides
    Mlt::Properties guidesProperties;
    Mlt::Properties playlistProps(m_binPlaylist->get_properties());
    guidesProperties.pass_values(playlistProps, "kdenlive:guide.");

    qDebug()<<"***********\nFOUND GUIDES: "<<guidesProperties.count()<<"\n**********";
    QMap <double,QString> guidesData;
    for (int i = 0; i < guidesProperties.count(); i++) {
        double time = locale.toDouble(guidesProperties.get_name(i));
        guidesData.insert(time, guidesProperties.get(i));
        // Clear bin data
        QString propertyName = "kdenlive:guide." + QString(guidesProperties.get_name(i));
        m_binPlaylist->set(propertyName.toUtf8().constData(), (char *) NULL);
    }
    return guidesData;
}
Ejemplo n.º 20
0
void NetworkProducerWidget::loadPreset(Mlt::Properties& p)
{
    const char *resource = p.get("resource");
    if (qstrcmp(resource, "<tractor>") && qstrcmp(resource, "<playlist>"))
        ui->urlLineEdit->setText(resource);
}
Ejemplo n.º 21
0
void Wizard::checkMltComponents()
{
    QSize itemSize(20, fontMetrics().height() * 2.5);
    m_mltCheck.programList->setColumnWidth(0, 30);
    m_mltCheck.programList->setIconSize(QSize(24, 24));


    QTreeWidgetItem *mltitem = new QTreeWidgetItem(m_mltCheck.programList);

    QTreeWidgetItem *meltitem = new QTreeWidgetItem(m_mltCheck.programList, QStringList() << QString() << i18n("Melt") + " (" + KdenliveSettings::rendererpath() + ')');
    meltitem->setData(1, Qt::UserRole, i18n("Required for rendering (part of MLT package)"));
    meltitem->setSizeHint(0, itemSize);
    meltitem->setIcon(0, m_okIcon);


    Mlt::Repository *repository = Mlt::Factory::init();
    if (!repository) {
        mltitem->setData(1, Qt::UserRole, i18n("Cannot start the MLT video backend!"));
        mltitem->setIcon(0, m_badIcon);
        m_systemCheckIsOk = false;
        button(QWizard::NextButton)->setEnabled(false);
    }
    else {
        int mltVersion = (mltVersionMajor << 16) + (mltVersionMinor << 8) + mltVersionRevision;
        mltitem->setText(1, i18n("MLT version: %1", mlt_version_get_string()));
        mltitem->setSizeHint(0, itemSize);
        if (mlt_version_get_int() < 1792) {
            mltitem->setData(1, Qt::UserRole, i18n("Your MLT version is unsupported!!!"));
            mltitem->setIcon(0, m_badIcon);
            m_systemCheckIsOk = false;
            button(QWizard::NextButton)->setEnabled(false);
        }
        else if (mlt_version_get_int() < mltVersion) {
            mltitem->setData(1, Qt::UserRole, i18n("Please upgrade to MLT %1.%2.%3", mltVersionMajor, mltVersionMinor, mltVersionRevision));
            mltitem->setIcon(0, m_badIcon);
        }
        else {
            mltitem->setData(1, Qt::UserRole, i18n("MLT video backend!"));
            mltitem->setIcon(0, m_okIcon);
        }

        // Retrieve the list of available transitions.
        Mlt::Properties *producers = repository->producers();
        QStringList producersItemList;
        for (int i = 0; i < producers->count(); ++i)
            producersItemList << producers->get_name(i);
        delete producers;

        Mlt::Properties *consumers = repository->consumers();
        QStringList consumersItemList;
        for (int i = 0; i < consumers->count(); ++i)
            consumersItemList << consumers->get_name(i);
        delete consumers;

        // SDL module
        QTreeWidgetItem *sdlItem = new QTreeWidgetItem(m_mltCheck.programList, QStringList() << QString() << i18n("SDL module"));
        sdlItem->setData(1, Qt::UserRole, i18n("Required for Kdenlive"));
        sdlItem->setSizeHint(0, itemSize);
        
        if (!consumersItemList.contains("sdl")) {
            sdlItem->setIcon(0, m_badIcon);
            m_systemCheckIsOk = false;
            button(QWizard::NextButton)->setEnabled(false);
        }
        else {
            sdlItem->setIcon(0, m_okIcon);
        }

        // AVformat module
        QTreeWidgetItem *avformatItem = new QTreeWidgetItem(m_mltCheck.programList, QStringList() << QString() << i18n("Avformat module (FFmpeg)"));
        avformatItem->setData(1, Qt::UserRole, i18n("Required to work with various video formats (hdv, mpeg, flash, ...)"));
        avformatItem->setSizeHint(0, itemSize);
        Mlt::Consumer *consumer = NULL;
        Mlt::Profile p;
        if (consumersItemList.contains("avformat"))
            consumer = new Mlt::Consumer(p, "avformat");
        if (consumer == NULL || !consumer->is_valid()) {
            avformatItem->setIcon(0, m_badIcon);
            m_mltCheck.tabWidget->setTabEnabled(1, false);
        }
        else {
            avformatItem->setIcon(0, m_okIcon);
            consumer->set("vcodec", "list");
            consumer->set("acodec", "list");
            consumer->set("f", "list");
            consumer->start();
            QStringList result;
            Mlt::Properties vcodecs((mlt_properties) consumer->get_data("vcodec"));
            for (int i = 0; i < vcodecs.count(); ++i)
                result << QString(vcodecs.get(i));
            m_mltCheck.vcodecs_list->addItems(result);
            KdenliveSettings::setVideocodecs(result);
            result.clear();
            Mlt::Properties acodecs((mlt_properties) consumer->get_data("acodec"));
            for (int i = 0; i < acodecs.count(); ++i)
                result << QString(acodecs.get(i));
            m_mltCheck.acodecs_list->addItems(result);
            KdenliveSettings::setAudiocodecs(result);
            result.clear();
            Mlt::Properties formats((mlt_properties) consumer->get_data("f"));
            for (int i = 0; i < formats.count(); ++i)
                result << QString(formats.get(i));
            m_mltCheck.formats_list->addItems(result);
            KdenliveSettings::setSupportedformats(result);
            checkMissingCodecs();
            delete consumer;
        }

        // Image module
        QTreeWidgetItem *imageItem = new QTreeWidgetItem(m_mltCheck.programList, QStringList() << QString() << i18n("QImage module"));
        imageItem->setData(1, Qt::UserRole, i18n("Required to work with images"));
        imageItem->setSizeHint(0, itemSize);
        if (!producersItemList.contains("qimage")) {
            imageItem->setIcon(0, m_badIcon);
            imageItem = new QTreeWidgetItem(m_mltCheck.programList, QStringList() << QString() << i18n("Pixbuf module"));
            imageItem->setData(1, Qt::UserRole, i18n("Required to work with images"));
            imageItem->setSizeHint(0, itemSize);
            if (producersItemList.contains("pixbuf")) {
                imageItem->setIcon(0, m_badIcon);
            }
            else {
                imageItem->setIcon(0, m_okIcon);
            }
        }
        else {
            imageItem->setIcon(0, m_okIcon);
        }

        // Titler module
        QTreeWidgetItem *titleItem = new QTreeWidgetItem(m_mltCheck.programList, QStringList() << QString() << i18n("Title module"));
        titleItem->setData(1, Qt::UserRole, i18n("Required to work with titles"));
        titleItem->setSizeHint(0, itemSize);
        if (!producersItemList.contains("kdenlivetitle")) {
            KdenliveSettings::setHastitleproducer(false);
            titleItem->setIcon(0, m_badIcon);
        } else {
            titleItem->setIcon(0, m_okIcon);
            KdenliveSettings::setHastitleproducer(true);
        }
    }
}
Ejemplo n.º 22
0
QUuid Controller::uuid(Mlt::Properties &properties) const
{
    return QUuid(properties.get(kUuidProperty));
}
Ejemplo n.º 23
0
void ColorBarsWidget::loadPreset(Mlt::Properties& p)
{
    ui->comboBox->setCurrentIndex(p.get_int(kParamType));
}
Ejemplo n.º 24
0
Mlt::Properties* ColorBarsWidget::getPreset() const
{
    Mlt::Properties* p = new Mlt::Properties;
    p->set(kParamType, ui->comboBox->currentIndex());
    return p;
}
Ejemplo n.º 25
0
void Controller::setUuid(Mlt::Properties &properties, QUuid uid) const
{
    properties.set(kUuidProperty,
            (uid.toByteArray() + '\n').data());
}
Ejemplo n.º 26
0
Mlt::Properties* NetworkProducerWidget::getPreset() const
{
    Mlt::Properties* p = new Mlt::Properties;
    p->set("resource", ui->urlLineEdit->text().toUtf8().constData());
    return p;
}
Ejemplo n.º 27
0
void CountProducerWidget::loadPreset(Mlt::Properties& p)
{
    if (!p.get("direction") || !p.get("style")) return;
    int index = -1;

    index = ui->directionCombo->findData(QVariant(p.get("direction")));
    ui->directionCombo->setCurrentIndex(index);

    index = ui->styleCombo->findData(QVariant(p.get("style")));
    ui->styleCombo->setCurrentIndex(index);

    index = ui->soundCombo->findData(QVariant(p.get("sound")));
    ui->soundCombo->setCurrentIndex(index);

    index = ui->backgroundCombo->findData(QVariant(p.get("background")));
    ui->backgroundCombo->setCurrentIndex(index);

    ui->dropCheckBox->setChecked(p.get("drop"));

    ui->durationSpinBox->setValue(p.get_int("length"));

    if (m_producer) {
        m_producer->set("direction", p.get("direction"));
        m_producer->set("style", p.get("style"));
        m_producer->set("sound", p.get("sound"));
        m_producer->set("background", p.get("background"));
        m_producer->set("drop", p.get("drop"));
        setLength(producer(), ui->durationSpinBox->value());
        m_producer->set(kShotcutDetailProperty, detail().toUtf8().constData());
        emit producerChanged(producer());
    }
}
Ejemplo n.º 28
0
void EncodeDock::loadPresetFromProperties(Mlt::Properties& preset)
{
    int audioQuality = -1;
    int videoQuality = -1;
    QStringList other;

    ui->disableAudioCheckbox->setChecked(preset.get_int("an"));
    ui->disableVideoCheckbox->setChecked(preset.get_int("vn"));
    m_extension.clear();
    for (int i = 0; i < preset.count(); i++) {
        QString name(preset.get_name(i));
        if (name == "f") {
            for (int i = 0; i < ui->formatCombo->count(); i++)
                if (ui->formatCombo->itemText(i) == preset.get("f")) {
                    ui->formatCombo->blockSignals(true);
                    ui->formatCombo->setCurrentIndex(i);
                    ui->formatCombo->blockSignals(false);
                    break;
                }
        }
        else if (name == "acodec") {
            for (int i = 0; i < ui->audioCodecCombo->count(); i++)
                if (ui->audioCodecCombo->itemText(i) == preset.get("acodec"))
                    ui->audioCodecCombo->setCurrentIndex(i);
            if (ui->audioCodecCombo->currentText() == "libopus")
                // reset libopus to VBR (its default)
                ui->audioRateControlCombo->setCurrentIndex(RateControlQuality);
        }
        else if (name == "vcodec") {
            for (int i = 0; i < ui->videoCodecCombo->count(); i++)
                if (ui->videoCodecCombo->itemText(i) == preset.get("vcodec"))
                    ui->videoCodecCombo->setCurrentIndex(i);
        }
        else if (name == "ar")
            ui->sampleRateCombo->lineEdit()->setText(preset.get("ar"));
        else if (name == "ab")
            ui->audioBitrateCombo->lineEdit()->setText(preset.get("ab"));
        else if (name == "vb") {
            ui->videoRateControlCombo->setCurrentIndex(RateControlAverage);
            ui->videoBitrateCombo->lineEdit()->setText(preset.get("vb"));
        }
        else if (name == "g")
            ui->gopSpinner->setValue(preset.get_int("g"));
        else if (name == "bf")
            ui->bFramesSpinner->setValue(preset.get_int("bf"));
        else if (name == "deinterlace") {
            ui->scanModeCombo->setCurrentIndex(preset.get_int("deinterlace"));
            ui->scanModeCombo->setEnabled(false);
        }
        else if (name == "progressive") {
            ui->scanModeCombo->setCurrentIndex(preset.get_int("progressive"));
            ui->scanModeCombo->setEnabled(false);
        }
        else if (name == "top_field_first") {
            ui->fieldOrderCombo->setCurrentIndex(preset.get_int("top_field_first"));
        }
        else if (name == "width") {
            ui->widthSpinner->setValue(preset.get_int("width"));
            ui->widthSpinner->setEnabled(false);
        }
        else if (name == "height") {
            ui->heightSpinner->setValue(preset.get_int("height"));
            ui->heightSpinner->setEnabled(false);
        }
        else if (name == "aspect") {
            double dar = preset.get_double("aspect");
            switch (int(dar * 100)) {
            case 133:
                ui->aspectNumSpinner->setValue(4);
                ui->aspectDenSpinner->setValue(3);
                break;
            case 177:
                ui->aspectNumSpinner->setValue(16);
                ui->aspectDenSpinner->setValue(9);
                break;
            case 56:
                ui->aspectNumSpinner->setValue(9);
                ui->aspectDenSpinner->setValue(16);
                break;
            default:
                ui->aspectNumSpinner->setValue(dar * 1000);
                ui->aspectDenSpinner->setValue(1000);
                break;
            }
            ui->aspectNumSpinner->setEnabled(false);
            ui->aspectDenSpinner->setEnabled(false);
        }
        else if (name == "r") {
            ui->fpsSpinner->setValue(preset.get_double("r"));
            ui->fpsSpinner->setEnabled(false);
        }
        else if (name == "pix_fmt") {
            QString pix_fmt(preset.get("pix_fmt"));
            if (pix_fmt != "yuv420p")
                other.append(QString("%1=%2").arg(name).arg(pix_fmt));
        }
        else if (name == "pass")
            ui->dualPassCheckbox->setChecked(true);
        else if (name == "aq") {
            ui->audioRateControlCombo->setCurrentIndex(RateControlQuality);
            audioQuality = preset.get_int("aq");
        }
        else if (name == "vbr") {
            // libopus rate mode
            QString value(preset.get("vbr"));
            if (value == "off")
                ui->audioRateControlCombo->setCurrentIndex(RateControlConstant);
            else if (value == "constrained")
                ui->audioRateControlCombo->setCurrentIndex(RateControlAverage);
            else
                ui->audioRateControlCombo->setCurrentIndex(RateControlQuality);
        }
        else if (name == "vq") {
            ui->videoRateControlCombo->setCurrentIndex(RateControlQuality);
            videoQuality = preset.get_int("vq");
        }
        else if (name == "qscale") {
            ui->videoRateControlCombo->setCurrentIndex(RateControlQuality);
            videoQuality = preset.get_int("qscale");
        }
        else if (name == "crf") {
            ui->videoRateControlCombo->setCurrentIndex(RateControlQuality);
            videoQuality = preset.get_int("crf");
        }
        else if (name == "bufsize") {
            // traditionally this means video only
            ui->videoRateControlCombo->setCurrentIndex(RateControlConstant);
            ui->videoBufferSizeSpinner->setValue(getBufferSize(preset, "bufsize"));
        }
        else if (name == "vbufsize") {
            ui->videoRateControlCombo->setCurrentIndex(RateControlConstant);
            ui->videoBufferSizeSpinner->setValue(getBufferSize(preset, "vbufsize"));
        }
        else if (name == "threads") {
            // TODO: should we save the thread count and restore it if preset is not 1?
            if (preset.get_int("threads") == 1)
                ui->videoCodecThreadsSpinner->setValue(1);
        }
        else if (name == "meta.preset.extension") {
            m_extension = preset.get("meta.preset.extension");
        }
        else if (name == "deinterlace_method") {
            name = preset.get("deinterlace_method");
            if (name == "onefield")
                ui->deinterlacerCombo->setCurrentIndex(0);
            else if (name == "linearblend")
                ui->deinterlacerCombo->setCurrentIndex(1);
            else if (name == "yadif-nospatial")
                ui->deinterlacerCombo->setCurrentIndex(2);
            else if (name == "yadif")
                ui->deinterlacerCombo->setCurrentIndex(3);
            ui->deinterlacerCombo->setDisabled(true);
        }
        else if (name == "rescale") {
            name = preset.get("rescale");
            if (name == "nearest" || name == "neighbor")
                ui->interpolationCombo->setCurrentIndex(0);
            else if (name == "bilinear")
                ui->interpolationCombo->setCurrentIndex(1);
            else if (name == "bicubic")
                ui->interpolationCombo->setCurrentIndex(2);
            else if (name == "hyper" || name == "lanczos")
                ui->interpolationCombo->setCurrentIndex(3);
            ui->interpolationCombo->setDisabled(true);
        }
        else if (name != "an" && name != "vn" && name != "threads"
                 && !name.startsWith('_') && !name.startsWith("meta.preset.")) {
            other.append(QString("%1=%2").arg(name).arg(preset.get(i)));
        }
    }
    ui->advancedTextEdit->setPlainText(other.join("\n"));

    // normalize the quality settings
    // quality depends on codec
    if (ui->audioRateControlCombo->currentIndex() == RateControlQuality && audioQuality > -1) {
        const QString& acodec = ui->audioCodecCombo->currentText();
        if (acodec == "libmp3lame") // 0 (best) - 9 (worst)
            ui->audioQualitySpinner->setValue(TO_RELATIVE(9, 0, audioQuality));
        if (acodec == "libvorbis" || acodec == "vorbis") // 0 (worst) - 10 (best)
            ui->audioQualitySpinner->setValue(TO_RELATIVE(0, 10, audioQuality));
        else
            // aac: 0 (worst) - 500 (best)
            ui->audioQualitySpinner->setValue(TO_RELATIVE(0, 500, audioQuality));
    }
    if (ui->videoRateControlCombo->currentIndex() == RateControlQuality && videoQuality > -1) {
        const QString& vcodec = ui->videoCodecCombo->currentText();
        //val = min + (max - min) * paramval;
        if (vcodec == "libx264" || vcodec == "libx265") // 0 (best, 100%) - 51 (worst)
            ui->videoQualitySpinner->setValue(TO_RELATIVE(51, 0, videoQuality));
        else if (vcodec.startsWith("libvpx")) // 0 (best, 100%) - 63 (worst)
            ui->videoQualitySpinner->setValue(TO_RELATIVE(63, 0, videoQuality));
        else // 1 (best, NOT 100%) - 31 (worst)
            ui->videoQualitySpinner->setValue(TO_RELATIVE(31, 1, videoQuality));
    }
    on_audioRateControlCombo_activated(ui->audioRateControlCombo->currentIndex());
    on_videoRateControlCombo_activated(ui->videoRateControlCombo->currentIndex());
}
Ejemplo n.º 29
0
void NetworkProducerWidget::loadPreset(Mlt::Properties& p)
{
    ui->urlLineEdit->setText(p.get("resource"));
}
Ejemplo n.º 30
0
void IsingWidget::loadPreset(Mlt::Properties& p)
{
    ui->tempSpinner->setValue(p.get_double(kParamTemperature));
    ui->borderGrowthSpinner->setValue(p.get_double(kParamBorderGrowth));
    ui->spontGrowthSpinner->setValue(p.get_double(kParamSpontaneous));
}