level element in playbin2

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

level element in playbin2

J. Rios
Hello,
   Im tryign to incorporate the level element into a playbin2. This is the significant part of what I have tried

    GstElement * outputsink;
    outputsink = gst_element_factory_make( "gconfaudiosink", "audio-sink" );
...
    GstElement * m_Playbin = gst_element_factory_make( "playbin2", "play" );
...
    GstElement * level = gst_element_factory_make( "level", "levelctrl" );

    GstElement * replay = gst_element_factory_make( "rgvolume", "replaygain" );


    gst_bin_add( GST_BIN( m_Playbin ), level );
    gst_bin_add( GST_BIN( m_Playbin ), replay );
    g_object_set( G_OBJECT( m_Playbin ), "audio-sink", outputsink, NULL );

    g_object_set( level, "message", true, NULL );

    g_object_set( G_OBJECT( m_Playbin ), "flags", 0x02|0x10, NULL );

    gst_bus_add_watch( gst_pipeline_get_bus( GST_PIPELINE( m_Playbin ) ),
            ( GstBusFunc ) gst_bus_async_callback, this );


The problem I have is that I dont get the Element messages. All the rest works fine including the replay-gain volumen but I dont get the level messages in the callback function.
What I want to do is detect when the sound level is below an user defined level so I can skip to next track.

I dunno if this is the correct place to put it but I have been tryign to search for this with no success. Please if u know what is wrong or how it should work let me know

Thanks in advance
J.Rios


------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: level element in playbin2

Arnout Vandecappelle
 Without actually trying anything or knowing how the level element works,
I'd say that at least you have to link your elements appropriately.  See
below.

 I'm surprised that the replaygain does work...

 Regards,
 Arnout

On Monday 28 December 2009 13:34:11, J. Rios wrote:

> Hello,
>    Im tryign to incorporate the level element into a playbin2. This is
>  the significant part of what I have tried
>
>     GstElement * outputsink;
>     outputsink = gst_element_factory_make( "gconfaudiosink", "audio-sink"
>  ); ...
>     GstElement * m_Playbin = gst_element_factory_make( "playbin2", "play"
>  ); ...
>     GstElement * level = gst_element_factory_make( "level", "levelctrl"
>  );
>
>     GstElement * replay = gst_element_factory_make( "rgvolume",
>  "replaygain" );
>
>
     gst_bin_add( GST_BIN( m_Playbin ), replay );
     gst_bin_add( GST_BIN( m_Playbin ), outputsink );
     gst_element_link_many ( level, replay, outputsink );
     g_object_set( G_OBJECT( m_Playbin ), "audio-sink", level, NULL );
>
>     g_object_set( level, "message", true, NULL );
>
>     g_object_set( G_OBJECT( m_Playbin ), "flags", 0x02|0x10, NULL );
>
>     gst_bus_add_watch( gst_pipeline_get_bus( GST_PIPELINE( m_Playbin ) ),
>             ( GstBusFunc ) gst_bus_async_callback, this );

--
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  31BB CF53 8660 6F88 345D  54CC A836 5879 20D7 CF43

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: level element in playbin2

J. Rios
This doenst work. How works but without level notifications is how i posted before.

But I want the level be after the replay gain volume. So I can get the signal level after the replay gain have done its gain adjust but not influenced by the playbin volume.

I dont know how to do something like that

Thanks in advance
J.Rios

On Wed, Dec 30, 2009 at 8:44 AM, Arnout Vandecappelle <[hidden email]> wrote:
 Without actually trying anything or knowing how the level element works,
I'd say that at least you have to link your elements appropriately.  See
below.

 I'm surprised that the replaygain does work...

 Regards,
 Arnout

On Monday 28 December 2009 13:34:11, J. Rios wrote:
> Hello,
>    Im tryign to incorporate the level element into a playbin2. This is
>  the significant part of what I have tried
>
>     GstElement * outputsink;
>     outputsink = gst_element_factory_make( "gconfaudiosink", "audio-sink"
>  ); ...
>     GstElement * m_Playbin = gst_element_factory_make( "playbin2", "play"
>  ); ...
>     GstElement * level = gst_element_factory_make( "level", "levelctrl"
>  );
>
>     GstElement * replay = gst_element_factory_make( "rgvolume",
>  "replaygain" );
>
>
    gst_bin_add( GST_BIN( m_Playbin ), replay );
    gst_bin_add( GST_BIN( m_Playbin ), outputsink );
    gst_element_link_many ( level, replay, outputsink );
    g_object_set( G_OBJECT( m_Playbin ), "audio-sink", level, NULL );
>
>     g_object_set( level, "message", true, NULL );
>
>     g_object_set( G_OBJECT( m_Playbin ), "flags", 0x02|0x10, NULL );
>
>     gst_bus_add_watch( gst_pipeline_get_bus( GST_PIPELINE( m_Playbin ) ),
>             ( GstBusFunc ) gst_bus_async_callback, this );

--
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  31BB CF53 8660 6F88 345D  54CC A836 5879 20D7 CF43


------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: level element in playbin2

Stefan Sauer
In reply to this post by J. Rios
hi,

Am 28.12.2009 14:34, schrieb J. Rios:

> Hello,
>    Im tryign to incorporate the level element into a playbin2. This is
> the significant part of what I have tried
>
>     GstElement * outputsink;
>     outputsink = gst_element_factory_make( "gconfaudiosink", "audio-sink" );
> ...
>     GstElement * m_Playbin = gst_element_factory_make( "playbin2", "play" );
> ...
>     GstElement * level = gst_element_factory_make( "level", "levelctrl" );
>
>     GstElement * replay = gst_element_factory_make( "rgvolume",
> "replaygain" );
>
>
>     gst_bin_add( GST_BIN( m_Playbin ), level );
>     gst_bin_add( GST_BIN( m_Playbin ), replay );
>     g_object_set( G_OBJECT( m_Playbin ), "audio-sink", outputsink, NULL );
>
>     g_object_set( level, "message", true, NULL );
>
>     g_object_set( G_OBJECT( m_Playbin ), "flags", 0x02|0x10, NULL );
>
>     gst_bus_add_watch( gst_pipeline_get_bus( GST_PIPELINE( m_Playbin ) ),
>             ( GstBusFunc ) gst_bus_async_callback, this );
>
>
this cannot work as such. The elements need to be linked in the right order.
What you need to do, is to create an own bin, add level, replay and the
audiosink there, link them and set your bin as the audiosink. You need to add a
ghostpad to the bin and set it to the first (yet unlinked) sink pad of you elements.

Stefan


> The problem I have is that I dont get the Element messages. All the rest
> works fine including the replay-gain volumen but I dont get the level
> messages in the callback function.
> What I want to do is detect when the sound level is below an user
> defined level so I can skip to next track.
>
> I dunno if this is the correct place to put it but I have been tryign to
> search for this with no success. Please if u know what is wrong or how
> it should work let me know
>
> Thanks in advance
> J.Rios
>
>
>
> ------------------------------------------------------------------------------
> This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app distribution fast and easy
> Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev 
>
>
>
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel


------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: level element in playbin2

J. Rios
Thanks that worked fine.
This is how did it if someone else is interested. I removed all the error checking code and kept only the significant part.

        ...
        GstElement * outputsink = gst_element_factory_make( "gconfaudiosink", "audio-sink" );
        GstElement * m_Playbin = gst_element_factory_make( "playbin2", "play" );
        GstElement * level = gst_element_factory_make( "level", "gulevelctrl" );
        g_object_set( level, "message", TRUE, NULL );
        g_object_set( level, "interval", gint64( 250000000 ), NULL );

        GstElement * replay = gst_element_factory_make( "rgvolume", "replaygain" );
        g_object_set( replay, "album-mode", false, NULL );

        gst_bin_add( GST_BIN( m_Playbin ), replay );


        GstElement * sinkbin = gst_bin_new( "outsinkbin" );

        GstElement * converter = gst_element_factory_make( "audioconvert", "aconvert" );

        GstPad * pad;
        GstPad * ghostpad;

        gst_bin_add_many( GST_BIN( sinkbin ), converter, level, outputsink, NULL );
        gst_element_link_many( converter, level, outputsink, NULL );

        pad = gst_element_get_pad( converter, "sink" );
        ghostpad = gst_ghost_pad_new( "sink", pad );
        gst_element_add_pad( sinkbin, ghostpad );
        gst_object_unref( pad );

        g_object_set( G_OBJECT( m_Playbin ), "audio-sink", sinkbin, NULL );

        g_object_set( G_OBJECT( m_Playbin ), "flags", 0x02|0x10, NULL );
        ...

This way it worked fine and get the level messages.

Thank you all for your help
Greets J.Rios


On Wed, Dec 30, 2009 at 2:30 PM, Stefan Kost <[hidden email]> wrote:
hi,

Am 28.12.2009 14:34, schrieb J. Rios:
> Hello,
>    Im tryign to incorporate the level element into a playbin2. This is
> the significant part of what I have tried
>
>     GstElement * outputsink;
>     outputsink = gst_element_factory_make( "gconfaudiosink", "audio-sink" );
> ...
>     GstElement * m_Playbin = gst_element_factory_make( "playbin2", "play" );
> ...
>     GstElement * level = gst_element_factory_make( "level", "levelctrl" );
>
>     GstElement * replay = gst_element_factory_make( "rgvolume",
> "replaygain" );
>
>
>     gst_bin_add( GST_BIN( m_Playbin ), level );
>     gst_bin_add( GST_BIN( m_Playbin ), replay );
>     g_object_set( G_OBJECT( m_Playbin ), "audio-sink", outputsink, NULL );
>
>     g_object_set( level, "message", true, NULL );
>
>     g_object_set( G_OBJECT( m_Playbin ), "flags", 0x02|0x10, NULL );
>
>     gst_bus_add_watch( gst_pipeline_get_bus( GST_PIPELINE( m_Playbin ) ),
>             ( GstBusFunc ) gst_bus_async_callback, this );
>
>
this cannot work as such. The elements need to be linked in the right order.
What you need to do, is to create an own bin, add level, replay and the
audiosink there, link them and set your bin as the audiosink. You need to add a
ghostpad to the bin and set it to the first (yet unlinked) sink pad of you elements.

Stefan


> The problem I have is that I dont get the Element messages. All the rest
> works fine including the replay-gain volumen but I dont get the level
> messages in the callback function.
> What I want to do is detect when the sound level is below an user
> defined level so I can skip to next track.
>
> I dunno if this is the correct place to put it but I have been tryign to
> search for this with no success. Please if u know what is wrong or how
> it should work let me know
>
> Thanks in advance
> J.Rios
>
>
>
> ------------------------------------------------------------------------------
> This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app distribution fast and easy
> Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev
>
>
>
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel



------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel