mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 08:46:40 +00:00
Added vmethod create_pipeline to GstRTSPMediaFactory
The pipeline is created in this method and the GstRTSPMedia's element is added to it
This commit is contained in:
parent
a697d16c75
commit
e417d83dce
3 changed files with 25 additions and 3 deletions
|
@ -40,6 +40,7 @@ static gchar * default_gen_key (GstRTSPMediaFactory *factory, const GstRTSPUrl *
|
|||
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);
|
||||
|
||||
|
@ -79,6 +80,7 @@ gst_rtsp_media_factory_class_init (GstRTSPMediaFactoryClass * klass)
|
|||
klass->get_element = default_get_element;
|
||||
klass->construct = default_construct;
|
||||
klass->configure = default_configure;
|
||||
klass->create_pipeline = default_create_pipeline;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -471,6 +473,11 @@ default_construct (GstRTSPMediaFactory *factory, const GstRTSPUrl *url)
|
|||
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;
|
||||
|
@ -481,6 +488,21 @@ no_element:
|
|||
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
|
||||
|
|
|
@ -77,6 +77,8 @@ struct _GstRTSPMediaFactory {
|
|||
* 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.
|
||||
*/
|
||||
|
@ -88,6 +90,7 @@ struct _GstRTSPMediaFactoryClass {
|
|||
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);
|
||||
|
|
|
@ -1268,7 +1268,6 @@ gst_rtsp_media_prepare (GstRTSPMedia *media)
|
|||
|
||||
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 */
|
||||
|
@ -1280,8 +1279,6 @@ gst_rtsp_media_prepare (GstRTSPMedia *media)
|
|||
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 */
|
||||
|
|
Loading…
Reference in a new issue