diff options
author | Peter Ross <pross@xvid.org> | 2014-11-09 12:05:41 +1100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-11-13 15:31:19 +0100 |
commit | 2093c1dc51ee1c08cb558759a1c59e6d1e3358a0 (patch) | |
tree | 2641916372748df8a38038b5d6a5cc1676961d00 | |
parent | 7a79c055e378d1a079d439c3e99fa45289d4a68e (diff) | |
download | ffmpeg-2093c1dc51ee1c08cb558759a1c59e6d1e3358a0.tar.gz |
cinedec: report white balance gain coefficients using metadata
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/cinedec.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/libavformat/cinedec.c b/libavformat/cinedec.c index 5776708940..632f46c454 100644 --- a/libavformat/cinedec.c +++ b/libavformat/cinedec.c @@ -27,6 +27,7 @@ #include "libavutil/intreadwrite.h" #include "libavcodec/bmp.h" +#include "libavutil/intfloat.h" #include "avformat.h" #include "internal.h" @@ -78,6 +79,16 @@ static int set_metadata_int(AVDictionary **dict, const char *key, int value, int return 0; } +static int set_metadata_float(AVDictionary **dict, const char *key, float value, int allow_zero) +{ + if (value != 0 || allow_zero) { + char tmp[64]; + snprintf(tmp, sizeof(tmp), "%f", value); + return av_dict_set(dict, key, tmp, 0); + } + return 0; +} + static int cine_read_header(AVFormatContext *avctx) { AVIOContext *pb = avctx->pb; @@ -177,7 +188,10 @@ static int cine_read_header(AVFormatContext *avctx) set_metadata_int(&st->metadata, "contrast", avio_rl32(pb), 1); set_metadata_int(&st->metadata, "gamma", avio_rl32(pb), 1); - avio_skip(pb, 72); // Reserved1 .. WBView + avio_skip(pb, 12 + 16); // Reserved1 .. AutoExpRect + set_metadata_float(&st->metadata, "wbgain[0].r", av_int2float(avio_rl32(pb)), 1); + set_metadata_float(&st->metadata, "wbgain[0].b", av_int2float(avio_rl32(pb)), 1); + avio_skip(pb, 36); // WBGain[1].. WBView st->codec->bits_per_coded_sample = avio_rl32(pb); |