[FFmpeg-devel] [PATCH] audio fifo filter for lavfi

Michael Niedermayer michaelni
Thu Sep 23 04:32:13 CEST 2010


On Wed, Sep 22, 2010 at 07:05:16PM -0700, S.N. Hemanth Meenakshisundaram wrote:
[...]
> +static void filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref)
> +{
> +    FifoContext *fifo = link->dst->priv;
> +
> +    // if frame requests are pending, directly pass on buffer, do not queue.
> +    if (fifo->frame_requests_pending) {
> +        filter_samples(link->dst->outputs[0], samplesref);
> +        fifo->frame_requests_pending--;
> +        return;
> +    }
> +    fifo->last->next       = av_mallocz(sizeof(BufSamples));
> +    fifo->last             = fifo->last->next;
> +    fifo->last->samplesref = samplesref;
> +    fifo->fifo_count += samplesref->audio->samples_nb;
> +}
> +
> +static int request_frame(AVFilterLink *link)
> +{
> +    FifoContext *fifo = link->src->priv;
> +    BufSamples *tmp;
> +    int err;
> +
> +    if (!fifo->root.next)
> +        if ((err = avfilter_request_frame(link->src->inputs[0])) < 0) {
> +            fifo->frame_requests_pending++;
> +            return err;
> +        }

elaborate please on how this can work
frames have no known size, anything calling request_frame() 5 times could
as a result get 5 samples or 5 billion samples
simply setting frame_requests_pending=1 would likely do the same
but this seems not what you intended it to do

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In fact, the RIAA has been known to suggest that students drop out
of college or go to community college in order to be able to afford
settlements. -- The RIAA
-------------- 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/20100923/b0bf1b05/attachment.pgp>



More information about the ffmpeg-devel mailing list