summaryrefslogtreecommitdiff
path: root/libavcodec/tiff.c
diff options
context:
space:
mode:
authorLynne <dev@lynne.ee>2020-01-10 21:55:19 +0000
committerLynne <dev@lynne.ee>2020-01-13 23:26:25 +0000
commit9e01f171f3b7d408f93ec0409d8f9be1d8b291d8 (patch)
treef5a5d77cd9670ac9423002fc6f636467046a7275 /libavcodec/tiff.c
parent722547996c27b871c9288c45de9887b98a076750 (diff)
tiffdec: support embedded ICC profiles
Diffstat (limited to 'libavcodec/tiff.c')
-rw-r--r--libavcodec/tiff.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 636614aa28..e8357114de 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -1218,6 +1218,8 @@ static void set_sar(TiffContext *s, unsigned tag, unsigned num, unsigned den)
static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
{
+ AVFrameSideData *sd;
+ GetByteContext gb_temp;
unsigned tag, type, count, off, value = 0, value2 = 1; // value2 is a denominator so init. to 1
int i, start;
int pos;
@@ -1643,6 +1645,22 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
}
}
break;
+ case TIFF_ICC_PROFILE:
+ if (type != TIFF_UNDEFINED)
+ return AVERROR_INVALIDDATA;
+
+ gb_temp = s->gb;
+ bytestream2_seek(&gb_temp, SEEK_SET, off);
+
+ if (bytestream2_get_bytes_left(&gb_temp) < count)
+ return AVERROR_INVALIDDATA;
+
+ sd = av_frame_new_side_data(frame, AV_FRAME_DATA_ICC_PROFILE, count);
+ if (!sd)
+ return AVERROR(ENOMEM);
+
+ bytestream2_get_bufferu(&gb_temp, sd->data, count);
+ break;
case TIFF_ARTIST:
ADD_METADATA(count, "artist", NULL);
break;