You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
avcodec/exr: export writer info into frame metadata
Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -1576,6 +1577,14 @@ static int decode_header(EXRContext *s)
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
Reference in New Issue
Block a user