[FFmpeg-cvslog] add av_dv_codec_profile2 : uses framerate to select best matching profile. default on first matching profile

Steve Jiekak git at videolan.org
Thu Dec 4 21:43:10 CET 2014


ffmpeg | branch: master | Steve Jiekak <devaureshy at gmail.com> | Thu Dec  4 14:48:14 2014 +0100| [6e9ac02af8b67522fef6eaf22d983b6d1a39221e] | committer: Michael Niedermayer

add av_dv_codec_profile2 : uses framerate to select best matching profile. default on first matching profile

Signed-off-by: Steve Jiekak <devaureshy at gmail.com>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 doc/APIchanges          |    3 +++
 libavcodec/dv_profile.c |   24 ++++++++++++++++++++++--
 libavcodec/dv_profile.h |    6 ++++++
 libavcodec/version.h    |    2 +-
 4 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 66b1278..df87465 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,9 @@ libavutil:     2014-08-09
 
 API changes, most recent first:
 
+2014-12-04 - xxxxxxx - lavc 56.14.100 - dv_profile.h
+  Add av_dv_codec_profile2().
+
 -------- 8< --------- FFmpeg 2.5 was cut here -------- 8< ---------
 
 2014-11-21 - ab922f9 - lavu 54.15.100 - dict.h
diff --git a/libavcodec/dv_profile.c b/libavcodec/dv_profile.c
index b301cbf..e336e08 100644
--- a/libavcodec/dv_profile.c
+++ b/libavcodec/dv_profile.c
@@ -315,15 +315,35 @@ const AVDVProfile *av_dv_codec_profile(int width, int height,
                                        enum AVPixelFormat pix_fmt)
 {
 #if CONFIG_DVPROFILE
+    return av_dv_codec_profile2(width, height, pix_fmt, (AVRational){0, 0});
+#endif
+
+    return NULL;
+}
+
+const AVDVProfile *av_dv_codec_profile2(int width, int height,
+                                       enum AVPixelFormat pix_fmt,
+                                       AVRational frame_rate)
+{
+    const AVDVProfile *p = NULL;
+#if CONFIG_DVPROFILE
     int i;
+    /* frame rate is necessary to select between 720p50 and 720p60 profiles */
+    int invalid_framerate = frame_rate.num == 0 || frame_rate.den == 0;
 
     for (i = 0; i < FF_ARRAY_ELEMS(dv_profiles); i++)
         if (height  == dv_profiles[i].height  &&
             pix_fmt == dv_profiles[i].pix_fmt &&
             width   == dv_profiles[i].width)
-            return &dv_profiles[i];
+        {
+            if( invalid_framerate || av_div_q(dv_profiles[i].time_base, frame_rate).num == 1 )
+                return &dv_profiles[i];
+
+            if(!p)
+                p = &dv_profiles[i];
+        }
 #endif
 
-    return NULL;
+    return p;
 }
 
diff --git a/libavcodec/dv_profile.h b/libavcodec/dv_profile.h
index d4437c9..d22ad26 100644
--- a/libavcodec/dv_profile.h
+++ b/libavcodec/dv_profile.h
@@ -83,4 +83,10 @@ const AVDVProfile *av_dv_frame_profile(const AVDVProfile *sys,
  */
 const AVDVProfile *av_dv_codec_profile(int width, int height, enum AVPixelFormat pix_fmt);
 
+/**
+ * Get a DV profile for the provided stream parameters.
+ * The frame rate is used as a best-effort parameter.
+ */
+const AVDVProfile *av_dv_codec_profile2(int width, int height, enum AVPixelFormat pix_fmt, AVRational frame_rate);
+
 #endif /* AVCODEC_DV_PROFILE_H */
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 23443ed..ef439d6 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
 #include "libavutil/version.h"
 
 #define LIBAVCODEC_VERSION_MAJOR 56
-#define LIBAVCODEC_VERSION_MINOR  13
+#define LIBAVCODEC_VERSION_MINOR  14
 #define LIBAVCODEC_VERSION_MICRO 100
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \



More information about the ffmpeg-cvslog mailing list