Name
GstAutoplug -- Automatically create and connect elements
Synopsis
#include <gst/gst.h>
struct GstAutoplug;
enum GstAutoplugFlags;
struct GstAutoplugFactory;
void gst_autoplug_signal_new_object (GstAutoplug *autoplug,
GstObject *object);
GstElement* gst_autoplug_to_caps (GstAutoplug *autoplug,
GstCaps *srccaps,
GstCaps *sinkcaps,
...);
GstElement* gst_autoplug_to_renderers (GstAutoplug *autoplug,
GstCaps *srccaps,
GstElement *target,
...);
GstAutoplugFactory* gst_autoplugfactory_new (const gchar *name,
const gchar *longdesc,
GtkType type);
void gst_autoplugfactory_destroy (GstAutoplugFactory *factory);
GstAutoplugFactory* gst_autoplugfactory_find
(const gchar *name);
GList* gst_autoplugfactory_get_list (void);
GstAutoplug* gst_autoplugfactory_create (GstAutoplugFactory *factory);
GstAutoplug* gst_autoplugfactory_make (const gchar *name);
xmlNodePtr gst_autoplugfactory_save_thyself
(GstAutoplugFactory *factory,
xmlNodePtr parent);
GstAutoplugFactory* gst_autoplugfactory_load_thyself
(xmlNodePtr parent);
|
Description
GstAutoplug is an abstract class that is used for constructing and
connecting elements. Two types og autopluggers exist: renderer ones and non
renderer ones. the renderer autopluggers will not have any src pads while the
non renderer ones do.
You first need to create a suitable autoplugger with gst_autoplugfactory_make().
The name of the autoplugger must be one of the registered autopluggers
(see GstStaticAutoplug and GstStaticAutoplugRender).
A list of all available autopluggers can be obtained with gst_autoplugfactory_get_list().
If the autoplugger supports the RENDERER API, use gst_autoplug_to_renderers() call to
create a bin that connectes the src caps to the specified rendrer elements. You can
then add the bin to a pipeline and run it.
GstAutoplug *autoplug;
GstElement *element;
GstElement *sink;
/* create a static autoplugger */
autoplug = gst_autoplugfactory_make ("staticrender");
/* create an osssink */
sink = gst_elementfactory_make ("osssink", "our_sink");
/* create an element that can play audio/mp3 through osssink */
element = gst_autoplug_to_renderers (autoplug,
gst_caps_new (
"sink_audio_caps",
"audio/mp3",
NULL
),
sink,
NULL);
/* add the element to a bin and connect the sink pad */
...
|
If the autoplugger supports the CAPS API, use gst_autoplug_to_caps() call to
connect the src caps to the destination caps. The created bin will have src pads
compatible with the provided sink caps.
GstAutoplug *autoplug;
GstElement *element;
/* create a static autoplugger */
autoplug = gst_autoplugfactory_make ("static");
/* create an element that converts audio/mp3 to audio/raw */
element = gst_autoplug_to_caps (autoplug,
gst_caps_new (
"sink_audio_caps",
"audio/mp3",
NULL
),
gst_caps_new (
"src_audio_caps",
"audio/raw",
NULL
),
NULL);
/* add the element to a bin and connect the src/sink pads */
...
|
Optionally you can get a notification when a new object is added to the created
pipeline with a gtk_signal_connect to the "new_object" signal.
Use the regular gst_object_destroy() call to destroy the autoplugger.
Details
struct GstAutoplug
struct GstAutoplug {
GstObject object;
}; |
enum GstAutoplugFlags
typedef enum {
GST_AUTOPLUG_TO_CAPS = GST_OBJECT_FLAG_LAST,
GST_AUTOPLUG_TO_RENDERER,
GST_AUTOPLUG_FLAG_LAST = GST_OBJECT_FLAG_LAST + 8,
} GstAutoplugFlags; |
The type of the autoplugger.
struct GstAutoplugFactory
struct GstAutoplugFactory {
gchar *name; /* name of autoplugger */
gchar *longdesc; /* long description of the autoplugger (well, don't overdo it..) */
GtkType type; /* unique GtkType of the autoplugger */
}; |
gst_autoplug_signal_new_object ()
Emit a new_object signal. autopluggers are supposed to
emit this signal whenever a new object has been added to
the autoplugged pipeline.
gst_autoplug_to_caps ()
Perform the autoplugging procedure on the given autoplugger.
The src caps will be connected to the sink caps.
gst_autoplug_to_renderers ()
Perform the autoplugging procedure on the given autoplugger.
The src caps will be connected to the target elements.
gst_autoplugfactory_new ()
GstAutoplugFactory* gst_autoplugfactory_new (const gchar *name,
const gchar *longdesc,
GtkType type); |
Create a new autoplugfactory with the given parameters
gst_autoplugfactory_destroy ()
Removes the autoplug from the global list.
gst_autoplugfactory_find ()
Search for an autoplugfactory of the given name.
gst_autoplugfactory_get_list ()
GList* gst_autoplugfactory_get_list (void); |
Get the global list of autoplugfactories.
gst_autoplugfactory_create ()
Create a new GstAutoplug instance from the
given autoplugfactory.
gst_autoplugfactory_make ()
GstAutoplug* gst_autoplugfactory_make (const gchar *name); |
Create a new GstAutoplug instance from the
autoplugfactory with the given name.
gst_autoplugfactory_save_thyself ()
xmlNodePtr gst_autoplugfactory_save_thyself
(GstAutoplugFactory *factory,
xmlNodePtr parent); |
Save the autoplugfactory into an XML representation
gst_autoplugfactory_load_thyself ()
Load an autoplugfactory from the given XML parent node.
See Also
GstStaticAutoplug, GstStaticAutoplugRender