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

Stefano Sabatini stefano.sabatini-lala
Sat Jan 22 20:44:08 CET 2011


On date Thursday 2011-01-13 02:56:40 +0100, Michael Niedermayer encoded:
> On Wed, Jan 12, 2011 at 10:31:54PM +0100, Stefano Sabatini wrote:
> [...]
> > @@ -2292,6 +2446,43 @@ static int stream_component_open(VideoState *is, int stream_index)
> >          is->audio_diff_threshold = 2.0 * SDL_AUDIO_BUFFER_SIZE / avctx->sample_rate;
> >  
> >          memset(&is->audio_pkt, 0, sizeof(is->audio_pkt));
> > +
> > +#if CONFIG_AVFILTER
> > +    is->agraph = avfilter_graph_alloc();
> > +    if (avfilter_graph_create_filter(&afilt_src, &input_audio_filter, "asrc",
> > +                                     NULL, is, is->agraph) < 0)
> > +        goto the_end;
> > +    if (avfilter_graph_create_filter(&afilt_out, &output_audio_filter, "aout",
> > +                                     NULL, NULL, is->agraph) < 0)
> > +        goto the_end;
> > +
> > +    if (afilters) {
> > +        AVFilterInOut *outputs = av_malloc(sizeof(AVFilterInOut));
> > +        AVFilterInOut *inputs  = av_malloc(sizeof(AVFilterInOut));
> > +
> > +        outputs->name       = av_strdup("in");
> > +        outputs->filter_ctx = afilt_src;
> > +        outputs->pad_idx    = 0;
> > +        outputs->next       = NULL;
> > +
> > +        inputs->name        = av_strdup("out");
> > +        inputs->filter_ctx  = afilt_out;
> > +        inputs->pad_idx     = 0;
> > +        inputs->next        = NULL;
> > +
> > +        if ((ret = avfilter_graph_parse(is->agraph, afilters, inputs, outputs, NULL)) < 0)
> > +            goto the_end;
> > +        av_freep(&afilters);
> > +    } else {
> > +        if (avfilter_link(afilt_src, 0, afilt_out, 0) < 0) goto the_end;
> > +    }
> > +
> > +    if ((ret = avfilter_graph_config(is->agraph, NULL)) < 0)
> > +        goto the_end;
> > +
> > +    is->out_audio_filter = afilt_out;
> > +#endif
> 
> i think this could be moved into its own function, it doesnt feel at the right
> place here to me

Done.

> [...]
> > +++ b/libavfilter/af_resample.c
> > @@ -424,7 +424,6 @@ static void filter_samples(AVFilterLink *inlink, AVFilterBufferRef *samplesref)
> >      resample->in_channel_layout = samplesref->audio->channel_layout;
> >  
> >      /* Convert to s16 sample format first, then to desired channel layout  and finally to desired sample format */
> > -
> >      if (samplesref->format == AV_SAMPLE_FMT_S16)
> >          resample->s16_samples_ptr = samplesref;
> >      else
> 
> doesnt belong in here

Fixed.

Patch updated, no need to review this as it depends on the av_samples*
and the aconvert patches.
-- 
FFmpeg = Fostering Fundamental Merciless Pitiless Elastic God



More information about the ffmpeg-devel mailing list