how to read/write property of alsasink from application

Mandeep Sandhu mandeepsandhu.chd at gmail.com
Sun Jan 20 21:24:11 PST 2013


On Mon, Jan 21, 2013 at 8:02 AM, Soho Soho123 <soho123.2012 at gmail.com> wrote:
> Hi Tim,
>
> Yes, you are right.
> But my problem is:
> if pipe I used :gst-launch-0.10 playbin2 url=....
> then the elements that be constructed in pipe are automatically, right?
> that inicludes alsasink element.
> If I created alsasink element by myself, then
> I have to pass the point to playbin2, right?
> how to let playbin2 know the audio sink is the alsasink that I created
> by myself,
> NOT use the element that auto created?

As Tim pointed out, this happens when you _explicitly_ set the audio
sink element on playbin2 by calling:

<snip>
GstElement *alsasink = gst_element_factory_make ("alsasink", NULL);

and then set it on playbin (=the pipeline) with

g_object_set (playbin, "audio-sink", alsasink, NULL);
</snip>

>From this point onwards, playbin2 will use this as the audio sink, and
not use the one created internally.

Do a gst-inspect on playbin2 and see what this ("audio-sink") property does.

We do something similar, where we want to explicitly set a custom
video sink and control the sinks properties sometime later.

HTH,
-mandeep

> Could you kindly help to explain more detail?
>
> Thank you very much!!
>
> Best Regards,
> Soho
>
> 2013/1/20 Tim-Philipp Müller <t.i.m at zen.co.uk>:
>> On Sun, 2013-01-20 at 00:13 +0800, Soho Soho123 wrote:
>>
>> Hi,
>>>
>>> If my application uses the pipe like "gst-launch-0.10 playbin url=.....", then
>>
>> You should use playbin2 uri=... really, not the old playbin.
>>
>>
>>> is there any method that I can read/write property of alsasink from
>>> main of application?
>>>  Does someone have idea?
>>> Because I have to tell alsa to do someting while audio playback!
>>
>> The easiest way would be to create the alsasink yourself using
>>
>>  GstElement *alsasink = gst_element_factory_make ("alsasink", NULL);
>>
>> and then set it on playbin (=the pipeline) with
>>
>> g_object_set (playbin, "audio-sink", alsasink, NULL);
>>
>> Then you can keep the alsasink pointer around and use
>>
>>   g_object_set (alsasink, "property-name", value, NULL);
>> or
>>   g_object_get (alsasink, "property-name", &value, NULL);
>>
>> (though many of the values can probably only be manipulated while
>> alsasink is in NULL state, not while it's being used for output).
>>
>> Cheers
>>  -Tim
>>
>>
>> _______________________________________________
>> gstreamer-devel mailing list
>> gstreamer-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


More information about the gstreamer-devel mailing list