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

Nicolas George nicolas.george at normalesup.org
Sun Dec 2 18:39:11 CET 2012


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)
 } 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);
+
 #if FF_API_AVFILTERPAD_PUBLIC
 /**
  * A filter pad used for either input or output.
-- 
1.7.10.4



More information about the ffmpeg-devel mailing list