[pulseaudio-discuss] Few questions about PA API

Tanu Kaskinen tanu.kaskinen at linux.intel.com
Mon Apr 14 06:49:51 PDT 2014


On Mon, 2014-04-14 at 14:35 +0200, Lukasz M wrote:
> On 14 April 2014 09:42, Tanu Kaskinen <tanu.kaskinen at linux.intel.com> wrote:
> 
> > On Mon, 2014-04-14 at 01:16 +0200, Lukasz Marek wrote:
> >  > - pa_stream_write has parameter pa_free_cb_t to provide zero-copy.
> > > Unfortunately it doesn't accept user data, in case of FFmpeg, the buffer
> > > is inside AVBuffer, AVPacket, or AVFrame (AVBuffer technically).
> > > Each of them contains a variable with a buffer that should be passed to
> > > pa_stream_write, but free function should unref this structure, not
> > > buffer itself.
> > > It cannot be extracted without copying and this zero-copy is hard to
> > reach.
> > > My question is: do you think it is doable/acceptable to add other
> > > function that would accept userdata for free callback?
> > > I know there is pa_stream_begin_write, but this is not suitable neither.
> >
> > Yes, I think that would be acceptable. I wonder what would be a good
> > name for the function. pa_stream_write_with_free_userdata?
> >
> 
> Maybe:
> 
> typedef void (*pa_free_ext_cb_t)(void *p, void *userdata);

Mmh, defining a new callback type is not really necessary. If you pass
the extra userdata pointer to pa_stream_write_with_free_ext() (or
whatever it will be called), the function can just pass the userdata
pointer to a regular pa_free_cb_t callback.

> pa_stream_write_with_free_ext(...)
> 
> I'll try to prepare a patch soon.

-- 
Tanu



More information about the pulseaudio-discuss mailing list