diff options
author | Ben Hagen <c.ben.hagen@gmail.com> | 2014-08-19 01:15:23 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-08-19 11:23:49 +0200 |
commit | c9a5497a0b4d61898458c6883cea83bac29d1057 (patch) | |
tree | a01b0e55a3fd0f9923bf976ff3f7c2546cd24bf7 | |
parent | 3c19744218e665a5b1ff426aae6e3402585d08b1 (diff) | |
download | ffmpeg-c9a5497a0b4d61898458c6883cea83bac29d1057.tar.gz |
avformat/cinedec: allow number zero in metadata
-rw-r--r-- | libavformat/cinedec.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/libavformat/cinedec.c b/libavformat/cinedec.c index 8f450fa865..9eed006e53 100644 --- a/libavformat/cinedec.c +++ b/libavformat/cinedec.c @@ -70,9 +70,9 @@ static int cine_read_probe(AVProbeData *p) return 0; } -static int set_metadata_int(AVDictionary **dict, const char *key, int value) +static int set_metadata_int(AVDictionary **dict, const char *key, int value, int allow_zero) { - if (value) { + if (value || allow_zero) { return av_dict_set_int(dict, key, value, 0); } return 0; @@ -166,16 +166,16 @@ static int cine_read_header(AVFormatContext *avctx) avio_skip(pb, 20); // Shutter .. bEnableColor - set_metadata_int(&st->metadata, "camera_version", avio_rl32(pb)); - set_metadata_int(&st->metadata, "firmware_version", avio_rl32(pb)); - set_metadata_int(&st->metadata, "software_version", avio_rl32(pb)); - set_metadata_int(&st->metadata, "recording_timezone", avio_rl32(pb)); + set_metadata_int(&st->metadata, "camera_version", avio_rl32(pb), 0); + set_metadata_int(&st->metadata, "firmware_version", avio_rl32(pb), 0); + set_metadata_int(&st->metadata, "software_version", avio_rl32(pb), 0); + set_metadata_int(&st->metadata, "recording_timezone", avio_rl32(pb), 0); CFA = avio_rl32(pb); - set_metadata_int(&st->metadata, "brightness", avio_rl32(pb)); - set_metadata_int(&st->metadata, "contrast", avio_rl32(pb)); - set_metadata_int(&st->metadata, "gamma", avio_rl32(pb)); + set_metadata_int(&st->metadata, "brightness", avio_rl32(pb), 1); + 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 @@ -227,7 +227,7 @@ static int cine_read_header(AVFormatContext *avctx) avio_skip(pb, 668); // Conv8Min ... Sensor - set_metadata_int(&st->metadata, "shutter_ns", avio_rl32(pb)); + set_metadata_int(&st->metadata, "shutter_ns", avio_rl32(pb), 0); avio_skip(pb, 24); // EDRShutterNs ... ImHeightAcq @@ -245,11 +245,11 @@ static int cine_read_header(AVFormatContext *avctx) avio_skip(pb, 1176); // RisingEdge ... cmUser - set_metadata_int(&st->metadata, "enable_crop", avio_rl32(pb)); - set_metadata_int(&st->metadata, "crop_left", avio_rl32(pb)); - set_metadata_int(&st->metadata, "crop_top", avio_rl32(pb)); - set_metadata_int(&st->metadata, "crop_right", avio_rl32(pb)); - set_metadata_int(&st->metadata, "crop_bottom", avio_rl32(pb)); + set_metadata_int(&st->metadata, "enable_crop", avio_rl32(pb), 1); + set_metadata_int(&st->metadata, "crop_left", avio_rl32(pb), 1); + set_metadata_int(&st->metadata, "crop_top", avio_rl32(pb), 1); + set_metadata_int(&st->metadata, "crop_right", avio_rl32(pb), 1); + set_metadata_int(&st->metadata, "crop_bottom", avio_rl32(pb), 1); /* parse image offsets */ avio_seek(pb, offImageOffsets, SEEK_SET); |