[gst-devel] Playing Mp3 help
Tiago Katcipis
katcipis at inf.ufsc.br
Thu Nov 19 15:00:56 CET 2009
Basavaraj,
seeing your on_pad_added function it sens that you never connect the decoder
on the convert, and never connect the convert on the sink. The following is
missing after you connect the signal:
* /* we link the elements together */
/* file-source -> mp3-demuxer ~> mp3-decoder -> converter -> alsa-output
*/
gst_element_link (source, demuxer);
g_signal_connect (demuxer, "pad-added", G_CALLBACK (on_pad_added),
decoder);
**gst_element_link (decoder, conv);
gst_element_link (conv**, sink);*
hope this helps you
best regards,
Katcipis
On Thu, Nov 19, 2009 at 11:40 AM, basavaraj P <basavarajp82 at gmail.com>wrote:
>
> Hello Katcipis,
>
> Following is the on_pad_added function.
>
> *static void
> on_pad_added (GstElement *element,
> GstPad *pad,
> gpointer data)
> {
> GstPad *sinkpad;
> GstElement *decoder = (GstElement *) data;
>
> /* We can now link this pad with the mp3-decoder sink pad */
> g_print ("Dynamic pad created, linking demuxer/decoder\n");
>
> sinkpad = gst_element_get_static_pad (decoder, "sink");
>
> gst_pad_link (pad, sinkpad);
>
> gst_object_unref (sinkpad);
> }
> *
>
> Thanks,
> Basavaraj
>
>
>
>
> On Thu, Nov 19, 2009 at 3:11 PM, Tiago Katcipis <katcipis at inf.ufsc.br>wrote:
>
>> It would be easier if you show your on_pad_added function, and if you tell
>> exactly what error messages do you get when you run your application.
>>
>> To investigate the capabilities of a element you can use gst-inspect.
>>
>> On a terminal you can type for example:
>> gst-inspect flump3dec
>>
>> it will give an complete specification of the flump3dec element.
>>
>> best regards,
>> Katcipis
>>
>> On Thu, Nov 19, 2009 at 6:40 AM, basavaraj P <basavarajp82 at gmail.com>wrote:
>>
>>> Hello,
>>>
>>> Following is code which plays mp3 using playbin
>>>
>>> * /* set up */
>>> play = gst_element_factory_make ("playbin2", "play");
>>> g_object_set (G_OBJECT (play), "uri",
>>> "file:///home/basavaraj/Music/JabSeTereNaina.mp3", NULL);
>>>
>>> bus = gst_pipeline_get_bus (GST_PIPELINE (play));
>>> // gst_bus_add_watch (bus, my_bus_callback, loop);
>>> gst_object_unref (bus);
>>>
>>> gst_element_set_state (play, GST_STATE_PLAYING);
>>> *
>>>
>>> Following is code which does not play mp3. Please help me what all
>>> plugins we need to connect and
>>> how to find their capabilities
>>>
>>> * /* Create gstreamer elements */
>>> GstElement* pipeline = gst_pipeline_new ("audio-player");
>>> GstElement* source = gst_element_factory_make ("filesrc",
>>> "file-source");
>>> GstElement* demuxer = gst_element_factory_make ("mpegdemux2",
>>> "mpeg-demuxer");
>>> GstElement* decoder = gst_element_factory_make ("flump3dec",
>>> "fluendo-decoder");
>>> // GstElement* decoder = gst_element_factory_make("decodebin",
>>> "decoderbin");
>>> GstElement* conv = gst_element_factory_make ("audioconvert",
>>> "converter");
>>> GstElement* sink = gst_element_factory_make ("autoaudiosink",
>>> "audio-output");
>>>
>>> if (!pipeline || !source || !demuxer || !decoder || !conv || !sink) {
>>> g_printerr ("One element could not be created. Exiting.\n");
>>> return -1;
>>> }
>>>
>>> /* Set up the pipeline */
>>>
>>> /* we set the input filename to the source element */
>>> // g_object_set (G_OBJECT (source), "uri",
>>> "file:///home/basavaraj/Music/Jab.mp3", NULL);
>>> g_object_set (G_OBJECT (source), "location",
>>> "/home/basavaraj/Music/Jab.mp3", NULL);
>>>
>>> /* we add a message handler */
>>> GstBus *bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
>>> gst_bus_add_watch (bus, bus_call, loop);
>>> gst_object_unref (bus);
>>>
>>> /* we add all elements into the pipeline */
>>> /* file-source | mp3-demuxer | mp3-decoder | converter | alsa-output */
>>> gst_bin_add_many (GST_BIN (pipeline),
>>> source, demuxer, decoder, conv, sink, NULL);
>>>
>>> /* we link the elements together */
>>> /* file-source -> mp3-demuxer ~> mp3-decoder -> converter ->
>>> alsa-output */
>>> gst_element_link (source, demuxer);
>>> g_signal_connect (demuxer, "pad-added", G_CALLBACK (on_pad_added),
>>> decoder);
>>>
>>> /* Set the pipeline to "playing" state*/
>>> g_print ("Now playing: %s\n", argv[1]);
>>> gst_element_set_state (pipeline, GST_STATE_PLAYING);
>>> *
>>>
>>> Thanks in advance,
>>> Basavaraj
>>>
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
>>> 30-Day
>>> trial. Simplify your report design, integration and deployment - and
>>> focus on
>>> what you do best, core application coding. Discover what's new with
>>> Crystal Reports now. http://p.sf.net/sfu/bobj-july
>>> _______________________________________________
>>> gstreamer-devel mailing list
>>> gstreamer-devel at lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>>>
>>>
>>
>>
>> --
>> "Se você se perder na selva africana, não precisa se desesperar. Basta
>> sentar em uma pedra e começar a instalar GNU/Linux em seu laptop. Em menos
>> de 5 minutos aparecerá alguém pra discordar de sua escolha de distribuição,
>> do particionamento, do gerenciador de janelas, do ambiente de desktop, do
>> editor de textos..."
>>
>>
>> ------------------------------------------------------------------------------
>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
>> 30-Day
>> trial. Simplify your report design, integration and deployment - and focus
>> on
>> what you do best, core application coding. Discover what's new with
>> Crystal Reports now. http://p.sf.net/sfu/bobj-july
>> _______________________________________________
>> gstreamer-devel mailing list
>> gstreamer-devel at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>>
>>
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>
>
--
"Se você se perder na selva africana, não precisa se desesperar. Basta
sentar em uma pedra e começar a instalar GNU/Linux em seu laptop. Em menos
de 5 minutos aparecerá alguém pra discordar de sua escolha de distribuição,
do particionamento, do gerenciador de janelas, do ambiente de desktop, do
editor de textos..."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20091119/d67d751d/attachment.htm>
More information about the gstreamer-devel
mailing list