mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
avcodec/webp: move exif_metadata outside of WebPContext
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
parent
dc0481f2fb
commit
778439b69a
@ -196,7 +196,6 @@ typedef struct WebPContext {
|
|||||||
uint8_t *alpha_data; /* alpha chunk data */
|
uint8_t *alpha_data; /* alpha chunk data */
|
||||||
int alpha_data_size; /* alpha chunk data size */
|
int alpha_data_size; /* alpha chunk data size */
|
||||||
int has_exif; /* set after an EXIF chunk has been processed */
|
int has_exif; /* set after an EXIF chunk has been processed */
|
||||||
AVDictionary *exif_metadata; /* EXIF chunk data */
|
|
||||||
int width; /* image width */
|
int width; /* image width */
|
||||||
int height; /* image height */
|
int height; /* image height */
|
||||||
int lossless; /* indicates lossless or lossy */
|
int lossless; /* indicates lossless or lossy */
|
||||||
@ -1386,7 +1385,6 @@ static int webp_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
|||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
av_dict_free(&s->exif_metadata);
|
|
||||||
while (bytestream2_get_bytes_left(&gb) > 8) {
|
while (bytestream2_get_bytes_left(&gb) > 8) {
|
||||||
char chunk_str[5] = { 0 };
|
char chunk_str[5] = { 0 };
|
||||||
|
|
||||||
@ -1463,6 +1461,7 @@ static int webp_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
|||||||
}
|
}
|
||||||
case MKTAG('E', 'X', 'I', 'F'): {
|
case MKTAG('E', 'X', 'I', 'F'): {
|
||||||
int le, ifd_offset, exif_offset = bytestream2_tell(&gb);
|
int le, ifd_offset, exif_offset = bytestream2_tell(&gb);
|
||||||
|
AVDictionary *exif_metadata = NULL;
|
||||||
GetByteContext exif_gb;
|
GetByteContext exif_gb;
|
||||||
|
|
||||||
if (s->has_exif) {
|
if (s->has_exif) {
|
||||||
@ -1484,15 +1483,15 @@ static int webp_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bytestream2_seek(&exif_gb, ifd_offset, SEEK_SET);
|
bytestream2_seek(&exif_gb, ifd_offset, SEEK_SET);
|
||||||
if (avpriv_exif_decode_ifd(avctx, &exif_gb, le, 0, &s->exif_metadata) < 0) {
|
if (avpriv_exif_decode_ifd(avctx, &exif_gb, le, 0, &exif_metadata) < 0) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "error decoding Exif data\n");
|
av_log(avctx, AV_LOG_ERROR, "error decoding Exif data\n");
|
||||||
goto exif_end;
|
goto exif_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
av_dict_copy(avpriv_frame_get_metadatap(data), s->exif_metadata, 0);
|
av_dict_copy(avpriv_frame_get_metadatap(data), exif_metadata, 0);
|
||||||
|
|
||||||
exif_end:
|
exif_end:
|
||||||
av_dict_free(&s->exif_metadata);
|
av_dict_free(&exif_metadata);
|
||||||
bytestream2_skip(&gb, chunk_size);
|
bytestream2_skip(&gb, chunk_size);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user