mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2026-02-04 14:30:55 +08:00
avcodec: Factor updating palette out
Because the properties of frames returned from ff_get/reget_buffer are not reset at all, lots of returned frames had palette_has_changed wrongly set to 1. This has been changed, too. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
@@ -2091,3 +2091,17 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ff_copy_palette(void *dst, const AVPacket *src, void *logctx)
|
||||
{
|
||||
buffer_size_t size;
|
||||
const void *pal = av_packet_get_side_data(src, AV_PKT_DATA_PALETTE, &size);
|
||||
|
||||
if (pal && size == AVPALETTE_SIZE) {
|
||||
memcpy(dst, pal, AVPALETTE_SIZE);
|
||||
return 1;
|
||||
} else if (pal) {
|
||||
av_log(logctx, AV_LOG_ERROR, "Palette size %d is wrong\n", size);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user