static void print_plugin_automatic_install_info (GstPlugin * plugin) { GList *features, *l; /* not interested in typefind factories, only element factories */ features = gst_registry_get_feature_list (gst_registry_get (), GST_TYPE_ELEMENT_FACTORY); for (l = features; l != NULL; l = l->next) { GstPluginFeature *feature; GstPlugin *feature_plugin; feature = GST_PLUGIN_FEATURE (l->data); /* only interested in the ones that are in the plugin we just loaded */ feature_plugin = gst_plugin_feature_get_plugin (feature); if (feature_plugin == plugin) { GstElementFactory *factory; g_print ("element-%s\n", gst_plugin_feature_get_name (feature)); factory = GST_ELEMENT_FACTORY (feature); print_plugin_automatic_install_info_protocols (factory); print_plugin_automatic_install_info_codecs (factory); } if (feature_plugin) gst_object_unref (feature_plugin); } g_list_foreach (features, (GFunc) gst_object_unref, NULL); g_list_free (features); }
/* * Method: get_features(feature_type_or_plugin_name) * feature_type_or_plugin_name: a feature type or plugin name. * * Gets a list of all plugin features of the given type in the pool. * * Valid features types are Gst::AutoplugFactory, Gst::ElementFactory, * Gst::IndexFactory, Gst::SchedulerFactory and Gst::TypeFactory. * * Returns: an array of Gst::PluginFeature objects. */ static VALUE rb_gst_registry_get_features(VALUE self, VALUE type_or_plugin_name) { GList *list, *node; GType gtype; VALUE arr; if (RVAL2CBOOL(rb_obj_is_kind_of(type_or_plugin_name, rb_cString))) { list = gst_registry_get_feature_list_by_plugin(RGST_REGISTRY(self), RVAL2CSTR(type_or_plugin_name)); } else { gtype = CLASS2GTYPE(type_or_plugin_name); if (!is_valid_pluginfeature_type(gtype)) rb_raise (rb_eArgError, "Invalid feature type."); list = gst_registry_get_feature_list(RGST_REGISTRY(self), gtype); } arr = rb_ary_new(); for (node = list; node != NULL; node = g_list_next(node)) { rb_ary_push(arr, instanciate_pluginfeature(GST_PLUGIN_FEATURE(node->data))); } g_list_free (list); return arr; }
int main (int argc, char *argv[]) { GstElementFactory *factory; GOptionEntry options[] = { GST_TOOLS_GOPTION_VERSION, {NULL} }; GOptionContext *ctx; GError *err = NULL; setlocale (LC_ALL, ""); #if !GLIB_CHECK_VERSION (2, 31, 0) g_thread_init (NULL); #endif gst_tools_set_prgname ("gst-xmlinspect"); ctx = g_option_context_new ("[ELEMENT-NAME]"); g_option_context_add_main_entries (ctx, options, GETTEXT_PACKAGE); g_option_context_add_group (ctx, gst_init_get_option_group ()); if (!g_option_context_parse (ctx, &argc, &argv, &err)) { g_print ("Error initializing: %s\n", err->message); exit (1); } g_option_context_free (ctx); gst_tools_print_version ("gst-xmlinspect"); /* if no arguments, print out all elements */ if (argc == 1) { GList *features, *f; features = gst_registry_get_feature_list (gst_registry_get_default (), GST_TYPE_ELEMENT_FACTORY); PUT_STRING (0, "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"); for (f = features; f != NULL; f = f->next) print_element_info (GST_ELEMENT_FACTORY (f->data)); gst_plugin_feature_list_free (features); return 0; } /* else we try to get a factory */ factory = gst_element_factory_find (argv[1]); /* if there's a factory, print out the info */ if (factory) { PUT_STRING (0, "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"); return print_element_info (factory); } /* otherwise, error out */ g_printerr ("no such element '%s'\n", argv[1]); return -1; }
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); }
/*** * !reimp */ QStringList Backend::availableMimeTypes() const { QStringList availableMimeTypes; if (!isValid()) return availableMimeTypes; GstElementFactory *mpegFactory; // Add mp3 as a separate mime type as people are likely to look for it. if ((mpegFactory = gst_element_factory_find ("ffmpeg")) || (mpegFactory = gst_element_factory_find ("mad"))) { availableMimeTypes << QLatin1String("audio/x-mp3"); gst_object_unref(GST_OBJECT(mpegFactory)); } // Iterate over all audio and video decoders and extract mime types from sink caps GList* factoryList = gst_registry_get_feature_list(gst_registry_get_default (), GST_TYPE_ELEMENT_FACTORY); for (GList* iter = g_list_first(factoryList) ; iter != NULL ; iter = g_list_next(iter)) { GstPluginFeature *feature = GST_PLUGIN_FEATURE(iter->data); QString klass = gst_element_factory_get_klass(GST_ELEMENT_FACTORY(feature)); if (klass == QLatin1String("Codec/Decoder/Audio") || klass == QLatin1String("Codec/Decoder/Video")) { const GList *static_templates; GstElementFactory *factory = GST_ELEMENT_FACTORY(feature); static_templates = gst_element_factory_get_static_pad_templates(factory); for (; static_templates != NULL ; static_templates = static_templates->next) { GstStaticPadTemplate *padTemplate = (GstStaticPadTemplate *) static_templates->data; if (padTemplate && padTemplate->direction == GST_PAD_SINK) { GstCaps *caps = gst_static_pad_template_get_caps (padTemplate); if (caps) { const GstStructure* capsStruct = gst_caps_get_structure (caps, 0); QString mime = QString::fromUtf8(gst_structure_get_name (capsStruct)); if (!availableMimeTypes.contains(mime)) availableMimeTypes.append(mime); } } } } } g_list_free(factoryList); availableMimeTypes.sort(); return availableMimeTypes; }
EXPORT_C #endif GList * gst_audio_default_registry_mixer_filter (GstAudioMixerFilterFunc filter_func, gboolean first, gpointer data) { GList *mixer_list = NULL; GList *feature_list; GList *walk; /* go through all elements of a certain class and check whether * they implement a mixer. If so, add it to the list. */ feature_list = gst_registry_get_feature_list (gst_registry_get_default (), GST_TYPE_ELEMENT_FACTORY); feature_list = g_list_sort (feature_list, element_factory_rank_compare_func); for (walk = feature_list; walk != NULL; walk = walk->next) { GstElementFactory *factory; const gchar *klass; factory = GST_ELEMENT_FACTORY (walk->data); /* check category */ klass = gst_element_factory_get_klass (factory); if (strcmp (klass, "Generic/Audio") == 0) { gst_audio_mixer_filter_probe_feature (filter_func, factory, &mixer_list, first, data); } if (first && mixer_list != NULL) { GST_DEBUG ("Stopping after first found mixer, as requested"); break; } } gst_plugin_feature_list_free (feature_list); return g_list_reverse (mixer_list); }
/** * gst_type_find_factory_get_list: * * Gets the list of all registered typefind factories. You must free the * list using gst_plugin_feature_list_free(). * * The returned factories are sorted by highest rank first, and then by * factory name. * * Free-function: gst_plugin_feature_list_free * * Returns: (transfer full) (element-type Gst.TypeFindFactory): the list of all * registered #GstTypeFindFactory. */ GList * gst_type_find_factory_get_list (void) { return gst_registry_get_feature_list (gst_registry_get (), GST_TYPE_TYPE_FIND_FACTORY); }
/* creates/returns a list of CodecCap based on given filter function and caps */ static GList * get_plugins_filtered_from_caps (FilterFunc filter, GstCaps *caps, GstPadDirection direction) { GList *walk, *result; GstElementFactory *factory; GList *list = NULL; gboolean is_valid; GstCaps *matched_caps = NULL; result = gst_registry_get_feature_list (gst_registry_get_default (), GST_TYPE_ELEMENT_FACTORY); result = g_list_sort (result, (GCompareFunc) compare_ranks); walk = result; while (walk) { factory = GST_ELEMENT_FACTORY (walk->data); is_valid = FALSE; if (!filter (factory)) { goto next; } if (caps) { if (check_caps_compatibility (factory, caps, &matched_caps)) { is_valid = TRUE; } } if (is_valid || !caps) { if (!matched_caps) { list = create_codec_cap_list (factory, direction, list, NULL); } else { gint i; for (i = 0; i < gst_caps_get_size (matched_caps); i++) { GstStructure *structure = gst_caps_get_structure (matched_caps, i); GstCaps *cur_caps = gst_caps_new_full (gst_structure_copy (structure), NULL); list = create_codec_cap_list (factory, direction, list, cur_caps); gst_caps_unref (cur_caps); } gst_caps_unref (matched_caps); } } next: walk = g_list_next (walk); } /* walk = result; while (walk) { factory = GST_ELEMENT_FACTORY (walk->data); DEBUG ("new refcnt is %d", GST_OBJECT_REFCOUNT_VALUE (GST_OBJECT (factory))); walk = g_list_next (walk); } */ gst_plugin_feature_list_free (result); return list; }
/* creates/returns a list of CodecCap based on given filter function and caps */ static GList * get_plugins_filtered_from_caps (FilterFunc filter, GstCaps *caps, GstPadDirection direction) { GList *walk, *result; GList *list = NULL; GstCaps *matched_caps = NULL; result = gst_registry_get_feature_list (gst_registry_get (), GST_TYPE_ELEMENT_FACTORY); result = g_list_sort (result, (GCompareFunc) compare_ranks); for (walk = result; walk; walk = walk->next) { GstElementFactory *factory = GST_ELEMENT_FACTORY (walk->data); /* Ignore unranked plugins */ if (gst_plugin_feature_get_rank (GST_PLUGIN_FEATURE (factory)) == GST_RANK_NONE) continue; if (!filter (factory)) continue; if (caps && !check_caps_compatibility (factory, caps, &matched_caps)) continue; if (!matched_caps) { list = create_codec_cap_list (factory, direction, list, NULL); } else { gint i; GPtrArray *capslist = g_ptr_array_new_with_free_func ( (GDestroyNotify) gst_caps_unref); while (gst_caps_get_size (matched_caps) > 0) { GstCaps *stolencaps = gst_caps_new_full ( gst_caps_steal_structure (matched_caps, 0), NULL); gboolean got_match = FALSE; for (i = 0; i < capslist->len; i++) { GstCaps *intersect = gst_caps_intersect (stolencaps, g_ptr_array_index (capslist, i)); if (gst_caps_is_empty (intersect)) { gst_caps_unref (intersect); } else { got_match = TRUE; gst_caps_unref (g_ptr_array_index (capslist, i)); g_ptr_array_index (capslist, i) = intersect; } } if (got_match) gst_caps_unref (stolencaps); else g_ptr_array_add (capslist, stolencaps); } gst_caps_unref (matched_caps); for (i = 0; i < capslist->len; i++) list = create_codec_cap_list (factory, direction, list, g_ptr_array_index (capslist, i)); g_ptr_array_unref (capslist); } } gst_plugin_feature_list_free (result); return list; }
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(); }
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); }