]> git.sesse.net Git - ffmpeg/commitdiff
Add av_get_profile_name() to get profile names.
authorAnssi Hannula <anssi.hannula@iki.fi>
Fri, 7 Jan 2011 22:27:26 +0000 (22:27 +0000)
committerCarl Eugen Hoyos <cehoyos@rainbow.studorg.tuwien.ac.at>
Fri, 7 Jan 2011 22:27:26 +0000 (22:27 +0000)
Patch by Anssi Hannula, anssi d hannula a iki d fi

Originally committed as revision 26259 to svn://svn.ffmpeg.org/ffmpeg/trunk

doc/APIchanges
libavcodec/avcodec.h
libavcodec/utils.c

index bf9d11dca7bdf7e4a823626df9d4f15435f45f10..f1722c7d204844aaeab48019ceedd3559e9b2be0 100644 (file)
@@ -13,6 +13,9 @@ libavutil:   2009-03-08
 
 API changes, most recent first:
 
+2011-01-XX - r26XXX - lavc 52.104.0 - av_get_profile_name()
+  Add av_get_profile_name to libavcodec/avcodec.h.
+
 2010-12-27 - r26108 - lavfi 1.71.0 - AV_PERM_NEG_LINESIZES
   Add AV_PERM_NEG_LINESIZES in avfilter.h.
 
index 7850e1da072cf7ec42ce21d2e61726c932b8dbfd..309edae365b3fb774f96bd9f19f79bd51997e938 100644 (file)
@@ -32,8 +32,8 @@
 #include "libavutil/cpu.h"
 
 #define LIBAVCODEC_VERSION_MAJOR 52
-#define LIBAVCODEC_VERSION_MINOR 103
-#define LIBAVCODEC_VERSION_MICRO  1
+#define LIBAVCODEC_VERSION_MINOR 104
+#define LIBAVCODEC_VERSION_MICRO  0
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
                                                LIBAVCODEC_VERSION_MINOR, \
@@ -2793,6 +2793,14 @@ typedef struct AVCodecContext {
     int subtitle_header_size;
 } AVCodecContext;
 
+/**
+ * AVProfile.
+ */
+typedef struct AVProfile {
+    int profile;
+    const char *name; ///< short name for the profile
+} AVProfile;
+
 /**
  * AVCodec.
  */
@@ -2834,6 +2842,7 @@ typedef struct AVCodec {
     const int64_t *channel_layouts;         ///< array of support channel layouts, or NULL if unknown. array is terminated by 0
     uint8_t max_lowres;                     ///< maximum value for lowres supported by the decoder
     AVClass *priv_class;                    ///< AVClass for the private context
+    const AVProfile *profiles;              ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN}
 } AVCodec;
 
 /**
@@ -3393,6 +3402,15 @@ AVCodec *avcodec_find_decoder(enum CodecID id);
 AVCodec *avcodec_find_decoder_by_name(const char *name);
 void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode);
 
+/**
+ * Return a name for the specified profile, if available.
+ *
+ * @param codec the codec that is searched for the given profile
+ * @param profile the profile value for which a name is requested
+ * @return A name for the profile if found, NULL otherwise.
+ */
+const char *av_get_profile_name(const AVCodec *codec, int profile);
+
 /**
  * Set the fields of the given AVCodecContext to default values.
  *
index ce7473587e035ae8e3181ccc11c0c513bbafa797..c11e4f56d3114be1d3e60edd3c40825f41cffbe2 100644 (file)
@@ -966,6 +966,19 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
     }
 }
 
+const char *av_get_profile_name(const AVCodec *codec, int profile)
+{
+    const AVProfile *p;
+    if (profile == FF_PROFILE_UNKNOWN || !codec->profiles)
+        return NULL;
+
+    for (p = codec->profiles; p->profile != FF_PROFILE_UNKNOWN; p++)
+        if (p->profile == profile)
+            return p->name;
+
+    return NULL;
+}
+
 unsigned avcodec_version( void )
 {
   return LIBAVCODEC_VERSION_INT;