audioresample

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

audioresample

Jesu Anuroop Suresh
Hi All,

Does anyone tried the pipeline for audioresample using C.

gst-launch -vvv filesrc location=01_Pepercut.mp3 ! id3demux ! mad !  audioconvert  ! audioresample ! audio/x-raw-int,width=16,rate=22050,channels=1,depth=16,signed=true,endianness=1234 ! alsasink

Thanks and regards
Jesu Anuroop Suresh
Reply | Threaded
Open this post in threaded view
|

Re: audioresample

Sean McNamara-4

Hi,

I don't entirely understand your question. Are you trying to convert a pipeline into an equivalent C application? Doing so is just based on understanding of C and the gstreamer C API... it is certainly possible, insofar as your pipeline is valid.

That said, look at gst_parse_* functions for a way to enter a pipeline spec in the gst-launch syntax and get either a GstBin or a GstPipeline out of it.

Sean

On Jan 12, 2011 4:20 AM, "Jesu Anuroop Suresh" <[hidden email]> wrote:
>
> Hi All,
>
> Does anyone tried the pipeline for audioresample using C.
>
> gst-launch -vvv filesrc location=01_Pepercut.mp3 ! id3demux ! mad !
> audioconvert ! audioresample !
> audio/x-raw-int,width=16,rate=22050,channels=1,depth=16,signed=true,endianness=1234
> ! alsasink
>
> Thanks and regards
> Jesu Anuroop Suresh
>
> --
> View this message in context: http://gstreamer-devel.966125.n4.nabble.com/audioresample-tp3213586p3213586.html
> Sent from the GStreamer-devel mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Protect Your Site and Customers from Malware Attacks
> Learn about various malware tactics and how to avoid them. Understand
> malware threats, the impact they can have on your business, and how you
> can protect your company and customers by using code signing.
> http://p.sf.net/sfu/oracle-sfdevnl
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel

------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: audioresample

Jesu Anuroop Suresh
Hi Sean,

Yes, what I was trying is to resample the decoded mp3 data to the fixed (22KHZ S16LE) formate, 

no matter what is the input rate using a C application.

Thanks for your response.

Here is the piece of the code for the same but it does not work  with audioresample with the caps filter 'resmux'. This code does work without the caps filter 'resmux'.

        GstElement *source, *demuxer, *decoder, *conv, *sink, *resample, *resmux;
        GstCaps *caps;

        gst_init(NULL, NULL);

        /* Create gstreamer elements */
        musicPlayer.playPipeline = gst_pipeline_new ("audio-player");
        source   = gst_element_factory_make ("filesrc", "file-source");
        sink     = gst_element_factory_make ("alsasink", "audio-output");
        resample = gst_element_factory_make ("audioresample", "audio-resample");
        conv     = gst_element_factory_make ("audioconvert",  "converter1");

        caps = gst_caps_new_simple ("audio/x-raw-int",
                                     "width", G_TYPE_INT, 16,
                                     "depth", G_TYPE_INT, 16,
                                     "rate",  G_TYPE_INT, 22050,
                                     "channels",G_TYPE_INT, 2, NULL
                                     );

        if (!musicPlayer.playPipeline || !source || !sink ||
            !resample || !resmux || !caps || !conv)
        {
            g_print ("NO MEM Exiting.\n");
            return 1;
        }

        /* we set the input filename to the source element */
        g_object_set (G_OBJECT (source), "location", filePath, NULL);

        demuxer  = gst_element_factory_make ("id3demux", "id3-demuxer");
        decoder  = gst_element_factory_make ("mad", "mp3-decoder");

         if (!demuxer || !decoder || !conv1)
         {
                    g_print ("NO MEM Exiting.\n");
                    return 1;
          }

         g_object_set (G_OBJECT (resmux), "caps", caps, NULL);
         gst_caps_unref (caps);

         /* file-source -> demuxer -> decoder ->  alsa-output */
        gst_bin_add_many (GST_BIN (musicPlayer.playPipeline),
                         source, demuxer, decoder, conv, resample, resmux,sink, NULL);

        gst_element_link (source, demuxer);
        gst_element_link_many (decoder, conv, resample,resmux,sink, NULL);

        g_signal_connect (demuxer, "pad-added", G_CALLBACK (on_pad_added), decoder);

        GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(musicPlayer.playPipeline));
        gst_bus_add_watch(bus, bus_call, NULL);
        gst_object_unref(bus);

        gst_element_set_state(GST_ELEMENT(musicPlayer.playPipeline), GST_STATE_PLAYING);

        musicPlayer.playLoop = g_main_loop_new(NULL, FALSE);

        g_main_loop_run(musicPlayer.playLoop);

        gst_element_set_state(GST_ELEMENT(musicPlayer.playPipeline), GST_STATE_NULL);
        gst_object_unref(GST_OBJECT(musicPlayer.playPipeline));




With Warm Regards
Jesu Anuroop Suresh

"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction."
"Anyone who has never made a mistake has never tried anything new."






On Wed, Jan 12, 2011 at 4:31 PM, Sean McNamara-4 [via GStreamer-devel] <[hidden email]> wrote:

Hi,

I don't entirely understand your question. Are you trying to convert a pipeline into an equivalent C application? Doing so is just based on understanding of C and the gstreamer C API... it is certainly possible, insofar as your pipeline is valid.

That said, look at gst_parse_* functions for a way to enter a pipeline spec in the gst-launch syntax and get either a GstBin or a GstPipeline out of it.

Sean

On Jan 12, 2011 4:20 AM, "Jesu Anuroop Suresh" <[hidden email]> wrote:
>
> Hi All,
>
> Does anyone tried the pipeline for audioresample using C.
>
> gst-launch -vvv filesrc location=01_Pepercut.mp3 ! id3demux ! mad !
> audioconvert ! audioresample !
> audio/x-raw-int,width=16,rate=22050,channels=1,depth=16,signed=true,endianness=1234
> ! alsasink
>
> Thanks and regards
> Jesu Anuroop Suresh
>
> --
> View this message in context: http://gstreamer-devel.966125.n4.nabble.com/audioresample-tp3213586p3213586.html
> Sent from the GStreamer-devel mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Protect Your Site and Customers from Malware Attacks
> Learn about various malware tactics and how to avoid them. Understand
> malware threats, the impact they can have on your business, and how you
> can protect your company and customers by using code signing.
> http://p.sf.net/sfu/oracle-sfdevnl
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]

------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
gstreamer-devel mailing list
[hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: audioresample

Cai Yuanqing
  Hi Suresh:
     Your application have a little problem. :-)


On 01/12/2011 08:41 PM, Jesu Anuroop Suresh wrote:

> Hi Sean,
>
> Yes, what I was trying is to resample the decoded mp3 data to the
> fixed (22KHZ S16LE) formate,
>
> no matter what is the input rate using a C application.
>
> Thanks for your response.
>
> Here is the piece of the code for the same but it does not work  with
> audioresample with the caps filter 'resmux'. This code does work
> without the caps filter 'resmux'.
>
>         GstElement *source, *demuxer, *decoder, *conv, *sink,
> *resample, *resmux;
>         GstCaps *caps;
>
>         gst_init(NULL, NULL);
>
>         /* Create gstreamer elements */
>         musicPlayer.playPipeline = gst_pipeline_new ("audio-player");
>         source   = gst_element_factory_make ("filesrc", "file-source");
>         sink     = gst_element_factory_make ("alsasink", "audio-output");
>         resample = gst_element_factory_make ("audioresample",
> "audio-resample");
>         conv     = gst_element_factory_make ("audioconvert",
>  "converter1");
>
>         caps = gst_caps_new_simple ("audio/x-raw-int",
>                                      "width", G_TYPE_INT, 16,
>                                      "depth", G_TYPE_INT, 16,
>                                      "rate",  G_TYPE_INT, 22050,
>                                      "channels",G_TYPE_INT, 2, NULL
>                                      );
>
>         if (!musicPlayer.playPipeline || !source || !sink ||
>             !resample || !resmux || !caps || !conv)
>         {
>             g_print ("NO MEM Exiting.\n");
>             return 1;
>         }
resmux is not initialized yet,here maybe some random value,you'd better
remove it from check list.

>
>         /* we set the input filename to the source element */
>         g_object_set (G_OBJECT (source), "location", filePath, NULL);
>
>         demuxer  = gst_element_factory_make ("id3demux", "id3-demuxer");
>         decoder  = gst_element_factory_make ("mad", "mp3-decoder");
>
>          if (!demuxer || !decoder || !conv1)
conv1 ? dose it should be conv?

>          {
>                     g_print ("NO MEM Exiting.\n");
>                     return 1;
>           }
>
>          g_object_set (G_OBJECT (resmux), "caps", caps, NULL);
>          gst_caps_unref (caps);
>
as I said before,resmux haven't initialized ,that's not quite right.
and I suggest you to remove these two lines.

>          /* file-source -> demuxer -> decoder ->  alsa-output */
>         gst_bin_add_many (GST_BIN (musicPlayer.playPipeline),
>                          source, demuxer, decoder, conv, resample,
> resmux,sink, NULL);
>
>         gst_element_link (source, demuxer);
>         gst_element_link_many (decoder, conv, resample,resmux,sink, NULL);
You can use gst_element_link_filtered to link resample and sink with
caps instead of this way.
something like:
     gst_element_link (source, demuxer);
     gst_element_link_many (decoder, conv, resample, NULL);
     if ( !gst_element_link_filtered(resample,sink,caps) ){
         g_printerr("Failed to link elements resample and alsa-sink");
     }


>         g_signal_connect (demuxer, "pad-added", G_CALLBACK
> (on_pad_added), decoder);
>
>         GstBus *bus =
> gst_pipeline_get_bus(GST_PIPELINE(musicPlayer.playPipeline));
>         gst_bus_add_watch(bus, bus_call, NULL);
>         gst_object_unref(bus);
>
>         gst_element_set_state(GST_ELEMENT(musicPlayer.playPipeline),
> GST_STATE_PLAYING);
>
>         musicPlayer.playLoop = g_main_loop_new(NULL, FALSE);
>
>         g_main_loop_run(musicPlayer.playLoop);
>
>         gst_element_set_state(GST_ELEMENT(musicPlayer.playPipeline),
> GST_STATE_NULL);
>         gst_object_unref(GST_OBJECT(musicPlayer.playPipeline));
>
>
>
>
> With Warm Regards
> Jesu Anuroop Suresh
>
> "Any intelligent fool can make things bigger, more complex, and more
> violent. It takes a touch of genius -- and a lot of courage -- to move
> in the opposite direction."
> "Anyone who has never made a mistake has never tried anything new."
>
>
I attached my modified source code ,you can try it.
Hope it helps.

Thanks.


--
B.R

Cai Yuanqing


------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel

test.c (6K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: audioresample

Jesu Anuroop Suresh
Hi Cai,


Thanks for you response, I Will try out your suggestion of using the filtered link.

Sorry there was some typoerror in my code what I shared. 

I did initialized the 'resmux' as capasity filter and used the conv not conv1.

The cocde works for me for mp3 playback in its original settings.


        resample = gst_element_factory_make ("audioresample", "audio-resample");
        conv     = gst_element_factory_make ("audioconvert",  "converter1");
resmux   = gst_element_factory_make ("capsfilter", "filter");

        caps = gst_caps_new_simple ("audio/x-raw-int",
                                     "width", G_TYPE_INT, 16,
                                     "depth", G_TYPE_INT, 16,
                                     "rate",  G_TYPE_INT, 22050,
                                     "channels",G_TYPE_INT, 2, NULL
                                     );

        if (!musicPlayer.playPipeline || !source || !sink ||
            !resample || !resmux || !caps || !conv)
        {
            g_print ("NO MEM Exiting.\n");
            return 1;
        }

        /* we set the input filename to the source element */
        g_object_set (G_OBJECT (source), "location", filePath, NULL);

        demuxer  = gst_element_factory_make ("id3demux", "id3-demuxer");
        decoder  = gst_element_factory_make ("mad", "mp3-decoder");

         if (!demuxer || !decoder || !conv)
         {
                    g_print ("NO MEM Exiting.\n");
                    return 1;
          }

With Warm Regards
Jesu Anuroop Suresh

"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction."
"Anyone who has never made a mistake has never tried anything new."

On Thu, Jan 13, 2011 at 7:16 AM, Cai Yuanqing [via GStreamer-devel] <[hidden email]> wrote:
  Hi Suresh:
     Your application have a little problem. :-)


On 01/12/2011 08:41 PM, Jesu Anuroop Suresh wrote:

> Hi Sean,
>
> Yes, what I was trying is to resample the decoded mp3 data to the
> fixed (22KHZ S16LE) formate,
>
> no matter what is the input rate using a C application.
>
> Thanks for your response.
>
> Here is the piece of the code for the same but it does not work  with
> audioresample with the caps filter 'resmux'. This code does work
> without the caps filter 'resmux'.
>
>         GstElement *source, *demuxer, *decoder, *conv, *sink,
> *resample, *resmux;
>         GstCaps *caps;
>
>         gst_init(NULL, NULL);
>
>         /* Create gstreamer elements */
>         musicPlayer.playPipeline = gst_pipeline_new ("audio-player");
>         source   = gst_element_factory_make ("filesrc", "file-source");
>         sink     = gst_element_factory_make ("alsasink", "audio-output");
>         resample = gst_element_factory_make ("audioresample",
> "audio-resample");
>         conv     = gst_element_factory_make ("audioconvert",
>  "converter1");
>
>         caps = gst_caps_new_simple ("audio/x-raw-int",
>                                      "width", G_TYPE_INT, 16,
>                                      "depth", G_TYPE_INT, 16,
>                                      "rate",  G_TYPE_INT, 22050,
>                                      "channels",G_TYPE_INT, 2, NULL
>                                      );
>
>         if (!musicPlayer.playPipeline || !source || !sink ||
>             !resample || !resmux || !caps || !conv)
>         {
>             g_print ("NO MEM Exiting.\n");
>             return 1;
>         }
resmux is not initialized yet,here maybe some random value,you'd better
remove it from check list.

>
>         /* we set the input filename to the source element */
>         g_object_set (G_OBJECT (source), "location", filePath, NULL);
>
>         demuxer  = gst_element_factory_make ("id3demux", "id3-demuxer");
>         decoder  = gst_element_factory_make ("mad", "mp3-decoder");
>
>          if (!demuxer || !decoder || !conv1)
conv1 ? dose it should be conv?

>          {
>                     g_print ("NO MEM Exiting.\n");
>                     return 1;
>           }
>
>          g_object_set (G_OBJECT (resmux), "caps", caps, NULL);
>          gst_caps_unref (caps);
>
as I said before,resmux haven't initialized ,that's not quite right.
and I suggest you to remove these two lines.

>          /* file-source -> demuxer -> decoder ->  alsa-output */
>         gst_bin_add_many (GST_BIN (musicPlayer.playPipeline),
>                          source, demuxer, decoder, conv, resample,
> resmux,sink, NULL);
>
>         gst_element_link (source, demuxer);
>         gst_element_link_many (decoder, conv, resample,resmux,sink, NULL);
You can use gst_element_link_filtered to link resample and sink with
caps instead of this way.
something like:
     gst_element_link (source, demuxer);
     gst_element_link_many (decoder, conv, resample, NULL);
     if ( !gst_element_link_filtered(resample,sink,caps) ){
         g_printerr("Failed to link elements resample and alsa-sink");
     }


>         g_signal_connect (demuxer, "pad-added", G_CALLBACK
> (on_pad_added), decoder);
>
>         GstBus *bus =
> gst_pipeline_get_bus(GST_PIPELINE(musicPlayer.playPipeline));
>         gst_bus_add_watch(bus, bus_call, NULL);
>         gst_object_unref(bus);
>
>         gst_element_set_state(GST_ELEMENT(musicPlayer.playPipeline),
> GST_STATE_PLAYING);
>
>         musicPlayer.playLoop = g_main_loop_new(NULL, FALSE);
>
>         g_main_loop_run(musicPlayer.playLoop);
>
>         gst_element_set_state(GST_ELEMENT(musicPlayer.playPipeline),
> GST_STATE_NULL);
>         gst_object_unref(GST_OBJECT(musicPlayer.playPipeline));
>
>
>
>
> With Warm Regards
> Jesu Anuroop Suresh
>
> "Any intelligent fool can make things bigger, more complex, and more
> violent. It takes a touch of genius -- and a lot of courage -- to move
> in the opposite direction."
> "Anyone who has never made a mistake has never tried anything new."
>
>
I attached my modified source code ,you can try it.
Hope it helps.

Thanks.


--
B.R

Cai Yuanqing


------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel

test.c (6K) Download Attachment




Reply | Threaded
Open this post in threaded view
|

Re: audioresample

Jesu Anuroop Suresh
Hi ,

I Tried the suggestion provided for the by Cai. Thanks for the code Cai.

It works something like this It only allows to playback the 22KHz S16LE audio.

What I was trying is to convert the any input format into a 22KHz S16LE so I can mux it with other stream of the same property and  mux multiple streams using alsasink plug:dmix.


With Warm Regards
Jesu Anuroop Suresh

"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction."
"Anyone who has never made a mistake has never tried anything new."






On Thu, Jan 13, 2011 at 9:51 AM, Jesu Anuroop Suresh <[hidden email]> wrote:
Hi Cai,


Thanks for you response, I Will try out your suggestion of using the filtered link.

Sorry there was some typoerror in my code what I shared. 

I did initialized the 'resmux' as capasity filter and used the conv not conv1.

The cocde works for me for mp3 playback in its original settings.


        resample = gst_element_factory_make ("audioresample", "audio-resample");
        conv     = gst_element_factory_make ("audioconvert",  "converter1");
resmux   = gst_element_factory_make ("capsfilter", "filter");

        caps = gst_caps_new_simple ("audio/x-raw-int",
                                     "width", G_TYPE_INT, 16,
                                     "depth", G_TYPE_INT, 16,
                                     "rate",  G_TYPE_INT, 22050,
                                     "channels",G_TYPE_INT, 2, NULL
                                     );

        if (!musicPlayer.playPipeline || !source || !sink ||
            !resample || !resmux || !caps || !conv)
        {
            g_print ("NO MEM Exiting.\n");
            return 1;
        }

        /* we set the input filename to the source element */
        g_object_set (G_OBJECT (source), "location", filePath, NULL);

        demuxer  = gst_element_factory_make ("id3demux", "id3-demuxer");
        decoder  = gst_element_factory_make ("mad", "mp3-decoder");

         if (!demuxer || !decoder || !conv)
         {
                    g_print ("NO MEM Exiting.\n");
                    return 1;
          }

With Warm Regards
Jesu Anuroop Suresh

"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction."
"Anyone who has never made a mistake has never tried anything new."

On Thu, Jan 13, 2011 at 7:16 AM, Cai Yuanqing [via GStreamer-devel] <[hidden email]> wrote:
  Hi Suresh:
     Your application have a little problem. :-)


On 01/12/2011 08:41 PM, Jesu Anuroop Suresh wrote:

> Hi Sean,
>
> Yes, what I was trying is to resample the decoded mp3 data to the
> fixed (22KHZ S16LE) formate,
>
> no matter what is the input rate using a C application.
>
> Thanks for your response.
>
> Here is the piece of the code for the same but it does not work  with
> audioresample with the caps filter 'resmux'. This code does work
> without the caps filter 'resmux'.
>
>         GstElement *source, *demuxer, *decoder, *conv, *sink,
> *resample, *resmux;
>         GstCaps *caps;
>
>         gst_init(NULL, NULL);
>
>         /* Create gstreamer elements */
>         musicPlayer.playPipeline = gst_pipeline_new ("audio-player");
>         source   = gst_element_factory_make ("filesrc", "file-source");
>         sink     = gst_element_factory_make ("alsasink", "audio-output");
>         resample = gst_element_factory_make ("audioresample",
> "audio-resample");
>         conv     = gst_element_factory_make ("audioconvert",
>  "converter1");
>
>         caps = gst_caps_new_simple ("audio/x-raw-int",
>                                      "width", G_TYPE_INT, 16,
>                                      "depth", G_TYPE_INT, 16,
>                                      "rate",  G_TYPE_INT, 22050,
>                                      "channels",G_TYPE_INT, 2, NULL
>                                      );
>
>         if (!musicPlayer.playPipeline || !source || !sink ||
>             !resample || !resmux || !caps || !conv)
>         {
>             g_print ("NO MEM Exiting.\n");
>             return 1;
>         }
resmux is not initialized yet,here maybe some random value,you'd better
remove it from check list.

>
>         /* we set the input filename to the source element */
>         g_object_set (G_OBJECT (source), "location", filePath, NULL);
>
>         demuxer  = gst_element_factory_make ("id3demux", "id3-demuxer");
>         decoder  = gst_element_factory_make ("mad", "mp3-decoder");
>
>          if (!demuxer || !decoder || !conv1)
conv1 ? dose it should be conv?

>          {
>                     g_print ("NO MEM Exiting.\n");
>                     return 1;
>           }
>
>          g_object_set (G_OBJECT (resmux), "caps", caps, NULL);
>          gst_caps_unref (caps);
>
as I said before,resmux haven't initialized ,that's not quite right.
and I suggest you to remove these two lines.

>          /* file-source -> demuxer -> decoder ->  alsa-output */
>         gst_bin_add_many (GST_BIN (musicPlayer.playPipeline),
>                          source, demuxer, decoder, conv, resample,
> resmux,sink, NULL);
>
>         gst_element_link (source, demuxer);
>         gst_element_link_many (decoder, conv, resample,resmux,sink, NULL);
You can use gst_element_link_filtered to link resample and sink with
caps instead of this way.
something like:
     gst_element_link (source, demuxer);
     gst_element_link_many (decoder, conv, resample, NULL);
     if ( !gst_element_link_filtered(resample,sink,caps) ){
         g_printerr("Failed to link elements resample and alsa-sink");
     }


>         g_signal_connect (demuxer, "pad-added", G_CALLBACK
> (on_pad_added), decoder);
>
>         GstBus *bus =
> gst_pipeline_get_bus(GST_PIPELINE(musicPlayer.playPipeline));
>         gst_bus_add_watch(bus, bus_call, NULL);
>         gst_object_unref(bus);
>
>         gst_element_set_state(GST_ELEMENT(musicPlayer.playPipeline),
> GST_STATE_PLAYING);
>
>         musicPlayer.playLoop = g_main_loop_new(NULL, FALSE);
>
>         g_main_loop_run(musicPlayer.playLoop);
>
>         gst_element_set_state(GST_ELEMENT(musicPlayer.playPipeline),
> GST_STATE_NULL);
>         gst_object_unref(GST_OBJECT(musicPlayer.playPipeline));
>
>
>
>
> With Warm Regards
> Jesu Anuroop Suresh
>
> "Any intelligent fool can make things bigger, more complex, and more
> violent. It takes a touch of genius -- and a lot of courage -- to move
> in the opposite direction."
> "Anyone who has never made a mistake has never tried anything new."
>
>
I attached my modified source code ,you can try it.
Hope it helps.
Thanks.


--
B.R

Cai Yuanqing


------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel

test.c (6K) Download Attachment






View this message in context: Re: audioresample

Sent from the GStreamer-devel mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel



------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: audioresample

Cai Yuanqing
  Hi,

On 01/13/2011 01:39 PM, Anuroop Jesu wrote:

> Hi ,
>
> I Tried the suggestion provided for the by Cai. Thanks for the code Cai.
>
> It works something like this It only allows to playback the 22KHz
> S16LE audio.
>
> What I was trying is to convert the any input format into a 22KHz
> S16LE so I can mux it with other stream of the same property and  mux
> multiple streams using alsasink plug:dmix.
I see what you mean :-)
I tried pipeline like this:
gst-launch-0.10 filesrc location=yellow.mp3 ! id3demux ! mad !
audioconvert ! audioresample !
'audio/x-raw-int,width=16,depth=16,rate=22050,channels=2,endianness=1234,signed=true'
! alsasink

It works well to first decode any type of mp3 files into PCM,and then
re-sample them into
'audio/x-raw-int,width=16,depth=16,rate=22050,channels=2,endianness=1234,signed=true.
So you can playback this stream ,or you can replace 'alsasink' to other
elements:

$ file yellow.mp3
yellow.mp3: Audio file with ID3 version 2.3.0, contains: MPEG ADTS,
layer III, v1, 128 kbps, 44.1 kHz, JntStereo

$ gst-launch-0.10 filesrc location=yellow.mp3 ! id3demux ! mad !
audioconvert ! audioresample !
'audio/x-raw-int,width=16,depth=16,rate=22050,channels=2,endianness=1234,signed=true'
! lame ! filesink location=haha.mp3

$ file haha.mp3
haha.mp3: MPEG ADTS, layer III, v2, 128 kbps, 22.05 kHz, JntStereo


The pipeline above turn your stream to encode int a mp3 file with
property as
'audio/x-raw-int,width=16,depth=16,rate=22050,channels=2,endianness=1234,signed=true'.

Just add elements behind audioresample and caps in the C code.

Hope it helps :-)

Thanks.




>
> With Warm Regards
> Jesu Anuroop Suresh
>
> "Any intelligent fool can make things bigger, more complex, and more
> violent. It takes a touch of genius -- and a lot of courage -- to move
> in the opposite direction."
> "Anyone who has never made a mistake has never tried anything new."
>
>
>
>
>
>
> On Thu, Jan 13, 2011 at 9:51 AM, Jesu Anuroop Suresh <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Hi Cai,
>
>
>     Thanks for you response, I Will try out your suggestion of using
>     the filtered link.
>
>     Sorry there was some typoerror in my code what I shared.
>
>     I did initialized the 'resmux' as capasity filter and used the
>     conv not conv1.
>
>     The cocde works for me for mp3 playback in its original settings.
>
>
>             resample = gst_element_factory_make ("audioresample",
>     "audio-resample");
>             conv     = gst_element_factory_make ("audioconvert",
>      "converter1");
>     resmux   = gst_element_factory_make ("capsfilter", "filter");
>
>             caps = gst_caps_new_simple ("audio/x-raw-int",
>                                          "width", G_TYPE_INT, 16,
>                                          "depth", G_TYPE_INT, 16,
>                                          "rate",  G_TYPE_INT, 22050,
>                                          "channels",G_TYPE_INT, 2, NULL
>                                          );
>
>             if (!musicPlayer.playPipeline || !source || !sink ||
>                 !resample || !resmux || !caps || !conv)
>             {
>                 g_print ("NO MEM Exiting.\n");
>                 return 1;
>             }
>
>             /* we set the input filename to the source element */
>             g_object_set (G_OBJECT (source), "location", filePath, NULL);
>
>             demuxer  = gst_element_factory_make ("id3demux",
>     "id3-demuxer");
>             decoder  = gst_element_factory_make ("mad", "mp3-decoder");
>
>              if (!demuxer || !decoder || !conv)
>              {
>                         g_print ("NO MEM Exiting.\n");
>                         return 1;
>               }
>
>     With Warm Regards
>     Jesu Anuroop Suresh
>
>     "Any intelligent fool can make things bigger, more complex, and
>     more violent. It takes a touch of genius -- and a lot of courage
>     -- to move in the opposite direction."
>     "Anyone who has never made a mistake has never tried anything new."
>
>     On Thu, Jan 13, 2011 at 7:16 AM, Cai Yuanqing [via
>     GStreamer-devel] <[hidden email]
>     <http://user/SendEmail.jtp?type=node&node=3215225&i=0>> wrote:
>
>           Hi Suresh:
>              Your application have a little problem. :-)
>
>
>         On 01/12/2011 08:41 PM, Jesu Anuroop Suresh wrote:
>
>         > Hi Sean,
>         >
>         > Yes, what I was trying is to resample the decoded mp3 data
>         to the
>         > fixed (22KHZ S16LE) formate,
>         >
>         > no matter what is the input rate using a C application.
>         >
>         > Thanks for your response.
>         >
>         > Here is the piece of the code for the same but it does not
>         work  with
>         > audioresample with the caps filter 'resmux'. This code does
>         work
>         > without the caps filter 'resmux'.
>         >
>         >         GstElement *source, *demuxer, *decoder, *conv, *sink,
>         > *resample, *resmux;
>         >         GstCaps *caps;
>         >
>         >         gst_init(NULL, NULL);
>         >
>         >         /* Create gstreamer elements */
>         >         musicPlayer.playPipeline = gst_pipeline_new
>         ("audio-player");
>         >         source   = gst_element_factory_make ("filesrc",
>         "file-source");
>         >         sink     = gst_element_factory_make ("alsasink",
>         "audio-output");
>         >         resample = gst_element_factory_make ("audioresample",
>         > "audio-resample");
>         >         conv     = gst_element_factory_make ("audioconvert",
>         >  "converter1");
>         >
>         >         caps = gst_caps_new_simple ("audio/x-raw-int",
>         >                                      "width", G_TYPE_INT, 16,
>         >                                      "depth", G_TYPE_INT, 16,
>         >                                      "rate",  G_TYPE_INT,
>         22050,
>         >                                      "channels",G_TYPE_INT,
>         2, NULL
>         >                                      );
>         >
>         >         if (!musicPlayer.playPipeline || !source || !sink ||
>         >             !resample || !resmux || !caps || !conv)
>         >         {
>         >             g_print ("NO MEM Exiting.\n");
>         >             return 1;
>         >         }
>         resmux is not initialized yet,here maybe some random
>         value,you'd better
>         remove it from check list.
>
>         >
>         >         /* we set the input filename to the source element */
>         >         g_object_set (G_OBJECT (source), "location",
>         filePath, NULL);
>         >
>         >         demuxer  = gst_element_factory_make ("id3demux",
>         "id3-demuxer");
>         >         decoder  = gst_element_factory_make ("mad",
>         "mp3-decoder");
>         >
>         >          if (!demuxer || !decoder || !conv1)
>         conv1 ? dose it should be conv?
>
>         >          {
>         >                     g_print ("NO MEM Exiting.\n");
>         >                     return 1;
>         >           }
>         >
>         >          g_object_set (G_OBJECT (resmux), "caps", caps, NULL);
>         >          gst_caps_unref (caps);
>         >
>         as I said before,resmux haven't initialized ,that's not quite
>         right.
>         and I suggest you to remove these two lines.
>
>         >          /* file-source -> demuxer -> decoder ->
>          alsa-output */
>         >         gst_bin_add_many (GST_BIN (musicPlayer.playPipeline),
>         >                          source, demuxer, decoder, conv,
>         resample,
>         > resmux,sink, NULL);
>         >
>         >         gst_element_link (source, demuxer);
>         >         gst_element_link_many (decoder, conv,
>         resample,resmux,sink, NULL);
>         You can use gst_element_link_filtered to link resample and
>         sink with
>         caps instead of this way.
>         something like:
>              gst_element_link (source, demuxer);
>              gst_element_link_many (decoder, conv, resample, NULL);
>              if ( !gst_element_link_filtered(resample,sink,caps) ){
>                  g_printerr("Failed to link elements resample and
>         alsa-sink");
>              }
>
>
>         >         g_signal_connect (demuxer, "pad-added", G_CALLBACK
>         > (on_pad_added), decoder);
>         >
>         >         GstBus *bus =
>         > gst_pipeline_get_bus(GST_PIPELINE(musicPlayer.playPipeline));
>         >         gst_bus_add_watch(bus, bus_call, NULL);
>         >         gst_object_unref(bus);
>         >
>         >        
>         gst_element_set_state(GST_ELEMENT(musicPlayer.playPipeline),
>         > GST_STATE_PLAYING);
>         >
>         >         musicPlayer.playLoop = g_main_loop_new(NULL, FALSE);
>         >
>         >         g_main_loop_run(musicPlayer.playLoop);
>         >
>         >        
>         gst_element_set_state(GST_ELEMENT(musicPlayer.playPipeline),
>         > GST_STATE_NULL);
>         >         gst_object_unref(GST_OBJECT(musicPlayer.playPipeline));
>         >
>         >
>         >
>         >
>         > With Warm Regards
>         > Jesu Anuroop Suresh
>         >
>         > "Any intelligent fool can make things bigger, more complex,
>         and more
>         > violent. It takes a touch of genius -- and a lot of courage
>         -- to move
>         > in the opposite direction."
>         > "Anyone who has never made a mistake has never tried
>         anything new."
>         >
>         >
>         I attached my modified source code ,you can try it.
>         Hope it helps.
>
>         Thanks.
>
>
>         --
>         B.R
>
>         Cai Yuanqing
>
>
>         ------------------------------------------------------------------------------
>
>         Protect Your Site and Customers from Malware Attacks
>         Learn about various malware tactics and how to avoid them.
>         Understand
>         malware threats, the impact they can have on your business,
>         and how you
>         can protect your company and customers by using code signing.
>         http://p.sf.net/sfu/oracle-sfdevnl
>         _______________________________________________
>         gstreamer-devel mailing list
>         [hidden email]
>         <http://user/SendEmail.jtp?type=node&node=3215098&i=0>
>         https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>
>
>         ------------------------------------------------------------------------
>         View message @
>         http://gstreamer-devel.966125.n4.nabble.com/audioresample-tp3213586p3215098.html
>         <http://gstreamer-devel.966125.n4.nabble.com/audioresample-tp3213586p3215098.html?by-user=t>
>
>
>         To unsubscribe from audioresample, click here
>         <
>
>
>
>
>     ------------------------------------------------------------------------
>     View this message in context: Re: audioresample
>     <
http://gstreamer-devel.966125.n4.nabble.com/audioresample-tp3213586p3215225.html>
>
>
>     Sent from the GStreamer-devel mailing list archive
>     <http://gstreamer-devel.966125.n4.nabble.com/> at Nabble.com.
>
>     ------------------------------------------------------------------------------
>     Protect Your Site and Customers from Malware Attacks
>     Learn about various malware tactics and how to avoid them. Understand
>     malware threats, the impact they can have on your business, and
>     how you
>     can protect your company and customers by using code signing.
>     http://p.sf.net/sfu/oracle-sfdevnl
>     _______________________________________________
>     gstreamer-devel mailing list
>     [hidden email]
>     <mailto:[hidden email]>
>     https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>
>


--
B.R

Cai Yuanqing


------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: audioresample

Jesu Anuroop Suresh
Hi Cai,

Thanks for your response.

Below  is the code which works and converts any input stream into 22KHz S16LE.


static gboolean bus_call(GstBus *bus,GstMessage *msg,gpointer data)
{
    GMainLoop *loop = (GMainLoop*)data;
    switch(GST_MESSAGE_TYPE(msg))
    {
            case GST_MESSAGE_EOS:
                g_print("End of stream\n");
                g_main_loop_quit(loop);
                break;
            case GST_MESSAGE_ERROR:
        {
                gchar *debug;
                GError *error;
                gst_message_parse_error(msg,&error,&debug);
                g_free(debug);
                    g_print("Error: %s\n",error->message);
                g_error_free(error);
                g_main_loop_quit(loop);
                break;
            }
        case GST_STATE_CHANGE_READY_TO_NULL:
            default:
                //g_print("Unkown message 0x%x\n",GST_MESSAGE_TYPE(msg));
                break;
    }
    return TRUE;
}
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 vorbis-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);
}

int main(int argc,char *argv[])
{
    GMainLoop *playerloop;
    GstBus *playerbus;

    GstElement *pipeline,*source, *demuxer, *decoder, *conv, *sink, *resample,*resmux;
    GstCaps *caps;

    playerloop = g_main_loop_new(NULL,FALSE);

    gst_init(&argc,&argv);

    /* Create gstreamer elements */
    pipeline = gst_pipeline_new ("audio-player");
    source   = gst_element_factory_make ("filesrc", "file-source");
    sink     = gst_element_factory_make ("alsasink", "audio-output");
    resample = gst_element_factory_make ("audioresample", "audio-resample");
    conv     = gst_element_factory_make ("audioconvert",  "converter1");
    resmux   = gst_element_factory_make ("capsfilter", "filter");

    caps = gst_caps_new_simple ("audio/x-raw-int",
                                 "width", G_TYPE_INT, 16,
                                 "depth", G_TYPE_INT, 16,
                                 "rate",  G_TYPE_INT, 22050,
                                 "channels",G_TYPE_INT, 2, NULL
                                 );

    if (!pipeline || !source || !sink ||
        !resample || !caps || !conv || !resmux )
    {
        g_print ("NO MEM Exiting.\n");
        return 1;
    }

    /* we set the input filename to the source element */
    g_object_set (G_OBJECT (source), "location", argv[1], NULL);

    demuxer  = gst_element_factory_make ("id3demux", "id3-demuxer");
    decoder  = gst_element_factory_make ("mad", "mp3-decoder");

    if (!demuxer || !decoder || !conv)
    {
                g_print ("NO MEM Exiting.\n");
                return 1;
    }

    g_object_set (G_OBJECT (resmux), "caps", caps, NULL);
    gst_caps_unref (caps);
     /* file-source -> demuxer -> decoder ->  alsa-output */
    gst_bin_add_many (GST_BIN (pipeline),
                     source, demuxer, decoder, conv, resample, resmux, sink, NULL);

    gst_element_link (source, demuxer);
    gst_element_link_many (decoder, conv, resample,resmux,NULL);

    if ( !gst_element_link_filtered(resmux,sink,caps) ){
         g_printerr("Failed to link elements resample and alsa-sink");
    }

    g_signal_connect (demuxer, "pad-added", G_CALLBACK (on_pad_added), decoder);

    playerbus = gst_pipeline_get_bus(GST_PIPELINE(pipeline));
    gst_bus_add_watch(playerbus,bus_call,playerloop);
    gst_object_unref(playerbus);

    gst_element_set_state(GST_ELEMENT(pipeline), GST_STATE_PLAYING);
    g_main_loop_run(playerloop);

    gst_element_set_state(GST_ELEMENT(pipeline), GST_STATE_NULL);
    gst_object_unref(GST_OBJECT(pipeline));

    g_print("Exit\n");
    return 0;
}




With Warm Regards
Jesu Anuroop Suresh

"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction."
"Anyone who has never made a mistake has never tried anything new."






On Mon, Jan 17, 2011 at 7:54 AM, Cai Yuanqing [via GStreamer-devel] <[hidden email]> wrote:
  Hi,

On 01/13/2011 01:39 PM, Anuroop Jesu wrote:

> Hi ,
>
> I Tried the suggestion provided for the by Cai. Thanks for the code Cai.
>
> It works something like this It only allows to playback the 22KHz
> S16LE audio.
>
> What I was trying is to convert the any input format into a 22KHz
> S16LE so I can mux it with other stream of the same property and  mux
> multiple streams using alsasink plug:dmix.
I see what you mean :-)
I tried pipeline like this:
gst-launch-0.10 filesrc location=yellow.mp3 ! id3demux ! mad !
audioconvert ! audioresample !
'audio/x-raw-int,width=16,depth=16,rate=22050,channels=2,endianness=1234,signed=true'
! alsasink

It works well to first decode any type of mp3 files into PCM,and then
re-sample them into
'audio/x-raw-int,width=16,depth=16,rate=22050,channels=2,endianness=1234,signed=true.
So you can playback this stream ,or you can replace 'alsasink' to other
elements:

$ file yellow.mp3
yellow.mp3: Audio file with ID3 version 2.3.0, contains: MPEG ADTS,
layer III, v1, 128 kbps, 44.1 kHz, JntStereo

$ gst-launch-0.10 filesrc location=yellow.mp3 ! id3demux ! mad !
audioconvert ! audioresample !
'audio/x-raw-int,width=16,depth=16,rate=22050,channels=2,endianness=1234,signed=true'
! lame ! filesink location=haha.mp3

$ file haha.mp3
haha.mp3: MPEG ADTS, layer III, v2, 128 kbps, 22.05 kHz, JntStereo


The pipeline above turn your stream to encode int a mp3 file with
property as
'audio/x-raw-int,width=16,depth=16,rate=22050,channels=2,endianness=1234,signed=true'.

Just add elements behind audioresample and caps in the C code.

Hope it helps :-)

Thanks.




>
> With Warm Regards

> Jesu Anuroop Suresh
>
> "Any intelligent fool can make things bigger, more complex, and more
> violent. It takes a touch of genius -- and a lot of courage -- to move
> in the opposite direction."
> "Anyone who has never made a mistake has never tried anything new."
>
>
>
>
>
>
> On Thu, Jan 13, 2011 at 9:51 AM, Jesu Anuroop Suresh <[hidden email]

> <mailto:[hidden email]>> wrote:
>
>     Hi Cai,
>
>
>     Thanks for you response, I Will try out your suggestion of using
>     the filtered link.
>
>     Sorry there was some typoerror in my code what I shared.
>
>     I did initialized the 'resmux' as capasity filter and used the
>     conv not conv1.
>
>     The cocde works for me for mp3 playback in its original settings.
>
>
>             resample = gst_element_factory_make ("audioresample",
>     "audio-resample");
>             conv     = gst_element_factory_make ("audioconvert",
>      "converter1");
>     resmux   = gst_element_factory_make ("capsfilter", "filter");
>
>             caps = gst_caps_new_simple ("audio/x-raw-int",
>                                          "width", G_TYPE_INT, 16,
>                                          "depth", G_TYPE_INT, 16,
>                                          "rate",  G_TYPE_INT, 22050,
>                                          "channels",G_TYPE_INT, 2, NULL
>                                          );
>
>             if (!musicPlayer.playPipeline || !source || !sink ||
>                 !resample || !resmux || !caps || !conv)
>             {
>                 g_print ("NO MEM Exiting.\n");
>                 return 1;
>             }
>
>             /* we set the input filename to the source element */
>             g_object_set (G_OBJECT (source), "location", filePath, NULL);
>
>             demuxer  = gst_element_factory_make ("id3demux",
>     "id3-demuxer");
>             decoder  = gst_element_factory_make ("mad", "mp3-decoder");
>
>              if (!demuxer || !decoder || !conv)
>              {
>                         g_print ("NO MEM Exiting.\n");
>                         return 1;
>               }
>
>     With Warm Regards
>     Jesu Anuroop Suresh
>
>     "Any intelligent fool can make things bigger, more complex, and
>     more violent. It takes a touch of genius -- and a lot of courage
>     -- to move in the opposite direction."
>     "Anyone who has never made a mistake has never tried anything new."
>
>     On Thu, Jan 13, 2011 at 7:16 AM, Cai Yuanqing [via
>     GStreamer-devel] <[hidden email]
>     <http://user/SendEmail.jtp?type=node&node=3215225&i=0>> wrote:

>
>           Hi Suresh:
>              Your application have a little problem. :-)
>
>
>         On 01/12/2011 08:41 PM, Jesu Anuroop Suresh wrote:
>
>         > Hi Sean,
>         >
>         > Yes, what I was trying is to resample the decoded mp3 data
>         to the
>         > fixed (22KHZ S16LE) formate,
>         >
>         > no matter what is the input rate using a C application.
>         >
>         > Thanks for your response.
>         >
>         > Here is the piece of the code for the same but it does not
>         work  with
>         > audioresample with the caps filter 'resmux'. This code does
>         work
>         > without the caps filter 'resmux'.
>         >
>         >         GstElement *source, *demuxer, *decoder, *conv, *sink,
>         > *resample, *resmux;
>         >         GstCaps *caps;
>         >
>         >         gst_init(NULL, NULL);
>         >
>         >         /* Create gstreamer elements */
>         >         musicPlayer.playPipeline = gst_pipeline_new
>         ("audio-player");
>         >         source   = gst_element_factory_make ("filesrc",
>         "file-source");
>         >         sink     = gst_element_factory_make ("alsasink",
>         "audio-output");
>         >         resample = gst_element_factory_make ("audioresample",
>         > "audio-resample");
>         >         conv     = gst_element_factory_make ("audioconvert",
>         >  "converter1");
>         >
>         >         caps = gst_caps_new_simple ("audio/x-raw-int",
>         >                                      "width", G_TYPE_INT, 16,
>         >                                      "depth", G_TYPE_INT, 16,
>         >                                      "rate",  G_TYPE_INT,
>         22050,
>         >                                      "channels",G_TYPE_INT,
>         2, NULL
>         >                                      );
>         >
>         >         if (!musicPlayer.playPipeline || !source || !sink ||
>         >             !resample || !resmux || !caps || !conv)
>         >         {
>         >             g_print ("NO MEM Exiting.\n");
>         >             return 1;
>         >         }
>         resmux is not initialized yet,here maybe some random
>         value,you'd better
>         remove it from check list.
>
>         >
>         >         /* we set the input filename to the source element */
>         >         g_object_set (G_OBJECT (source), "location",
>         filePath, NULL);
>         >
>         >         demuxer  = gst_element_factory_make ("id3demux",
>         "id3-demuxer");
>         >         decoder  = gst_element_factory_make ("mad",
>         "mp3-decoder");
>         >
>         >          if (!demuxer || !decoder || !conv1)
>         conv1 ? dose it should be conv?
>
>         >          {
>         >                     g_print ("NO MEM Exiting.\n");
>         >                     return 1;
>         >           }
>         >
>         >          g_object_set (G_OBJECT (resmux), "caps", caps, NULL);
>         >          gst_caps_unref (caps);
>         >
>         as I said before,resmux haven't initialized ,that's not quite
>         right.
>         and I suggest you to remove these two lines.
>
>         >          /* file-source -> demuxer -> decoder ->
>          alsa-output */
>         >         gst_bin_add_many (GST_BIN (musicPlayer.playPipeline),
>         >                          source, demuxer, decoder, conv,
>         resample,
>         > resmux,sink, NULL);
>         >
>         >         gst_element_link (source, demuxer);
>         >         gst_element_link_many (decoder, conv,
>         resample,resmux,sink, NULL);
>         You can use gst_element_link_filtered to link resample and
>         sink with
>         caps instead of this way.
>         something like:
>              gst_element_link (source, demuxer);
>              gst_element_link_many (decoder, conv, resample, NULL);
>              if ( !gst_element_link_filtered(resample,sink,caps) ){
>                  g_printerr("Failed to link elements resample and
>         alsa-sink");
>              }
>
>
>         >         g_signal_connect (demuxer, "pad-added", G_CALLBACK
>         > (on_pad_added), decoder);
>         >
>         >         GstBus *bus =
>         > gst_pipeline_get_bus(GST_PIPELINE(musicPlayer.playPipeline));
>         >         gst_bus_add_watch(bus, bus_call, NULL);
>         >         gst_object_unref(bus);
>         >
>         >        
>         gst_element_set_state(GST_ELEMENT(musicPlayer.playPipeline),
>         > GST_STATE_PLAYING);
>         >
>         >         musicPlayer.playLoop = g_main_loop_new(NULL, FALSE);
>         >
>         >         g_main_loop_run(musicPlayer.playLoop);
>         >
>         >        
>         gst_element_set_state(GST_ELEMENT(musicPlayer.playPipeline),
>         > GST_STATE_NULL);
>         >         gst_object_unref(GST_OBJECT(musicPlayer.playPipeline));
>         >
>         >
>         >
>         >
>         > With Warm Regards
>         > Jesu Anuroop Suresh
>         >
>         > "Any intelligent fool can make things bigger, more complex,
>         and more
>         > violent. It takes a touch of genius -- and a lot of courage
>         -- to move
>         > in the opposite direction."
>         > "Anyone who has never made a mistake has never tried
>         anything new."
>         >
>         >
>         I attached my modified source code ,you can try it.
>         Hope it helps.
>
>         Thanks.
>
>
>         --
>         B.R
>
>         Cai Yuanqing
>
>
>         ------------------------------------------------------------------------------
>
>         Protect Your Site and Customers from Malware Attacks
>         Learn about various malware tactics and how to avoid them.
>         Understand
>         malware threats, the impact they can have on your business,
>         and how you
>         can protect your company and customers by using code signing.
>         http://p.sf.net/sfu/oracle-sfdevnl
>         _______________________________________________
>         gstreamer-devel mailing list
>         [hidden email]
>         ------------------------------------------------------------------------
>         <http://gstreamer-devel.966125.n4.nabble.com/audioresample-tp3213586p3215098.html?by-user=t>
>
>
>         To unsubscribe from audioresample, click here
>     <http://gstreamer-devel.966125.n4.nabble.com/audioresample-tp3213586p3215225.html>
>
>
>     Sent from the GStreamer-devel mailing list archive
>     <http://gstreamer-devel.966125.n4.nabble.com/> at Nabble.com.
>
>     ------------------------------------------------------------------------------
>     Protect Your Site and Customers from Malware Attacks
>     Learn about various malware tactics and how to avoid them. Understand
>     malware threats, the impact they can have on your business, and
>     how you
>     can protect your company and customers by using code signing.
>     http://p.sf.net/sfu/oracle-sfdevnl
>     _______________________________________________
>     gstreamer-devel mailing list
>     [hidden email]
>     <mailto:[hidden email]>


--
B.R

Cai Yuanqing


------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel