-- Mats Peterson http://matsp888.no-ip.org/~mats/
>From 750d1d19dbb234c5d2d07dd8235afa48d3f1ba1f Mon Sep 17 00:00:00 2001 From: Mats Peterson <matsp...@yahoo.com> Date: Mon, 29 Feb 2016 14:24:31 +0100 Subject: [PATCH v2 3/4] lavf/rawutils: New function ff_get_raw_palette()
--- libavformat/rawutils.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/libavformat/rawutils.c b/libavformat/rawutils.c index 26ebbb5..7b84984 100644 --- a/libavformat/rawutils.c +++ b/libavformat/rawutils.c @@ -65,3 +65,19 @@ fail: return ret; } + +int ff_get_raw_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