lavf/utils: Add ff_get_packet_palette()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
554f6e930c
commit
2be0366a7f
2 changed files with 28 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue