[FFmpeg-devel] [ffmpeg-devel] [PATCH 3/4] lavfi: add audio convert filter

Mina Nagy Zaki mnzaki at gmail.com
Tue Aug 2 21:00:50 CEST 2011


On Tue, Aug 02, 2011 at 04:09:26PM +0200, Stefano Sabatini wrote:
> On date Monday 2011-08-01 11:52:21 +0300, Mina Nagy Zaki encoded:
[...]
Fixed things.

> 
> > +    /* Handle generic planar stereo downmixing */
> > +    if (!aconvert->convert_chlayout && !aconvert->audioconvert_ctx &&
> > +        outlink->channel_layout == AV_CH_LAYOUT_STEREO) {
> > +        int size =
> > +          av_get_bytes_per_sample(inlink->format) * curbuf->audio->nb_samples;
> > +        if (nb_channels == 1) curbuf->data[1] = curbuf->data[0];
> > +        memcpy(aconvert->out_samplesref->data[0],curbuf->data[0], size);
> > +        memcpy(aconvert->out_samplesref->data[1], curbuf->data[1], size);
> > +        aconvert->out_samplesref->audio->nb_samples =
> > +            curbuf->audio->nb_samples;
> > +        curbuf = aconvert->out_samplesref;
> > +    }
> 
> what's this exactly doing?

As the code comment suggests, this is essentially a shortcut for downmixing to
planar stereo, since it can be done with a simple memcpy, no need for
av_audio_convert or any conversion functions.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-lavfi-add-audio-convert-filter.patch
Type: text/x-diff
Size: 26630 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110802/fdd23cf9/attachment.bin>


More information about the ffmpeg-devel mailing list