<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 14 April 2014 09:42, Tanu Kaskinen <span dir="ltr"><<a href="mailto:tanu.kaskinen@linux.intel.com" target="_blank">tanu.kaskinen@linux.intel.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div>On Mon, 2014-04-14 at 01:16 +0200, Lukasz Marek wrote:<br>

> Hi,<br>
><br>
> I hope this is correct list for general questions about PulseAudio<br>
> development. I devel some stuff for FFmpeg project and I want to update<br>
> pulse output device. I have few questions:<br>
><br>
> - Is this possible to detect that mute/volume for sink input has changed<br>
> without calling pa_context_get_sink_input_info periodically?<br>
> I saw some commits recently that seems to add this, but ubuntu still use<br>
> 4.0 for example, so probably not, but I still wanted to ask about it.<br>
<br>
</div>You can get notifications about sink input changes with the subscription<br>
API: <a href="http://freedesktop.org/software/pulseaudio/doxygen/subscribe.html" target="_blank">http://freedesktop.org/software/pulseaudio/doxygen/subscribe.html</a><br>
<br>
The API will tell you only that something changed (not necessarily<br>
volume/mute), so when you get a change event for a sink input that you<br>
are interested in, you then call pa_context_get_sink_input_info().</blockquote><div><br></div><div>Looks like something I needed. Thanks.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<div></div><div>
> - pa_stream_write has parameter pa_free_cb_t to provide zero-copy.<br>
> Unfortunately it doesn't accept user data, in case of FFmpeg, the buffer<br>
> is inside AVBuffer, AVPacket, or AVFrame (AVBuffer technically).<br>
> Each of them contains a variable with a buffer that should be passed to<br>
> pa_stream_write, but free function should unref this structure, not<br>
> buffer itself.<br>
> It cannot be extracted without copying and this zero-copy is hard to reach.<br>
> My question is: do you think it is doable/acceptable to add other<br>
> function that would accept userdata for free callback?<br>
> I know there is pa_stream_begin_write, but this is not suitable neither.<br>
<br>
</div>Yes, I think that would be acceptable. I wonder what would be a good<br>
name for the function. pa_stream_write_with_free_userdata?<br></blockquote><div><br></div><div>Maybe:</div><div><br></div><div>typedef void (*pa_free_ext_cb_t)(void *p, void *userdata);<br></div><div><br></div><div><div>
pa_stream_write_with_free_ext(...)<br></div></div><div><br></div><div>I'll try to prepare a patch soon.<br></div><div><br></div><div><br></div></div></div></div>