[gst-devel] Quiet output from playbin on maemo

Jeffrey Barish jeff_barish at earthlink.net
Thu Jun 5 21:55:16 CEST 2008


Kalle Vahlman wrote:
> We had this problem in kilikali and fixed it with the following code
> (not sure if it's valid but it's based on empirical testing and
> results and seems to work so...):
> 
> #ifdef MAEMO_CHANGES
>   /* Ok, here are the rules that seem to be in effect:
>   *  - standard playbin really only has the range 0.0...1.0 since anything
>   *    over 1.0 starts to distort the sound
>   *  - maemo playbin seems to set the volume element volume to 0.0, dunno
>   why
>   *  - maemo playbin uses the whole 0.0...10.0 range to control the dsp
>   sink *
>   * So in principle you could adjust volume the same way everywhere but
>   * you just won't like the result (1/10th of max volume) on maemo.
>   *
>   * So we hack around, as usual.
>   */
>   g_object_set (G_OBJECT(self->audiobin), "volume",
>                 (gdouble)(1.0*volume/10.0), NULL);
> 
>   {
>     GstElement *sink = gst_bin_get_by_name(GST_BIN(self->audiobin),
>     "volume"); if (sink != NULL)
>     {
>       g_object_set (G_OBJECT(sink), "volume", 1.0, NULL);
>     }
>   }
> #else
>   g_object_set (G_OBJECT(self->audiobin), "volume",
>                 self->priv->volume, NULL);
> #endif
> 
> The dsp sinks I believe have their own volume setting so the funky
> behaviour might be caused by that but I don't know.

This code looks interesting, but I'm not getting it -- in part, perhaps,
because I am actually coding in Python.

1. If we're not on maemo, then we're in the else clause.  You say that
playbin really only has the range of 0.0 - 1.0, so I presume that
self->priv->volume has the range 0.0 - 1.0.  In the maemo case, you say
that the playbin uses the range 0.0 - 10.0.  The volume variable presumably
refers to something different from self->priv->volume, but it's hard to
imagine why you would have to divide it by 10.0 rather than multiplying it
by 10.0.  In any case, I had already tried multiplying by 8.0 (I just
picked a number out of a hat) and found that the sound was distorted.  To
be precise, I created a playbin with

player = gst.element_factory_make('playbin', 'player')

and then set its volume with

player.set_property('volume', 8.0 * v)

The sound does get louder, but it's distorted.

2. I don't know GStreamer well enough to fully understand what you're doing
in the gst_bin_get_by_name.  I tried

player.get_by_name('volume')

but got None.  I assume that this code addresses your second bullet item:
playbin sets the volume element volume to 0.0 so you are setting it to 1.0. 
So there is a volume element volume that is different from the playbin
volume?  If it really is a separate volume control, why am I getting any
output if its value is set to 0 by default?
-- 
Jeffrey Barish





More information about the gstreamer-devel mailing list