EXPORT_C #endif GstPluginFeature * gst_plugin_feature_load (GstPluginFeature * feature) { GstPlugin *plugin; GstPluginFeature *real_feature; g_return_val_if_fail (feature != NULL, FALSE); g_return_val_if_fail (GST_IS_PLUGIN_FEATURE (feature), FALSE); GST_DEBUG ("loading plugin for feature %p; '%s'", feature, GST_PLUGIN_FEATURE_NAME (feature)); if (feature->loaded) return gst_object_ref (feature); GST_DEBUG ("loading plugin %s", feature->plugin_name); plugin = gst_plugin_load_by_name (feature->plugin_name); if (!plugin) goto load_failed; GST_DEBUG ("loaded plugin %s", feature->plugin_name); gst_object_unref (plugin); real_feature = gst_registry_lookup_feature (gst_registry_get_default (), feature->name); if (real_feature == NULL) goto disappeared; else if (!real_feature->loaded) goto not_found; return real_feature; /* ERRORS */ load_failed: { GST_WARNING ("Failed to load plugin containing feature '%s'.", GST_PLUGIN_FEATURE_NAME (feature)); return NULL; } disappeared: { GST_INFO ("Loaded plugin containing feature '%s', but feature disappeared.", feature->name); return NULL; } not_found: { GST_INFO ("Tried to load plugin containing feature '%s', but feature was " "not found.", real_feature->name); return NULL; } }
static gint type_find_factory_rank_cmp (gconstpointer fac1, gconstpointer fac2) { if (GST_PLUGIN_FEATURE (fac1)->rank != GST_PLUGIN_FEATURE (fac2)->rank) return GST_PLUGIN_FEATURE (fac2)->rank - GST_PLUGIN_FEATURE (fac1)->rank; /* to make the order in which things happen more deterministic, * sort by name when the ranks are the same. */ return strcmp (GST_PLUGIN_FEATURE_NAME (fac1), GST_PLUGIN_FEATURE_NAME (fac2)); }
static gint element_factory_rank_compare_func (gconstpointer a, gconstpointer b) { gint rank_a = gst_plugin_feature_get_rank (GST_PLUGIN_FEATURE (a)); gint rank_b = gst_plugin_feature_get_rank (GST_PLUGIN_FEATURE (b)); /* make order chosen in the end more determinable */ if (rank_a == rank_b) { const gchar *name_a = GST_PLUGIN_FEATURE_NAME (GST_PLUGIN_FEATURE (a)); const gchar *name_b = GST_PLUGIN_FEATURE_NAME (GST_PLUGIN_FEATURE (b)); return g_ascii_strcasecmp (name_a, name_b); } return rank_b - rank_a; }
/* Method: to_s * Returns: a String representing the factory. */ static VALUE rg_to_s (VALUE self) { GstIndexFactory *factory = RGST_INDEX_FACTORY (self); return rb_str_new_with_format ("Index: %s (%s)", GST_PLUGIN_FEATURE_NAME (factory), factory->longdesc); }
static VALUE rb_gst_elementfactory_to_s (VALUE self) { GstElementFactory *factory = RGST_ELEMENT_FACTORY (self); return rb_str_new_with_format ("Element: %s (%s)", GST_PLUGIN_FEATURE_NAME(factory), factory->details.longname); }
/** * gst_plugin_feature_type_name_filter: * @feature: the #GstPluginFeature * @data: the type and name to check against * * Compares type and name of plugin feature. Can be used with gst_filter_run(). * * Returns: TRUE if equal. */ gboolean gst_plugin_feature_type_name_filter (GstPluginFeature * feature, GstTypeNameData * data) { return ((data->type == 0 || data->type == G_OBJECT_TYPE (feature)) && (data->name == NULL || !strcmp (data->name, GST_PLUGIN_FEATURE_NAME (feature)))); }
static guint64 helper_find_get_length (gpointer data) { GstTypeFindHelper *helper = (GstTypeFindHelper *) data; GST_LOG_OBJECT (helper->obj, "'%s' called get_length, returning %" G_GUINT64_FORMAT, GST_PLUGIN_FEATURE_NAME (helper->factory), helper->size); return helper->size; }
static void gst_plugin_feature_finalize (GObject * object) { GstPluginFeature *feature = GST_PLUGIN_FEATURE_CAST (object); GST_DEBUG ("finalizing feature %p: '%s'", feature, GST_PLUGIN_FEATURE_NAME (feature)); g_free (feature->name); G_OBJECT_CLASS (parent_class)->finalize (object); }
/* * buf_helper_find_peek: * @data: helper data struct * @off: stream offset * @size: block size * * Get data pointer within a buffer. * * Returns: address inside the buffer or %NULL if buffer does not cover the * requested range. */ static guint8 * buf_helper_find_peek (gpointer data, gint64 off, guint size) { GstTypeFindBufHelper *helper; helper = (GstTypeFindBufHelper *) data; GST_LOG_OBJECT (helper->obj, "'%s' called peek (%" G_GINT64_FORMAT ", %u)", GST_PLUGIN_FEATURE_NAME (helper->factory), off, size); if (size == 0) return NULL; if (off < 0) { GST_LOG_OBJECT (helper->obj, "'%s' wanted to peek at end; not supported", GST_PLUGIN_FEATURE_NAME (helper->factory)); return NULL; } if ((off + size) <= helper->size) return helper->data + off; return NULL; }
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); }
/* * helper_find_suggest: * @data: helper data struct * @probability: probability of the match * @caps: caps of the type * * If given @probability is higher, replace previously store caps. */ static void helper_find_suggest (gpointer data, guint probability, const GstCaps * caps) { GstTypeFindHelper *helper = (GstTypeFindHelper *) data; GST_LOG_OBJECT (helper->obj, "'%s' called called suggest (%u, %" GST_PTR_FORMAT ")", GST_PLUGIN_FEATURE_NAME (helper->factory), probability, caps); if (probability > helper->best_probability) { GstCaps *copy = gst_caps_copy (caps); gst_caps_replace (&helper->caps, copy); gst_caps_unref (copy); helper->best_probability = probability; } }
/* * buf_helper_find_suggest: * @data: helper data struct * @probability: probability of the match * @caps: caps of the type * * If given @probability is higher, replace previously store caps. */ static void buf_helper_find_suggest (gpointer data, guint probability, const GstCaps * caps) { GstTypeFindBufHelper *helper = (GstTypeFindBufHelper *) data; GST_LOG_OBJECT (helper->obj, "'%s' called called suggest (%u, %" GST_PTR_FORMAT ")", GST_PLUGIN_FEATURE_NAME (helper->factory), probability, caps); /* Note: not >= as we call typefinders in order of rank, highest first */ if (probability > helper->best_probability) { GstCaps *copy = gst_caps_copy (caps); gst_caps_replace (&helper->caps, copy); gst_caps_unref (copy); helper->best_probability = probability; } }
/** * gst_type_find_helper_get_range_ext: * @obj: A #GstObject that will be passed as first argument to @func * @func: (scope call): A generic #GstTypeFindHelperGetRangeFunction that will * be used to access data at random offsets when doing the typefinding * @size: The length in bytes * @extension: extension of the media * @prob: (out) (allow-none): location to store the probability of the found * caps, or #NULL * * Utility function to do pull-based typefinding. Unlike gst_type_find_helper() * however, this function will use the specified function @func to obtain the * data needed by the typefind functions, rather than operating on a given * source pad. This is useful mostly for elements like tag demuxers which * strip off data at the beginning and/or end of a file and want to typefind * the stripped data stream before adding their own source pad (the specified * callback can then call the upstream peer pad with offsets adjusted for the * tag size, for example). * * When @extension is not NULL, this function will first try the typefind * functions for the given extension, which might speed up the typefinding * in many cases. * * Free-function: gst_caps_unref * * Returns: (transfer full): the #GstCaps corresponding to the data stream. * Returns #NULL if no #GstCaps matches the data stream. * * Since: 0.10.26 */ GstCaps * gst_type_find_helper_get_range_ext (GstObject * obj, GstTypeFindHelperGetRangeFunction func, guint64 size, const gchar * extension, GstTypeFindProbability * prob) { GstTypeFindHelper helper; GstTypeFind find; GSList *walk; GList *l, *type_list; GstCaps *result = NULL; gint pos = 0; g_return_val_if_fail (GST_IS_OBJECT (obj), NULL); g_return_val_if_fail (func != NULL, NULL); helper.buffers = NULL; helper.size = size; helper.last_offset = 0; helper.func = func; helper.best_probability = GST_TYPE_FIND_NONE; helper.caps = NULL; helper.obj = obj; find.data = &helper; find.peek = helper_find_peek; find.suggest = helper_find_suggest; if (size == 0 || size == (guint64) - 1) { find.get_length = NULL; } else { find.get_length = helper_find_get_length; } type_list = gst_type_find_factory_get_list (); /* move the typefinders for the extension first in the list. The idea is that * when one of them returns MAX we don't need to search further as there is a * very high chance we got the right type. */ if (extension) { GList *next; GST_LOG_OBJECT (obj, "sorting typefind for extension %s to head", extension); for (l = type_list; l; l = next) { GstTypeFindFactory *factory; gint i; gchar **ext; next = l->next; factory = GST_TYPE_FIND_FACTORY (l->data); ext = gst_type_find_factory_get_extensions (factory); if (ext == NULL) continue; GST_LOG_OBJECT (obj, "testing factory %s for extension %s", GST_PLUGIN_FEATURE_NAME (factory), extension); for (i = 0; ext[i]; i++) { if (strcmp (ext[i], extension) == 0) { /* found extension, move in front */ GST_LOG_OBJECT (obj, "moving typefind for extension %s to head", extension); /* remove entry from list */ type_list = g_list_delete_link (type_list, l); /* insert at the position */ type_list = g_list_insert (type_list, factory, pos); /* next element will be inserted after this one */ pos++; break; } } } } for (l = type_list; l; l = l->next) { helper.factory = GST_TYPE_FIND_FACTORY (l->data); gst_type_find_factory_call_function (helper.factory, &find); if (helper.best_probability >= GST_TYPE_FIND_MAXIMUM) break; } gst_plugin_feature_list_free (type_list); for (walk = helper.buffers; walk; walk = walk->next) gst_buffer_unref (GST_BUFFER_CAST (walk->data)); g_slist_free (helper.buffers); if (helper.best_probability > 0) result = helper.caps; if (prob) *prob = helper.best_probability; GST_LOG_OBJECT (obj, "Returning %" GST_PTR_FORMAT " (probability = %u)", result, (guint) helper.best_probability); return result; }
static gboolean gst_plugin_feature_name_filter (GstPluginFeature * feature, const gchar * name) { return !strcmp (name, GST_PLUGIN_FEATURE_NAME (feature)); }
/** * gst_element_factory_create: * @factory: factory to instantiate * @name: (allow-none): name of new element, or NULL to automatically create * a unique name * * Create a new element of the type defined by the given elementfactory. * It will be given the name supplied, since all elements require a name as * their first argument. * * Returns: (transfer full): new #GstElement or NULL if the element couldn't * be created */ GstElement * gst_element_factory_create (GstElementFactory * factory, const gchar * name) { GstElement *element; GstElementClass *oclass; GstElementFactory *newfactory; g_return_val_if_fail (factory != NULL, NULL); newfactory = GST_ELEMENT_FACTORY (gst_plugin_feature_load (GST_PLUGIN_FEATURE (factory))); if (newfactory == NULL) goto load_failed; factory = newfactory; if (name) GST_INFO ("creating element \"%s\" named \"%s\"", GST_PLUGIN_FEATURE_NAME (factory), GST_STR_NULL (name)); else GST_INFO ("creating element \"%s\"", GST_PLUGIN_FEATURE_NAME (factory)); if (factory->type == 0) goto no_type; /* create an instance of the element, cast so we don't assert on NULL * also set name as early as we can */ if (name) element = GST_ELEMENT_CAST (g_object_new (factory->type, "name", name, NULL)); else element = GST_ELEMENT_CAST (g_object_newv (factory->type, 0, NULL)); if (G_UNLIKELY (element == NULL)) goto no_element; /* fill in the pointer to the factory in the element class. The * class will not be unreffed currently. * Be thread safe as there might be 2 threads creating the first instance of * an element at the same moment */ oclass = GST_ELEMENT_GET_CLASS (element); if (!G_ATOMIC_POINTER_COMPARE_AND_EXCHANGE (&oclass->elementfactory, NULL, factory)) gst_object_unref (factory); GST_DEBUG ("created element \"%s\"", GST_PLUGIN_FEATURE_NAME (factory)); return element; /* ERRORS */ load_failed: { GST_WARNING_OBJECT (factory, "loading plugin containing feature %s returned NULL!", name); return NULL; } no_type: { GST_WARNING_OBJECT (factory, "factory has no type"); gst_object_unref (factory); return NULL; } no_element: { GST_WARNING_OBJECT (factory, "could not create element"); gst_object_unref (factory); return NULL; } }
static void print_element_list (gboolean print_all) { int plugincount = 0, featurecount = 0; GList *plugins, *orig_plugins; orig_plugins = plugins = gst_default_registry_get_plugin_list (); while (plugins) { GList *features, *orig_features; GstPlugin *plugin; plugin = (GstPlugin *) (plugins->data); plugins = g_list_next (plugins); plugincount++; orig_features = features = gst_registry_get_feature_list_by_plugin (gst_registry_get_default (), plugin->desc.name); while (features) { GstPluginFeature *feature; feature = GST_PLUGIN_FEATURE (features->data); featurecount++; if (GST_IS_ELEMENT_FACTORY (feature)) { GstElementFactory *factory; factory = GST_ELEMENT_FACTORY (feature); if (print_all) print_element_info (factory, TRUE); else g_print ("%s: %s: %s\n", plugin->desc.name, GST_PLUGIN_FEATURE_NAME (factory), gst_element_factory_get_longname (factory)); } else if (GST_IS_INDEX_FACTORY (feature)) { GstIndexFactory *factory; factory = GST_INDEX_FACTORY (feature); if (!print_all) g_print ("%s: %s: %s\n", plugin->desc.name, GST_PLUGIN_FEATURE_NAME (factory), factory->longdesc); } else if (GST_IS_TYPE_FIND_FACTORY (feature)) { GstTypeFindFactory *factory; factory = GST_TYPE_FIND_FACTORY (feature); if (!print_all) g_print ("%s: %s: ", plugin->desc.name, gst_plugin_feature_get_name (feature)); if (factory->extensions) { guint i = 0; while (factory->extensions[i]) { if (!print_all) g_print ("%s%s", i > 0 ? ", " : "", factory->extensions[i]); i++; } if (!print_all) g_print ("\n"); } else { if (!print_all) g_print ("no extensions\n"); } } else { if (!print_all) n_print ("%s: %s (%s)\n", plugin->desc.name, GST_PLUGIN_FEATURE_NAME (feature), g_type_name (G_OBJECT_TYPE (feature))); } features = g_list_next (features); } gst_plugin_feature_list_free (orig_features); } gst_plugin_list_free (orig_plugins); g_print ("\n"); g_print (_("Total count: ")); g_print (ngettext ("%d plugin", "%d plugins", plugincount), plugincount); g_print (", "); g_print (ngettext ("%d feature", "%d features", featurecount), featurecount); g_print ("\n"); }
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(); }
static gboolean filter_func (GstPluginFeature * feature, gpointer user_data) { return (g_str_has_prefix (GST_PLUGIN_FEATURE_NAME (feature), "libvisual_")); }
static gint print_element_info (GstElementFactory * factory) { GstElement *element; #ifndef GST_DISABLE_LOADSAVE GstObjectClass *gstobject_class; #endif GstElementClass *gstelement_class; GList *pads; GstPad *pad; GstStaticPadTemplate *padtemplate; gint maxlevel = 0; element = gst_element_factory_create (factory, "element"); if (!element) { g_print ("couldn't construct element for some reason\n"); return -1; } PUT_START_TAG (0, "element"); PUT_ESCAPED (1, "name", GST_PLUGIN_FEATURE_NAME (factory)); #ifndef GST_DISABLE_LOADSAVE gstobject_class = GST_OBJECT_CLASS (G_OBJECT_GET_CLASS (element)); #endif gstelement_class = GST_ELEMENT_CLASS (G_OBJECT_GET_CLASS (element)); PUT_START_TAG (1, "details"); PUT_ESCAPED (2, "long-name", factory->details.longname); PUT_ESCAPED (2, "class", factory->details.klass); PUT_ESCAPED (2, "description", factory->details.description); PUT_ESCAPED (2, "authors", factory->details.author); PUT_END_TAG (1, "details"); output_hierarchy (G_OBJECT_TYPE (element), 0, &maxlevel); PUT_START_TAG (1, "pad-templates"); if (factory->numpadtemplates) { pads = factory->staticpadtemplates; while (pads) { padtemplate = (GstStaticPadTemplate *) (pads->data); pads = g_list_next (pads); PUT_START_TAG (2, "pad-template"); PUT_ESCAPED (3, "name", padtemplate->name_template); if (padtemplate->direction == GST_PAD_SRC) PUT_ESCAPED (3, "direction", "src"); else if (padtemplate->direction == GST_PAD_SINK) PUT_ESCAPED (3, "direction", "sink"); else PUT_ESCAPED (3, "direction", "unknown"); if (padtemplate->presence == GST_PAD_ALWAYS) PUT_ESCAPED (3, "presence", "always"); else if (padtemplate->presence == GST_PAD_SOMETIMES) PUT_ESCAPED (3, "presence", "sometimes"); else if (padtemplate->presence == GST_PAD_REQUEST) { PUT_ESCAPED (3, "presence", "request"); PUT_ESCAPED (3, "request-function", GST_DEBUG_FUNCPTR_NAME (gstelement_class->request_new_pad)); } else PUT_ESCAPED (3, "presence", "unknown"); if (padtemplate->static_caps.string) { print_caps (gst_static_caps_get (&padtemplate->static_caps), 3); } PUT_END_TAG (2, "pad-template"); } } PUT_END_TAG (1, "pad-templates"); PUT_START_TAG (1, "element-flags"); PUT_END_TAG (1, "element-flags"); if (GST_IS_BIN (element)) { PUT_START_TAG (1, "bin-flags"); PUT_END_TAG (1, "bin-flags"); } PUT_START_TAG (1, "element-implementation"); PUT_STRING (2, "<state-change function=\"%s\"/>", GST_DEBUG_FUNCPTR_NAME (gstelement_class->change_state)); #ifndef GST_DISABLE_LOADSAVE PUT_STRING (2, "<save function=\"%s\"/>", GST_DEBUG_FUNCPTR_NAME (gstobject_class->save_thyself)); PUT_STRING (2, "<load function=\"%s\"/>", GST_DEBUG_FUNCPTR_NAME (gstobject_class->restore_thyself)); #endif PUT_END_TAG (1, "element-implementation"); PUT_START_TAG (1, "clocking-interaction"); if (gst_element_requires_clock (element)) { PUT_STRING (2, "<requires-clock/>"); } if (gst_element_provides_clock (element)) { GstClock *clock; clock = gst_element_get_clock (element); if (clock) PUT_STRING (2, "<provides-clock name=\"%s\"/>", GST_OBJECT_NAME (clock)); } PUT_END_TAG (1, "clocking-interaction"); if (gst_element_is_indexable (element)) { PUT_STRING (1, "<indexing-capabilities/>"); } PUT_START_TAG (1, "pads"); if (element->numpads) { const GList *pads; pads = element->pads; while (pads) { pad = GST_PAD (pads->data); pads = g_list_next (pads); PUT_START_TAG (2, "pad"); PUT_ESCAPED (3, "name", gst_pad_get_name (pad)); if (gst_pad_get_direction (pad) == GST_PAD_SRC) PUT_ESCAPED (3, "direction", "src"); else if (gst_pad_get_direction (pad) == GST_PAD_SINK) PUT_ESCAPED (3, "direction", "sink"); else PUT_ESCAPED (3, "direction", "unknown"); if (pad->padtemplate) PUT_ESCAPED (3, "template", pad->padtemplate->name_template); PUT_START_TAG (3, "implementation"); if (pad->chainfunc) PUT_STRING (4, "<chain-based function=\"%s\"/>", GST_DEBUG_FUNCPTR_NAME (pad->chainfunc)); if (pad->getrangefunc) PUT_STRING (4, "<get-range-based function=\"%s\"/>", GST_DEBUG_FUNCPTR_NAME (pad->getrangefunc)); if (pad->eventfunc != gst_pad_event_default) PUT_STRING (4, "<event-function function=\"%s\"/>", GST_DEBUG_FUNCPTR_NAME (pad->eventfunc)); if (pad->queryfunc != gst_pad_query_default) PUT_STRING (4, "<query-function function=\"%s\"/>", GST_DEBUG_FUNCPTR_NAME (pad->queryfunc)); if (pad->querytypefunc != gst_pad_get_query_types_default) { PUT_STRING (4, "<query-type-func function=\"%s\">", GST_DEBUG_FUNCPTR_NAME (pad->querytypefunc)); print_query_types (gst_pad_get_query_types (pad), 5); PUT_END_TAG (4, "query-type-func"); } if (pad->iterintlinkfunc != gst_pad_iterate_internal_links_default) PUT_STRING (4, "<iterintlink-function function=\"%s\"/>", GST_DEBUG_FUNCPTR_NAME (pad->iterintlinkfunc)); if (pad->bufferallocfunc) PUT_STRING (4, "<bufferalloc-function function=\"%s\"/>", GST_DEBUG_FUNCPTR_NAME (pad->bufferallocfunc)); PUT_END_TAG (3, "implementation"); if (pad->caps) { print_caps (pad->caps, 3); } PUT_END_TAG (2, "pad"); } } PUT_END_TAG (1, "pads"); print_element_properties (element, 1); print_element_signals (element, 1); /* for compound elements */ /* FIXME: gst_bin_get_list does not exist anymore if (GST_IS_BIN (element)) { GList *children; GstElement *child; PUT_START_TAG (1, "children"); children = (GList *) gst_bin_get_list (GST_BIN (element)); while (children) { child = GST_ELEMENT (children->data); children = g_list_next (children); PUT_ESCAPED (2, "child", GST_ELEMENT_NAME (child)); } PUT_END_TAG (1, "children"); } */ PUT_END_TAG (0, "element"); return 0; }
/* * helper_find_peek: * @data: helper data struct * @off: stream offset * @size: block size * * Get data pointer within a stream. Keeps a cache of read buffers (partly * for performance reasons, but mostly because pointers returned by us need * to stay valid until typefinding has finished) * * Returns: address of the data or %NULL if buffer does not cover the * requested range. */ static guint8 * helper_find_peek (gpointer data, gint64 offset, guint size) { GstTypeFindHelper *helper; GstBuffer *buffer; GstFlowReturn ret; GSList *insert_pos = NULL; guint buf_size; guint64 buf_offset; GstCaps *caps; helper = (GstTypeFindHelper *) data; GST_LOG_OBJECT (helper->obj, "'%s' called peek (%" G_GINT64_FORMAT ", %u)", GST_PLUGIN_FEATURE_NAME (helper->factory), offset, size); if (size == 0) return NULL; if (offset < 0) { if (helper->size == -1 || helper->size < -offset) return NULL; offset += helper->size; } /* see if we have a matching buffer already in our list */ if (size > 0 && offset <= helper->last_offset) { GSList *walk; for (walk = helper->buffers; walk; walk = walk->next) { GstBuffer *buf = GST_BUFFER_CAST (walk->data); guint64 buf_offset = GST_BUFFER_OFFSET (buf); guint buf_size = GST_BUFFER_SIZE (buf); /* buffers are kept sorted by end offset (highest first) in the list, so * at this point we save the current position and stop searching if * we're after the searched end offset */ if (buf_offset <= offset) { if ((offset + size) < (buf_offset + buf_size)) { return GST_BUFFER_DATA (buf) + (offset - buf_offset); } } else if (offset + size >= buf_offset + buf_size) { insert_pos = walk; break; } } } buffer = NULL; /* some typefinders go in 1 byte steps over 1k of data and request * small buffers. It is really inefficient to pull each time, and pulling * a larger chunk is almost free. Trying to pull a larger chunk at the end * of the file is also not a problem here, we'll just get a truncated buffer * in that case (and we'll have to double-check the size we actually get * anyway, see below) */ ret = helper->func (helper->obj, offset, MAX (size, 4096), &buffer); if (ret != GST_FLOW_OK) goto error; caps = GST_BUFFER_CAPS (buffer); if (caps && !gst_caps_is_empty (caps) && !gst_caps_is_any (caps)) { GST_DEBUG ("buffer has caps %" GST_PTR_FORMAT ", suggest max probability", caps); gst_caps_replace (&helper->caps, caps); helper->best_probability = GST_TYPE_FIND_MAXIMUM; gst_buffer_unref (buffer); return NULL; } /* getrange might silently return shortened buffers at the end of a file, * we must, however, always return either the full requested data or NULL */ buf_offset = GST_BUFFER_OFFSET (buffer); buf_size = GST_BUFFER_SIZE (buffer); if ((buf_offset != -1 && buf_offset != offset) || buf_size < size) { GST_DEBUG ("dropping short buffer: %" G_GUINT64_FORMAT "-%" G_GUINT64_FORMAT " instead of %" G_GUINT64_FORMAT "-%" G_GUINT64_FORMAT, buf_offset, buf_offset + buf_size - 1, offset, offset + size - 1); gst_buffer_unref (buffer); return NULL; } if (insert_pos) { helper->buffers = g_slist_insert_before (helper->buffers, insert_pos, buffer); } else { /* if insert_pos is not set, our offset is bigger than the largest offset * we have so far; since we keep the list sorted with highest offsets * first, we need to prepend the buffer to the list */ helper->last_offset = GST_BUFFER_OFFSET (buffer) + GST_BUFFER_SIZE (buffer); helper->buffers = g_slist_prepend (helper->buffers, buffer); } return GST_BUFFER_DATA (buffer); error: { GST_INFO ("typefind function returned: %s", gst_flow_get_name (ret)); return NULL; } }
static void print_plugin_features (GstPlugin * plugin) { GList *features; gint num_features = 0; gint num_elements = 0; gint num_types = 0; gint num_indexes = 0; gint num_other = 0; features = gst_registry_get_feature_list_by_plugin (gst_registry_get_default (), plugin->desc.name); while (features) { GstPluginFeature *feature; feature = GST_PLUGIN_FEATURE (features->data); if (GST_IS_ELEMENT_FACTORY (feature)) { GstElementFactory *factory; factory = GST_ELEMENT_FACTORY (feature); n_print (" %s: %s\n", GST_PLUGIN_FEATURE_NAME (factory), gst_element_factory_get_longname (factory)); num_elements++; } else if (GST_IS_INDEX_FACTORY (feature)) { GstIndexFactory *factory; factory = GST_INDEX_FACTORY (feature); n_print (" %s: %s\n", GST_OBJECT_NAME (factory), factory->longdesc); num_indexes++; } else if (GST_IS_TYPE_FIND_FACTORY (feature)) { GstTypeFindFactory *factory; factory = GST_TYPE_FIND_FACTORY (feature); if (factory->extensions) { guint i = 0; g_print ("%s: %s: ", plugin->desc.name, gst_plugin_feature_get_name (feature)); while (factory->extensions[i]) { g_print ("%s%s", i > 0 ? ", " : "", factory->extensions[i]); i++; } g_print ("\n"); } else g_print ("%s: %s: no extensions\n", plugin->desc.name, gst_plugin_feature_get_name (feature)); num_types++; } else { n_print (" %s (%s)\n", gst_object_get_name (GST_OBJECT (feature)), g_type_name (G_OBJECT_TYPE (feature))); num_other++; } num_features++; features = g_list_next (features); } n_print ("\n"); n_print (" %d features:\n", num_features); if (num_elements > 0) n_print (" +-- %d elements\n", num_elements); if (num_types > 0) n_print (" +-- %d types\n", num_types); if (num_indexes > 0) n_print (" +-- %d indexes\n", num_indexes); if (num_other > 0) n_print (" +-- %d other objects\n", num_other); n_print ("\n"); }
static void print_plugin_automatic_install_info_codecs (GstElementFactory * factory) { GstPadDirection direction; const gchar *type_name; const gchar *klass; const GList *static_templates, *l; GstCaps *caps = NULL; guint i, num; klass = gst_element_factory_get_klass (factory); g_return_if_fail (klass != NULL); if (strstr (klass, "Demuxer") || strstr (klass, "Decoder") || strstr (klass, "Depay") || strstr (klass, "Parser")) { type_name = "decoder"; direction = GST_PAD_SINK; } else if (strstr (klass, "Muxer") || strstr (klass, "Encoder") || strstr (klass, "Pay")) { type_name = "encoder"; direction = GST_PAD_SRC; } else { return; } /* decoder/demuxer sink pads should always be static and there should only * be one, the same applies to encoders/muxers and source pads */ static_templates = gst_element_factory_get_static_pad_templates (factory); for (l = static_templates; l != NULL; l = l->next) { GstStaticPadTemplate *tmpl = NULL; tmpl = (GstStaticPadTemplate *) l->data; if (tmpl->direction == direction) { caps = gst_static_pad_template_get_caps (tmpl); break; } } if (caps == NULL) { g_printerr ("Couldn't find static pad template for %s '%s'\n", type_name, GST_PLUGIN_FEATURE_NAME (factory)); return; } caps = gst_caps_make_writable (caps); num = gst_caps_get_size (caps); for (i = 0; i < num; ++i) { GstStructure *s; gchar *s_str; s = gst_caps_get_structure (caps, i); /* remove fields that are almost always just MIN-MAX of some sort * in order to make the caps look less messy */ gst_structure_remove_field (s, "pixel-aspect-ratio"); gst_structure_remove_field (s, "framerate"); gst_structure_remove_field (s, "channels"); gst_structure_remove_field (s, "width"); gst_structure_remove_field (s, "height"); gst_structure_remove_field (s, "rate"); gst_structure_remove_field (s, "depth"); gst_structure_remove_field (s, "clock-rate"); s_str = gst_structure_to_string (s); g_print ("%s-%s\n", type_name, s_str); g_free (s_str); } gst_caps_unref (caps); }