Ejemplo n.º 1
0
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);
}
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);
	}
}
Ejemplo n.º 3
0
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;
}
Ejemplo n.º 4
0
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;
}
Ejemplo n.º 5
0
void test_typefind()
{
    GstPlugin *plugin;
    GstPluginFeature *feature;
    GstTypeFind typefind = {
        peek,
        suggest,
        NULL,
        NULL,
        GST_PADDING_INIT
    };
//xmlfile = "test_typefind";
    std_log(LOG_FILENAME_LINE, "Test Started test_typefind");
    plugin = gst_default_registry_find_plugin ("typefindfunctions");
    fail_if (plugin == NULL, "Failed to find typefind functions");
    fail_if (GST_OBJECT_REFCOUNT_VALUE (plugin) != 2,
             "Refcount of plugin in registry should be 2");
    /*
       //commented
         fail_if (gst_plugin_is_loaded (plugin), "Expected plugin to be unloaded");
    */
    feature = gst_registry_find_feature (gst_registry_get_default (),
                                         "audio/x-au", GST_TYPE_TYPE_FIND_FACTORY);
    fail_if (feature == NULL, "Failed to find audio/x-aw typefind factory");


#ifndef __SYMBIAN32__
    fail_if (feature->plugin != plugin,
             "Expected identity to be from coreelements plugin");
    fail_if (GST_OBJECT_REFCOUNT_VALUE (plugin) != 3,
             "Refcount of plugin in registry+feature should be 3");
    gst_type_find_factory_call_function (GST_TYPE_FIND_FACTORY (feature),
                                         &typefind);
    gst_object_unref (feature->plugin);


#endif





    gst_object_unref (plugin);

    fail_if (GST_OBJECT_REFCOUNT_VALUE (plugin) != 1,
             "Refcount of plugin in after list free should be 1");


    std_log(LOG_FILENAME_LINE, "Test Successful");
    create_xml(0);
}
Ejemplo n.º 6
0
/*
 * Method: find_feature(feature_name, feature_type)
 * feature_name: a feature name.
 * feature_type: a feature type.
 * 
 * Finds the plugin feature with the given name and type in the registry.
 *
 * Valid features types are Gst::AutoplugFactory, Gst::ElementFactory,
 * Gst::IndexFactory, Gst::SchedulerFactory and Gst::TypeFactory.
 *
 * Returns: a reference to a Gst::PluginFeature on success, or nil if the
 * named plugin feature is not found.
 */
static VALUE
rb_gst_registry_find_feature(VALUE self, VALUE name, VALUE type)
{
	GstPluginFeature *feature;
	GType gtype;
	
	gtype = CLASS2GTYPE (type);
	if (!is_valid_pluginfeature_type (gtype))
		rb_raise (rb_eArgError, "Invalid feature type.");
	feature = gst_registry_find_feature (RGST_REGISTRY (self),
					     RVAL2CSTR (name),
					     gtype);
	return feature != NULL
		? instanciate_pluginfeature (feature)
		: Qnil;
}
Ejemplo n.º 7
0
/**
 * 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): #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_default (), 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;
}
Ejemplo n.º 8
0
void test_find_feature()
{
    GstPluginFeature *feature;
    //xmlfile = "test_find_feature";
    std_log(LOG_FILENAME_LINE, "Test Started test_find_feature");
    feature = gst_registry_find_feature (gst_registry_get_default (),
                                         "identity", GST_TYPE_ELEMENT_FACTORY);
    fail_if (feature == NULL, "Failed to find identity element factory");
    fail_if (strcmp (feature->plugin_name, "coreelements"),
             "Expected identity to be from coreelements plugin");
    fail_if (GST_OBJECT_REFCOUNT_VALUE (feature) != 2,
             "Refcount of feature should be 2");
    GST_DEBUG ("refcount %d", GST_OBJECT_REFCOUNT_VALUE (feature));
    gst_object_unref (feature);
    std_log(LOG_FILENAME_LINE, "Test Successful");
    create_xml(0);
}
/**
 * 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;
}
Ejemplo n.º 10
0
static void
set_autoconvert_factories (GstElement * autoconvert)
{
  const gchar *desired_features[] = { "testelement1", "testelement2" };
  GstElementFactory *feature;
  GList *factories = NULL;
  gint i;

  for (i = 0; i < G_N_ELEMENTS (desired_features); i++) {
    feature =
        GST_ELEMENT_FACTORY_CAST (gst_registry_find_feature
        (gst_registry_get (), desired_features[i], GST_TYPE_ELEMENT_FACTORY));
    fail_if (feature == NULL, "Test element %s was not found in registry",
        desired_features[i]);
    factories = g_list_prepend (factories, feature);
  }

  g_object_set (G_OBJECT (autoconvert), "factories", factories, NULL);

  g_list_free (factories);
}