[gst-devel] level element in playbin2
J. Rios
jrioslists at gmail.com
Thu Dec 31 11:57:36 CET 2009
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 <ensonic at hora-obscura.de>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
> > gstreamer-devel at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20091231/8dd64070/attachment.htm>
More information about the gstreamer-devel
mailing list