mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-12 17:25:36 +00:00
examples/retag/retag.c: Update retag example so that it actually works (#319316).
Original commit message from CVS: * examples/retag/retag.c: (main): Update retag example so that it actually works (#319316).
This commit is contained in:
parent
9ef03a8c03
commit
b1f3296556
3 changed files with 25 additions and 4 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2005-10-27 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
|
* examples/retag/retag.c: (main):
|
||||||
|
Update retag example so that it actually works (#319316).
|
||||||
|
|
||||||
2005-10-20 Tim-Philipp Müller <tim at centricular dot net>
|
2005-10-20 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
* tools/gst-inspect.c: (print_interfaces),
|
* tools/gst-inspect.c: (print_interfaces),
|
||||||
|
|
|
@ -19,6 +19,7 @@ int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
GstElement *bin, *filesrc, *tag_changer, *filesink;
|
GstElement *bin, *filesrc, *tag_changer, *filesink;
|
||||||
|
GstCaps *filtercaps;
|
||||||
gchar *artist, *title, *ext, *filename;
|
gchar *artist, *title, *ext, *filename;
|
||||||
|
|
||||||
/* initialize GStreamer */
|
/* initialize GStreamer */
|
||||||
|
@ -74,7 +75,8 @@ main (int argc, char *argv[])
|
||||||
/* make sure the tag setter uses our stuff
|
/* make sure the tag setter uses our stuff
|
||||||
(though that should already be default) */
|
(though that should already be default) */
|
||||||
gst_tag_setter_set_merge_mode (GST_TAG_SETTER (tag_changer),
|
gst_tag_setter_set_merge_mode (GST_TAG_SETTER (tag_changer),
|
||||||
GST_TAG_MERGE_KEEP);
|
GST_TAG_MERGE_REPLACE);
|
||||||
|
|
||||||
/* set the tagging information */
|
/* set the tagging information */
|
||||||
gst_tag_setter_add (GST_TAG_SETTER (tag_changer), GST_TAG_MERGE_REPLACE,
|
gst_tag_setter_add (GST_TAG_SETTER (tag_changer), GST_TAG_MERGE_REPLACE,
|
||||||
GST_TAG_ARTIST, artist, GST_TAG_TITLE, title, NULL);
|
GST_TAG_ARTIST, artist, GST_TAG_TITLE, title, NULL);
|
||||||
|
@ -83,9 +85,15 @@ main (int argc, char *argv[])
|
||||||
gst_bin_add_many (GST_BIN (bin), filesrc, tag_changer, filesink, NULL);
|
gst_bin_add_many (GST_BIN (bin), filesrc, tag_changer, filesink, NULL);
|
||||||
|
|
||||||
/* link the elements */
|
/* link the elements */
|
||||||
if (!gst_element_link_many (filesrc, tag_changer, filesink, NULL))
|
if (!gst_element_link (filesrc, tag_changer))
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
|
|
||||||
|
/* id3tag determines its mode of operation from its source caps */
|
||||||
|
filtercaps = gst_caps_new_simple ("application/x-id3", NULL);
|
||||||
|
if (!gst_element_link_filtered (tag_changer, filesink, filtercaps))
|
||||||
|
g_assert_not_reached ();
|
||||||
|
gst_caps_free (filtercaps);
|
||||||
|
|
||||||
/* start playing */
|
/* start playing */
|
||||||
gst_element_set_state (bin, GST_STATE_PLAYING);
|
gst_element_set_state (bin, GST_STATE_PLAYING);
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
GstElement *bin, *filesrc, *tag_changer, *filesink;
|
GstElement *bin, *filesrc, *tag_changer, *filesink;
|
||||||
|
GstCaps *filtercaps;
|
||||||
gchar *artist, *title, *ext, *filename;
|
gchar *artist, *title, *ext, *filename;
|
||||||
|
|
||||||
/* initialize GStreamer */
|
/* initialize GStreamer */
|
||||||
|
@ -74,7 +75,8 @@ main (int argc, char *argv[])
|
||||||
/* make sure the tag setter uses our stuff
|
/* make sure the tag setter uses our stuff
|
||||||
(though that should already be default) */
|
(though that should already be default) */
|
||||||
gst_tag_setter_set_merge_mode (GST_TAG_SETTER (tag_changer),
|
gst_tag_setter_set_merge_mode (GST_TAG_SETTER (tag_changer),
|
||||||
GST_TAG_MERGE_KEEP);
|
GST_TAG_MERGE_REPLACE);
|
||||||
|
|
||||||
/* set the tagging information */
|
/* set the tagging information */
|
||||||
gst_tag_setter_add (GST_TAG_SETTER (tag_changer), GST_TAG_MERGE_REPLACE,
|
gst_tag_setter_add (GST_TAG_SETTER (tag_changer), GST_TAG_MERGE_REPLACE,
|
||||||
GST_TAG_ARTIST, artist, GST_TAG_TITLE, title, NULL);
|
GST_TAG_ARTIST, artist, GST_TAG_TITLE, title, NULL);
|
||||||
|
@ -83,9 +85,15 @@ main (int argc, char *argv[])
|
||||||
gst_bin_add_many (GST_BIN (bin), filesrc, tag_changer, filesink, NULL);
|
gst_bin_add_many (GST_BIN (bin), filesrc, tag_changer, filesink, NULL);
|
||||||
|
|
||||||
/* link the elements */
|
/* link the elements */
|
||||||
if (!gst_element_link_many (filesrc, tag_changer, filesink, NULL))
|
if (!gst_element_link (filesrc, tag_changer))
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
|
|
||||||
|
/* id3tag determines its mode of operation from its source caps */
|
||||||
|
filtercaps = gst_caps_new_simple ("application/x-id3", NULL);
|
||||||
|
if (!gst_element_link_filtered (tag_changer, filesink, filtercaps))
|
||||||
|
g_assert_not_reached ();
|
||||||
|
gst_caps_free (filtercaps);
|
||||||
|
|
||||||
/* start playing */
|
/* start playing */
|
||||||
gst_element_set_state (bin, GST_STATE_PLAYING);
|
gst_element_set_state (bin, GST_STATE_PLAYING);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue