[FFmpeg-cvslog] lavc: add avcodec_descriptor_get_by_name().

Anton Khirnov git at videolan.org
Sat Aug 18 15:26:30 CEST 2012


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sat Aug 11 15:32:27 2012 +0200| [91e59fea30f57af7abd1ad6a68a8f6663805ee44] | committer: Anton Khirnov

lavc: add avcodec_descriptor_get_by_name().

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

 libavcodec/avcodec.h    |    6 ++++++
 libavcodec/codec_desc.c |   13 +++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index b6917a0..9658b67 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -4549,6 +4549,12 @@ const AVCodecDescriptor *avcodec_descriptor_get(enum AVCodecID id);
 const AVCodecDescriptor *avcodec_descriptor_next(const AVCodecDescriptor *prev);
 
 /**
+ * @return codec descriptor with the given name or NULL if no such descriptor
+ *         exists.
+ */
+const AVCodecDescriptor *avcodec_descriptor_get_by_name(const char *name);
+
+/**
  * @}
  */
 
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 2ace53b..30a4e4a 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -16,6 +16,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include <string.h>
+
 #include "avcodec.h"
 
 #include "libavutil/common.h"
@@ -1939,3 +1941,14 @@ const AVCodecDescriptor *avcodec_descriptor_next(const AVCodecDescriptor *prev)
         return prev + 1;
     return NULL;
 }
+
+const AVCodecDescriptor *avcodec_descriptor_get_by_name(const char *name)
+{
+    const AVCodecDescriptor *desc = NULL;
+
+    while ((desc = avcodec_descriptor_next(desc))) {
+        if (!strcmp(desc->name, name))
+            return desc;
+    }
+    return NULL;
+}



More information about the ffmpeg-cvslog mailing list