Few questions about PA API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 14.04.2014 15:49, Tanu Kaskinen wrote:
> 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.

Yes. I was just proposing different name of the function, I didn't think 
much about it.

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

I have attached a patch. I tested my use case and some random file 
played with paplay. It seems to be working good, but do deep review, 
I've might miss something.

I don't know if I should update version or something.

-- 
Best Regards,
Lukasz Marek

You can avoid reality, but you cannot avoid the consequences of avoiding 
reality. - Ayn Rand
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-pa_stream_write_ext_free-function.patch
Type: text/x-patch
Size: 7067 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20140415/107a8e88/attachment.bin>


[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux