[FFmpeg-devel] [PATCH] Add asrc abuffer - audio buffer source filter
Michael Niedermayer
michaelni
Wed Sep 15 14:02:59 CEST 2010
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
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Rewriting code that is poorly written but fully understood is good.
Rewriting code that one doesnt understand is a sign that one is less smart
then the original author, trying to rewrite it will not make it better.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100915/e6a41a08/attachment.pgp>
More information about the ffmpeg-devel
mailing list