Case 1:<br>The below pipeline should play any mp3 file.<br><br>gst-launch -v filesrc location=song.mp3 ! mad !
audioconvert ! audioresample ! autoaudiosink<br><br>Case 2:<br>And optionally if the file has id3 tags then use<br><br>gst-launch -v filesrc location=song.mp3 ! id3demux ! mad !
audioconvert ! audioresample ! autoaudiosink<br><br>You need to additional install mad(mp3 decoder).<br><br>Only in case 2 you need to have the callback for "pad-added" signal. Check out the helloworld example and similar<br>
from manual.<br><br><br><div class="gmail_quote">On Thu, Nov 19, 2009 at 4:14 PM, Lukas Ruetz <span dir="ltr"><<a href="mailto:lukas.ruetz@gmx.at">lukas.ruetz@gmx.at</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>
<br>
Am Donnerstag, den 19.11.2009, 07:41 -0200 schrieb Tiago Katcipis:<br>
<div><div></div><div class="h5">> It would be easier if you show your on_pad_added function, and if you<br>
> tell exactly what error messages do you get when you run your<br>
> application.<br>
><br>
> To investigate the capabilities of a element you can use gst-inspect.<br>
><br>
> On a terminal you can type for example:<br>
> gst-inspect flump3dec<br>
><br>
> it will give an complete specification of the flump3dec element.<br>
><br>
> best regards,<br>
> Katcipis<br>
><br>
> On Thu, Nov 19, 2009 at 6:40 AM, basavaraj P <<a href="mailto:basavarajp82@gmail.com">basavarajp82@gmail.com</a>><br>
> wrote:<br>
> Hello,<br>
><br>
> Following is code which plays mp3 using playbin<br>
><br>
> /* set up */<br>
> play = gst_element_factory_make ("playbin2", "play");<br>
> g_object_set (G_OBJECT (play), "uri",<br>
> "file:///home/basavaraj/Music/JabSeTereNaina.mp3", NULL);<br>
><br>
> bus = gst_pipeline_get_bus (GST_PIPELINE (play));<br>
> // gst_bus_add_watch (bus, my_bus_callback, loop);<br>
> gst_object_unref (bus);<br>
><br>
> gst_element_set_state (play, GST_STATE_PLAYING);<br>
><br>
><br>
> Following is code which does not play mp3. Please help me what<br>
> all plugins we need to connect and<br>
> how to find their capabilities<br>
><br>
> /* Create gstreamer elements */<br>
> GstElement* pipeline = gst_pipeline_new ("audio-player");<br>
> GstElement* source = gst_element_factory_make ("filesrc",<br>
> "file-source");<br>
> GstElement* demuxer = gst_element_factory_make<br>
> ("mpegdemux2", "mpeg-demuxer");<br>
> GstElement* decoder = gst_element_factory_make<br>
> ("flump3dec", "fluendo-decoder");<br>
> // GstElement* decoder =<br>
> gst_element_factory_make("decodebin", "decoderbin");<br>
> GstElement* conv = gst_element_factory_make<br>
> ("audioconvert", "converter");<br>
> GstElement* sink = gst_element_factory_make<br>
> ("autoaudiosink", "audio-output");<br>
><br>
> if (!pipeline || !source || !demuxer || !decoder || !conv<br>
> || !sink) {<br>
> g_printerr ("One element could not be created.<br>
> Exiting.\n");<br>
> return -1;<br>
> }<br>
><br>
> /* Set up the pipeline */<br>
><br>
> /* we set the input filename to the source element */<br>
> // g_object_set (G_OBJECT (source), "uri",<br>
> "file:///home/basavaraj/Music/Jab.mp3", NULL);<br>
> g_object_set (G_OBJECT (source), "location",<br>
> "/home/basavaraj/Music/Jab.mp3", NULL);<br>
><br>
> /* we add a message handler */<br>
> GstBus *bus = gst_pipeline_get_bus (GST_PIPELINE<br>
> (pipeline));<br>
> gst_bus_add_watch (bus, bus_call, loop);<br>
> gst_object_unref (bus);<br>
><br>
> /* we add all elements into the pipeline */<br>
> /* file-source | mp3-demuxer | mp3-decoder | converter |<br>
> alsa-output */<br>
> gst_bin_add_many (GST_BIN (pipeline),<br>
> source, demuxer, decoder, conv, sink,<br>
> NULL);<br>
><br>
> /* we link the elements together */<br>
> /* file-source -> mp3-demuxer ~> mp3-decoder -> converter -><br>
> alsa-output */<br>
> gst_element_link (source, demuxer);<br>
> g_signal_connect (demuxer, "pad-added", G_CALLBACK<br>
> (on_pad_added), decoder);<br>
><br>
> /* Set the pipeline to "playing" state*/<br>
> g_print ("Now playing: %s\n", argv[1]);<br>
> gst_element_set_state (pipeline, GST_STATE_PLAYING);<br>
><br>
><br>
> Thanks in advance,<br>
> Basavaraj<br>
<br>
<br>
</div></div>Try this pipeline to play mp3s. Because it's audio-only (beside<br>
mp3-tags) you don't need a demuxer.<br>
<br>
gst-launch-0.10 -v filesrc location=song.mp3 ! mp3parse ! flump3dec !<br>
audioconvert ! audioresample ! autoaudiosink<br>
<br>
hth,<br>
<font color="#888888">lukas<br>
</font><div><div></div><div class="h5"><br>
<br>
<br>
------------------------------------------------------------------------------<br>
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day<br>
trial. Simplify your report design, integration and deployment - and focus on<br>
what you do best, core application coding. Discover what's new with<br>
Crystal Reports now. <a href="http://p.sf.net/sfu/bobj-july" target="_blank">http://p.sf.net/sfu/bobj-july</a><br>
_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.sourceforge.net">gstreamer-devel@lists.sourceforge.net</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/gstreamer-devel" target="_blank">https://lists.sourceforge.net/lists/listinfo/gstreamer-devel</a><br>
</div></div></blockquote></div><br>