GstAutoplug

Name

GstAutoplug -- Automatically create and link elements

Synopsis


#include <gst/gst.h>


struct      GstAutoplug;
enum        GstAutoplugFlags;
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,
                                             ...);

Object Hierarchy


  GObject
   +----GstObject
         +----GstAutoplug

Signal Prototypes


"new-object"
            void        user_function      (GstAutoplug *gstautoplug,
                                            GstObject *arg1,
                                            gpointer user_data);

Description

GstAutoplug is an abstract class that is used for constructing and linking elements. Two types of 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_autoplug_factory_make() (see GstAutoplugFactory). The name of the autoplugger must be one of the registered autopluggers (see GstStaticAutoplug and GstStaticAutoplugRender).

If the autoplugger supports the RENDERER API, use gst_autoplug_to_renderers() to create a bin that links the src caps to the specified renderer 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_autoplug_factory_make ("staticrender");

  /* create an osssink */
  sink = gst_element_factory_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 link the sink pad */
  ...
  

If the autoplugger supports the CAPS API, use gst_autoplug_to_caps() to link the src caps to the destination caps. The created bin will have src caps compatible with the provided sink caps.
  GstAutoplug *autoplug;
  GstElement  *element;

  /* create a static autoplugger */
  autoplug = gst_autoplug_factory_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 link the src/sink pads */
  ...
  

Optionally you can get a notification when a new object is added to the created pipeline with a g_signal_connect to the "new_object" signal.

Use the regular gst_object_destroy() call to destroy the autoplugger.

Details

struct GstAutoplug

struct GstAutoplug;

The autoplug 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.


gst_autoplug_signal_new_object ()

void        gst_autoplug_signal_new_object  (GstAutoplug *autoplug,
                                             GstObject *object);

Emit a new_object signal. autopluggers are supposed to emit this signal whenever a new object has been added to the autoplugged pipeline.

autoplug :

The autoplugger to emit the signal

object :

The object that is passed to the signal


gst_autoplug_to_caps ()

GstElement* gst_autoplug_to_caps            (GstAutoplug *autoplug,
                                             GstCaps *srccaps,
                                             GstCaps *sinkcaps,
                                             ...);

Perform the autoplugging procedure on the given autoplugger. The src caps will be connected to the sink caps.

autoplug :

The autoplugger perform the autoplugging

srccaps :

The source cpabilities

sinkcaps :

The target capabilities

... :

more target capabilities

Returns :

A new Element that connects the src caps to the sink caps.


gst_autoplug_to_renderers ()

GstElement* gst_autoplug_to_renderers       (GstAutoplug *autoplug,
                                             GstCaps *srccaps,
                                             GstElement *target,
                                             ...);

Perform the autoplugging procedure on the given autoplugger. The src caps will be connected to the target elements.

autoplug :

The autoplugger perform the autoplugging

srccaps :

The source cpabilities

target :

The target element

... :

more target elements

Returns :

A new Element that connects the src caps to the target elements.

Signals

The "new-object" signal

void        user_function                  (GstAutoplug *gstautoplug,
                                            GstObject *arg1,
                                            gpointer user_data);

gstautoplug :

the object which received the signal.

arg1 :

user_data :

user data set when the signal handler was connected.

See Also

GstStaticAutoplug, GstStaticAutoplugRender