[FFmpeg-devel] [PATCH] Add get_audio_buffer_ref function to lavfi.

S.N. Hemanth Meenakshisundaram smeenaks
Wed Sep 15 18:10:45 CEST 2010


 On 09/15/2010 05:02 AM, Michael Niedermayer wrote:
> On Thu, Sep 02, 2010 at 12:52:54AM -0700, S.N. Hemanth Meenakshisundaram wrote:
> [...]
>> +int av_asrc_buffer_add_frame(AVFilterContext *ctx, uint8_t *frame, int sample_fmt,
>> +                             int size, int64_t ch_layout, int planar, int64_t pts)
>> +{
>> +    AVFilterLink *link            = ctx->outputs[0];
>> +    ABufferSourceContext *abuffer = ctx->priv;
>> +    AVFilterBufferRef *samplesref;
>> +
>> +    if (av_fifo_space(abuffer->fifo) < sizeof(samplesref)) {
>> +        av_log(ctx, AV_LOG_ERROR,
>> +               "Buffering limit reached. Please consume some available frames before adding new ones.\n");
>> +        return AVERROR(ENOMEM);
>> +    }
>> +
>> +    samplesref = avfilter_get_audio_buffer(link, AV_PERM_WRITE | AV_PERM_PRESERVE |
>> +                                           AV_PERM_REUSE2, sample_fmt, size, ch_layout, planar);
>> +
>> +    memcpy(samplesref->data[0], frame, samplesref->audio->size);
> it still does a memcpy
> the user should receive a pointer into which she can store the audio not have
> to provide a pointer to the filter and that then does a forced copy
>
> or any other method that avoids the memcpy
>
> [...]
>


I had sent the attached patch earlier too. This adds a
get_audio_buffer_ref function that will help avoid the memcpy above.

If the attached patch is ok, I can modify this asrc_abuffer too.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: get_buffer_ref.patch
Type: text/x-patch
Size: 2502 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100915/dcff16d1/attachment.bin>



More information about the ffmpeg-devel mailing list