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

Michael Niedermayer michaelni
Thu Jan 13 02:56:40 CET 2011


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


[...]
> +++ 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

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

The misfortune of the wise is better than the prosperity of the fool.
-- Epicurus
-------------- 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/20110113/2ab18117/attachment.pgp>



More information about the ffmpeg-devel mailing list