diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-07-15 01:50:02 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-07-25 01:25:28 +0200 |
commit | 72743aef03f7933f89ede398ca2c2a8a8ab90cd4 (patch) | |
tree | 5eabfbfb9bd5db954f52cab70a27395979774e46 /libavcodec/imgconvert.c | |
parent | 23bb85b0691d76162da753ce08d8dd03f636ef47 (diff) | |
download | ffmpeg-72743aef03f7933f89ede398ca2c2a8a8ab90cd4.tar.gz |
imgconvert: Implement avcodec_find_best_pix_fmt_of_list()
The old avcodec_find_best_pix_fmt() was insufficient due to 64 pix_fmt limit.
In ffmpeg this problem has been solved long ago through avcodec_find_best_pix_fmt2()
Today libav has added a incompatible modified version of avcodec_find_best_pix_fmt2()
under the same name, thus again breaking ABI/API ...
The avcodec_find_best_pix_fmt_of_list() added in this commit here makes the libav
API available to ffmpeg users too.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/imgconvert.c')
-rw-r--r-- | libavcodec/imgconvert.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c index 34493f619a..6be366f44d 100644 --- a/libavcodec/imgconvert.c +++ b/libavcodec/imgconvert.c @@ -576,6 +576,19 @@ enum PixelFormat avcodec_find_best_pix_fmt2(enum PixelFormat dst_pix_fmt1, enum return dst_pix_fmt; } +enum PixelFormat avcodec_find_best_pix_fmt_of_list(enum PixelFormat *pix_fmt_list, + enum PixelFormat src_pix_fmt, + int has_alpha, int *loss_ptr){ + int i; + + enum PixelFormat best = PIX_FMT_NONE; + + for(i=0; pix_fmt_list[i] != PIX_FMT_NONE; i++) + best = avcodec_find_best_pix_fmt2(best, pix_fmt_list[i], src_pix_fmt, has_alpha, loss_ptr); + + return best; +} + void av_picture_copy(AVPicture *dst, const AVPicture *src, enum PixelFormat pix_fmt, int width, int height) { |