How to set a volume property in audiomixer's sink pads?

Michael Gruner michael.gruner at ridgerun.com
Fri Jun 3 03:45:44 UTC 2016


Hi Natanael

The problem you are having now is because you are using get_element_get_static_pad to ask for the audiomixer pad. This function is for static pads only. The videomixer pads are request pads, hence this function will return NULL giving you the error on the next functions. 

Using your original code, it should look something like:

	gst_bin_add(GST_BIN(pipeline), source->get_bin());
        GstPad *mixer_pad = gst_element_request_pad (audiomixer, mix_template, NULL, NULL);
        GstPad *a_pad = gst_element_get_static_pad(source->get_bin(), "audiosrc");
        if (gst_pad_link (a_pad, mixer_pad) != GST_PAD_LINK_OK ){
                 g_critical ("link audio source to audiomixer failed.\n");
                 exit(1);
         }
	g_object_set(mixer_pad, “mute”, TRUE, NULL);

Note how I’m using the pad that was returned originally by gst_element_request_pad. You need to keep a reference of the pads in order to set the properties later.

—
Michael Gruner <michael.gruner at ridgerun.com <mailto:michael.gruner at ridgerun.com>>
Embedded Linux and GStreamer solutions
RidgeRun Engineering
Contact Us - http://www.ridgerun.com/#!contact/c3vn <http://www.ridgerun.com/#!contact/c3vn>
> On Jun 2, 2016, at 21:10, Natanael Mojica <neithanmo at gmail.com> wrote:
> 
> Thanks Michael
> 
> I tried your recomendation but that not work, example:
> 
> GObject *pad =G_OBJECT(gst_element_get_static_pad(audiomixer,                        sink.toUtf8().constData()));
> 
> then:
> 
>         g_object_set(pad, "volume", x,NULL);
> 
> and in running time I get this error:
> 
>               g_object_set: assertion 'G_IS_OBJECT (object)' failed
> 
> and if in another way:
> 
> g_object_set(gst_element_get_static_pad(audiomixer,                        sink.toUtf8().constData()), "volume", x , NULL);
> 
> dont work ., getting same error message
> 
> So, whats is the correct way to do that??
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20160602/1bfb491b/attachment.html>


More information about the gstreamer-devel mailing list