mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-16 19:25:18 +00:00
global s/disksrc/filesrc/, but edited by me
Original commit message from CVS: global s/disksrc/filesrc/, but edited by me
This commit is contained in:
parent
7eda2fc8b5
commit
35aa5cebdf
20 changed files with 118 additions and 120 deletions
|
@ -42,7 +42,6 @@
|
|||
<!entity GstFakeSrc SYSTEM "sgml/gstfakesrc.sgml">
|
||||
<!entity GstFakeSink SYSTEM "sgml/gstfakesink.sgml">
|
||||
<!entity GstFileSrc SYSTEM "sgml/gstfilesrc.sgml">
|
||||
<!entity GstDiskSrc SYSTEM "sgml/gstdisksrc.sgml">
|
||||
<!entity GstDiskSink SYSTEM "sgml/gstdisksink.sgml">
|
||||
<!entity GstHttpSrc SYSTEM "sgml/gsthttpsrc.sgml">
|
||||
<!entity GstFdSrc SYSTEM "sgml/gstfdsrc.sgml">
|
||||
|
@ -119,7 +118,6 @@ with some more specialized elements.</para>
|
|||
&GstFakeSink;
|
||||
|
||||
&GstFileSrc;
|
||||
&GstDiskSrc;
|
||||
&GstDiskSink;
|
||||
|
||||
&GstHttpSrc;
|
||||
|
|
|
@ -40,7 +40,7 @@ The following code example shows you how to create a GstDiskSrc element.
|
|||
|
||||
gst_init(&argc,&argv);
|
||||
|
||||
srcfactory = gst_elementfactory_find("disksrc");
|
||||
srcfactory = gst_elementfactory_find("filesrc");
|
||||
g_return_if_fail(srcfactory != NULL);
|
||||
|
||||
src = gst_elementfactory_create(srcfactory,"src");
|
||||
|
|
|
@ -16,7 +16,7 @@ mp3 player.
|
|||
pipeline = gst_pipeline_new ("launch");
|
||||
|
||||
/* build a pipeline in the pipeline */
|
||||
gst_parse_launch ("disksrc location=some.mp3 ! mad ! osssink", GST_BIN (pipeline));
|
||||
gst_parse_launch ("filesrc location=some.mp3 ! mad ! osssink", GST_BIN (pipeline));
|
||||
|
||||
/* play the thing */
|
||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
||||
|
|
|
@ -76,7 +76,7 @@ eos (GstSrc *src, gpointer data)
|
|||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
GstElement *disksrc, *audiosink;
|
||||
GstElement *filesrc, *audiosink;
|
||||
GstElement *pipeline;
|
||||
GstElement *thread;
|
||||
|
||||
|
@ -96,10 +96,10 @@ main (int argc, char *argv[])
|
|||
g_assert (pipeline != NULL);
|
||||
|
||||
/* create a disk reader */
|
||||
disksrc = gst_elementfactory_make ("disksrc", "disk_source");
|
||||
g_assert (disksrc != NULL);
|
||||
g_object_set (G_OBJECT (disksrc), "location", argv[1], NULL);
|
||||
g_signal_connect (G_OBJECT (disksrc), "eos",
|
||||
filesrc = gst_elementfactory_make ("filesrc", "disk_source");
|
||||
g_assert (filesrc != NULL);
|
||||
g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);
|
||||
g_signal_connect (G_OBJECT (filesrc), "eos",
|
||||
G_CALLBACK (eos), thread);
|
||||
|
||||
/* and an audio sink */
|
||||
|
@ -107,7 +107,7 @@ main (int argc, char *argv[])
|
|||
g_assert (audiosink != NULL);
|
||||
|
||||
/* add objects to the main pipeline */
|
||||
gst_bin_add (GST_BIN (pipeline), disksrc);
|
||||
gst_bin_add (GST_BIN (pipeline), filesrc);
|
||||
gst_bin_add (GST_BIN (pipeline), audiosink);
|
||||
|
||||
/* automatically setup the pipeline */
|
||||
|
@ -117,11 +117,11 @@ main (int argc, char *argv[])
|
|||
}
|
||||
|
||||
/* remove the source element from the pipeline */
|
||||
gst_bin_remove (GST_BIN (pipeline), disksrc);
|
||||
gst_bin_remove (GST_BIN (pipeline), filesrc);
|
||||
|
||||
/* insert the source element in the thread, remember a thread needs at
|
||||
least one source or connection element */
|
||||
gst_bin_add (GST_BIN (thread), disksrc);
|
||||
gst_bin_add (GST_BIN (thread), filesrc);
|
||||
|
||||
/* add the pipeline to the thread too */
|
||||
gst_bin_add (GST_BIN (thread), GST_ELEMENT (pipeline));
|
||||
|
|
|
@ -90,13 +90,13 @@ clean:
|
|||
A simple commandline looks like:
|
||||
|
||||
<screen>
|
||||
gstreamer-launch disksrc location=hello.mp3 ! mp3parse ! mpg123 ! audiosink
|
||||
gstreamer-launch filesrc location=hello.mp3 ! mp3parse ! mpg123 ! audiosink
|
||||
</screen>
|
||||
|
||||
A more complex pipeline looks like:
|
||||
|
||||
<screen>
|
||||
gstreamer-launch disksrc redpill.vob audio_00! (ac3parse ! ac3dec ! audiosink) \
|
||||
gstreamer-launch filesrc redpill.vob audio_00! (ac3parse ! ac3dec ! audiosink) \
|
||||
video_00! (mpeg2dec ! videosink)
|
||||
</screen>
|
||||
|
||||
|
@ -118,7 +118,7 @@ int
|
|||
main (int argc, char *argv[])
|
||||
{
|
||||
GstElement *pipeline;
|
||||
GstElement *disksrc;
|
||||
GstElement *filesrc;
|
||||
|
||||
gst_init (&argc, &argv);
|
||||
|
||||
|
@ -128,10 +128,10 @@ main (int argc, char *argv[])
|
|||
}
|
||||
pipeline = gst_pipeline_new ("my_pipeline");
|
||||
|
||||
gst_parse_launch ("disksrc[my_disksrc] ! mp3parse ! mpg123 ! osssink", GST_BIN (pipeline));
|
||||
gst_parse_launch ("filesrc[my_filesrc] ! mp3parse ! mpg123 ! osssink", GST_BIN (pipeline));
|
||||
|
||||
disksrc = gst_bin_get_by_name (GST_BIN (pipeline), "my_disksrc");
|
||||
g_object_set (G_OBJECT (disksrc), "location", argv[1], NULL);
|
||||
filesrc = gst_bin_get_by_name (GST_BIN (pipeline), "my_filesrc");
|
||||
g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);
|
||||
|
||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
||||
|
||||
|
@ -143,7 +143,7 @@ main (int argc, char *argv[])
|
|||
}
|
||||
</programlisting>
|
||||
<para>
|
||||
Note how we can retrieve the disksrc element from the constructed bin using the
|
||||
Note how we can retrieve the filesrc element from the constructed bin using the
|
||||
element name.
|
||||
</para>
|
||||
</sect1>
|
||||
|
|
|
@ -202,15 +202,15 @@
|
|||
</programlisting>
|
||||
<para>
|
||||
In the above example, the bin now also has a pad: the pad called 'sink' of the
|
||||
given element. We can now, for example, connect the srcpad of a disksrc to the
|
||||
given element. We can now, for example, connect the srcpad of a filesrc to the
|
||||
bin with:
|
||||
</para>
|
||||
<programlisting>
|
||||
GstElement *disksrc;
|
||||
GstElement *filesrc;
|
||||
|
||||
disksrc = gst_elementfactory_create ("disksrc", "disk_reader");
|
||||
filesrc = gst_elementfactory_create ("filesrc", "disk_reader");
|
||||
|
||||
gst_element_connect (disksrc, "src", bin, "sink");
|
||||
gst_element_connect (filesrc, "src", bin, "sink");
|
||||
...
|
||||
</programlisting>
|
||||
</sect1>
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
GstElement *pipeline, *disksrc, *parse, *decoder, *audiosink;
|
||||
GstElement *pipeline, *filesrc, *parse, *decoder, *audiosink;
|
||||
|
||||
gst_init(&argc, &argv);
|
||||
|
||||
|
@ -35,8 +35,8 @@ main (int argc, char *argv[])
|
|||
pipeline = gst_pipeline_new ("pipeline");
|
||||
|
||||
/* create a disk reader */
|
||||
disksrc = gst_elementfactory_make ("disksrc", "disk_source");
|
||||
g_object_set (G_OBJECT (disksrc), "location", argv[1], NULL);
|
||||
filesrc = gst_elementfactory_make ("filesrc", "disk_source");
|
||||
g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);
|
||||
|
||||
/* now it's time to get the parser */
|
||||
parse = gst_elementfactory_make ("mp3parse", "parse");
|
||||
|
@ -46,13 +46,13 @@ main (int argc, char *argv[])
|
|||
audiosink = gst_elementfactory_make ("osssink", "play_audio");
|
||||
|
||||
/* add objects to the main pipeline */
|
||||
gst_bin_add (GST_BIN (pipeline), disksrc);
|
||||
gst_bin_add (GST_BIN (pipeline), filesrc);
|
||||
gst_bin_add (GST_BIN (pipeline), parse);
|
||||
gst_bin_add (GST_BIN (pipeline), decoder);
|
||||
gst_bin_add (GST_BIN (pipeline), audiosink);
|
||||
|
||||
/* connect src to sink */
|
||||
gst_pad_connect (gst_element_get_pad (disksrc, "src"),
|
||||
gst_pad_connect (gst_element_get_pad (filesrc, "src"),
|
||||
gst_element_get_pad (parse, "sink"));
|
||||
gst_pad_connect (gst_element_get_pad (parse, "src"),
|
||||
gst_element_get_pad (decoder, "sink"));
|
||||
|
@ -71,7 +71,7 @@ main (int argc, char *argv[])
|
|||
gst_object_unref (GST_OBJECT (audiosink));
|
||||
gst_object_unref (GST_OBJECT (parse));
|
||||
gst_object_unref (GST_OBJECT (decoder));
|
||||
gst_object_unref (GST_OBJECT (disksrc));
|
||||
gst_object_unref (GST_OBJECT (filesrc));
|
||||
gst_object_unref (GST_OBJECT (pipeline));
|
||||
|
||||
exit (0);
|
||||
|
@ -108,7 +108,7 @@ main (int argc, char *argv[])
|
|||
</para>
|
||||
<programlisting>
|
||||
...
|
||||
GstElement *pipeline, *disksrc, *parse, *decoder, *audiosink;
|
||||
GstElement *pipeline, *filesrc, *parse, *decoder, *audiosink;
|
||||
...
|
||||
</programlisting>
|
||||
|
||||
|
@ -132,12 +132,12 @@ main (int argc, char *argv[])
|
|||
</para>
|
||||
<programlisting>
|
||||
/* create a disk reader */
|
||||
disksrc = gst_elementfactory_make ("disksrc", "disk_source");
|
||||
g_object_set (G_OBJECT (disksrc), "location", argv[1], NULL);
|
||||
filesrc = gst_elementfactory_make ("filesrc", "disk_source");
|
||||
g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);
|
||||
</programlisting>
|
||||
<note>
|
||||
<para>
|
||||
You can check if the disksrc != NULL to verify the creation of the
|
||||
You can check if the filesrc != NULL to verify the creation of the
|
||||
disk source element.
|
||||
</para>
|
||||
</note>
|
||||
|
@ -176,7 +176,7 @@ main (int argc, char *argv[])
|
|||
</para>
|
||||
<programlisting>
|
||||
/* add objects to the main pipeline */
|
||||
gst_bin_add (GST_BIN (pipeline), disksrc);
|
||||
gst_bin_add (GST_BIN (pipeline), filesrc);
|
||||
gst_bin_add (GST_BIN (pipeline), parse);
|
||||
gst_bin_add (GST_BIN (pipeline), decoder);
|
||||
gst_bin_add (GST_BIN (pipeline), audiosink);
|
||||
|
@ -187,7 +187,7 @@ main (int argc, char *argv[])
|
|||
</para>
|
||||
<programlisting>
|
||||
/* connect src to sink */
|
||||
gst_pad_connect (gst_element_get_pad (disksrc, "src"),
|
||||
gst_pad_connect (gst_element_get_pad (filesrc, "src"),
|
||||
gst_element_get_pad (parse, "sink"));
|
||||
gst_pad_connect (gst_element_get_pad (parse, "src"),
|
||||
gst_element_get_pad (decoder, "sink"));
|
||||
|
@ -243,7 +243,7 @@ main (int argc, char *argv[])
|
|||
|
||||
gst_object_unref (GST_OBJECT (audiosink));
|
||||
gst_object_unref (GST_OBJECT (decoder));
|
||||
gst_object_unref (GST_OBJECT (disksrc));
|
||||
gst_object_unref (GST_OBJECT (filesrc));
|
||||
gst_object_unref (GST_OBJECT (pipeline));
|
||||
|
||||
exit (0);
|
||||
|
@ -291,7 +291,7 @@ main (int argc, char *argv[])
|
|||
</para>
|
||||
<para>
|
||||
It should be clear from the example that we can very easily replace the
|
||||
disksrc element with an httpsrc, giving you instant network streaming.
|
||||
filesrc element with an httpsrc, giving you instant network streaming.
|
||||
An element could be build to handle icecast connections, for example.
|
||||
</para>
|
||||
<para>
|
||||
|
|
|
@ -202,15 +202,15 @@
|
|||
</programlisting>
|
||||
<para>
|
||||
In the above example, the bin now also has a pad: the pad called 'sink' of the
|
||||
given element. We can now, for example, connect the srcpad of a disksrc to the
|
||||
given element. We can now, for example, connect the srcpad of a filesrc to the
|
||||
bin with:
|
||||
</para>
|
||||
<programlisting>
|
||||
GstElement *disksrc;
|
||||
GstElement *filesrc;
|
||||
|
||||
disksrc = gst_elementfactory_create ("disksrc", "disk_reader");
|
||||
filesrc = gst_elementfactory_create ("filesrc", "disk_reader");
|
||||
|
||||
gst_element_connect (disksrc, "src", bin, "sink");
|
||||
gst_element_connect (filesrc, "src", bin, "sink");
|
||||
...
|
||||
</programlisting>
|
||||
</sect1>
|
||||
|
|
|
@ -44,7 +44,7 @@ main(int argc, char *argv[])
|
|||
pipeline = gst_pipeline_new ("pipeline");
|
||||
g_return_val_if_fail (pipeline != NULL, -1);
|
||||
|
||||
src = gst_elementfactory_make ("disksrc", "src");
|
||||
src = gst_elementfactory_make ("filesrc", "src");
|
||||
g_return_val_if_fail (src != NULL, -1);
|
||||
g_object_set (G_OBJECT (src), "location", argv[1], NULL);
|
||||
|
||||
|
@ -76,9 +76,9 @@ main(int argc, char *argv[])
|
|||
|
||||
</programlisting>
|
||||
<para>
|
||||
We create two elements: a disksrc (the element that will read the
|
||||
We create two elements: a filesrc (the element that will read the
|
||||
file from disk) and an mpeg1parser. We also add an EOS (End Of Stream)
|
||||
signal to the disksrc so that we will be notified when the file has ended.
|
||||
signal to the filesrc so that we will be notified when the file has ended.
|
||||
There's nothing special about this piece of code except for the signal
|
||||
'new_pad' that we connected to the mpeg1parser using:
|
||||
</para>
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
GstElement *pipeline, *disksrc, *parse, *decoder, *audiosink;
|
||||
GstElement *pipeline, *filesrc, *parse, *decoder, *audiosink;
|
||||
|
||||
gst_init(&argc, &argv);
|
||||
|
||||
|
@ -35,8 +35,8 @@ main (int argc, char *argv[])
|
|||
pipeline = gst_pipeline_new ("pipeline");
|
||||
|
||||
/* create a disk reader */
|
||||
disksrc = gst_elementfactory_make ("disksrc", "disk_source");
|
||||
g_object_set (G_OBJECT (disksrc), "location", argv[1], NULL);
|
||||
filesrc = gst_elementfactory_make ("filesrc", "disk_source");
|
||||
g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);
|
||||
|
||||
/* now it's time to get the parser */
|
||||
parse = gst_elementfactory_make ("mp3parse", "parse");
|
||||
|
@ -46,13 +46,13 @@ main (int argc, char *argv[])
|
|||
audiosink = gst_elementfactory_make ("osssink", "play_audio");
|
||||
|
||||
/* add objects to the main pipeline */
|
||||
gst_bin_add (GST_BIN (pipeline), disksrc);
|
||||
gst_bin_add (GST_BIN (pipeline), filesrc);
|
||||
gst_bin_add (GST_BIN (pipeline), parse);
|
||||
gst_bin_add (GST_BIN (pipeline), decoder);
|
||||
gst_bin_add (GST_BIN (pipeline), audiosink);
|
||||
|
||||
/* connect src to sink */
|
||||
gst_pad_connect (gst_element_get_pad (disksrc, "src"),
|
||||
gst_pad_connect (gst_element_get_pad (filesrc, "src"),
|
||||
gst_element_get_pad (parse, "sink"));
|
||||
gst_pad_connect (gst_element_get_pad (parse, "src"),
|
||||
gst_element_get_pad (decoder, "sink"));
|
||||
|
@ -71,7 +71,7 @@ main (int argc, char *argv[])
|
|||
gst_object_unref (GST_OBJECT (audiosink));
|
||||
gst_object_unref (GST_OBJECT (parse));
|
||||
gst_object_unref (GST_OBJECT (decoder));
|
||||
gst_object_unref (GST_OBJECT (disksrc));
|
||||
gst_object_unref (GST_OBJECT (filesrc));
|
||||
gst_object_unref (GST_OBJECT (pipeline));
|
||||
|
||||
exit (0);
|
||||
|
@ -108,7 +108,7 @@ main (int argc, char *argv[])
|
|||
</para>
|
||||
<programlisting>
|
||||
...
|
||||
GstElement *pipeline, *disksrc, *parse, *decoder, *audiosink;
|
||||
GstElement *pipeline, *filesrc, *parse, *decoder, *audiosink;
|
||||
...
|
||||
</programlisting>
|
||||
|
||||
|
@ -132,12 +132,12 @@ main (int argc, char *argv[])
|
|||
</para>
|
||||
<programlisting>
|
||||
/* create a disk reader */
|
||||
disksrc = gst_elementfactory_make ("disksrc", "disk_source");
|
||||
g_object_set (G_OBJECT (disksrc), "location", argv[1], NULL);
|
||||
filesrc = gst_elementfactory_make ("filesrc", "disk_source");
|
||||
g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);
|
||||
</programlisting>
|
||||
<note>
|
||||
<para>
|
||||
You can check if the disksrc != NULL to verify the creation of the
|
||||
You can check if the filesrc != NULL to verify the creation of the
|
||||
disk source element.
|
||||
</para>
|
||||
</note>
|
||||
|
@ -176,7 +176,7 @@ main (int argc, char *argv[])
|
|||
</para>
|
||||
<programlisting>
|
||||
/* add objects to the main pipeline */
|
||||
gst_bin_add (GST_BIN (pipeline), disksrc);
|
||||
gst_bin_add (GST_BIN (pipeline), filesrc);
|
||||
gst_bin_add (GST_BIN (pipeline), parse);
|
||||
gst_bin_add (GST_BIN (pipeline), decoder);
|
||||
gst_bin_add (GST_BIN (pipeline), audiosink);
|
||||
|
@ -187,7 +187,7 @@ main (int argc, char *argv[])
|
|||
</para>
|
||||
<programlisting>
|
||||
/* connect src to sink */
|
||||
gst_pad_connect (gst_element_get_pad (disksrc, "src"),
|
||||
gst_pad_connect (gst_element_get_pad (filesrc, "src"),
|
||||
gst_element_get_pad (parse, "sink"));
|
||||
gst_pad_connect (gst_element_get_pad (parse, "src"),
|
||||
gst_element_get_pad (decoder, "sink"));
|
||||
|
@ -243,7 +243,7 @@ main (int argc, char *argv[])
|
|||
|
||||
gst_object_unref (GST_OBJECT (audiosink));
|
||||
gst_object_unref (GST_OBJECT (decoder));
|
||||
gst_object_unref (GST_OBJECT (disksrc));
|
||||
gst_object_unref (GST_OBJECT (filesrc));
|
||||
gst_object_unref (GST_OBJECT (pipeline));
|
||||
|
||||
exit (0);
|
||||
|
@ -291,7 +291,7 @@ main (int argc, char *argv[])
|
|||
</para>
|
||||
<para>
|
||||
It should be clear from the example that we can very easily replace the
|
||||
disksrc element with an httpsrc, giving you instant network streaming.
|
||||
filesrc element with an httpsrc, giving you instant network streaming.
|
||||
An element could be build to handle icecast connections, for example.
|
||||
</para>
|
||||
<para>
|
||||
|
|
|
@ -26,7 +26,7 @@ static void gst_play_cache_empty (GstElement *element, GstElement *pipeline);
|
|||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
GstElement *disksrc;
|
||||
GstElement *filesrc;
|
||||
GstElement *pipeline;
|
||||
GstElement *autobin;
|
||||
GstElement *typefind;
|
||||
|
@ -44,10 +44,10 @@ main (int argc, char *argv[])
|
|||
g_assert (pipeline != NULL);
|
||||
|
||||
/* create a disk reader */
|
||||
disksrc = gst_elementfactory_make ("disksrc", "disk_source");
|
||||
g_assert (disksrc != NULL);
|
||||
g_object_set (G_OBJECT (disksrc), "location", argv[1], NULL);
|
||||
gst_bin_add (GST_BIN (pipeline), disksrc);
|
||||
filesrc = gst_elementfactory_make ("filesrc", "disk_source");
|
||||
g_assert (filesrc != NULL);
|
||||
g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);
|
||||
gst_bin_add (GST_BIN (pipeline), filesrc);
|
||||
|
||||
autobin = gst_bin_new ("autobin");
|
||||
cache = gst_elementfactory_make ("autoplugcache", "cache");
|
||||
|
@ -64,7 +64,7 @@ main (int argc, char *argv[])
|
|||
gst_element_add_ghost_pad (autobin, gst_element_get_pad (cache, "sink"), "sink");
|
||||
|
||||
gst_bin_add (GST_BIN( pipeline), autobin);
|
||||
gst_element_connect (disksrc, "src", autobin, "sink");
|
||||
gst_element_connect (filesrc, "src", autobin, "sink");
|
||||
|
||||
/* start playing */
|
||||
gst_element_set_state( GST_ELEMENT (pipeline), GST_STATE_PLAYING);
|
||||
|
@ -80,7 +80,7 @@ main (int argc, char *argv[])
|
|||
}
|
||||
</programlisting>
|
||||
<para>
|
||||
We start by constructing a 'disksrc' element and an 'autobin' element that
|
||||
We start by constructing a 'filesrc' element and an 'autobin' element that
|
||||
holds the autoplugcache and the typefind element.
|
||||
</para>
|
||||
<para>
|
||||
|
@ -96,14 +96,14 @@ gst_play_have_type (GstElement *typefind, GstCaps *caps, GstElement *pipeline)
|
|||
GstElement *new_element;
|
||||
GstAutoplug *autoplug;
|
||||
GstElement *autobin;
|
||||
GstElement *disksrc;
|
||||
GstElement *filesrc;
|
||||
GstElement *cache;
|
||||
|
||||
GST_DEBUG (0,"GstPipeline: play have type\n");
|
||||
|
||||
gst_element_set_state (pipeline, GST_STATE_PAUSED);
|
||||
|
||||
disksrc = gst_bin_get_by_name (GST_BIN (pipeline), "disk_source");
|
||||
filesrc = gst_bin_get_by_name (GST_BIN (pipeline), "disk_source");
|
||||
autobin = gst_bin_get_by_name (GST_BIN (pipeline), "autobin");
|
||||
cache = gst_bin_get_by_name (GST_BIN (autobin), "cache");
|
||||
|
||||
|
@ -145,7 +145,7 @@ gst_play_have_type (GstElement *typefind, GstCaps *caps, GstElement *pipeline)
|
|||
manipulate in the pipeline with:
|
||||
</para>
|
||||
<programlisting>
|
||||
disksrc = gst_bin_get_by_name (GST_BIN (pipeline), "disk_source");
|
||||
filesrc = gst_bin_get_by_name (GST_BIN (pipeline), "disk_source");
|
||||
autobin = gst_bin_get_by_name (GST_BIN (pipeline), "autobin");
|
||||
cache = gst_bin_get_by_name (GST_BIN (autobin), "cache");
|
||||
</programlisting>
|
||||
|
@ -214,7 +214,7 @@ static void
|
|||
gst_play_cache_empty (GstElement *element, GstElement *pipeline)
|
||||
{
|
||||
GstElement *autobin;
|
||||
GstElement *disksrc;
|
||||
GstElement *filesrc;
|
||||
GstElement *cache;
|
||||
GstElement *new_element;
|
||||
|
||||
|
@ -222,15 +222,15 @@ gst_play_cache_empty (GstElement *element, GstElement *pipeline)
|
|||
|
||||
gst_element_set_state (pipeline, GST_STATE_PAUSED);
|
||||
|
||||
disksrc = gst_bin_get_by_name (GST_BIN (pipeline), "disk_source");
|
||||
filesrc = gst_bin_get_by_name (GST_BIN (pipeline), "disk_source");
|
||||
autobin = gst_bin_get_by_name (GST_BIN (pipeline), "autobin");
|
||||
cache = gst_bin_get_by_name (GST_BIN (autobin), "cache");
|
||||
new_element = gst_bin_get_by_name (GST_BIN (autobin), "new_element");
|
||||
|
||||
gst_element_disconnect (disksrc, "src", cache, "sink");
|
||||
gst_element_disconnect (filesrc, "src", cache, "sink");
|
||||
gst_element_disconnect (cache, "src", new_element, "sink");
|
||||
gst_bin_remove (GST_BIN (autobin), cache);
|
||||
gst_element_connect (disksrc, "src", new_element, "sink");
|
||||
gst_element_connect (filesrc, "src", new_element, "sink");
|
||||
|
||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
||||
|
||||
|
@ -240,7 +240,7 @@ gst_play_cache_empty (GstElement *element, GstElement *pipeline)
|
|||
|
||||
<para>
|
||||
The cache empty function simply removes the autoplugcache element from
|
||||
the pipeline and reconnects the disksrc to the autoplugged element.
|
||||
the pipeline and reconnects the filesrc to the autoplugged element.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
|
|
|
@ -31,7 +31,7 @@ gboolean playing;
|
|||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
GstElement *disksrc, *audiosink, *queue, *queue2, *parse, *decode;
|
||||
GstElement *filesrc, *audiosink, *queue, *queue2, *parse, *decode;
|
||||
GstElement *bin;
|
||||
GstElement *thread, *thread2;
|
||||
|
||||
|
@ -53,9 +53,9 @@ main (int argc, char *argv[])
|
|||
g_assert (bin != NULL);
|
||||
|
||||
/* create a disk reader */
|
||||
disksrc = gst_elementfactory_make ("disksrc", "disk_source");
|
||||
g_assert (disksrc != NULL);
|
||||
g_object_set (G_OBJECT (disksrc), "location", argv[1], NULL);
|
||||
filesrc = gst_elementfactory_make ("filesrc", "disk_source");
|
||||
g_assert (filesrc != NULL);
|
||||
g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);
|
||||
|
||||
queue = gst_elementfactory_make ("queue", "queue");
|
||||
queue2 = gst_elementfactory_make ("queue", "queue2");
|
||||
|
@ -68,7 +68,7 @@ main (int argc, char *argv[])
|
|||
decode = gst_elementfactory_make ("mpg123", "decode");
|
||||
|
||||
/* add objects to the main bin */
|
||||
gst_bin_add (GST_BIN (bin), disksrc);
|
||||
gst_bin_add (GST_BIN (bin), filesrc);
|
||||
gst_bin_add (GST_BIN (bin), queue);
|
||||
|
||||
gst_bin_add (GST_BIN (thread), parse);
|
||||
|
@ -77,7 +77,7 @@ main (int argc, char *argv[])
|
|||
|
||||
gst_bin_add (GST_BIN (thread2), audiosink);
|
||||
|
||||
gst_pad_connect (gst_element_get_pad (disksrc,"src"),
|
||||
gst_pad_connect (gst_element_get_pad (filesrc,"src"),
|
||||
gst_element_get_pad (queue,"sink"));
|
||||
|
||||
gst_pad_connect (gst_element_get_pad (queue,"src"),
|
||||
|
|
|
@ -90,13 +90,13 @@ clean:
|
|||
A simple commandline looks like:
|
||||
|
||||
<screen>
|
||||
gstreamer-launch disksrc location=hello.mp3 ! mp3parse ! mpg123 ! audiosink
|
||||
gstreamer-launch filesrc location=hello.mp3 ! mp3parse ! mpg123 ! audiosink
|
||||
</screen>
|
||||
|
||||
A more complex pipeline looks like:
|
||||
|
||||
<screen>
|
||||
gstreamer-launch disksrc redpill.vob audio_00! (ac3parse ! ac3dec ! audiosink) \
|
||||
gstreamer-launch filesrc redpill.vob audio_00! (ac3parse ! ac3dec ! audiosink) \
|
||||
video_00! (mpeg2dec ! videosink)
|
||||
</screen>
|
||||
|
||||
|
@ -118,7 +118,7 @@ int
|
|||
main (int argc, char *argv[])
|
||||
{
|
||||
GstElement *pipeline;
|
||||
GstElement *disksrc;
|
||||
GstElement *filesrc;
|
||||
|
||||
gst_init (&argc, &argv);
|
||||
|
||||
|
@ -128,10 +128,10 @@ main (int argc, char *argv[])
|
|||
}
|
||||
pipeline = gst_pipeline_new ("my_pipeline");
|
||||
|
||||
gst_parse_launch ("disksrc[my_disksrc] ! mp3parse ! mpg123 ! osssink", GST_BIN (pipeline));
|
||||
gst_parse_launch ("filesrc[my_filesrc] ! mp3parse ! mpg123 ! osssink", GST_BIN (pipeline));
|
||||
|
||||
disksrc = gst_bin_get_by_name (GST_BIN (pipeline), "my_disksrc");
|
||||
g_object_set (G_OBJECT (disksrc), "location", argv[1], NULL);
|
||||
filesrc = gst_bin_get_by_name (GST_BIN (pipeline), "my_filesrc");
|
||||
g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);
|
||||
|
||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
||||
|
||||
|
@ -143,7 +143,7 @@ main (int argc, char *argv[])
|
|||
}
|
||||
</programlisting>
|
||||
<para>
|
||||
Note how we can retrieve the disksrc element from the constructed bin using the
|
||||
Note how we can retrieve the filesrc element from the constructed bin using the
|
||||
element name.
|
||||
</para>
|
||||
</sect1>
|
||||
|
|
|
@ -63,7 +63,7 @@ eos (GstElement *element, gpointer data)
|
|||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
GstElement *disksrc, *audiosink, *queue, *parse, *decode;
|
||||
GstElement *filesrc, *audiosink, *queue, *parse, *decode;
|
||||
GstElement *bin;
|
||||
GstElement *thread;
|
||||
|
||||
|
@ -83,10 +83,10 @@ main (int argc, char *argv[])
|
|||
g_assert (bin != NULL);
|
||||
|
||||
/* create a disk reader */
|
||||
disksrc = gst_elementfactory_make ("disksrc", "disk_source");
|
||||
g_assert (disksrc != NULL);
|
||||
g_object_set (G_OBJECT (disksrc), "location", argv[1], NULL);
|
||||
g_signal_connect (G_OBJECT (disksrc), "eos",
|
||||
filesrc = gst_elementfactory_make ("filesrc", "disk_source");
|
||||
g_assert (filesrc != NULL);
|
||||
g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);
|
||||
g_signal_connect (G_OBJECT (filesrc), "eos",
|
||||
G_CALLBACK (eos), thread);
|
||||
|
||||
queue = gst_elementfactory_make ("queue", "queue");
|
||||
|
@ -99,14 +99,14 @@ main (int argc, char *argv[])
|
|||
decode = gst_elementfactory_make ("mpg123", "decode");
|
||||
|
||||
/* add objects to the main bin */
|
||||
gst_bin_add (GST_BIN (bin), disksrc);
|
||||
gst_bin_add (GST_BIN (bin), filesrc);
|
||||
gst_bin_add (GST_BIN (bin), queue);
|
||||
|
||||
gst_bin_add (GST_BIN (thread), parse);
|
||||
gst_bin_add (GST_BIN (thread), decode);
|
||||
gst_bin_add (GST_BIN (thread), audiosink);
|
||||
|
||||
gst_pad_connect (gst_element_get_pad (disksrc,"src"),
|
||||
gst_pad_connect (gst_element_get_pad (filesrc,"src"),
|
||||
gst_element_get_pad (queue,"sink"));
|
||||
|
||||
gst_pad_connect (gst_element_get_pad (queue, "src"),
|
||||
|
|
|
@ -76,7 +76,7 @@ eos (GstSrc *src, gpointer data)
|
|||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
GstElement *disksrc, *audiosink;
|
||||
GstElement *filesrc, *audiosink;
|
||||
GstElement *pipeline;
|
||||
GstElement *thread;
|
||||
|
||||
|
@ -96,10 +96,10 @@ main (int argc, char *argv[])
|
|||
g_assert (pipeline != NULL);
|
||||
|
||||
/* create a disk reader */
|
||||
disksrc = gst_elementfactory_make ("disksrc", "disk_source");
|
||||
g_assert (disksrc != NULL);
|
||||
g_object_set (G_OBJECT (disksrc), "location", argv[1], NULL);
|
||||
g_signal_connect (G_OBJECT (disksrc), "eos",
|
||||
filesrc = gst_elementfactory_make ("filesrc", "disk_source");
|
||||
g_assert (filesrc != NULL);
|
||||
g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);
|
||||
g_signal_connect (G_OBJECT (filesrc), "eos",
|
||||
G_CALLBACK (eos), thread);
|
||||
|
||||
/* and an audio sink */
|
||||
|
@ -107,7 +107,7 @@ main (int argc, char *argv[])
|
|||
g_assert (audiosink != NULL);
|
||||
|
||||
/* add objects to the main pipeline */
|
||||
gst_bin_add (GST_BIN (pipeline), disksrc);
|
||||
gst_bin_add (GST_BIN (pipeline), filesrc);
|
||||
gst_bin_add (GST_BIN (pipeline), audiosink);
|
||||
|
||||
/* automatically setup the pipeline */
|
||||
|
@ -117,11 +117,11 @@ main (int argc, char *argv[])
|
|||
}
|
||||
|
||||
/* remove the source element from the pipeline */
|
||||
gst_bin_remove (GST_BIN (pipeline), disksrc);
|
||||
gst_bin_remove (GST_BIN (pipeline), filesrc);
|
||||
|
||||
/* insert the source element in the thread, remember a thread needs at
|
||||
least one source or connection element */
|
||||
gst_bin_add (GST_BIN (thread), disksrc);
|
||||
gst_bin_add (GST_BIN (thread), filesrc);
|
||||
|
||||
/* add the pipeline to the thread too */
|
||||
gst_bin_add (GST_BIN (thread), GST_ELEMENT (pipeline));
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<chapter id="cha-typedetection">
|
||||
<title>Typedetection</title>
|
||||
<para>
|
||||
Sometimes the capabilities of a pad are not specificied. The disksrc, for
|
||||
Sometimes the capabilities of a pad are not specificied. The filesrc, for
|
||||
example, does not know what type of file it is reading. Before you can attach
|
||||
an element to the pad of the disksrc, you need to determine the media type in
|
||||
an element to the pad of the filesrc, you need to determine the media type in
|
||||
order to be able to choose a compatible element.
|
||||
</para>
|
||||
<para>
|
||||
|
@ -59,7 +59,7 @@ void type_found (GstElement *typefind, GstCaps* caps);
|
|||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
GstElement *bin, *disksrc, *typefind;
|
||||
GstElement *bin, *filesrc, *typefind;
|
||||
|
||||
gst_init (&argc, &argv);
|
||||
|
||||
|
@ -73,22 +73,22 @@ main(int argc, char *argv[])
|
|||
g_assert (bin != NULL);
|
||||
|
||||
/* create a disk reader */
|
||||
disksrc = gst_elementfactory_make ("disksrc", "disk_source");
|
||||
g_assert (disksrc != NULL);
|
||||
g_object_set (G_OBJECT (disksrc), "location", argv[1], NULL);
|
||||
filesrc = gst_elementfactory_make ("filesrc", "disk_source");
|
||||
g_assert (filesrc != NULL);
|
||||
g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);
|
||||
|
||||
/* create the typefind element */
|
||||
typefind = gst_elementfactory_make ("typefind", "typefind");
|
||||
g_assert (typefind != NULL);
|
||||
|
||||
/* add objects to the main pipeline */
|
||||
gst_bin_add (GST_BIN (bin), disksrc);
|
||||
gst_bin_add (GST_BIN (bin), filesrc);
|
||||
gst_bin_add (GST_BIN (bin), typefind);
|
||||
|
||||
g_signal_connect (G_OBJECT (typefind), "have_type",
|
||||
G_CALLBACK (type_found), NULL);
|
||||
|
||||
gst_pad_connect (gst_element_get_pad (disksrc, "src"),
|
||||
gst_pad_connect (gst_element_get_pad (filesrc, "src"),
|
||||
gst_element_get_pad (typefind, "sink"));
|
||||
|
||||
/* start playing */
|
||||
|
@ -102,9 +102,9 @@ main(int argc, char *argv[])
|
|||
}
|
||||
</programlisting>
|
||||
<para>
|
||||
We create a very simple pipeline with only a disksrc and the typefind element
|
||||
We create a very simple pipeline with only a filesrc and the typefind element
|
||||
in it. The sinkpad of the typefind element has been connected to the src pad
|
||||
of the disksrc.
|
||||
of the filesrc.
|
||||
</para>
|
||||
<para>
|
||||
We attached a signal 'have_type' to the typefind element which will be called
|
||||
|
|
|
@ -31,7 +31,7 @@ gboolean playing;
|
|||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
GstElement *disksrc, *audiosink, *queue, *queue2, *parse, *decode;
|
||||
GstElement *filesrc, *audiosink, *queue, *queue2, *parse, *decode;
|
||||
GstElement *bin;
|
||||
GstElement *thread, *thread2;
|
||||
|
||||
|
@ -53,9 +53,9 @@ main (int argc, char *argv[])
|
|||
g_assert (bin != NULL);
|
||||
|
||||
/* create a disk reader */
|
||||
disksrc = gst_elementfactory_make ("disksrc", "disk_source");
|
||||
g_assert (disksrc != NULL);
|
||||
g_object_set (G_OBJECT (disksrc), "location", argv[1], NULL);
|
||||
filesrc = gst_elementfactory_make ("filesrc", "disk_source");
|
||||
g_assert (filesrc != NULL);
|
||||
g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);
|
||||
|
||||
queue = gst_elementfactory_make ("queue", "queue");
|
||||
queue2 = gst_elementfactory_make ("queue", "queue2");
|
||||
|
@ -68,7 +68,7 @@ main (int argc, char *argv[])
|
|||
decode = gst_elementfactory_make ("mpg123", "decode");
|
||||
|
||||
/* add objects to the main bin */
|
||||
gst_bin_add (GST_BIN (bin), disksrc);
|
||||
gst_bin_add (GST_BIN (bin), filesrc);
|
||||
gst_bin_add (GST_BIN (bin), queue);
|
||||
|
||||
gst_bin_add (GST_BIN (thread), parse);
|
||||
|
@ -77,7 +77,7 @@ main (int argc, char *argv[])
|
|||
|
||||
gst_bin_add (GST_BIN (thread2), audiosink);
|
||||
|
||||
gst_pad_connect (gst_element_get_pad (disksrc,"src"),
|
||||
gst_pad_connect (gst_element_get_pad (filesrc,"src"),
|
||||
gst_element_get_pad (queue,"sink"));
|
||||
|
||||
gst_pad_connect (gst_element_get_pad (queue,"src"),
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#! /bin/sh
|
||||
for loc in "$@"; do
|
||||
../../tools/gstreamer-launch disksrc \""location=$loc"\" ! mp3parse ! mpg123 ! osssink
|
||||
../../tools/gstreamer-launch filesrc \""location=$loc"\" ! mp3parse ! mpg123 ! osssink
|
||||
done
|
||||
|
|
|
@ -67,7 +67,7 @@ int main (int argc,char *argv[]) {
|
|||
gst_init(&argc,&argv);
|
||||
|
||||
pipeline = gst_pipeline_new("pipeline");
|
||||
src = gst_elementfactory_make ("disksrc","src");
|
||||
src = gst_elementfactory_make ("filesrc","src");
|
||||
g_object_set(G_OBJECT(src),"location",argv[1],NULL);
|
||||
gst_bin_add (GST_BIN(pipeline),src);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#! /bin/sh
|
||||
for loc in "$@"; do
|
||||
../../tools/gstreamer-launch disksrc \""location=$loc"\" ! mp3parse ! mpg123 ! osssink
|
||||
../../tools/gstreamer-launch filesrc \""location=$loc"\" ! mp3parse ! mpg123 ! osssink
|
||||
done
|
||||
|
|
Loading…
Reference in a new issue