Hi Cai,<div><br></div><div><br></div><div>Thanks for you response, I Will try out your suggestion of using the filtered link.</div><div><br></div><div>Sorry there was some typoerror in my code what I shared. </div><div><br>
</div><div>I did initialized the &#39;resmux&#39; as capasity filter and used the conv not conv1.</div><div><br></div><div>The cocde works for me for mp3 playback in its original settings.</div><div><br></div><div><br></div>
<div>        resample = gst_element_factory_make (&quot;audioresample&quot;, &quot;audio-resample&quot;);</div><div><div>        conv     = gst_element_factory_make (&quot;audioconvert&quot;,  &quot;converter1&quot;);</div>
<div><font class="Apple-style-span" color="#FF0000"><span class="Apple-tab-span" style="white-space:pre">        </span>resmux   = gst_element_factory_make (&quot;capsfilter&quot;, &quot;filter&quot;);</font></div><div><br></div>
<div>        caps = gst_caps_new_simple (&quot;audio/x-raw-int&quot;,</div><div>                                     &quot;width&quot;, G_TYPE_INT, 16,</div><div>                                     &quot;depth&quot;, G_TYPE_INT, 16,</div>
<div>                                     &quot;rate&quot;,  G_TYPE_INT, 22050,</div><div>                                     &quot;channels&quot;,G_TYPE_INT, 2, NULL</div><div>                                     );</div>
<div><br></div><div>        if (!musicPlayer.playPipeline || !source || !sink ||</div><div>            !resample || !resmux || !caps || !conv)</div><div>        {</div><div>            g_print (&quot;NO MEM Exiting.\n&quot;);</div>
<div>            return 1;</div><div>        }</div><div><br></div><div>        /* we set the input filename to the source element */</div><div>        g_object_set (G_OBJECT (source), &quot;location&quot;, filePath, NULL);</div>
<div><br></div><div>        demuxer  = gst_element_factory_make (&quot;id3demux&quot;, &quot;id3-demuxer&quot;);</div><div>        decoder  = gst_element_factory_make (&quot;mad&quot;, &quot;mp3-decoder&quot;);</div><div>
<br></div><div><font class="Apple-style-span" color="#FF0000">         if (!demuxer || !decoder || !conv)</font></div><div>         {</div><div>                    g_print (&quot;NO MEM Exiting.\n&quot;);</div><div>                    return 1;</div>
<div>          }</div><div><br></div></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; color: rgb(80, 0, 80); ">With Warm Regards<br>Jesu Anuroop Suresh<br>
<br>&quot;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.&quot;<br>&quot;Anyone who has never made a mistake has never tried anything new.&quot;<br>
</span></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; color: rgb(80, 0, 80); "><br></span></div><div><div class="gmail_quote">On Thu, Jan 13, 2011 at 7:16 AM, Cai Yuanqing [via GStreamer-devel] <span dir="ltr">&lt;<a href="/user/SendEmail.jtp?type=node&node=3215225&i=0" target="_top" rel="nofollow">[hidden email]</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

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


        
        <br>
        <br>
        <hr noshade size="1" color="#cccccc">
        <div style="color:#666666;font:11px tahoma,geneva,helvetica,arial,sans-serif">
                View message @ <a href="http://gstreamer-devel.966125.n4.nabble.com/audioresample-tp3213586p3215098.html?by-user=t" target="_blank" rel="nofollow" link="external">http://gstreamer-devel.966125.n4.nabble.com/audioresample-tp3213586p3215098.html</a><div>
<br>
                
                To unsubscribe from audioresample, <a href="http://gstreamer-devel.966125.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&amp;node=3213586&amp;code=amVzdWFzQGdtYWlsLmNvbXwzMjEzNTg2fDcwOTc3MzYyOA==&by-user=t" target="_blank" rel="nofollow" link="external">click here</a>.
        </div></div></blockquote></div><br></div>

<br><hr align="left" width="300">
View this message in context: <a href="http://gstreamer-devel.966125.n4.nabble.com/audioresample-tp3213586p3215225.html">Re: audioresample</a><br>
Sent from the <a href="http://gstreamer-devel.966125.n4.nabble.com/">GStreamer-devel mailing list archive</a> at Nabble.com.<br>