[FFmpeg-devel] [PATCH 2/4] lavfi: add an accessor for ref->audio->channels.

Stefano Sabatini stefasab at gmail.com
Thu Dec 20 00:55:19 CET 2012


On date Sunday 2012-12-02 18:39:11 +0100, Nicolas George encoded:
> TODO: minor bump for this change and the previous.
> 
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
>  libavfilter/audio.c    |    5 +++++
>  libavfilter/avfilter.h |    7 ++++++-
>  2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/libavfilter/audio.c b/libavfilter/audio.c
> index 565f2e2..3564896 100644
> --- a/libavfilter/audio.c
> +++ b/libavfilter/audio.c
> @@ -27,6 +27,11 @@
>  #include "avfilter.h"
>  #include "internal.h"
>  
> +int avfilter_ref_get_channels(AVFilterBufferRef *ref)
> +{
> +    return ref->audio ? ref->audio->channels : 0;
> +}
> +
>  AVFilterBufferRef *ff_null_get_audio_buffer(AVFilterLink *link, int perms,
>                                              int nb_samples)
>  {
> diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
> index 9c69c3d..108477e 100644
> --- a/libavfilter/avfilter.h
> +++ b/libavfilter/avfilter.h
> @@ -117,7 +117,7 @@ typedef struct AVFilterBufferRefAudioProps {
>      uint64_t channel_layout;    ///< channel layout of audio buffer
>      int nb_samples;             ///< number of audio samples per channel
>      int sample_rate;            ///< audio buffer sample rate
> -    int channels;               ///< number of channels

> +    int channels;               ///< number of channels (do not access directly)

Here you could mention avfilter_ref_get_channels().

>  } AVFilterBufferRefAudioProps;
>  
>  /**
> @@ -222,6 +222,11 @@ void avfilter_unref_buffer(AVFilterBufferRef *ref);
>   */
>  void avfilter_unref_bufferp(AVFilterBufferRef **ref);
>  
> +/**
> + * Get the number of channels of a buffer reference.
> + */
> +int avfilter_ref_get_channels(AVFilterBufferRef *ref);

I suppose this is fine if it is to preserve ABI in case of mid-struct
merges from external repos.

> +
>  #if FF_API_AVFILTERPAD_PUBLIC
>  /**
>   * A filter pad used for either input or output.

LGTM, thanks.
-- 
FFmpeg = Faithless & Fundamental Martial Prodigious Elastic Glue


More information about the ffmpeg-devel mailing list