[FFmpeg-cvslog] avcodec/exr: export writer info into frame metadata
Paul B Mahol
git at videolan.org
Thu Jan 19 22:07:11 EET 2017
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Mon Jan 16 13:07:45 2017 +0100| [8a1759ad46f05375c957f33049b4592befbcb224] | committer: Paul B Mahol
avcodec/exr: export writer info into frame metadata
Signed-off-by: Paul B Mahol <onemda at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8a1759ad46f05375c957f33049b4592befbcb224
---
libavcodec/exr.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/libavcodec/exr.c b/libavcodec/exr.c
index 0c2e5d2..034920f 100644
--- a/libavcodec/exr.c
+++ b/libavcodec/exr.c
@@ -1303,8 +1303,9 @@ static int check_header_variable(EXRContext *s,
return var_size;
}
-static int decode_header(EXRContext *s)
+static int decode_header(EXRContext *s, AVFrame *frame)
{
+ AVDictionary *metadata = NULL;
int magic_number, version, i, flags, sar = 0;
int layer_match = 0;
@@ -1577,6 +1578,14 @@ static int decode_header(EXRContext *s)
}
continue;
+ } else if ((var_size = check_header_variable(s, "writer",
+ "string", 1)) >= 0) {
+ uint8_t key[256] = { 0 };
+
+ bytestream2_get_buffer(&s->gb, key, FFMIN(sizeof(key) - 1, var_size));
+ av_dict_set(&metadata, "writer", key, 0);
+
+ continue;
}
// Check if there are enough bytes for a header
@@ -1612,6 +1621,8 @@ static int decode_header(EXRContext *s)
return AVERROR_INVALIDDATA;
}
+ av_frame_set_metadata(frame, metadata);
+
// aaand we are done
bytestream2_skip(&s->gb, 1);
return 0;
@@ -1631,7 +1642,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
bytestream2_init(&s->gb, avpkt->data, avpkt->size);
- if ((ret = decode_header(s)) < 0)
+ if ((ret = decode_header(s, picture)) < 0)
return ret;
switch (s->pixel_type) {
More information about the ffmpeg-cvslog
mailing list