[FFmpeg-cvslog] audioconvert: add a function for getting the name of a single channel.

Anton Khirnov git at videolan.org
Sun Jun 10 21:39:49 CEST 2012


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Mon May 28 08:39:10 2012 +0200| [5df320e167dc5b5a6fa46e2d1d59f51263dea181] | committer: Anton Khirnov

audioconvert: add a function for getting the name of a single channel.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5df320e167dc5b5a6fa46e2d1d59f51263dea181
---

 libavutil/audioconvert.c |   11 +++++++++++
 libavutil/audioconvert.h |    7 +++++++
 2 files changed, 18 insertions(+)

diff --git a/libavutil/audioconvert.c b/libavutil/audioconvert.c
index 9e2f812..36d07ee 100644
--- a/libavutil/audioconvert.c
+++ b/libavutil/audioconvert.c
@@ -202,3 +202,14 @@ int av_get_channel_layout_channel_index(uint64_t channel_layout,
     channel_layout &= channel - 1;
     return av_get_channel_layout_nb_channels(channel_layout);
 }
+
+const char *av_get_channel_name(uint64_t channel)
+{
+    int i;
+    if (av_get_channel_layout_nb_channels(channel) != 1)
+        return NULL;
+    for (i = 0; i < 64; i++)
+        if ((1ULL<<i) & channel)
+            return get_channel_name(i);
+    return NULL;
+}
diff --git a/libavutil/audioconvert.h b/libavutil/audioconvert.h
index 6f6b444..e516ae8 100644
--- a/libavutil/audioconvert.h
+++ b/libavutil/audioconvert.h
@@ -156,6 +156,13 @@ int av_get_channel_layout_channel_index(uint64_t channel_layout,
                                         uint64_t channel);
 
 /**
+ * Get the name of a given channel.
+ *
+ * @return channel name on success, NULL on error.
+ */
+const char *av_get_channel_name(uint64_t channel);
+
+/**
  * @}
  */
 



More information about the ffmpeg-cvslog mailing list