[FFmpeg-devel] [PATCH] ffplay changes for lavfi audio

Michael Niedermayer michaelni
Tue Aug 24 11:58:11 CEST 2010


On Sat, Aug 21, 2010 at 09:56:17AM -0700, S.N. Hemanth Meenakshisundaram wrote:
> Added Changelog and doc for -af option in ffplay.texi
> 
> ---
>  Changelog           |    2 +
>  doc/ffplay-doc.texi |    5 +
>  ffplay.c            |  204 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 211 insertions(+), 0 deletions(-)
> 
> 
> 

>  Changelog           |    2 
>  doc/ffplay-doc.texi |    5 +
>  ffplay.c            |  204 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 211 insertions(+)
> f826d2874d10f6781b4ce78528a3153d979495ce  0001-ffplay-changes-for-lavfi-audio.patch
[...]
> +static int input_request_audio_frame(AVFilterLink *link)
> +{
> +    AudioFilterPriv *priv = link->src->priv;
> +    AVFilterBufferRef *samplesref;
> +    AVCodecContext *avctx;
> +    double pts = 0;
> +    int buf_size = 0;
> +
> +    buf_size = audio_decode_frame(priv->is, &pts);
> +    avctx = priv->is->audio_st->codec;
> +    if (buf_size <= 0)
> +        return AVERROR(EINVAL);
> +
> +    /* FIXME Currently audio streams seem to have no info on planar/packed.
> +     * Assuming packed here and passing 0 as last attribute to get_audio_buffer.
> +     */
> +    if (!avctx->channel_layout) {
> +        avctx->channel_layout = avcodec_guess_channel_layout(avctx->channels, 0, NULL);
> +    }
> +
> +    samplesref = avfilter_get_audio_buffer(link, AV_PERM_WRITE, avctx->sample_fmt, 
> +                                           buf_size, avctx->channel_layout, 0);
> +    memcpy(samplesref->data[0], priv->is->audio_buf, buf_size);

this looks inefficient


> +
> +    samplesref->pts         = (int64_t) pts;

this looks wrong


[...]
> +static int get_filtered_audio_samples(AVFilterContext *ctx, VideoState *is, double *pts)
> +{
> +    AVFilterBufferRef *samplesref;
> +    int ret, size;
> +
> +    if ((ret = avfilter_request_frame(ctx->inputs[0])))
> +        return ret;
> +    if (!(samplesref = ctx->inputs[0]->cur_buf))
> +        return AVERROR(EINVAL);
> +    ctx->inputs[0]->cur_buf = NULL;
> +    size = samplesref->audio->size;
> +
> +    *pts          = samplesref->pts;
> +
> +    memcpy(is->audio_buf, samplesref->data[0], size);

this too looks inefficient

at the least a filter chain with no filter or null filter must be free of
additional all sample memcpy (and without this being explicitly handled as a
special case)


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

Many things microsoft did are stupid, but not doing something just because
microsoft did it is even more stupid. If everything ms did were stupid they
would be bankrupt already.
-------------- 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/20100824/3a0ff66c/attachment.pgp>



More information about the ffmpeg-devel mailing list