[FFmpeg-devel] [PATCH 1/2] af_pan: remove the indirect function call.

Clément Bœsch ubitux at gmail.com
Mon Feb 20 22:10:01 CET 2012


On Mon, Feb 20, 2012 at 09:47:25PM +0100, Nicolas George wrote:
> libswresample is used in all cases.
> 
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
>  libavfilter/af_pan.c |   17 +----------------
>  1 files changed, 1 insertions(+), 16 deletions(-)
> 
> diff --git a/libavfilter/af_pan.c b/libavfilter/af_pan.c
> index 5c32564..82010b7 100644
> --- a/libavfilter/af_pan.c
> +++ b/libavfilter/af_pan.c
> @@ -44,11 +44,6 @@ typedef struct PanContext {
>      int nb_output_channels;
>  
>      int pure_gains;
> -    void (*filter_samples)(struct PanContext*,
> -                           AVFilterBufferRef*,
> -                           AVFilterBufferRef*,
> -                           int);
> -
>      /* channel mapping specific */
>      int channel_map[SWR_CH_MAX];
>      struct SwrContext *swr;
> @@ -318,14 +313,6 @@ static int config_props(AVFilterLink *link)
>      return 0;
>  }
>  
> -static void filter_samples_channel_mapping(PanContext *pan,
> -                                           AVFilterBufferRef *outsamples,
> -                                           AVFilterBufferRef *insamples,
> -                                           int n)
> -{
> -    swr_convert(pan->swr, outsamples->data, n, (void *)insamples->data, n);
> -}
> -
>  static void filter_samples(AVFilterLink *inlink, AVFilterBufferRef *insamples)
>  {
>      int n = insamples->audio->nb_samples;
> @@ -333,8 +320,7 @@ static void filter_samples(AVFilterLink *inlink, AVFilterBufferRef *insamples)
>      AVFilterBufferRef *outsamples = avfilter_get_audio_buffer(outlink, AV_PERM_WRITE, n);
>      PanContext *pan = inlink->dst->priv;
>  
> -    pan->filter_samples(pan, outsamples, insamples, n);
> -
> +    swr_convert(pan->swr, outsamples->data, n, (void *)insamples->data, n);
>      avfilter_copy_buffer_ref_props(outsamples, insamples);
>      outsamples->audio->channel_layout = outlink->channel_layout;
>      outsamples->audio->planar         = outlink->planar;
> @@ -354,7 +340,6 @@ static int query_formats(AVFilterContext *ctx)
>      /* libswr supports any sample and packing formats */
>      avfilter_set_common_sample_formats(ctx, avfilter_make_all_formats(AVMEDIA_TYPE_AUDIO));
>      avfilter_set_common_packing_formats(ctx, avfilter_make_all_packing_formats());
> -    pan->filter_samples = filter_samples_channel_mapping;
>  
>      // inlink supports any channel layout
>      formats = avfilter_make_all_channel_layouts();

Sure, OK

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120220/bc86dc1e/attachment.asc>


More information about the ffmpeg-devel mailing list