fail_if (sinkpad == NULL, "Could not get sink pad from %s",
GST_ELEMENT_NAME (element));
ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 2);
- fail_unless (gst_pad_set_caps (srcpad, caps));
+ if (caps)
+ fail_unless (gst_pad_set_caps (srcpad, caps));
fail_unless (gst_pad_link (srcpad, sinkpad) == GST_PAD_LINK_OK,
"Could not link source and %s sink pads", GST_ELEMENT_NAME (element));
gst_object_unref (sinkpad); /* because we got it higher up */
srcpad = gst_element_get_pad (element, "src");
fail_if (srcpad == NULL, "Could not get source pad from %s",
GST_ELEMENT_NAME (element));
- fail_unless (gst_pad_set_caps (sinkpad, caps));
+ if (caps)
+ fail_unless (gst_pad_set_caps (sinkpad, caps));
gst_pad_set_chain_function (sinkpad, gst_check_chain_func);
fail_unless (gst_pad_link (srcpad, sinkpad) == GST_PAD_LINK_OK,
* <programlisting>
* static gboolean stats = FALSE;
* ...
- *
* int
* main (int argc, char *argv[])
* {
* "Show pad stats", NULL},
* POPT_TABLEEND
* };
- *
* // initialize the GStreamer library
* gst_init_with_popt_table (&argc, &argv, options);
- *
* ...
* }
* </programlisting>
* <programlisting>
* GstBuffer *buffer;
* gint size, width, height, bpp;
- *
* ...
- *
* size = width * height * bpp;
- *
* buffer = gst_buffer_new ();
* GST_BUFFER_SIZE (buffer) = size;
* GST_BUFFER_MALLOCDATA (buffer) = g_alloc (size);
#include "gst_private.h"
#include <gst/gst.h>
-/* #define DEBUG_REFCOUNT */
+#define DEBUG_REFCOUNT
#define CAPS_POISON(caps) G_STMT_START{ \
if (caps) { \
* <title>Using an element factory</title>
* <programlisting language="c">
* #include <gst/gst.h>
- *
* GstElement *src;
* GstElementFactory *srcfactory;
- *
* gst_init(&argc,&argv);
- *
* srcfactory = gst_element_factory_find("filesrc");
* g_return_if_fail(srcfactory != NULL);
- *
* src = gst_element_factory_create(srcfactory,"src");
* g_return_if_fail(src != NULL);
* ...
* "channels = (int) [ 1, 6 ]"
* )
* )
- *
* void
* my_method (void)
* {
* GstPad *pad;
- *
* pad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (my_template_factory), "sink");
* ...
* }
* my_factory_init (GstPlugin *plugin)
* {
* GstElementFactory *factory;
- *
* factory = gst_element_factory_new ("my_factory", GST_TYPE_MYFACTORY, &gst_myfactory_details);
* g_return_val_if_fail (factory != NULL, FALSE);
- *
* gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (my_template_factory));
- *
* gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
- *
* return TRUE;
* }
* </programlisting>
* A plugin system can provide one or more of the basic
* <application>GStreamer</application> #GstPluginFeature subclasses.
*
- * A plugin should export a symbol <symbol>plugin_desc</symbol> that is a struct of type #GstPluginDesc.
+ * A plugin should export a symbol <symbol>plugin_desc</symbol> that is a
+ * struct of type #GstPluginDesc.
* the plugin loader will check the version of the core library the plugin was
* linked against and will create a new #GstPlugin. It will then call the
* #GstPluginInitFunc function that was provided in the plugin_desc.
* <programlisting>
* GstPlugin *loaded_plugin;
* loaded_plugin = gst_plugin_load (plugin);
- *
* // presumably, we're no longer interested in the potentially-unloaded plugin
* gst_object_unref (plugin);
* plugin = loaded_plugin;
* GList *walk, *type_list;
* MyTypeFind find = {data, size, 0, NULL};
* GstTypeFind gst_find = {my_peek, my_suggest, &find, };
- *
* walk = type_list = gst_type_find_factory_get_list ();
* while (walk) {
* GstTypeFindFactory *factory = GST_TYPE_FIND_FACTORY (walk->data);
fail_if (sinkpad == NULL, "Could not get sink pad from %s",
GST_ELEMENT_NAME (element));
ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 2);
- fail_unless (gst_pad_set_caps (srcpad, caps));
+ if (caps)
+ fail_unless (gst_pad_set_caps (srcpad, caps));
fail_unless (gst_pad_link (srcpad, sinkpad) == GST_PAD_LINK_OK,
"Could not link source and %s sink pads", GST_ELEMENT_NAME (element));
gst_object_unref (sinkpad); /* because we got it higher up */
srcpad = gst_element_get_pad (element, "src");
fail_if (srcpad == NULL, "Could not get source pad from %s",
GST_ELEMENT_NAME (element));
- fail_unless (gst_pad_set_caps (sinkpad, caps));
+ if (caps)
+ fail_unless (gst_pad_set_caps (sinkpad, caps));
gst_pad_set_chain_function (sinkpad, gst_check_chain_func);
fail_unless (gst_pad_link (srcpad, sinkpad) == GST_PAD_LINK_OK,