-- Mats Peterson http://matsp888.no-ip.org/~mats/
>From 403d4db37d2690a8263db53b28225409eeb9bb8c Mon Sep 17 00:00:00 2001 From: Mats Peterson <matsp...@yahoo.com> Date: Wed, 2 Mar 2016 03:14:05 +0100 Subject: [PATCH v4 4/5] lavf/utils: New function ff_get_packet_palette()
--- libavformat/utils.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/libavformat/utils.c b/libavformat/utils.c index fe2916f..771e878 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -4759,3 +4759,19 @@ int ff_parse_creation_time_metadata(AVFormatContext *s, int64_t *timestamp, int } return 0; } + +int ff_get_packet_palette(AVFormatContext *s, AVPacket *pkt, int ret, const uint8_t **palette) +{ + int size; + + *palette = av_packet_get_side_data(pkt, AV_PKT_DATA_PALETTE, &size); + if (*palette && size != AVPALETTE_SIZE) { + av_log(s, AV_LOG_ERROR, "Invalid palette side data\n"); + return AVERROR_INVALIDDATA; + } + + if (!*palette && ret == CONTAINS_PAL) + *palette = pkt->data + pkt->size - AVPALETTE_SIZE; + + return 0; +} -- 1.7.10.4
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel