--
Mats Peterson
http://matsp888.no-ip.org/~mats/
>From adaa0cecae9bc1bcf276826be5b7a61785bb5a9e Mon Sep 17 00:00:00 2001
From: Mats Peterson <matsp...@yahoo.com>
Date: Mon, 29 Feb 2016 07:36:34 +0100
Subject: [PATCH 3/4] lavf/rawutils: New function ff_get_raw_palette()

---
 libavformat/rawutils.c |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/libavformat/rawutils.c b/libavformat/rawutils.c
index 26ebbb5..4af40ca 100644
--- a/libavformat/rawutils.c
+++ b/libavformat/rawutils.c
@@ -65,3 +65,21 @@ fail:
 
     return ret;
 }
+
+int ff_get_raw_palette(AVFormatContext *s, AVPacket *pkt, int ret, const uint8_t **palette)
+{
+    uint8_t *tmp = NULL;
+    int size;
+
+    tmp = av_packet_get_side_data(pkt, AV_PKT_DATA_PALETTE, &size);
+    if (tmp && size != AVPALETTE_SIZE) {
+        av_log(s, AV_LOG_ERROR, "Invalid palette side data\n");
+        return AVERROR_INVALIDDATA;
+    }
+
+    if (!tmp && ret == CONTAINS_PAL)
+        tmp = pkt->data + pkt->size - AVPALETTE_SIZE;
+
+    *palette = tmp;
+    return 0;
+}
-- 
1.7.10.4

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to