void gst_auto_video_convert_update_factory_list (GstAutoVideoConvert * autovideoconvert) { /* use a static mutex to protect factories list and factories cookie */ g_static_mutex_lock (&factories_mutex); /* test if a factories list already exist or not */ if (!factories) { /* no factories list create it */ factories_cookie = gst_registry_get_feature_list_cookie (gst_registry_get ()); factories = gst_auto_video_convert_create_factory_list (autovideoconvert); } else { /* a factories list exist but is it up to date? */ if (factories_cookie != gst_registry_get_feature_list_cookie (gst_registry_get ())) { /* we need to update the factories list */ /* first free the old one */ gst_plugin_feature_list_free (factories); /* then create an updated one */ factories_cookie = gst_registry_get_feature_list_cookie (gst_registry_get ()); factories = gst_auto_video_convert_create_factory_list (autovideoconvert); } } g_static_mutex_unlock (&factories_mutex); }
GList* GStreamerFormatHelper::GetFactories() { NS_ASSERTION(sLoadOK, "GStreamer library not linked"); #if GST_VERSION_MAJOR >= 1 uint32_t cookie = gst_registry_get_feature_list_cookie(gst_registry_get()); #else uint32_t cookie = gst_default_registry_get_feature_list_cookie(); #endif if (cookie != mCookie) { g_list_free(mFactories); #if GST_VERSION_MAJOR >= 1 mFactories = gst_registry_feature_filter(gst_registry_get(), (GstPluginFeatureFilter)FactoryFilter, false, nullptr); #else mFactories = gst_default_registry_feature_filter((GstPluginFeatureFilter)FactoryFilter, false, nullptr); #endif mCookie = cookie; } return mFactories; }
static void setup (void) { GList *features, *f; GList *plugins, *p; gchar **ignorelist = NULL; const gchar *STATE_IGNORE_ELEMENTS = NULL; GST_DEBUG ("getting elements for package %s", PACKAGE); STATE_IGNORE_ELEMENTS = g_getenv ("GST_STATE_IGNORE_ELEMENTS"); fail_unless (STATE_IGNORE_ELEMENTS != NULL, "Test environment not set up!"); if (!g_getenv ("GST_NO_STATE_IGNORE_ELEMENTS")) { GST_DEBUG ("Will ignore element factories: '%s'", STATE_IGNORE_ELEMENTS); ignorelist = g_strsplit (STATE_IGNORE_ELEMENTS, " ", 0); } plugins = gst_registry_get_plugin_list (gst_registry_get ()); for (p = plugins; p; p = p->next) { GstPlugin *plugin = p->data; if (strcmp (gst_plugin_get_source (plugin), PACKAGE) != 0) continue; features = gst_registry_get_feature_list_by_plugin (gst_registry_get (), gst_plugin_get_name (plugin)); for (f = features; f; f = f->next) { GstPluginFeature *feature = f->data; const gchar *name; gboolean ignore = FALSE; if (!GST_IS_ELEMENT_FACTORY (feature)) continue; name = GST_OBJECT_NAME (feature); if (ignorelist) { gchar **s; for (s = ignorelist; s && *s; ++s) { if (g_str_has_prefix (name, *s)) { GST_DEBUG ("ignoring element %s", name); ignore = TRUE; } } if (ignore) continue; } GST_DEBUG ("adding element %s", name); elements = g_list_prepend (elements, g_strdup (name)); } gst_plugin_feature_list_free (features); } gst_plugin_list_free (plugins); g_strfreev (ignorelist); }
gboolean gst_tracer_register (GstPlugin * plugin, const gchar * name, GType type) { GstPluginFeature *existing_feature; GstRegistry *registry; GstTracerFactory *factory; g_return_val_if_fail (name != NULL, FALSE); g_return_val_if_fail (g_type_is_a (type, GST_TYPE_TRACER), FALSE); registry = gst_registry_get (); /* check if feature already exists, if it exists there is no need to update it * when the registry is getting updated, outdated plugins and all their * features are removed and readded. */ existing_feature = gst_registry_lookup_feature (registry, name); if (existing_feature) { GST_DEBUG_OBJECT (registry, "update existing feature %p (%s)", existing_feature, name); factory = GST_TRACER_FACTORY_CAST (existing_feature); factory->type = type; existing_feature->loaded = TRUE; gst_object_unref (existing_feature); return TRUE; } factory = g_object_newv (GST_TYPE_TRACER_FACTORY, 0, NULL); GST_DEBUG_OBJECT (factory, "new tracer factory for %s", name); gst_plugin_feature_set_name (GST_PLUGIN_FEATURE_CAST (factory), name); gst_plugin_feature_set_rank (GST_PLUGIN_FEATURE_CAST (factory), GST_RANK_NONE); factory->type = type; GST_DEBUG_OBJECT (factory, "tracer factory for %u:%s", (guint) type, g_type_name (type)); if (plugin && plugin->desc.name) { GST_PLUGIN_FEATURE_CAST (factory)->plugin_name = plugin->desc.name; /* interned string */ GST_PLUGIN_FEATURE_CAST (factory)->plugin = plugin; g_object_add_weak_pointer ((GObject *) plugin, (gpointer *) & GST_PLUGIN_FEATURE_CAST (factory)->plugin); } else { GST_PLUGIN_FEATURE_CAST (factory)->plugin_name = "NULL"; GST_PLUGIN_FEATURE_CAST (factory)->plugin = NULL; } GST_PLUGIN_FEATURE_CAST (factory)->loaded = TRUE; gst_registry_add_feature (gst_registry_get (), GST_PLUGIN_FEATURE_CAST (factory)); return TRUE; }
GList* GStreamerFormatHelper::GetFactories() { NS_ASSERTION(sLoadOK, "GStreamer library not linked"); uint32_t cookie = gst_registry_get_feature_list_cookie(gst_registry_get()); if (cookie != mCookie) { g_list_free(mFactories); mFactories = gst_registry_feature_filter(gst_registry_get(), (GstPluginFeatureFilter)FactoryFilter, false, nullptr); mCookie = cookie; } return mFactories; }
static Suite * gnonlin_suite (void) { Suite *s = suite_create ("nlecomposition"); TCase *tc_chain = tcase_create ("nlecomposition"); if (atexit (ges_deinit) != 0) { GST_ERROR ("failed to set ges_deinit as exit function"); } ges_init (); suite_add_tcase (s, tc_chain); tcase_add_test (tc_chain, test_change_object_start_stop_in_current_stack); tcase_add_test (tc_chain, test_remove_invalid_object); tcase_add_test (tc_chain, test_remove_last_object); tcase_add_test (tc_chain, test_dispose_on_commit); if (gst_registry_check_feature_version (gst_registry_get (), "audiomixer", 1, 0, 0)) { tcase_add_test (tc_chain, test_simple_audiomixer); } else { GST_WARNING ("audiomixer element not available, skipping 1 test"); } return s; }
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); }
/** * gst_plugin_feature_check_version: * @feature: a feature * @min_major: minimum required major version * @min_minor: minimum required minor version * @min_micro: minimum required micro version * * Checks whether the given plugin feature is at least * the required version * * Returns: #TRUE if the plugin feature has at least * the required version, otherwise #FALSE. */ gboolean gst_plugin_feature_check_version (GstPluginFeature * feature, guint min_major, guint min_minor, guint min_micro) { GstRegistry *registry; GstPlugin *plugin; gboolean ret = FALSE; g_return_val_if_fail (feature != NULL, FALSE); g_return_val_if_fail (GST_IS_PLUGIN_FEATURE (feature), FALSE); GST_DEBUG ("Looking up plugin '%s' containing plugin feature '%s'", feature->plugin_name, GST_OBJECT_NAME (feature)); registry = gst_registry_get (); plugin = gst_registry_find_plugin (registry, feature->plugin_name); if (plugin) { const gchar *ver_str; guint major, minor, micro, nano; gint nscan; ver_str = gst_plugin_get_version (plugin); g_return_val_if_fail (ver_str != NULL, FALSE); nscan = sscanf (ver_str, "%u.%u.%u.%u", &major, &minor, µ, &nano); GST_DEBUG ("version string '%s' parsed to %d values", ver_str, nscan); if (nscan >= 3) { if (major > min_major) ret = TRUE; else if (major < min_major) ret = FALSE; else if (minor > min_minor) ret = TRUE; else if (minor < min_minor) ret = FALSE; else if (micro > min_micro) ret = TRUE; /* micro is 1 smaller but we have a nano version, this is the upcoming * release of the requested version and we're ok then */ else if (nscan == 4 && nano > 0 && (micro + 1 == min_micro)) ret = TRUE; else ret = (micro == min_micro); GST_DEBUG ("Checking whether %u.%u.%u >= %u.%u.%u? %s", major, minor, micro, min_major, min_minor, min_micro, (ret) ? "yes" : "no"); } else { GST_WARNING ("Could not parse version string '%s' of plugin '%s'", ver_str, feature->plugin_name); } gst_object_unref (plugin); } else { GST_DEBUG ("Could not find plugin '%s'", feature->plugin_name); } return ret; }
static Suite * mpg123audiodec_suite (void) { GstRegistry *registry; Suite *s = suite_create ("mpg123audiodec"); TCase *tc_chain = tcase_create ("general"); registry = gst_registry_get (); suite_add_tcase (s, tc_chain); if (gst_registry_check_feature_version (registry, "filesrc", GST_VERSION_MAJOR, GST_VERSION_MINOR, 0) && gst_registry_check_feature_version (registry, "mpegaudioparse", GST_VERSION_MAJOR, GST_VERSION_MINOR, 0) && gst_registry_check_feature_version (registry, "appsrc", GST_VERSION_MAJOR, GST_VERSION_MINOR, 0)) { if (is_test_file_available (MP2_STREAM_FILENAME)) tcase_add_test (tc_chain, test_decode_mpeg1layer2); if (is_test_file_available (MP3_CBR_STREAM_FILENAME)) tcase_add_test (tc_chain, test_decode_mpeg1layer3_cbr); if (is_test_file_available (MP3_VBR_STREAM_FILENAME)) tcase_add_test (tc_chain, test_decode_mpeg1layer3_vbr); } tcase_add_test (tc_chain, test_decode_garbage_mpeg1layer2); tcase_add_test (tc_chain, test_decode_garbage_mpeg1layer3); return s; }
static void thumb_app_setup_play (ThumbApp *app) { GstElement *play; GstElement *audio_sink, *video_sink; GstRegistry *registry; GstPluginFeature *feature; play = gst_element_factory_make ("playbin", "play"); audio_sink = gst_element_factory_make ("fakesink", "audio-fake-sink"); video_sink = gst_element_factory_make ("fakesink", "video-fake-sink"); g_object_set (video_sink, "sync", TRUE, NULL); g_object_set (play, "audio-sink", audio_sink, "video-sink", video_sink, "flags", GST_PLAY_FLAG_VIDEO | GST_PLAY_FLAG_AUDIO, NULL); app->play = play; /* Disable the vaapi plugin as it will not work with the * fakesink we use: * See: https://bugzilla.gnome.org/show_bug.cgi?id=700186 */ registry = gst_registry_get (); feature = gst_registry_find_feature (registry, "vaapidecode", GST_TYPE_ELEMENT_FACTORY); if (!feature) return; gst_registry_remove_feature (registry, feature); }
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)); }
void bacon_video_widget_gst_missing_plugins_blacklist (void) { struct { const char *name; gboolean remove; } blacklisted_elements[] = { { "ffdemux_flv", 0 }, { "avdemux_flv", 0 }, { "dvdreadsrc" , 1 } }; GstRegistry *registry; guint i; registry = gst_registry_get (); for (i = 0; i < G_N_ELEMENTS (blacklisted_elements); ++i) { GstPluginFeature *feature; feature = gst_registry_find_feature (registry, blacklisted_elements[i].name, GST_TYPE_ELEMENT_FACTORY); if (!feature) continue; if (blacklisted_elements[i].remove) gst_registry_remove_feature (registry, feature); else gst_plugin_feature_set_rank (feature, GST_RANK_NONE); } }
static Suite * simple_launch_lines_suite (void) { gint timeout = 0; Suite *s = suite_create ("Pipelines"); TCase *tc_chain = tcase_create ("linear"); if (g_getenv ("CK_DEFAULT_TIMEOUT")) timeout = atoi (g_getenv ("CK_DEFAULT_TIMEOUT")); if (timeout == 0) timeout = 3; /* set multiple of default timeout (random magic value) */ tcase_set_timeout (tc_chain, timeout * 12); suite_add_tcase (s, tc_chain); #ifndef GST_DISABLE_PARSE /* only run this if we haven't been configured with --disable-encoders */ if (gst_registry_check_feature_version (gst_registry_get (), "avenc_mpeg4", GST_VERSION_MAJOR, GST_VERSION_MINOR, 0)) { tcase_add_test (tc_chain, test_libavcodec_locks); } else { g_print ("******* Skipping libavcodec_locks test, no encoder available\n"); } #endif return s; }
static gpointer _get_decoder_factories (gpointer arg) { GstElementClass *klass = arg; GList *factories; GstPadTemplate *templ = gst_element_class_get_pad_template (klass, "sink"); RsnDecFactoryFilterCtx ctx = { NULL, }; GstCaps *raw; gboolean raw_audio; GstRegistry *registry = gst_registry_get (); ctx.desired_caps = gst_pad_template_get_caps (templ); raw = gst_caps_from_string ("audio/x-raw,format=(string){ F32LE, F32BE, F64LE, F64BE }"); raw_audio = gst_caps_can_intersect (raw, ctx.desired_caps); if (raw_audio) { GstCaps *sub = gst_caps_subtract (ctx.desired_caps, raw); ctx.desired_caps = sub; } else { gst_caps_ref (ctx.desired_caps); } gst_caps_unref (raw); /* Set decoder caps to empty. Will be filled by the factory_filter */ ctx.decoder_caps = gst_caps_new_empty (); GST_DEBUG ("Finding factories for caps: %" GST_PTR_FORMAT, ctx.desired_caps); factories = gst_registry_feature_filter (registry, (GstPluginFeatureFilter) rsndec_factory_filter, FALSE, &ctx); /* If these are audio caps, we add audioconvert, which is not a decoder, but allows raw audio to go through relatively unmolested - this will come handy when we have to send placeholder silence to allow preroll for those DVDs which have titles with no audio track. */ if (raw_audio) { GstPluginFeature *feature; GST_DEBUG ("These are audio caps, adding audioconvert"); feature = gst_registry_find_feature (registry, "audioconvert", GST_TYPE_ELEMENT_FACTORY); if (feature) { factories = g_list_append (factories, feature); } else { GST_WARNING ("Could not find feature audioconvert"); } } factories = g_list_sort (factories, (GCompareFunc) sort_by_ranks); GST_DEBUG ("Available decoder caps %" GST_PTR_FORMAT, ctx.decoder_caps); gst_caps_unref (ctx.decoder_caps); gst_caps_unref (ctx.desired_caps); return factories; }
GStreamerInitializer::GStreamerInitializer() { gst_init(nullptr, nullptr); char buffer[MAX_PATH]; GetModuleFileNameA(nullptr, buffer, MAX_PATH); auto fileName = std::string(buffer); auto path = fileName.substr(0, fileName.find_last_of('\\')) + "\\plugins\\gstreamer-plugins\\"; gst_registry_scan_path(gst_registry_get(), path.c_str()); }
// *** main int main() { //makeing a follower ShmdataLogger logger = shmdata_make_logger(&mylog, &mylog, &mylog, &mylog, &mylog, &mylog, NULL); assert(NULL != logger); ShmdataFollower follower = shmdata_make_follower("/tmp/check-shmdatasink", &on_data, &on_server_connect, &on_server_disconnect, NULL, logger); assert(NULL != follower); //gstreamer shmdatasink for writing GstElement *pipeline, *audiosource, *shmdatasink; GstBus *bus; guint bus_watch_id; gst_init(NULL, NULL); #ifdef HAVE_CONFIG_H GstRegistry *registry = gst_registry_get(); gst_registry_scan_path(registry, "./" LT_OBJDIR); #else g_printerr("shmdatasink plugin not found"); return -1; #endif loop = g_main_loop_new(NULL, FALSE); /* Create gstreamer elements */ pipeline = gst_pipeline_new("audio-player"); audiosource = gst_element_factory_make("audiotestsrc", "audiosource"); shmdatasink = gst_element_factory_make("shmdatasink", "shmdata-output"); if (!pipeline || !audiosource || !shmdatasink) { g_printerr("One element could not be created. Exiting.\n"); return -1; } g_object_set(G_OBJECT(shmdatasink), "socket-path", "/tmp/check-shmdatasink", NULL); bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline)); bus_watch_id = gst_bus_add_watch(bus, bus_call, loop); gst_object_unref(bus); gst_bin_add_many(GST_BIN(pipeline), audiosource, shmdatasink, NULL); gst_element_link(audiosource, shmdatasink); gst_element_set_state(pipeline, GST_STATE_PLAYING); g_main_loop_run(loop); // cleaning gst gst_element_set_state(pipeline, GST_STATE_NULL); gst_object_unref(GST_OBJECT(pipeline)); g_source_remove(bus_watch_id); g_main_loop_unref(loop); // cleaning follower shmdata_delete_follower(follower); shmdata_delete_logger(logger); return res; }
/** * gst_plugin_feature_load: * @feature: (transfer none): the plugin feature to check * * Loads the plugin containing @feature if it's not already loaded. @feature is * unaffected; use the return value instead. * * Normally this function is used like this: * |[ * GstPluginFeature *loaded_feature; * * loaded_feature = gst_plugin_feature_load (feature); * // presumably, we're no longer interested in the potentially-unloaded feature * gst_object_unref (feature); * feature = loaded_feature; * ]| * * Returns: (transfer full): a reference to the loaded feature, or NULL on error */ 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_OBJECT_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 (), GST_OBJECT_NAME (feature)); 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_OBJECT_NAME (feature)); return NULL; } disappeared: { GST_INFO ("Loaded plugin containing feature '%s', but feature disappeared.", GST_OBJECT_NAME (feature)); return NULL; } not_found: { GST_INFO ("Tried to load plugin containing feature '%s', but feature was " "not found.", GST_OBJECT_NAME (real_feature)); return NULL; } }
static int print_element_features (const gchar * element_name) { GstPluginFeature *feature; /* FIXME implement other pretty print function for these */ feature = gst_registry_find_feature (gst_registry_get (), element_name, GST_TYPE_TYPE_FIND_FACTORY); if (feature) { n_print ("%s: a typefind function\n", element_name); return 0; } feature = gst_registry_find_feature (gst_registry_get (), element_name, GST_TYPE_TRACER_FACTORY); if (feature) { n_print ("%s: a tracer module\n", element_name); return 0; } return -1; }
int Uridecodebin::autoplug_continue_cb(GstElement* /*bin */, GstPad* pad, GstCaps* caps, gpointer /*user_data*/) { GList* list = gst_registry_feature_filter( gst_registry_get(), (GstPluginFeatureFilter)sink_factory_filter, FALSE, caps); int length = g_list_length(list); gst_plugin_feature_list_free(list); if (length == 0 || pad_is_image(get_pad_name(pad))) return 0; return 1; }
void check_remove_gst_feature (gchar * feature_name) { GstRegistry *registry = gst_registry_get (); GstPluginFeature *feature; if ((feature = gst_registry_lookup_feature (registry, feature_name))) { gst_registry_remove_feature (registry, feature); gst_object_unref (feature); } else { GST_WARNING ("feature not found"); } }
/* * Creates the test suite. * * Returns: pointer to the test suite. */ static Suite * rtp_payloading_suite (void) { GstRegistry *registry = gst_registry_get (); Suite *s = suite_create ("rtp_data_test"); TCase *tc_chain = tcase_create ("linear"); /* Set timeout to 60 seconds. */ tcase_set_timeout (tc_chain, 60); suite_add_tcase (s, tc_chain); tcase_add_test (tc_chain, rtp_ilbc); tcase_add_test (tc_chain, rtp_gsm); tcase_add_test (tc_chain, rtp_amr); tcase_add_test (tc_chain, rtp_pcma); tcase_add_test (tc_chain, rtp_pcmu); tcase_add_test (tc_chain, rtp_mpa); tcase_add_test (tc_chain, rtp_h261); tcase_add_test (tc_chain, rtp_h263); tcase_add_test (tc_chain, rtp_h263p); tcase_add_test (tc_chain, rtp_h264); tcase_add_test (tc_chain, rtp_h264_list_lt_mtu); tcase_add_test (tc_chain, rtp_h264_list_lt_mtu_avc); tcase_add_test (tc_chain, rtp_h264_list_gt_mtu); tcase_add_test (tc_chain, rtp_h264_list_gt_mtu_avc); tcase_add_test (tc_chain, rtp_klv); tcase_add_test (tc_chain, rtp_klv_fragmented); tcase_add_test (tc_chain, rtp_L16); tcase_add_test (tc_chain, rtp_L24); tcase_add_test (tc_chain, rtp_mp2t); tcase_add_test (tc_chain, rtp_mp4v); tcase_add_test (tc_chain, rtp_mp4v_list); tcase_add_test (tc_chain, rtp_mp4g); tcase_add_test (tc_chain, rtp_theora); tcase_add_test (tc_chain, rtp_vorbis); tcase_add_test (tc_chain, rtp_jpeg); tcase_add_test (tc_chain, rtp_jpeg_width_greater_than_2040); tcase_add_test (tc_chain, rtp_jpeg_height_greater_than_2040); tcase_add_test (tc_chain, rtp_jpeg_width_and_height_greater_than_2040); tcase_add_test (tc_chain, rtp_jpeg_list); tcase_add_test (tc_chain, rtp_jpeg_list_width_greater_than_2040); tcase_add_test (tc_chain, rtp_jpeg_list_height_greater_than_2040); tcase_add_test (tc_chain, rtp_jpeg_list_width_and_height_greater_than_2040); if (gst_registry_check_feature_version (registry, "jpegenc", 1, 0, 0) && gst_registry_check_feature_version (registry, "videotestsrc", 1, 0, 0)) tcase_add_loop_test (tc_chain, rtp_jpeg_packet_loss, 0, 7); tcase_add_test (tc_chain, rtp_g729); tcase_add_test (tc_chain, rtp_gst_custom_event); return s; }
/** * gst_device_provider_factory_list_get_device_providers: * @minrank: Minimum rank * * Get a list of factories with a rank greater or equal to @minrank. * The list of factories is returned by decreasing rank. * * Returns: (transfer full) (element-type Gst.DeviceProviderFactory): * a #GList of #GstDeviceProviderFactory device providers. Use * gst_plugin_feature_list_free() after usage. * * Since: 1.4 */ GList * gst_device_provider_factory_list_get_device_providers (GstRank minrank) { GList *result; /* get the feature list using the filter */ result = gst_registry_feature_filter (gst_registry_get (), (GstPluginFeatureFilter) device_provider_filter, FALSE, &minrank); /* sort on rank and name */ result = g_list_sort (result, gst_plugin_feature_rank_compare_func); return result; }
static gboolean ges_check_gnonlin_availability (void) { gboolean ret = TRUE; if (!gst_registry_check_feature_version (gst_registry_get (), "gnlcomposition", GES_GNONLIN_VERSION_NEEDED_MAJOR, GES_GNONLIN_VERSION_NEEDED_MINOR, GES_GNONLIN_VERSION_NEEDED_MICRO)) { GST_ERROR ("GNonLin plugins not found, or not at least version %u.%u.%u", GES_GNONLIN_VERSION_NEEDED_MAJOR, GES_GNONLIN_VERSION_NEEDED_MINOR, GES_GNONLIN_VERSION_NEEDED_MICRO); ret = FALSE; } return ret; }
static void print_all_plugin_automatic_install_info (void) { GList *plugins, *orig_plugins; orig_plugins = plugins = gst_registry_get_plugin_list (gst_registry_get ()); while (plugins) { GstPlugin *plugin; plugin = (GstPlugin *) (plugins->data); plugins = g_list_next (plugins); print_plugin_automatic_install_info (plugin); } gst_plugin_list_free (orig_plugins); }
static GList * gst_auto_video_convert_create_factory_list (GstAutoVideoConvert * autovideoconvert) { GList *result = NULL; /* get the feature list using the filter */ result = gst_registry_feature_filter (gst_registry_get (), (GstPluginFeatureFilter) gst_auto_video_convert_element_filter, FALSE, autovideoconvert); /* sort on rank and name */ result = g_list_sort (result, gst_plugin_feature_rank_compare_func); return result; }
/** * gst_element_factory_find: * @name: name of factory to find * * Search for an element factory of the given name. Refs the returned * element factory; caller is responsible for unreffing. * * Returns: (transfer full) (nullable): #GstElementFactory if found, * %NULL otherwise */ GstElementFactory * gst_element_factory_find (const gchar * name) { GstPluginFeature *feature; g_return_val_if_fail (name != NULL, NULL); feature = gst_registry_find_feature (gst_registry_get (), name, GST_TYPE_ELEMENT_FACTORY); if (feature) return GST_ELEMENT_FACTORY (feature); /* this isn't an error, for instance when you query if an element factory is * present */ GST_LOG ("no such element factory \"%s\"", name); return NULL; }
/** * gst_type_find_register: * @plugin: (allow-none): A #GstPlugin, or NULL for a static typefind function * @name: The name for registering * @rank: The rank (or importance) of this typefind function * @func: The #GstTypeFindFunction to use * @extensions: (allow-none): Optional comma-separated list of extensions * that could belong to this type * @possible_caps: Optionally the caps that could be returned when typefinding * succeeds * @data: Optional user data. This user data must be available until the plugin * is unloaded. * @data_notify: a #GDestroyNotify that will be called on @data when the plugin * is unloaded. * * Registers a new typefind function to be used for typefinding. After * registering this function will be available for typefinding. * This function is typically called during an element's plugin initialization. * * Returns: TRUE on success, FALSE otherwise */ gboolean gst_type_find_register (GstPlugin * plugin, const gchar * name, guint rank, GstTypeFindFunction func, const gchar * extensions, GstCaps * possible_caps, gpointer data, GDestroyNotify data_notify) { GstTypeFindFactory *factory; g_return_val_if_fail (name != NULL, FALSE); GST_INFO ("registering typefind function for %s", name); factory = g_object_newv (GST_TYPE_TYPE_FIND_FACTORY, 0, NULL); GST_DEBUG_OBJECT (factory, "using new typefind factory for %s", name); g_assert (GST_IS_TYPE_FIND_FACTORY (factory)); gst_plugin_feature_set_name (GST_PLUGIN_FEATURE_CAST (factory), name); gst_plugin_feature_set_rank (GST_PLUGIN_FEATURE_CAST (factory), rank); if (factory->extensions) { g_strfreev (factory->extensions); factory->extensions = NULL; } if (extensions) factory->extensions = g_strsplit (extensions, ",", -1); gst_caps_replace (&factory->caps, possible_caps); factory->function = func; factory->user_data = data; factory->user_data_notify = data_notify; if (plugin && plugin->desc.name) { GST_PLUGIN_FEATURE_CAST (factory)->plugin_name = plugin->desc.name; /* interned string */ GST_PLUGIN_FEATURE_CAST (factory)->plugin = plugin; g_object_add_weak_pointer ((GObject *) plugin, (gpointer *) & GST_PLUGIN_FEATURE_CAST (factory)->plugin); } else { GST_PLUGIN_FEATURE_CAST (factory)->plugin_name = "NULL"; GST_PLUGIN_FEATURE_CAST (factory)->plugin = NULL; } GST_PLUGIN_FEATURE_CAST (factory)->loaded = TRUE; gst_registry_add_feature (gst_registry_get (), GST_PLUGIN_FEATURE_CAST (factory)); return TRUE; }
/** * gst_device_provider_factory_find: * @name: name of factory to find * * Search for an device provider factory of the given name. Refs the returned * device provider factory; caller is responsible for unreffing. * * Returns: (transfer full) (nullable): #GstDeviceProviderFactory if * found, %NULL otherwise * * Since: 1.4 */ GstDeviceProviderFactory * gst_device_provider_factory_find (const gchar * name) { GstPluginFeature *feature; g_return_val_if_fail (name != NULL, NULL); feature = gst_registry_find_feature (gst_registry_get (), name, GST_TYPE_DEVICE_PROVIDER_FACTORY); if (feature) return GST_DEVICE_PROVIDER_FACTORY (feature); /* this isn't an error, for instance when you query if an device provider factory is * present */ GST_LOG ("no such device provider factory \"%s\"", name); return NULL; }
static Suite * mxfdemux_suite (void) { Suite *s = suite_create ("mxfdemux"); TCase *tc_chain = tcase_create ("general"); /* FIXME: remove again once ported */ if (!gst_registry_check_feature_version (gst_registry_get (), "mxfdemux", 1, 0, 0)) return s; suite_add_tcase (s, tc_chain); tcase_set_timeout (tc_chain, 180); tcase_add_test (tc_chain, test_pull); tcase_add_test (tc_chain, test_push); return s; }
gint main (int argc, char *argv[]) { options(argc, argv); loop = g_main_loop_new(NULL, FALSE); GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL); /*Tell gstreamer to look locally for the plugin*/ GstRegistry *registry; registry = gst_registry_get(); gst_registry_scan_path(registry, "plugins"); GError *parse_error = NULL; GstElement *pipeline = make_pipeline(&parse_error, loop); DEBUG("pipeline is %p", pipeline); DEBUG("template is '%s'", PIPELINE_TEMPLATE); GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline)); gst_bus_set_sync_handler(bus, (GstBusSyncHandler)sync_bus_call, NULL, NULL); gst_bus_add_watch(bus, (GstBusFunc)bus_callback, pipeline); gst_object_unref(bus); gst_element_set_state(pipeline, GST_STATE_PLAYING); g_signal_connect(G_OBJECT(window), "key-press-event", G_CALLBACK(key_press_event_cb), pipeline); STDERR_DEBUG("pipeline is %p", pipeline); g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(destroy_cb), loop); g_signal_connect(window, "realize", G_CALLBACK(video_widget_realize_cb), NULL); gtk_widget_show_all(window); g_main_loop_run(loop); gst_element_set_state (pipeline, GST_STATE_NULL); gst_object_unref (pipeline); return 0; }