diff options
author | Steve Jiekak <devaureshy@gmail.com> | 2014-12-04 16:48:14 +0300 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-12-04 22:23:52 +0300 |
commit | 6e9ac02af8b67522fef6eaf22d983b6d1a39221e (patch) | |
tree | 9ea19dc4937846063a462aa4958d62f9a6fdecf0 /libavcodec/dv_profile.c | |
parent | bde27e1e617dfeb3c026f530f48a77f5ed8aa2ea (diff) |
add av_dv_codec_profile2 : uses framerate to select best matching profile. default on first matching profile
Signed-off-by: Steve Jiekak <devaureshy@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/dv_profile.c')
-rw-r--r-- | libavcodec/dv_profile.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/libavcodec/dv_profile.c b/libavcodec/dv_profile.c index b301cbfb8b..e336e081ea 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; } |