summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2023-05-17 22:39:57 -0300
committerJames Almer <jamrial@gmail.com>2023-05-18 08:45:23 -0300
commit63767b79a570404628b2521b83104108b7b6884c (patch)
treeba05301188d4deb51854721e0e60bfca4edb0323
parent01d9a84ef58c2d0d89958b18420483b058ac9dd1 (diff)
avutil/frame: deprecate palette_has_changed
Not only this is information that relies on the concept of a sequence of frames, which is completely out of place as a field in AVFrame, but there are no known or intended uses of this field. Signed-off-by: James Almer <jamrial@gmail.com>
-rw-r--r--doc/APIchanges3
-rw-r--r--libavcodec/8bps.c13
-rw-r--r--libavcodec/ansi.c8
-rw-r--r--libavcodec/bethsoftvideo.c4
-rw-r--r--libavcodec/bfi.c8
-rw-r--r--libavcodec/bintext.c4
-rw-r--r--libavcodec/bmvvideo.c4
-rw-r--r--libavcodec/brenderpix.c8
-rw-r--r--libavcodec/c93.c4
-rw-r--r--libavcodec/cdgraphics.c4
-rw-r--r--libavcodec/cdtoons.c4
-rw-r--r--libavcodec/cinepak.c9
-rw-r--r--libavcodec/dds.c8
-rw-r--r--libavcodec/dfa.c4
-rw-r--r--libavcodec/dsicinvideo.c4
-rw-r--r--libavcodec/dxa.c4
-rw-r--r--libavcodec/flicvideo.c4
-rw-r--r--libavcodec/gemdec.c4
-rw-r--r--libavcodec/idcinvideo.c9
-rw-r--r--libavcodec/imx.c8
-rw-r--r--libavcodec/interplayvideo.c9
-rw-r--r--libavcodec/jvdec.c8
-rw-r--r--libavcodec/kmvc.c17
-rw-r--r--libavcodec/mscc.c4
-rw-r--r--libavcodec/msrle.c9
-rw-r--r--libavcodec/mss1.c4
-rw-r--r--libavcodec/msvideo1.c9
-rw-r--r--libavcodec/pafvideo.c4
-rw-r--r--libavcodec/pictordec.c4
-rw-r--r--libavcodec/psd.c4
-rw-r--r--libavcodec/qdrw.c4
-rw-r--r--libavcodec/qpeg.c9
-rw-r--r--libavcodec/qtrle.c9
-rw-r--r--libavcodec/rawdec.c8
-rw-r--r--libavcodec/rscc.c9
-rw-r--r--libavcodec/sga.c4
-rw-r--r--libavcodec/smacker.c4
-rw-r--r--libavcodec/smc.c9
-rw-r--r--libavcodec/targa.c4
-rw-r--r--libavcodec/tiertexseqv.c4
-rw-r--r--libavcodec/tmv.c4
-rw-r--r--libavcodec/tscc.c4
-rw-r--r--libavcodec/vb.c4
-rw-r--r--libavcodec/vqavideo.c4
-rw-r--r--libavcodec/yop.c4
-rw-r--r--libavutil/frame.c4
-rw-r--r--libavutil/frame.h3
-rw-r--r--libavutil/version.h1
48 files changed, 267 insertions, 15 deletions
diff --git a/doc/APIchanges b/doc/APIchanges
index d2255867a8..770d6ffc5e 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,9 @@ The last version increases of all libraries were on 2023-02-09
API changes, most recent first:
+2023-05-xx - xxxxxxxxxx - lavu 58 - frame.h
+ Deprecate AVFrame.palette_has_changed without replacement.
+
2023-05-xx - xxxxxxxxxx - lavc 60 - avcodec.h
Depreate AVCodecContext.ticks_per_frame in favor of
AVCodecContext.framerate (encoding) and
diff --git a/libavcodec/8bps.c b/libavcodec/8bps.c
index 90d6c96fd1..af98f62fad 100644
--- a/libavcodec/8bps.c
+++ b/libavcodec/8bps.c
@@ -47,8 +47,6 @@ typedef struct EightBpsContext {
unsigned char planes;
unsigned char planemap[4];
-
- uint32_t pal[256];
} EightBpsContext;
static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
@@ -123,9 +121,14 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
}
if (avctx->bits_per_coded_sample <= 8) {
- frame->palette_has_changed = ff_copy_palette(c->pal, avpkt, avctx);
-
- memcpy (frame->data[1], c->pal, AVPALETTE_SIZE);
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
+ frame->palette_has_changed =
+#endif
+ ff_copy_palette(frame->data[1], avpkt, avctx);
+#if FF_API_PALETTE_HAS_CHANGED
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
}
*got_frame = 1;
diff --git a/libavcodec/ansi.c b/libavcodec/ansi.c
index c1e31266ec..49c3770c4c 100644
--- a/libavcodec/ansi.c
+++ b/libavcodec/ansi.c
@@ -262,7 +262,11 @@ static int execute_code(AVCodecContext * avctx, int c)
AV_GET_BUFFER_FLAG_REF)) < 0)
return ret;
s->frame->pict_type = AV_PICTURE_TYPE_I;
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
s->frame->palette_has_changed = 1;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
set_palette((uint32_t *)s->frame->data[1]);
erase_screen(avctx);
} else if (c == 'l') {
@@ -371,7 +375,11 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
}
s->frame->pict_type = AV_PICTURE_TYPE_I;
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
s->frame->palette_has_changed = 1;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
set_palette((uint32_t *)s->frame->data[1]);
if (!s->first_frame) {
erase_screen(avctx);
diff --git a/libavcodec/bethsoftvideo.c b/libavcodec/bethsoftvideo.c
index e095d04fa5..6de502822b 100644
--- a/libavcodec/bethsoftvideo.c
+++ b/libavcodec/bethsoftvideo.c
@@ -63,7 +63,11 @@ static int set_palette(BethsoftvidContext *ctx, GetByteContext *g)
palette[a] = 0xFFU << 24 | bytestream2_get_be24u(g) * 4;
palette[a] |= palette[a] >> 6 & 0x30303;
}
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
ctx->frame->palette_has_changed = 1;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
return 0;
}
diff --git a/libavcodec/bfi.c b/libavcodec/bfi.c
index 55429d4b7c..901669a3a9 100644
--- a/libavcodec/bfi.c
+++ b/libavcodec/bfi.c
@@ -84,11 +84,19 @@ static int bfi_decode_frame(AVCodecContext *avctx, AVFrame *frame,
pal++;
}
memcpy(bfi->pal, frame->data[1], sizeof(bfi->pal));
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed = 1;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
} else {
frame->pict_type = AV_PICTURE_TYPE_P;
frame->flags &= ~AV_FRAME_FLAG_KEY;
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed = 0;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
memcpy(frame->data[1], bfi->pal, sizeof(bfi->pal));
}
diff --git a/libavcodec/bintext.c b/libavcodec/bintext.c
index ce814f7693..b20d6ce176 100644
--- a/libavcodec/bintext.c
+++ b/libavcodec/bintext.c
@@ -157,7 +157,11 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
if ((ret = ff_get_buffer(avctx, s->frame, 0)) < 0)
return ret;
s->frame->pict_type = AV_PICTURE_TYPE_I;
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
s->frame->palette_has_changed = 1;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
memcpy(s->frame->data[1], s->palette, 16 * 4);
if (avctx->codec_id == AV_CODEC_ID_XBIN) {
diff --git a/libavcodec/bmvvideo.c b/libavcodec/bmvvideo.c
index 92ce41c836..20f07ca556 100644
--- a/libavcodec/bmvvideo.c
+++ b/libavcodec/bmvvideo.c
@@ -251,7 +251,11 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
}
memcpy(frame->data[1], c->pal, AVPALETTE_SIZE);
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed = type & BMV_PALETTE;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
outptr = frame->data[0];
srcptr = c->frame;
diff --git a/libavcodec/brenderpix.c b/libavcodec/brenderpix.c
index 85eb55f50b..70a3e6be2a 100644
--- a/libavcodec/brenderpix.c
+++ b/libavcodec/brenderpix.c
@@ -245,7 +245,11 @@ static int pix_decode_frame(AVCodecContext *avctx, AVFrame *frame,
*pal_out++ = (0xFFU << 24) | bytestream2_get_be32u(&gb);
bytestream2_skip(&gb, 8);
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed = 1;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
chunk_type = bytestream2_get_be32(&gb);
} else if (avctx->pix_fmt == AV_PIX_FMT_PAL8) {
@@ -257,7 +261,11 @@ static int pix_decode_frame(AVCodecContext *avctx, AVFrame *frame,
"Using default palette, colors might be off.\n");
memcpy(pal_out, std_pal_table, sizeof(uint32_t) * 256);
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed = 1;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
}
data_len = bytestream2_get_be32(&gb);
diff --git a/libavcodec/c93.c b/libavcodec/c93.c
index b872f95e9b..2a4fe45958 100644
--- a/libavcodec/c93.c
+++ b/libavcodec/c93.c
@@ -246,7 +246,11 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
for (i = 0; i < 256; i++) {
palette[i] = 0xFFU << 24 | bytestream2_get_be24(&gb);
}
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
newpic->palette_has_changed = 1;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
} else {
if (oldpic->data[1])
memcpy(newpic->data[1], oldpic->data[1], 256 * 4);
diff --git a/libavcodec/cdgraphics.c b/libavcodec/cdgraphics.c
index 431e99cd76..0c5022a5d6 100644
--- a/libavcodec/cdgraphics.c
+++ b/libavcodec/cdgraphics.c
@@ -125,7 +125,11 @@ static void cdg_load_palette(CDGraphicsContext *cc, uint8_t *data, int low)
b = ((color ) & 0x000F) * 17;
palette[i + array_offset] = (uint32_t)cc->alpha[i + array_offset] << 24 | r << 16 | g << 8 | b;
}
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
cc->frame->palette_has_changed = 1;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
}
static int cdg_tile_block(CDGraphicsContext *cc, uint8_t *data, int b)
diff --git a/libavcodec/cdtoons.c b/libavcodec/cdtoons.c
index 3ebed2267c..94c49f0c81 100644
--- a/libavcodec/cdtoons.c
+++ b/libavcodec/cdtoons.c
@@ -384,7 +384,11 @@ static int cdtoons_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
}
/* first palette entry indicates transparency */
c->pal[0] = 0;
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
c->frame->palette_has_changed = 1;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
}
}
diff --git a/libavcodec/cinepak.c b/libavcodec/cinepak.c
index e91f2f1012..2ec0ce8882 100644
--- a/libavcodec/cinepak.c
+++ b/libavcodec/cinepak.c
@@ -476,7 +476,14 @@ static int cinepak_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
return ret;
if (s->palette_video) {
- s->frame->palette_has_changed = ff_copy_palette(s->pal, avpkt, avctx);
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
+ s->frame->palette_has_changed =
+#endif
+ ff_copy_palette(s->pal, avpkt, avctx);
+#if FF_API_PALETTE_HAS_CHANGED
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
}
if ((ret = cinepak_decode(s)) < 0) {
diff --git a/libavcodec/dds.c b/libavcodec/dds.c
index 670a42fbf9..31a327a579 100644
--- a/libavcodec/dds.c
+++ b/libavcodec/dds.c
@@ -651,7 +651,11 @@ static int dds_decode(AVCodecContext *avctx, AVFrame *frame,
((unsigned)frame->data[1][3+i*4]<<24)
);
}
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed = 1;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
if (bytestream2_get_bytes_left(gbc) < frame->height * frame->width / 2) {
av_log(avctx, AV_LOG_ERROR, "Buffer is too small (%d < %d).\n",
@@ -682,7 +686,11 @@ static int dds_decode(AVCodecContext *avctx, AVFrame *frame,
((unsigned)frame->data[1][3+i*4]<<24)
);
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed = 1;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
}
if (bytestream2_get_bytes_left(gbc) < frame->height * linesize) {
diff --git a/libavcodec/dfa.c b/libavcodec/dfa.c
index 114c803f32..9114feb0b3 100644
--- a/libavcodec/dfa.c
+++ b/libavcodec/dfa.c
@@ -367,7 +367,11 @@ static int dfa_decode_frame(AVCodecContext *avctx, AVFrame *frame,
s->pal[i] = bytestream2_get_be24(&gb) << 2;
s->pal[i] |= 0xFFU << 24 | (s->pal[i] >> 6) & 0x30303;
}
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed = 1;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
} else if (chunk_type <= 9) {
if (decoder[chunk_type - 2](&gb, s->frame_buf, avctx->width, avctx->height)) {
av_log(avctx, AV_LOG_ERROR, "Error decoding %s chunk\n",
diff --git a/libavcodec/dsicinvideo.c b/libavcodec/dsicinvideo.c
index 222044d125..000d79e169 100644
--- a/libavcodec/dsicinvideo.c
+++ b/libavcodec/dsicinvideo.c
@@ -293,7 +293,11 @@ static int cinvideo_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
return res;
memcpy(cin->frame->data[1], cin->palette, sizeof(cin->palette));
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
cin->frame->palette_has_changed = 1;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
for (y = 0; y < cin->avctx->height; ++y)
memcpy(cin->frame->data[0] + (cin->avctx->height - 1 - y) * cin->frame->linesize[0],
cin->bitmap_table[CIN_CUR_BMP] + y * cin->avctx->width,
diff --git a/libavcodec/dxa.c b/libavcodec/dxa.c
index ecb48c9d3f..d903b7ecd4 100644
--- a/libavcodec/dxa.c
+++ b/libavcodec/dxa.c
@@ -230,7 +230,11 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0)
return ret;
memcpy(frame->data[1], c->pal, AVPALETTE_SIZE);
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed = pc;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
outptr = frame->data[0];
srcptr = c->decomp_buf;
diff --git a/libavcodec/flicvideo.c b/libavcodec/flicvideo.c
index 228f652775..e4b334e10f 100644
--- a/libavcodec/flicvideo.c
+++ b/libavcodec/flicvideo.c
@@ -473,7 +473,11 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx,
/* make the palette available on the way out */
memcpy(s->frame->data[1], s->palette, AVPALETTE_SIZE);
if (s->new_palette) {
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
s->frame->palette_has_changed = 1;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
s->new_palette = 0;
}
diff --git a/libavcodec/gemdec.c b/libavcodec/gemdec.c
index 73e907c041..9e2a50c766 100644
--- a/libavcodec/gemdec.c
+++ b/libavcodec/gemdec.c
@@ -181,7 +181,11 @@ static int gem_decode_frame(AVCodecContext *avctx, AVFrame *p,
p->pict_type = AV_PICTURE_TYPE_I;
p->flags |= AV_FRAME_FLAG_KEY;
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
p->palette_has_changed = 1;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
palette = (uint32_t *)p->data[1];
if (tag == AV_RB32("STTT")) {
diff --git a/libavcodec/idcinvideo.c b/libavcodec/idcinvideo.c
index f6b8b3cd69..d9e4633548 100644
--- a/libavcodec/idcinvideo.c
+++ b/libavcodec/idcinvideo.c
@@ -224,7 +224,14 @@ static int idcin_decode_frame(AVCodecContext *avctx, AVFrame *frame,
if (idcin_decode_vlcs(s, frame))
return AVERROR_INVALIDDATA;
- frame->palette_has_changed = ff_copy_palette(s->pal, avpkt, avctx);
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
+ frame->palette_has_changed =
+#endif
+ ff_copy_palette(s->pal, avpkt, avctx);
+#if FF_API_PALETTE_HAS_CHANGED
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
/* make the palette available on the way out */
memcpy(frame->data[1], s->pal, AVPALETTE_SIZE);
diff --git a/libavcodec/imx.c b/libavcodec/imx.c
index 4ae68eb93c..0d9d9b5bb9 100644
--- a/libavcodec/imx.c
+++ b/libavcodec/imx.c
@@ -58,11 +58,19 @@ static int imx_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
return ret;
if (ff_copy_palette(imx->pal, avpkt, avctx)) {
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed = 1;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
frame->flags |= AV_FRAME_FLAG_KEY;
} else {
frame->flags &= ~AV_FRAME_FLAG_KEY;
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed = 0;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
}
bytestream2_init(&gb, avpkt->data, avpkt->size);
diff --git a/libavcodec/interplayvideo.c b/libavcodec/interplayvideo.c
index 1a3461bf10..1f0414bbaf 100644
--- a/libavcodec/interplayvideo.c
+++ b/libavcodec/interplayvideo.c
@@ -1315,7 +1315,14 @@ static int ipvideo_decode_frame(AVCodecContext *avctx, AVFrame *frame,
return ret;
if (!s->is_16bpp) {
- frame->palette_has_changed = ff_copy_palette(s->pal, avpkt, avctx);
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
+ frame->palette_has_changed =
+#endif
+ ff_copy_palette(s->pal, avpkt, avctx);
+#if FF_API_PALETTE_HAS_CHANGED
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
}
switch (frame_format) {
diff --git a/libavcodec/jvdec.c b/libavcodec/jvdec.c
index f44b21af11..13ede9068a 100644
--- a/libavcodec/jvdec.c
+++ b/libavcodec/jvdec.c
@@ -37,7 +37,9 @@ typedef struct JvContext {
BlockDSPContext bdsp;
AVFrame *frame;
uint32_t palette[AVPALETTE_COUNT];
+#if FF_API_PALETTE_HAS_CHANGED
int palette_has_changed;
+#endif
} JvContext;
static av_cold int decode_init(AVCodecContext *avctx)
@@ -207,14 +209,20 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
s->palette[i] = 0xFFU << 24 | pal << 2 | ((pal >> 4) & 0x30303);
buf += 3;
}
+#if FF_API_PALETTE_HAS_CHANGED
s->palette_has_changed = 1;
+#endif
}
if (video_size) {
s->frame->flags |= AV_FRAME_FLAG_KEY;
s->frame->pict_type = AV_PICTURE_TYPE_I;
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
s->frame->palette_has_changed = s->palette_has_changed;
s->palette_has_changed = 0;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
memcpy(s->frame->data[1], s->palette, AVPALETTE_SIZE);
if ((ret = av_frame_ref(rframe, s->frame)) < 0)
diff --git a/libavcodec/kmvc.c b/libavcodec/kmvc.c
index de01f6b75b..83aba4b252 100644
--- a/libavcodec/kmvc.c
+++ b/libavcodec/kmvc.c
@@ -273,7 +273,14 @@ static int decode_frame(AVCodecContext * avctx, AVFrame *frame,
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
return ret;
- frame->palette_has_changed = ff_copy_palette(ctx->pal, avpkt, avctx);
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
+ frame->palette_has_changed =
+#endif
+ ff_copy_palette(ctx->pal, avpkt, avctx);
+#if FF_API_PALETTE_HAS_CHANGED
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
header = bytestream2_get_byte(&ctx->g);
@@ -296,7 +303,11 @@ static int decode_frame(AVCodecContext * avctx, AVFrame *frame,
}
if (header & KMVC_PALETTE) {
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed = 1;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
// palette starts from index 1 and has 127 entries
for (i = 1; i <= ctx->palsize; i++) {
ctx->pal[i] = 0xFFU << 24 | bytestream2_get_be24(&ctx->g);
@@ -305,7 +316,11 @@ static int decode_frame(AVCodecContext * avctx, AVFrame *frame,
if (ctx->setpal) {
ctx->setpal = 0;
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed = 1;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
}
/* make the palette available on the way out */
diff --git a/libavcodec/mscc.c b/libavcodec/mscc.c
index 1844664477..d1d23e6751 100644
--- a/libavcodec/mscc.c
+++ b/libavcodec/mscc.c
@@ -150,7 +150,11 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size);
if (pal && size == AVPALETTE_SIZE) {
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed = 1;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
for (j = 0; j < 256; j++)
s->pal[j] = 0xFF000000 | AV_RL32(pal + j * 4);
} else if (pal) {
diff --git a/libavcodec/msrle.c b/libavcodec/msrle.c
index b6fa7f7abb..51e843e4a6 100644
--- a/libavcodec/msrle.c
+++ b/libavcodec/msrle.c
@@ -95,7 +95,14 @@ static int msrle_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
return ret;
if (avctx->bits_per_coded_sample > 1 && avctx->bits_per_coded_sample <= 8) {
- s->frame->palette_has_changed = ff_copy_palette(s->pal, avpkt, avctx);
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
+ s->frame->palette_has_changed =
+#endif
+ ff_copy_palette(s->pal, avpkt, avctx);
+#if FF_API_PALETTE_HAS_CHANGED
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
/* make the palette available */
memcpy(s->frame->data[1], s->pal, AVPALETTE_SIZE);
diff --git a/libavcodec/mss1.c b/libavcodec/mss1.c
index dc06a9e236..fb5fc34ea1 100644
--- a/libavcodec/mss1.c
+++ b/libavcodec/mss1.c
@@ -178,7 +178,11 @@ static int mss1_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
if (c->corrupted)
return AVERROR_INVALIDDATA;
memcpy(ctx->pic->data[1], c->pal, AVPALETTE_SIZE);
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
ctx->pic->palette_has_changed = pal_changed;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
if ((ret = av_frame_ref(rframe, ctx->pic)) < 0)
return ret;
diff --git a/libavcodec/msvideo1.c b/libavcodec/msvideo1.c
index 9903ff36a7..ca4583d841 100644
--- a/libavcodec/msvideo1.c
+++ b/libavcodec/msvideo1.c
@@ -312,7 +312,14 @@ static int msvideo1_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
return ret;
if (s->mode_8bit) {
- s->frame->palette_has_changed = ff_copy_palette(s->pal, avpkt, avctx);
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
+ s->frame->palette_has_changed =
+#endif
+ ff_copy_palette(s->pal, avpkt, avctx);
+#if FF_API_PALETTE_HAS_CHANGED
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
}
if (s->mode_8bit)
diff --git a/libavcodec/pafvideo.c b/libavcodec/pafvideo.c
index fa914ccbaa..14eb42435a 100644
--- a/libavcodec/pafvideo.c
+++ b/libavcodec/pafvideo.c
@@ -327,7 +327,11 @@ static int paf_video_decode(AVCodecContext *avctx, AVFrame *rframe,
b = b << 2 | b >> 4;
*out++ = (0xFFU << 24) | (r << 16) | (g << 8) | b;
}
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
c->pic->palette_has_changed = 1;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
}
c->dirty[c->current_frame] = 1;
diff --git a/libavcodec/pictordec.c b/libavcodec/pictordec.c
index aef3d3de76..5aaa725bd3 100644
--- a/libavcodec/pictordec.c
+++ b/libavcodec/pictordec.c
@@ -191,7 +191,11 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
return ret;
memset(frame->data[0], 0, s->height * frame->linesize[0]);
frame->pict_type = AV_PICTURE_TYPE_I;
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed = 1;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
pos_after_pal = bytestream2_tell(&s->g) + esize;
palette = (uint32_t*)frame->data[1];
diff --git a/libavcodec/psd.c b/libavcodec/psd.c
index ee96bd1237..d3456e6b3d 100644
--- a/libavcodec/psd.c
+++ b/libavcodec/psd.c
@@ -532,7 +532,11 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *picture,
}
if (s->color_mode == PSD_INDEXED) {
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
picture->palette_has_changed = 1;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
memcpy(picture->data[1], s->palette, AVPALETTE_SIZE);
}
diff --git a/libavcodec/qdrw.c b/libavcodec/qdrw.c
index 65e7269e5d..21a53b8e72 100644
--- a/libavcodec/qdrw.c
+++ b/libavcodec/qdrw.c
@@ -384,7 +384,11 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p,
ret = parse_palette(avctx, &gbc, (uint32_t *)p->data[1], colors, flags & 0x8000);
if (ret < 0)
return ret;
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
p->palette_has_changed = 1;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
/* jump to image data */
bytestream2_skip(&gbc, 18);
diff --git a/libavcodec/qpeg.c b/libavcodec/qpeg.c
index 43a24fab08..1f76ebc5a1 100644
--- a/libavcodec/qpeg.c
+++ b/libavcodec/qpeg.c
@@ -297,7 +297,14 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p,
}
/* make the palette available on the way out */
- p->palette_has_changed = ff_copy_palette(a->pal, avpkt, avctx);
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
+ p->palette_has_changed =
+#endif
+ ff_copy_palette(a->pal, avpkt, avctx);
+#if FF_API_PALETTE_HAS_CHANGED
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
memcpy(p->data[1], a->pal, AVPALETTE_SIZE);
av_frame_unref(ref);
diff --git a/libavcodec/qtrle.c b/libavcodec/qtrle.c
index 5cb18c86c2..9b016d7e83 100644
--- a/libavcodec/qtrle.c
+++ b/libavcodec/qtrle.c
@@ -537,7 +537,14 @@ static int qtrle_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
}
if(has_palette) {
- s->frame->palette_has_changed = ff_copy_palette(s->pal, avpkt, avctx);
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
+ s->frame->palette_has_changed =
+#endif
+ ff_copy_palette(s->pal, avpkt, avctx);
+#if FF_API_PALETTE_HAS_CHANGED
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
/* make the palette available on the way out */
memcpy(s->frame->data[1], s->pal, AVPALETTE_SIZE);
diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
index baca16c743..8e9358f95d 100644
--- a/libavcodec/rawdec.c
+++ b/libavcodec/rawdec.c
@@ -373,7 +373,11 @@ static int raw_decode(AVCodecContext *avctx, AVFrame *frame,
}
if (ff_copy_palette(context->palette->data, avpkt, avctx)) {
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed = 1;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
} else if (context->is_nut_pal8) {
int vid_size = avctx->width * avctx->height;
int pal_size = avpkt->size - vid_size;
@@ -381,7 +385,11 @@ static int raw_decode(AVCodecContext *avctx, AVFrame *frame,
if (avpkt->size > vid_size && pal_size <= AVPALETTE_SIZE) {
const uint8_t *pal = avpkt->data + vid_size;
memcpy(context->palette->data, pal, pal_size);
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed = 1;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
}
}
}
diff --git a/libavcodec/rscc.c b/libavcodec/rscc.c
index 2ae8899977..ace9aeeb40 100644
--- a/libavcodec/rscc.c
+++ b/libavcodec/rscc.c
@@ -346,7 +346,14 @@ static int rscc_decode_frame(AVCodecContext *avctx, AVFrame *frame,
/* Palette handling */
if (avctx->pix_fmt == AV_PIX_FMT_PAL8) {
- frame->palette_has_changed = ff_copy_palette(ctx->palette, avpkt, avctx);
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
+ frame->palette_has_changed =
+#endif
+ ff_copy_palette(ctx->palette, avpkt, avctx);
+#if FF_API_PALETTE_HAS_CHANGED
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
memcpy(frame->data[1], ctx->palette, AVPALETTE_SIZE);
}
// We only return a picture when enough of it is undamaged, this avoids copying nearly broken frames around
diff --git a/libavcodec/sga.c b/libavcodec/sga.c
index 16442b40be..eae691adad 100644
--- a/libavcodec/sga.c
+++ b/libavcodec/sga.c
@@ -497,7 +497,11 @@ static int sga_decode_frame(AVCodecContext *avctx, AVFrame *frame,
}
memcpy(frame->data[1], s->pal, AVPALETTE_SIZE);
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed = 1;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
frame->pict_type = AV_PICTURE_TYPE_I;
frame->flags |= AV_FRAME_FLAG_KEY;
diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c
index 08841f4cce..b98e7275f6 100644
--- a/libavcodec/smacker.c
+++ b/libavcodec/smacker.c
@@ -392,7 +392,11 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
pal = (uint32_t*)smk->pic->data[1];
bytestream2_init(&gb2, avpkt->data, avpkt->size);
flags = bytestream2_get_byteu(&gb2);
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
smk->pic->palette_has_changed = flags & 1;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
if (flags & 2) {
smk->pic->flags |= AV_FRAME_FLAG_KEY;
smk->pic->pict_type = AV_PICTURE_TYPE_I;
diff --git a/libavcodec/smc.c b/libavcodec/smc.c
index 2b10e74386..3e8a89ced1 100644
--- a/libavcodec/smc.c
+++ b/libavcodec/smc.c
@@ -437,7 +437,14 @@ static int smc_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0)
return ret;
- s->frame->palette_has_changed = ff_copy_palette(s->pal, avpkt, avctx);
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
+ s->frame->palette_has_changed =
+#endif
+ ff_copy_palette(s->pal, avpkt, avctx);
+#if FF_API_PALETTE_HAS_CHANGED
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
bytestream2_init(&gb, buf, buf_size);
ret = smc_decode_stream(s, &gb);
diff --git a/libavcodec/targa.c b/libavcodec/targa.c
index 07005f2be6..59fdc428d9 100644
--- a/libavcodec/targa.c
+++ b/libavcodec/targa.c
@@ -249,7 +249,11 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p,
}
break;
}
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
p->palette_has_changed = 1;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
}
}
diff --git a/libavcodec/tiertexseqv.c b/libavcodec/tiertexseqv.c
index 19c0671bf6..cdc885558b 100644
--- a/libavcodec/tiertexseqv.c
+++ b/libavcodec/tiertexseqv.c
@@ -182,7 +182,11 @@ static int seqvideo_decode(SeqVideoContext *seq, const unsigned char *data, int
c[j] = (*data << 2) | (*data >> 4);
palette[i] = 0xFFU << 24 | AV_RB24(c);
}
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
seq->frame->palette_has_changed = 1;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
}
if (flags & 2) {
diff --git a/libavcodec/tmv.c b/libavcodec/tmv.c
index 582b6ddd02..2a7e1a105f 100644
--- a/libavcodec/tmv.c
+++ b/libavcodec/tmv.c
@@ -60,7 +60,11 @@ static int tmv_decode_frame(AVCodecContext *avctx, AVFrame *frame,
frame->flags |= AV_FRAME_FLAG_KEY;
dst = frame->data[0];
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed = 1;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
memcpy(frame->data[1], ff_cga_palette, 16 * 4);
memset(frame->data[1] + 16 * 4, 0, AVPALETTE_SIZE - 16 * 4);
diff --git a/libavcodec/tscc.c b/libavcodec/tscc.c
index 0ebe641ab1..346d93e1f2 100644
--- a/libavcodec/tscc.c
+++ b/libavcodec/tscc.c
@@ -106,7 +106,11 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
/* make the palette available on the way out */
if (c->avctx->pix_fmt == AV_PIX_FMT_PAL8) {
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed = palette_has_changed;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
memcpy(frame->data[1], c->pal, AVPALETTE_SIZE);
}
diff --git a/libavcodec/vb.c b/libavcodec/vb.c
index 8b0e216473..5744faa983 100644
--- a/libavcodec/vb.c
+++ b/libavcodec/vb.c
@@ -230,7 +230,11 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
}
memcpy(frame->data[1], c->pal, AVPALETTE_SIZE);
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed = flags & VB_HAS_PALETTE;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
outptr = frame->data[0];
srcptr = c->frame;
diff --git a/libavcodec/vqavideo.c b/libavcodec/vqavideo.c
index 0573696d94..2977cf9a52 100644
--- a/libavcodec/vqavideo.c
+++ b/libavcodec/vqavideo.c
@@ -809,7 +809,11 @@ static int vqa_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
/* make the palette available on the way out */
memcpy(s->frame->data[1], s->palette, PALETTE_COUNT * 4);
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
s->frame->palette_has_changed = 1;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
} else if (avctx->pix_fmt == AV_PIX_FMT_RGB555LE) {
if ((res = vqa_decode_frame_hicolor(s, s->frame)) < 0)
return res;
diff --git a/libavcodec/yop.c b/libavcodec/yop.c
index 14244c942a..1294c5cc00 100644
--- a/libavcodec/yop.c
+++ b/libavcodec/yop.c
@@ -232,7 +232,11 @@ static int yop_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
(palette[i + firstcolor] >> 6) & 0x30303;
}
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
frame->palette_has_changed = 1;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
for (y = 0; y < avctx->height; y += 2) {
for (x = 0; x < avctx->width; x += 2) {
diff --git a/libavutil/frame.c b/libavutil/frame.c
index 97d40208c8..b0d8eebdde 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -284,7 +284,11 @@ FF_DISABLE_DEPRECATION_WARNINGS
dst->top_field_first = src->top_field_first;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
dst->palette_has_changed = src->palette_has_changed;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
dst->sample_rate = src->sample_rate;
dst->opaque = src->opaque;
dst->pkt_dts = src->pkt_dts;
diff --git a/libavutil/frame.h b/libavutil/frame.h
index ed3f199ce1..bb634008ea 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -528,10 +528,13 @@ typedef struct AVFrame {
int top_field_first;
#endif
+#if FF_API_PALETTE_HAS_CHANGED
/**
* Tell user application that palette has changed from previous frame.
*/
+ attribute_deprecated
int palette_has_changed;
+#endif
#if FF_API_REORDERED_OPAQUE
/**
diff --git a/libavutil/version.h b/libavutil/version.h
index 341bcbf188..c41c6afeac 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -117,6 +117,7 @@
#define FF_API_FRAME_PKT (LIBAVUTIL_VERSION_MAJOR < 59)
#define FF_API_INTERLACED_FRAME (LIBAVUTIL_VERSION_MAJOR < 59)
#define FF_API_FRAME_KEY (LIBAVUTIL_VERSION_MAJOR < 59)
+#define FF_API_PALETTE_HAS_CHANGED (LIBAVUTIL_VERSION_MAJOR < 59)
/**
* @}