diff options
author | Mats Peterson <matsp888@yahoo.com> | 2016-03-02 03:14:05 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2016-03-02 18:11:18 +0100 |
commit | 2be0366a7f5de926efac5a412268c824a6acbddf (patch) | |
tree | a0ac5db53e0bd200c70d2512a758e45d1bd5d538 /libavformat/utils.c | |
parent | 554f6e930ce05a4c5449efcaae36bdafe2d9de74 (diff) | |
download | ffmpeg-2be0366a7f5de926efac5a412268c824a6acbddf.tar.gz |
lavf/utils: Add ff_get_packet_palette()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r-- | libavformat/utils.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index fe2916ff97..771e878b75 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; +} |