Imported Debian version 2.5.0~trusty1.1
[deb_ffmpeg.git] / ffmpeg / libavformat / cinedec.c
index 9eed006e53da2a9da8f26acbdc529eafd7bf5775..632f46c454cd105099b040edc22d8a90429fb45d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Phanton Cine demuxer
+ * Phantom Cine demuxer
  * Copyright (c) 2010-2011 Peter Ross <pross@xvid.org>
  *
  * This file is part of FFmpeg.
@@ -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);