static const char *Gstreamer_FindMatch(const char *strcaps) { struct typeinfo data; GList *list, *copy; guint bestrank = 0; GstElementFactory *bestfactory = NULL; GstCaps *caps = gst_caps_from_string(strcaps); TRACE("%s\n", strcaps); data.caps = caps; data.type = "Decoder"; copy = gst_registry_feature_filter(gst_registry_get(), match_element, 0, &data); for (list = copy; list; list = list->next) { GstElementFactory *factory = (GstElementFactory*)list->data; guint rank; rank = gst_plugin_feature_get_rank(GST_PLUGIN_FEATURE(factory)); if (rank > bestrank || !bestrank) { bestrank = rank; bestfactory = factory; } } gst_caps_unref(caps); g_list_free(copy); if (!bestfactory) { FIXME("Could not find plugin for %s\n", strcaps); return NULL; } return gst_plugin_feature_get_name(GST_PLUGIN_FEATURE(bestfactory)); }
static int print_element_info (GstElementFactory * factory, gboolean print_names) { GstElement *element; gint maxlevel = 0; factory = GST_ELEMENT_FACTORY (gst_plugin_feature_load (GST_PLUGIN_FEATURE (factory))); if (!factory) { g_print ("element plugin couldn't be loaded\n"); return -1; } element = gst_element_factory_create (factory, NULL); if (!element) { g_print ("couldn't construct element for some reason\n"); return -1; } if (print_names) _name = g_strdup_printf ("%s: ", GST_PLUGIN_FEATURE (factory)->name); else _name = NULL; print_factory_details_info (factory); if (GST_PLUGIN_FEATURE (factory)->plugin_name) { GstPlugin *plugin; plugin = gst_registry_find_plugin (gst_registry_get_default (), GST_PLUGIN_FEATURE (factory)->plugin_name); if (plugin) { print_plugin_info (plugin); } } print_hierarchy (G_OBJECT_TYPE (element), 0, &maxlevel); print_interfaces (G_OBJECT_TYPE (element)); print_pad_templates_info (element, factory); print_element_flag_info (element); print_implementation_info (element); print_clocking_info (element); print_index_info (element); print_uri_handler_info (element); print_pad_info (element); print_element_properties_info (element); print_signal_info (element); print_children_info (element); gst_object_unref (element); gst_object_unref (factory); g_free (_name); return 0; }
void gstsharp_gst_index_factory_set_plugin (GstIndexFactory * factory, GstPlugin * plugin) { if (!plugin) return; GST_PLUGIN_FEATURE (factory)->plugin_name = g_strdup (plugin->desc.name); GST_PLUGIN_FEATURE (factory)->loaded = TRUE; }
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 void print_factory_details_info (GstElementFactory * factory) { n_print ("Factory Details:\n"); n_print (" Long name:\t%s\n", factory->details.longname); n_print (" Class:\t%s\n", factory->details.klass); n_print (" Description:\t%s\n", factory->details.description); n_print (" Author(s):\t%s\n", factory->details.author); n_print (" Rank:\t\t%s (%d)\n", get_rank_name (GST_PLUGIN_FEATURE (factory)->rank), GST_PLUGIN_FEATURE (factory)->rank); n_print ("\n"); }
/* * 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; }
void test_registry() { GList *g; GstRegistry *registry; //xmlfile = "test_registry"; std_log(LOG_FILENAME_LINE, "Test Started test_registry"); registry = gst_registry_get_default (); for (g = registry->plugins; g; g = g->next) { GstPlugin *plugin = GST_PLUGIN (g->data); ASSERT_OBJECT_REFCOUNT (plugin, "plugin in registry", 1); GST_DEBUG ("refcount %d %s", GST_OBJECT_REFCOUNT_VALUE (plugin), plugin->desc.name); } for (g = registry->features; g; g = g->next) { GstPluginFeature *feature = GST_PLUGIN_FEATURE (g->data); fail_if (GST_OBJECT_REFCOUNT_VALUE (feature) != 1, "Feature in registry should have refcount of 1"); GST_DEBUG ("refcount %d %s", GST_OBJECT_REFCOUNT_VALUE (feature), feature->name); } std_log(LOG_FILENAME_LINE, "Test Successful"); create_xml(0); }
/* Get the intersection of parser caps and available (sorted) decoders */ static GstCaps * get_parser_caps_filter (GstDecodebin3 * dbin, GstCaps * caps) { GList *tmp; GstCaps *filter_caps = gst_caps_new_empty (); g_mutex_lock (&dbin->factories_lock); gst_decode_bin_update_factories_list (dbin); for (tmp = dbin->decoder_factories; tmp; tmp = tmp->next) { GstElementFactory *factory = (GstElementFactory *) tmp->data; GstCaps *tcaps, *intersection; const GList *tmps; GST_LOG ("Trying factory %s", gst_plugin_feature_get_name (GST_PLUGIN_FEATURE (factory))); for (tmps = gst_element_factory_get_static_pad_templates (factory); tmps; tmps = tmps->next) { GstStaticPadTemplate *st = (GstStaticPadTemplate *) tmps->data; if (st->direction != GST_PAD_SINK || st->presence != GST_PAD_ALWAYS) continue; tcaps = gst_static_pad_template_get_caps (st); intersection = gst_caps_intersect_full (tcaps, caps, GST_CAPS_INTERSECT_FIRST); filter_caps = gst_caps_merge (filter_caps, intersection); gst_caps_unref (tcaps); } } g_mutex_unlock (&dbin->factories_lock); GST_DEBUG_OBJECT (dbin, "Got filter caps %" GST_PTR_FORMAT, filter_caps); return filter_caps; }
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); }
static gboolean check_parser_caps_filter (GstDecodebin3 * dbin, GstCaps * caps) { GList *tmp; gboolean res = FALSE; g_mutex_lock (&dbin->factories_lock); gst_decode_bin_update_factories_list (dbin); for (tmp = dbin->decoder_factories; tmp; tmp = tmp->next) { GstElementFactory *factory = (GstElementFactory *) tmp->data; GstCaps *tcaps; const GList *tmps; GST_LOG ("Trying factory %s", gst_plugin_feature_get_name (GST_PLUGIN_FEATURE (factory))); for (tmps = gst_element_factory_get_static_pad_templates (factory); tmps; tmps = tmps->next) { GstStaticPadTemplate *st = (GstStaticPadTemplate *) tmps->data; if (st->direction != GST_PAD_SINK || st->presence != GST_PAD_ALWAYS) continue; tcaps = gst_static_pad_template_get_caps (st); if (gst_caps_can_intersect (tcaps, caps)) { res = TRUE; gst_caps_unref (tcaps); goto beach; } gst_caps_unref (tcaps); } } beach: g_mutex_unlock (&dbin->factories_lock); GST_DEBUG_OBJECT (dbin, "Can intersect : %d", res); return res; }
static void conference_element_added (FsElementAddedNotifier *notifier, GstBin *bin, GstElement *element, gpointer user_data) { GstElementFactory *factory; const gchar *name; factory = gst_element_get_factory (element); name = gst_plugin_feature_get_name (GST_PLUGIN_FEATURE (factory)); if (!tp_strdiff (name, "x264enc")) { /* Ensure that the encoder creates the baseline profile */ g_object_set (element, "byte-stream", TRUE, "bframes", 0, "b-adapt", FALSE, "cabac", FALSE, "dct8x8", FALSE, NULL); } else if (!tp_strdiff (name, "gstrtpbin")) { /* Lower the jitterbuffer latency to make it more suitable for video * conferencing */ g_object_set (element, "latency", 100, NULL); } }
static void print_factory_details_info (GstElementFactory * factory) { gchar **keys, **k; GstRank rank; char s[20]; rank = gst_plugin_feature_get_rank (GST_PLUGIN_FEATURE (factory)); n_print ("Factory Details:\n"); n_print (" %-25s%s (%d)\n", "Rank", get_rank_name (s, rank), rank); keys = gst_element_factory_get_metadata_keys (factory); if (keys != NULL) { for (k = keys; *k != NULL; ++k) { const gchar *val; gchar *key = *k; val = gst_element_factory_get_metadata (factory, key); key[0] = g_ascii_toupper (key[0]); n_print (" %-25s%s\n", key, val); } g_strfreev (keys); } n_print ("\n"); }
int iterate_plugins_elements (GstElementFactory *factory, GHashTable *hashtable) { GstElement *element; const GList *pads; GstStaticPadTemplate *padtemplate; const GstCaps * caps; int i; factory = GST_ELEMENT_FACTORY (gst_plugin_feature_load (GST_PLUGIN_FEATURE (factory))); if (!factory) { g_error ("element plugin couldn't be loaded"); return -1; } element = gst_element_factory_create (factory, NULL); if (!element) { g_error ("couldn't construct element for some reason"); return -1; } if (factory->numpadtemplates) { pads = factory->staticpadtemplates; while (pads) { padtemplate = (GstStaticPadTemplate *) (pads->data); pads = g_list_next (pads); if (padtemplate->direction == GST_PAD_SINK && padtemplate->presence == GST_PAD_ALWAYS && padtemplate->static_caps.string) { caps = gst_static_caps_get (&padtemplate->static_caps); if (caps != NULL && !gst_caps_is_any (caps) && !gst_caps_is_empty (caps)) { for (i = 0; i < gst_caps_get_size (caps); i++) { GstStructure *structure = gst_caps_get_structure (caps, i); const gchar *mime = gst_structure_get_name (structure); if (g_str_has_prefix (mime, "audio")) { g_hash_table_insert(hashtable, (gpointer)mime, (gpointer)&ONE); } } } } } } gst_object_unref (element); gst_object_unref (factory); return 0; }
static GstElement * try_codecs(GList *codecs, const gchar *name_prefix) { GList *l; gchar *element_name; for (l = codecs; l; l = l->next) { GstElementFactory *f = l->data; GstElement *e; element_name = g_strdup_printf("%s_%s_%u", name_prefix, gst_plugin_feature_get_name(GST_PLUGIN_FEATURE(f)), get_unique_id()); e = gst_element_factory_create(f, element_name); g_free(element_name); if (!e) continue; /* Try setting to READY. If this fails the codec does not work, for * example because the hardware codec is currently busy */ if (gst_element_set_state (e, GST_STATE_READY) != GST_STATE_CHANGE_SUCCESS) { gst_element_set_state (e, GST_STATE_NULL); gst_object_unref(e); continue; } return e; } return NULL; }
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; }
static void mutate_playbin (RBVisualizerPlugin *plugin, GstElement *playbin) { GstElement *current_vis_plugin; GstElement *current_video_sink; int playbin_flags; if (playbin == plugin->playbin) return; rb_debug ("mutating playbin"); /* check no one has already set the playbin properties we're interested in */ g_object_get (playbin, "vis-plugin", ¤t_vis_plugin, "video-sink", ¤t_video_sink, "flags", &playbin_flags, NULL); /* ignore fakesinks */ if (current_video_sink != NULL) { const char *factoryname; GstElementFactory *factory; factory = gst_element_get_factory (current_video_sink); factoryname = gst_plugin_feature_get_name (GST_PLUGIN_FEATURE (factory)); if (strcmp (factoryname, "fakesink") == 0) { g_object_unref (current_video_sink); current_video_sink = NULL; } } if ((current_vis_plugin != NULL) || (current_video_sink != NULL)) { g_warning ("sink and/or vis plugin already set on playbin"); if (current_vis_plugin) g_object_unref (current_vis_plugin); if (current_video_sink) g_object_unref (current_video_sink); return; } /* detach from old playbin (this should never really happen) */ if (plugin->playbin) { g_object_unref (plugin->playbin); } /* attach to new playbin */ plugin->playbin = g_object_ref (playbin); g_object_set (plugin->playbin, "video-sink", plugin->sink, NULL); /* start visualizer if it's supposed to be running */ if (plugin->visualizer != NULL) { playbin_flags |= PLAYBIN2_FLAG_VIS; g_object_set (plugin->playbin, "flags", playbin_flags, "vis-plugin", plugin->visualizer, NULL); } }
void GstVideoPlayerBackend::enableFactory(const gchar *name, gboolean enable) { GstRegistry *registry = gst_registry_get_default(); if (!registry) return; GstElementFactory *factory = gst_element_factory_find(name); if (!factory) return; if (enable) gst_plugin_feature_set_rank(GST_PLUGIN_FEATURE(factory), GST_RANK_PRIMARY + 1); else gst_plugin_feature_set_rank(GST_PLUGIN_FEATURE(factory), GST_RANK_NONE); gst_registry_add_feature(registry, GST_PLUGIN_FEATURE(factory)); }
static const gchar * factory_name_from_element (GstElement *element) { GstElementFactory *factory = gst_element_get_factory (element); if (factory) return gst_plugin_feature_get_name (GST_PLUGIN_FEATURE (factory)); else return NULL; }
static void print_factory_details_info (GstElementFactory * factory) { char s[20]; n_print ("Factory Details:\n"); n_print (" Long name:\t%s\n", factory->details.longname); n_print (" Class:\t%s\n", factory->details.klass); n_print (" Description:\t%s\n", factory->details.description); n_print (" Author(s):\t%s\n", factory->details.author); n_print (" Rank:\t\t%s (%d)\n", get_rank_name (s, GST_PLUGIN_FEATURE (factory)->rank), GST_PLUGIN_FEATURE (factory)->rank); if (factory->meta_data != NULL) { gst_structure_foreach ((GstStructure *) factory->meta_data, print_factory_details_meta_data, NULL); } n_print ("\n"); }
static gint find_composition_func (const GValue * velement) { GstElement *element = g_value_get_object (velement); GstElementFactory *fac = gst_element_get_factory (element); const gchar *name = gst_plugin_feature_get_name (GST_PLUGIN_FEATURE (fac)); if (g_strcmp0 (name, "gnlcomposition") == 0) return 0; return 1; }
gboolean rb_gst_encoder_set_encoding_style (GstElement *encoder, const char *style) { GstElementFactory *factory; char *group_name; char **keys; int i; factory = gst_element_get_factory (encoder); group_name = g_strdup_printf (ENCODER_STYLE_SETTINGS_PREFIX "%s-%s", gst_plugin_feature_get_name (GST_PLUGIN_FEATURE (factory)), style); rb_debug ("applying settings from %s", group_name); keys = g_key_file_get_keys (get_target_keyfile (), group_name, NULL, NULL); if (keys == NULL) { rb_debug ("nothing to apply"); g_free (group_name); return FALSE; } for (i = 0; keys[i] != NULL; i++) { GParamSpec *pspec; GValue v = {0,}; char *value; pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (encoder), keys[i]); if (pspec == NULL) { rb_debug ("couldn't find property %s", keys[i]); continue; } value = g_key_file_get_string (get_target_keyfile (), group_name, keys[i], NULL); if (value == NULL) { rb_debug ("couldn't get value for property %s", keys[i]); continue; } g_value_init (&v, pspec->value_type); if (gst_value_deserialize (&v, value)) { rb_debug ("applying value \"%s\" to property %s", value, keys[i]); g_object_set_property (G_OBJECT (encoder), keys[i], &v); } else { rb_debug ("couldn't deserialize value \"%s\" for property %s", value, keys[i]); } g_value_unset (&v); } g_strfreev (keys); g_free (group_name); return TRUE; }
gboolean gst_mem_index_plugin_init (GstPlugin * plugin) { GstIndexFactory *factory; factory = gst_index_factory_new ("memindex", "A index that stores entries in memory", gst_mem_index_get_type ()); if (factory == NULL) { g_warning ("failed to create memindex factory"); return FALSE; } GST_PLUGIN_FEATURE (factory)->plugin_name = plugin->desc.name; GST_PLUGIN_FEATURE (factory)->loaded = TRUE; gst_registry_add_feature (gst_registry_get_default (), GST_PLUGIN_FEATURE (factory)); return TRUE; }
gboolean gst_file_index_plugin_init (GstPlugin * plugin) { GstIndexFactory *factory; factory = gst_index_factory_new ("fileindex", "A index that stores entries in file", gst_file_index_get_type ()); if (factory == NULL) { return FALSE; } GST_PLUGIN_FEATURE (factory)->plugin_name = plugin->desc.name; GST_PLUGIN_FEATURE (factory)->loaded = TRUE; gst_registry_add_feature (gst_registry_get_default (), GST_PLUGIN_FEATURE (factory)); GST_DEBUG_CATEGORY_INIT (DC, "GST_FILEINDEX", 0, NULL); return TRUE; }
GstElement * _bp_equalizer_new (BansheePlayer *player) { GstElement *equalizer; if (player->equalizer_status == BP_EQ_STATUS_DISABLED) { return NULL; } if (player->equalizer_status == BP_EQ_STATUS_UNCHECKED || player->equalizer_status == BP_EQ_STATUS_USE_BUILTIN) { equalizer = gst_element_factory_make ("banshee-equalizer", "banshee-equalizer"); if (equalizer != NULL) { if (player->equalizer_status == BP_EQ_STATUS_UNCHECKED) { player->equalizer_status = BP_EQ_STATUS_USE_BUILTIN; bp_debug ("Using built-in equalizer element"); } return equalizer; } } if (player->equalizer_status == BP_EQ_STATUS_UNCHECKED || player->equalizer_status == BP_EQ_STATUS_USE_SYSTEM) { equalizer = gst_element_factory_make ("equalizer-10bands", "equalizer-10bands"); if (equalizer != NULL) { GstElementFactory *efactory = NULL; if (player->equalizer_status == BP_EQ_STATUS_USE_SYSTEM) { return equalizer; } efactory = gst_element_get_factory (equalizer); if (gst_plugin_feature_check_version (GST_PLUGIN_FEATURE (efactory), 0, 10, 9)) { bp_debug ("Using system (gst-plugins-good) equalizer element"); player->equalizer_status = BP_EQ_STATUS_USE_SYSTEM; return equalizer; } bp_debug ("Buggy system equalizer found. gst-plugins-good 0.10.9 or better " "required, or build Banshee with the built-in equalizer."); gst_object_unref (equalizer); } else { bp_debug ("No system equalizer found"); } } bp_debug ("No suitable equalizer element could be found, disabling EQ for this session"); player->equalizer_status = BP_EQ_STATUS_DISABLED; return NULL; }
static gboolean filter_parsers (GstElementFactory * factory, gpointer user_data) { if (GST_IS_ELEMENT_FACTORY (factory) == FALSE) return FALSE; if (g_strrstr (gst_element_factory_get_klass (factory), "Parser")) { if (gst_plugin_feature_get_rank (GST_PLUGIN_FEATURE (factory)) >= GST_RANK_PRIMARY) return TRUE; } return FALSE; }
static void debug_pipeline (GstDebugLevel level, const gchar *prefix, GList *pipeline) { GList *walk; GString *str; gboolean first = TRUE; if (gst_debug_category_get_threshold (GST_CAT_DEFAULT) < level) return; str = g_string_new (prefix); for (walk = pipeline; walk; walk = g_list_next (walk)) { GList *walk2; gboolean first_alt = TRUE; if (!first) g_string_append (str, " ->"); first = FALSE; for (walk2 = g_list_first (walk->data); walk2; walk2 = g_list_next (walk2)) { if (first_alt) g_string_append_printf (str, " %s", gst_plugin_feature_get_name (GST_PLUGIN_FEATURE (walk2->data))); else g_string_append_printf (str, " | %s", gst_plugin_feature_get_name (GST_PLUGIN_FEATURE (walk2->data))); first_alt = FALSE; } } GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, level, NULL, "%s", str->str); g_string_free (str, TRUE); }
void GStreamerReader::ElementAddedCb(GstBin *aPlayBin, GstElement *aElement, gpointer aUserData) { GstElementFactory *factory = gst_element_get_factory(aElement); if (!factory) return; const gchar *name = gst_plugin_feature_get_name(GST_PLUGIN_FEATURE(factory)); if (name && !strcmp(name, "uridecodebin")) { g_signal_connect(G_OBJECT(aElement), "autoplug-sort", G_CALLBACK(GStreamerReader::ElementFilterCb), aUserData); } }
static void element_added (FsElementAddedNotifier *notif, GstBin *bin, GstElement *element, gpointer user_data) { GstElementFactory *fact = gst_element_get_factory (element); if (!fact) return; if (strcmp (gst_plugin_feature_get_name (GST_PLUGIN_FEATURE (fact)), "theoradec")) return; ts_fail_unless (decoder_count == 0); decoder_count++; }
/*** * !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; }
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); }