static GstElement * default_get_element (GstRTSPMediaFactory *factory, const GstRTSPUrl *url);
static GstRTSPMedia * default_construct (GstRTSPMediaFactory *factory, const GstRTSPUrl *url);
static void default_configure (GstRTSPMediaFactory *factory, GstRTSPMedia *media);
+static GstElement* default_create_pipeline (GstRTSPMediaFactory *factory, GstRTSPMedia *media);
G_DEFINE_TYPE (GstRTSPMediaFactory, gst_rtsp_media_factory, G_TYPE_OBJECT);
klass->get_element = default_get_element;
klass->construct = default_construct;
klass->configure = default_configure;
+ klass->create_pipeline = default_create_pipeline;
}
static void
media = gst_rtsp_media_new ();
media->element = element;
+ if (!klass->create_pipeline)
+ goto no_pipeline;
+
+ media->pipeline = klass->create_pipeline (factory, media);
+
collect_streams (factory, url, media);
return media;
g_critical ("could not create element");
return NULL;
}
+no_pipeline:
+ {
+ g_critical ("could not create pipeline");
+ return FALSE;
+ }
+}
+
+static GstElement*
+default_create_pipeline (GstRTSPMediaFactory *factory, GstRTSPMedia *media) {
+ GstElement *pipeline;
+
+ pipeline = gst_pipeline_new ("media-pipeline");
+ gst_bin_add (GST_BIN_CAST (pipeline), media->element);
+
+ return pipeline;
}
static void
* pay%d to create the streams.
* @configure: configure the media created with @construct. The default
* implementation will configure the 'shared' property of the media.
+ * @create_pipeline: create a new pipeline or re-use an existing one and
+ * add the #GstRTSPMedia's element created by @construct to the pipeline.
*
* The #GstRTSPMediaFactory class structure.
*/
GstElement * (*get_element) (GstRTSPMediaFactory *factory, const GstRTSPUrl *url);
GstRTSPMedia * (*construct) (GstRTSPMediaFactory *factory, const GstRTSPUrl *url);
void (*configure) (GstRTSPMediaFactory *factory, GstRTSPMedia *media);
+ GstElement * (*create_pipeline)(GstRTSPMediaFactory *factory, GstRTSPMedia *media);
};
GType gst_rtsp_media_factory_get_type (void);
g_message ("preparing media %p", media);
- media->pipeline = gst_pipeline_new ("media-pipeline");
bus = gst_pipeline_get_bus (GST_PIPELINE_CAST (media->pipeline));
/* add the pipeline bus to our custom mainloop */
klass = GST_RTSP_MEDIA_GET_CLASS (media);
media->id = g_source_attach (media->source, klass->context);
- gst_bin_add (GST_BIN_CAST (media->pipeline), media->element);
-
media->rtpbin = gst_element_factory_make ("gstrtpbin", "rtpbin");
/* add stuff to the bin */