diff --git a/docs/manual/dynamic.sgml b/docs/manual/dynamic.sgml index 209d08a856..3f7990a660 100644 --- a/docs/manual/dynamic.sgml +++ b/docs/manual/dynamic.sgml @@ -9,8 +9,9 @@ GStreamer. - We will show how to create an mpeg1 video player using the dynamic pipeline - + We will show how to create an mpeg1 video player using dynamic pipelines. + As you have seen in the pad section, we can attach a signal to an element + when a pad is created. We will use this to create our MPEG1 player. diff --git a/docs/manual/pads.sgml b/docs/manual/pads.sgml index 357bb3f6ec..947e0ad587 100644 --- a/docs/manual/pads.sgml +++ b/docs/manual/pads.sgml @@ -57,6 +57,68 @@ GstObject. + + Dynamic pads + + Some elements might not have their pads when they are created. This can, for + example, happen with an MPEG2 system demuxer. The demuxer will create its + pads at runtime when it detects the different elementary streams in the MPEG2 + system stream. + + + Running gstreamer-inspect mpeg2parse will show that + the element has only one pad: a sink pad called 'sink'. The other pads are + "dormant" as you can see in the padtemplates from the 'Exists: Sometimes' + property. Depending on the type of MPEG2 file you play, the pads are created. We + will see that this is very important when you are going to create dynamic + pipelines later on in this manual. + + + You can attach a signal to an element to inform you when the element has created + a new pad from one of its padtemplates. The following piece of code is an example + of how to do this: + + +static void +pad_connect_func (GstElement *parser, GstPad *pad, GstElement *pipeline) +{ + g_print("***** a new pad %s was created\n", gst_pad_get_name(pad)); + + gst_element_set_state (pipeline, GST_STATE_PAUSED); + + if (strncmp (gst_pad_get_name (pad), "private_stream_1.0", 18) == 0) { + // set up an AC3 decoder pipeline + ... + // connect pad to the AC3 decoder pipeline + ... + } + gst_element_set_state (GST_ELEMENT (audio_thread), GST_STATE_READY); +} + +int +main(int argc, char *argv[]) +{ + GstElement *pipeline; + GstElement *mpeg2parser; + + // create pipeline and do something usefull + ... + + mpeg2parser = gst_elementfactory_make ("mpeg2parse", "mpeg2parse"); + gtk_signal_connect (GTK_OBJECT (mpeg2parser), "new_pad", pad_connect_func, pipeline); + ... + + // start the pipeline + gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING); + ... +} + + + + You need to set the pipeline to READY or NULL if you want to change it. + + + Capabilities of a GstPad diff --git a/docs/manual/quotes.sgml b/docs/manual/quotes.sgml index 44522c5d5f..78bff5dd0d 100644 --- a/docs/manual/quotes.sgml +++ b/docs/manual/quotes.sgml @@ -13,6 +13,7 @@ 14 Jan 2001 + Omega: did you run ldconfig? maybe it talks to init?