QGstreamerVideoEncode::QGstreamerVideoEncode(QGstreamerCaptureSession *session)
    :QVideoEncoderControl(session), m_session(session)
{
    QList<QByteArray> codecCandidates;
    codecCandidates << "video/h264" << "video/xvid" << "video/mpeg4" << "video/mpeg1" << "video/mpeg2" << "video/theora";

    m_elementNames["video/h264"] = "x264enc";
    m_elementNames["video/xvid"] = "xvidenc";
    m_elementNames["video/mpeg4"] = "ffenc_mpeg4";
    m_elementNames["video/mpeg1"] = "ffenc_mpeg1video";
    m_elementNames["video/mpeg2"] = "ffenc_mpeg2video";
    m_elementNames["video/theora"] = "theoraenc";

    m_codecOptions["video/h264"] = QStringList() << "quantizer";
    m_codecOptions["video/xvid"] = QStringList() << "quantizer" << "profile";
    m_codecOptions["video/mpeg4"] = QStringList() << "quantizer";
    m_codecOptions["video/mpeg1"] = QStringList() << "quantizer";
    m_codecOptions["video/mpeg2"] = QStringList() << "quantizer";
    m_codecOptions["video/theora"] = QStringList();

    foreach( const QByteArray& codecName, codecCandidates ) {
        QByteArray elementName = m_elementNames[codecName];
        GstElementFactory *factory = gst_element_factory_find(elementName.constData());
        if (factory) {
            m_codecs.append(codecName);
            const gchar *descr = gst_element_factory_get_description(factory);
            m_codecDescriptions.insert(codecName, QString::fromUtf8(descr));

            m_streamTypes.insert(codecName,
                                 QGstreamerMediaContainerControl::supportedStreamTypes(factory, GST_PAD_SRC));

            gst_object_unref(GST_OBJECT(factory));
        }
    }
Пример #2
0
QGstreamerAudioEncode::QGstreamerAudioEncode(QObject *parent)
    :QAudioEncoderControl(parent)
{
    QList<QByteArray> codecCandidates;

#if defined(Q_WS_MAEMO_5)
    codecCandidates << "audio/PCM"; //<< "audio/AMR" << "audio/AMR-WB" << "audio/speex";
#elif defined(Q_WS_MAEMO_6)
    codecCandidates << "audio/AAC" << "audio/mpeg" << "audio/vorbis" << "audio/speex" << "audio/GSM"
                    << "audio/PCM" << "audio/AMR" << "audio/AMR-WB" << "audio/FLAC";
#else
    codecCandidates << "audio/mpeg" << "audio/vorbis" << "audio/speex" << "audio/GSM"
                    << "audio/PCM" << "audio/AMR" << "audio/AMR-WB" << "audio/FLAC";
#endif

#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6)
    m_elementNames["audio/AMR"] = "nokiaamrnbenc";
    m_elementNames["audio/AMR-WB"] = "nokiaamrwbenc";
    m_elementNames["audio/AAC"] = "nokiaaacenc";
#else
    m_elementNames["audio/mpeg"] = "lamemp3enc";
    m_elementNames["audio/AMR"] = "amrnbenc";
    m_elementNames["audio/AMR-WB"] = "amrwbenc";
#endif

    m_elementNames["audio/vorbis"] = "vorbisenc";
    m_elementNames["audio/speex"] = "speexenc";
    m_elementNames["audio/PCM"] = "audioresample";
    m_elementNames["audio/FLAC"] = "flacenc";
    m_elementNames["audio/GSM"] = "gsmenc";

    m_codecOptions["audio/vorbis"] = QStringList() << "min-bitrate" << "max-bitrate";
    m_codecOptions["audio/mpeg"] = QStringList() << "mode";
    m_codecOptions["audio/speex"] = QStringList() << "mode" << "vbr" << "vad" << "dtx";
    m_codecOptions["audio/GSM"] = QStringList();
    m_codecOptions["audio/PCM"] = QStringList();
    m_codecOptions["audio/AMR"] = QStringList();
    m_codecOptions["audio/AMR-WB"] = QStringList();

    foreach( const QByteArray& codecName, codecCandidates ) {
        QByteArray elementName = m_elementNames[codecName];
        GstElementFactory *factory = gst_element_factory_find(elementName.constData());

        if (factory) {
            m_codecs.append(codecName);
            const gchar *descr = gst_element_factory_get_description(factory);

            if (codecName == QByteArray("audio/PCM"))
                m_codecDescriptions.insert(codecName, tr("Raw PCM audio"));
            else
                m_codecDescriptions.insert(codecName, QString::fromUtf8(descr));

            m_streamTypes.insert(codecName,
                                 QGstreamerMediaContainerControl::supportedStreamTypes(factory, GST_PAD_SRC));

            gst_object_unref(GST_OBJECT(factory));
        }
    }
Пример #3
0
EffectManager::EffectManager(Backend *backend)
        : QObject(backend)
        , m_backend(backend)
{
    GList* factoryList = gst_registry_get_feature_list(gst_registry_get_default (), GST_TYPE_ELEMENT_FACTORY);
    QString name, klass, description, author;
    for (GList* iter = g_list_first(factoryList) ; iter != NULL ; iter = g_list_next(iter)) {
        GstPluginFeature *feature = GST_PLUGIN_FEATURE(iter->data);
        klass = gst_element_factory_get_klass(GST_ELEMENT_FACTORY(feature));
        if ( klass == "Filter/Effect/Audio" ) {
            name =  GST_PLUGIN_FEATURE_NAME(feature);

            // These plugins simply make no sense to the frontend:
            // "audiorate" Should be internal
            // "volume" not needed
            // "equalizer-nbands" not really useful at the moment

            // These plugins simply don't work or have major stability issues:
            // "iir" Does not seem to do much at the moment
            // "audioinvert" Only works for some streams, should be invesigated
            // "lpwsinc" Crashes for large values of filter kernel
            // "name" Crashes for large values of filter kernel
            
            // Seems to be working, but not well tested:
            // name == "rglimiter" Seems functional
            // name == "rgvolume" Seems to be working

            QString pluginString = qgetenv("PHONON_GST_ALL_EFFECTS");
            bool acceptAll = pluginString.toInt();

            if (acceptAll 
                // Plugins that have been accepted so far
                 || name == "audiopanorama" 
                 || name == "audioamplify" 
                 || name == "audiodynamic" 
                 || name == "equalizer-10bands" 
                 || name == "speed") 
                {
                    description = gst_element_factory_get_description (GST_ELEMENT_FACTORY(feature));
                    author = gst_element_factory_get_author (GST_ELEMENT_FACTORY(feature));
                    EffectInfo *effect = new EffectInfo(name, description, author);
                    m_audioEffectList.append(effect);
            }
        }
    }
    g_list_free(factoryList);
}
Пример #4
0
static VALUE
get_description(VALUE self)
{
    return CSTR2RVAL(gst_element_factory_get_description(SELF(self)));
}
Пример #5
0
MainWindow::MainWindow()
    : MainWindowBase(0, "main window"),
      editPalette(palette()), previewPalette(palette()), previewstyle(0)
{
    modified = true;
    desktopThemeName = tr("Desktop Settings (Default)");
    setIcon(QPixmap(":/trolltech/qtconfig/images/appicon.png"));
    QStringList gstyles = QStyleFactory::keys();
    gstyles.sort();
    gstylecombo->addItem(desktopThemeName);
    gstylecombo->setItemData(gstylecombo->findText(desktopThemeName),
                                tr("Choose style and palette based on your desktop settings."), Qt::ToolTipRole);
    gstylecombo->insertStringList(gstyles);

    QSettings settings(QLatin1String("Trolltech"));
    settings.beginGroup(QLatin1String("Qt"));

    QString currentstyle = settings.value(QLatin1String("style")).toString();
    if (currentstyle.isEmpty()) {
        gstylecombo->setCurrentItem(gstylecombo->findText(desktopThemeName));
        currentstyle = QLatin1String(QApplication::style()->name());
    } else {
        int index = gstylecombo->findText(currentstyle, Qt::MatchFixedString);
        if (index != -1) {
            gstylecombo->setCurrentItem(index);
        } else { // we give up
            gstylecombo->insertItem(QLatin1String("Unknown"));
            gstylecombo->setCurrentItem(gstylecombo->count() - 1);
        }
    }
    buttonMainColor->setColor(palette().color(QPalette::Active,
                                              QColorGroup::Button));
    buttonMainColor2->setColor(palette().color(QPalette::Active,
                                               QColorGroup::Window));
    connect(buttonMainColor, SIGNAL(colorChanged(QColor)),
                this, SLOT(buildPalette()));
    connect(buttonMainColor2, SIGNAL(colorChanged(QColor)),
                this, SLOT(buildPalette()));

    if (X11->desktopEnvironment == DE_KDE)
        colorConfig->hide();
    else
        labelKDENote->hide();

    QFontDatabase db;
    QStringList families = db.families();
    familycombo->insertStringList(families);

    QStringList fs = families;
    QStringList fs2 = QFont::substitutions();
    QStringList::Iterator fsit = fs2.begin();
    while (fsit != fs2.end()) {
        if (! fs.contains(*fsit))
            fs += *fsit;
        fsit++;
    }
    fs.sort();
    familysubcombo->insertStringList(fs);

    choosesubcombo->insertStringList(families);
    Q3ValueList<int> sizes = db.standardSizes();
    Q3ValueList<int>::Iterator it = sizes.begin();
    while (it != sizes.end())
        psizecombo->insertItem(QString::number(*it++));

    dcispin->setValue(QApplication::doubleClickInterval());
    cfispin->setValue(QApplication::cursorFlashTime());
    wslspin->setValue(QApplication::wheelScrollLines());
    // #############
//    resolvelinks->setChecked(qt_resolve_symlinks);

    effectcheckbox->setChecked(QApplication::isEffectEnabled(Qt::UI_General));
    effectbase->setEnabled(effectcheckbox->isChecked());

    if (QApplication::isEffectEnabled(Qt::UI_FadeMenu))
        menueffect->setCurrentItem(2);
    else if (QApplication::isEffectEnabled(Qt::UI_AnimateMenu))
        menueffect->setCurrentItem(1);

    if (QApplication::isEffectEnabled(Qt::UI_AnimateCombo))
        comboeffect->setCurrentItem(1);

    if (QApplication::isEffectEnabled(Qt::UI_FadeTooltip))
        tooltipeffect->setCurrentItem(2);
    else if (QApplication::isEffectEnabled(Qt::UI_AnimateTooltip))
        tooltipeffect->setCurrentItem(1);

    if ( QApplication::isEffectEnabled( Qt::UI_AnimateToolBox ) )
        toolboxeffect->setCurrentItem( 1 );

    QSize globalStrut = QApplication::globalStrut();
    strutwidth->setValue(globalStrut.width());
    strutheight->setValue(globalStrut.height());

    // find the default family
    QStringList::Iterator sit = families.begin();
    int i = 0, possible = -1;
    while (sit != families.end()) {
        if (*sit == QApplication::font().family())
            break;
        if ((*sit).contains(QApplication::font().family()))
            possible = i;

        i++;
        sit++;
    }
    if (sit == families.end())
        i = possible;
    if (i == -1) // no clue about the current font
        i = 0;

    familycombo->setCurrentItem(i);

    QStringList styles = db.styles(familycombo->currentText());
    stylecombo->insertStringList(styles);

    QString stylestring = db.styleString(QApplication::font());
    sit = styles.begin();
    i = 0;
    possible = -1;
    while (sit != styles.end()) {
        if (*sit == stylestring)
            break;
        if ((*sit).contains(stylestring))
            possible = i;

        i++;
        sit++;
    }
    if (sit == styles.end())
        i = possible;
    if (i == -1) // no clue about the current font
        i = 0;
    stylecombo->setCurrentItem(i);

    i = 0;
    for (int psize = QApplication::font().pointSize(); i < psizecombo->count(); ++i) {
        const int sz = psizecombo->text(i).toInt();
        if (sz == psize) {
            psizecombo->setCurrentItem(i);
            break;
        } else if(sz > psize) {
            psizecombo->insertItem(i, QString::number(psize));
            psizecombo->setCurrentItem(i);
            break;
        }
    }

    QStringList subs = QFont::substitutes(familysubcombo->currentText());
    sublistbox->clear();
    sublistbox->insertStringList(subs);

    rtlExtensions->setChecked(settings.value(QLatin1String("useRtlExtensions"), false).toBool());

#ifdef Q_WS_X11
    inputStyle->setCurrentText(settings.value(QLatin1String("XIMInputStyle"), trUtf8("On The Spot")).toString());
#else
    inputStyle->hide();
    inputStyleLabel->hide();
#endif

#if defined(Q_WS_X11) && !defined(QT_NO_XIM)
    QStringList inputMethods = QInputContextFactory::keys();
    int inputMethodIndex = -1;
    QString defaultInputMethod = settings.value(QLatin1String("DefaultInputMethod"), QLatin1String("xim")).toString();
    for (int i = inputMethods.size()-1; i >= 0; --i) {
        const QString &im = inputMethods.at(i);
        if (im.contains(QLatin1String("imsw"))) {
            inputMethods.removeAt(i);
            if (inputMethodIndex > i)
                --inputMethodIndex;
        } else if (im == defaultInputMethod) {
            inputMethodIndex = i;
        }
    }
    if (inputMethodIndex == -1 && !inputMethods.isEmpty())
        inputMethodIndex = 0;
    inputMethod->addItems(inputMethods);
    inputMethod->setCurrentIndex(inputMethodIndex);
#else
    inputMethod->hide();
    inputMethodLabel->hide();
#endif

    fontembeddingcheckbox->setChecked(settings.value(QLatin1String("embedFonts"), true).toBool());
    fontpaths = settings.value(QLatin1String("fontPath")).toStringList();
    fontpathlistbox->insertStringList(fontpaths);

    audiosinkCombo->addItem(tr("Auto (default)"), QLatin1String("Auto"));
    audiosinkCombo->setItemData(audiosinkCombo->findText(tr("Auto (default)")),
                                tr("Choose audio output automatically."), Qt::ToolTipRole);
    audiosinkCombo->addItem(tr("aRts"), QLatin1String("artssink"));
    audiosinkCombo->setItemData(audiosinkCombo->findText(tr("aRts")),
                                tr("Experimental aRts support for GStreamer."), Qt::ToolTipRole);
#ifdef HAVE_PHONON
    phononVersionLabel->setText(QLatin1String(Phonon::phononVersion()));
#endif
#ifndef QT_NO_GSTREAMER
    if (gst_init_check(0, 0, 0)) {
        gchar *versionString = gst_version_string();
        gstversionLabel->setText(QLatin1String(versionString));
        g_free(versionString);
        GList* factoryList = gst_registry_get_feature_list(gst_registry_get_default (), GST_TYPE_ELEMENT_FACTORY);
        QString name, klass, description;
        for (GList* iter = g_list_first(factoryList) ; iter != NULL ; iter = g_list_next(iter)) {
            GstPluginFeature *feature = GST_PLUGIN_FEATURE(iter->data);
            klass = QLatin1String(gst_element_factory_get_klass(GST_ELEMENT_FACTORY(feature)));
            if (klass == QLatin1String("Sink/Audio")) {
                name = QLatin1String(GST_PLUGIN_FEATURE_NAME(feature));
                if (name == QLatin1String("sfsink"))
                    continue; //useless to output audio to file when you cannot set the file path
                else if (name == QLatin1String("autoaudiosink"))
                    continue; //This is used implicitly from the auto setting
                GstElement *sink = gst_element_factory_make (qPrintable(name), NULL);
                if (sink) {
                    description = QLatin1String(gst_element_factory_get_description (GST_ELEMENT_FACTORY(feature)));
                    audiosinkCombo->addItem(name, name);
                    audiosinkCombo->setItemData(audiosinkCombo->findText(name), description, Qt::ToolTipRole);
                    gst_object_unref (sink);
                }
            }
        }
        g_list_free(factoryList);
    }
#else
    tab4->setEnabled(false);
    phononLabel->setText(tr("Phonon GStreamer backend not available."));
#endif

    videomodeCombo->addItem(tr("Auto (default)"), QLatin1String("Auto"));
    videomodeCombo->setItemData(videomodeCombo->findText(tr("Auto (default)")), tr("Choose render method automatically"), Qt::ToolTipRole);
#ifdef Q_WS_X11
    videomodeCombo->addItem(tr("X11"), QLatin1String("X11"));
    videomodeCombo->setItemData(videomodeCombo->findText(tr("X11")), tr("Use X11 Overlays"), Qt::ToolTipRole);
#endif
#ifndef QT_NO_OPENGL
    videomodeCombo->addItem(tr("OpenGL"), QLatin1String("OpenGL"));
    videomodeCombo->setItemData(videomodeCombo->findText(tr("OpenGL")), tr("Use OpenGL if available"), Qt::ToolTipRole);
#endif
    videomodeCombo->addItem(tr("Software"), QLatin1String("Software"));
    videomodeCombo->setItemData(videomodeCombo->findText(tr("Software")), tr("Use simple software rendering"), Qt::ToolTipRole);

    QString audioSink = settings.value(QLatin1String("audiosink"), QLatin1String("Auto")).toString();
    QString videoMode = settings.value(QLatin1String("videomode"), QLatin1String("Auto")).toString();
    audiosinkCombo->setCurrentItem(audiosinkCombo->findData(audioSink));
    videomodeCombo->setCurrentItem(videomodeCombo->findData(videoMode));

    settings.endGroup(); // Qt

    helpview->setText(tr(appearance_text));

    setModified(false);
    updateStyleLayout();
}
Пример #6
0
EffectManager::EffectManager(Backend *backend)
        : QObject(backend)
        , m_backend(backend)
{
    GList *factoryList = gst_registry_get_feature_list(gst_registry_get(), GST_TYPE_ELEMENT_FACTORY);

    QString name;
    QString klass;
    QString description;
    QString author;
    for (GList* iter = g_list_first(factoryList); iter != NULL ; iter = g_list_next(iter)) {
        GstPluginFeature *feature = GST_PLUGIN_FEATURE(iter->data);
        klass = gst_element_factory_get_klass(GST_ELEMENT_FACTORY(feature));
        if (klass == QLatin1String("Filter/Effect/Audio")) {
            name = GST_OBJECT_NAME(feature);

            // These plugins simply make no sense to the frontend:
            // "audiorate" Should be internal
            // "volume" not needed
            // "equalizer-nbands" not really useful at the moment

            // These plugins simply don't work or have major stability issues:
            // "iir" Does not seem to do much at the moment
            // "audioinvert" Only works for some streams, should be invesigated
            // "lpwsinc" Crashes for large values of filter kernel
            // "name" Crashes for large values of filter kernel

            // Seems to be working, but not well tested:
            // name == "rglimiter" Seems functional
            // name == "rgvolume" Seems to be working

            QString pluginString = qgetenv("PHONON_GST_ALL_EFFECTS");
            bool acceptAll = pluginString.toInt();

            if (acceptAll
                // Plugins that have been accepted so far
                 || name == QLatin1String("audiopanorama")
                 || name == QLatin1String("audioamplify")
                 || name == QLatin1String("audiodynamic")
                 || name == QLatin1String("equalizer-10bands")
                 || name == QLatin1String("speed"))
                {
                    description = gst_element_factory_get_description(GST_ELEMENT_FACTORY(feature));
                    author = gst_element_factory_get_author(GST_ELEMENT_FACTORY(feature));
                    EffectInfo *effect = new EffectInfo(name, description, author);
                    m_audioEffectList.append(effect);

#ifdef __GNUC__
#warning TODO - get rid of equalizer name mapping (also see audioeffect.cpp)
#endif
                    // Map the GStreamer name to the name used by Xine, to allow
                    // API consumers that think KEqualizer is a persistant name
                    // to have a working equalizer with GStreamer too (e.g. Amarok).
                    if (name == QLatin1String("equalizer-10bands")) {
                        m_audioEffectList.append(new EffectInfo(
                                                     QLatin1String("KEqualizer"),
                                                     QLatin1String("Compatibility effect. Do not use in new software!"),
                                                     author));
                    }
            }
        }
    }
    gst_plugin_feature_list_free(factoryList);
}