static void gst_rtsp_media_factory_finalize (GObject * obj);
static GstRTSPMediaBin * default_construct (GstRTSPMediaFactory *factory, const gchar *location);
+static GstElement * default_get_element (GstRTSPMediaFactory *factory, const gchar *location);
G_DEFINE_TYPE (GstRTSPMediaFactory, gst_rtsp_media_factory, G_TYPE_OBJECT);
DEFAULT_LAUNCH, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
klass->construct = default_construct;
+ klass->get_element = default_get_element;
}
static void
gst_caps_ref (stream->caps);
}
-static GstRTSPMediaBin *
-default_construct (GstRTSPMediaFactory *factory, const gchar *location)
+static GstElement *
+default_get_element (GstRTSPMediaFactory *factory, const gchar *location)
{
- GstRTSPMediaBin *bin;
- GstRTSPMediaStream *stream;
- GstElement *pay, *element;
- GstPad * pad;
- gint i;
+ GstElement *element;
GError *error = NULL;
/* we need a parse syntax */
g_warning ("recoverable parsing error: %s", error->message);
g_error_free (error);
}
+ return element;
+
+ /* ERRORS */
+no_launch:
+ {
+ g_critical ("no launch line specified");
+ return NULL;
+ }
+parse_error:
+ {
+ g_critical ("could not parse launch syntax (%s): %s", factory->launch,
+ (error ? error->message : "unknown reason"));
+ if (error)
+ g_error_free (error);
+ return NULL;
+ }
+}
+
+static GstRTSPMediaBin *
+default_construct (GstRTSPMediaFactory *factory, const gchar *location)
+{
+ GstRTSPMediaBin *bin;
+ GstRTSPMediaStream *stream;
+ GstElement *pay, *element;
+ GstPad * pad;
+ gint i;
+ GstRTSPMediaFactoryClass *klass;
+
+ klass = GST_RTSP_MEDIA_FACTORY_GET_CLASS (factory);
+
+ if (klass->get_element)
+ element = klass->get_element (factory, location);
+ else
+ element = NULL;
+ if (element == NULL)
+ goto no_element;
bin = g_object_new (GST_TYPE_RTSP_MEDIA_BIN, NULL);
bin->element = element;
return bin;
/* ERRORS */
-no_launch:
- {
- g_critical ("no launch line specified");
- return NULL;
- }
-parse_error:
+no_element:
{
- g_critical ("could not parse launch syntax (%s): %s", factory->launch,
- (error ? error->message : "unknown reason"));
- if (error)
- g_error_free (error);
+ g_critical ("could not create element");
return NULL;
}
}
/**
* GstRTSPMediaFactoryClass:
+ * @get_element: Construct an return a #GstElement thast is a #GstBin containing
+ * the pipeline to use for the media. The bin should contain elements
+ * pay%d for each stream. The default implementation of this functions
+ * returns the bin created from the launch parameter.
* @construct: the vmethod that will be called when the factory has to create the
- * #GstRTSPMediaBin for @location.
+ * #GstRTSPMediaBin for @location. The default implementation of this
+ * function calls get_element to retrieve an element and then looks for
+ * pay%d to create the streams.
*
* the #GstRTSPMediaFactory class structure.
*/
struct _GstRTSPMediaFactoryClass {
GObjectClass parent_class;
- GstRTSPMediaBin * (*construct) (GstRTSPMediaFactory *factory, const gchar *location);
+ GstElement * (*get_element) (GstRTSPMediaFactory *factory, const gchar *location);
+ GstRTSPMediaBin * (*construct) (GstRTSPMediaFactory *factory, const gchar *location);
};
GType gst_rtsp_media_factory_get_type (void);