diff options
author | jstebbins <[email protected]> | 2014-05-29 19:59:57 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2014-05-29 19:59:57 +0000 |
commit | c50cf79a313ab76473a69f6ed8625afcb1a2c40b (patch) | |
tree | f4f33d97d109481c6e41d7290eb73572d9edc03c /libhb/decavcodec.c | |
parent | 0340cdc16c3cf51f24a2ddfcb40cd8d3b7257e17 (diff) |
libhb: Fix decoding avi with palette
... and probably other formats that use a palette.
The palette is stored in AVPacket side data which we did not read. So
read the side data and stash it in hb_buffer_t so that it can be used
later by the decoder.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6207 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/decavcodec.c')
-rw-r--r-- | libhb/decavcodec.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libhb/decavcodec.c b/libhb/decavcodec.c index 9b7be6702..bfa5f221d 100644 --- a/libhb/decavcodec.c +++ b/libhb/decavcodec.c @@ -86,6 +86,7 @@ struct hb_work_private_s AVCodecContext *context; AVCodecParserContext *parser; AVFrame *frame; + hb_buffer_t *palette; int threads; int video_codec_opened; hb_list_t *list; @@ -1175,6 +1176,18 @@ static int decodeFrame( hb_work_object_t *w, uint8_t *data, int size, int sequen avp.size = size; avp.pts = pts; avp.dts = dts; + + if (pv->palette != NULL) + { + uint8_t * palette; + int size; + palette = av_packet_new_side_data(&avp, AV_PKT_DATA_PALETTE, + AVPALETTE_SIZE); + size = MIN(pv->palette->size, AVPALETTE_SIZE); + memcpy(palette, pv->palette->data, size); + hb_buffer_close(&pv->palette); + } + /* * libav avcodec_decode_video2() needs AVPacket flagged with AV_PKT_FLAG_KEY * for some codecs. For example, sequence of PNG in a mov container. @@ -1882,6 +1895,11 @@ static int decavcodecvWork( hb_work_object_t * w, hb_buffer_t ** buf_in, pv->dxva2->input_dts = dts; } #endif + if (in->palette != NULL) + { + pv->palette = in->palette; + in->palette = NULL; + } decodeVideo( w, in->data, in->size, in->sequence, pts, dts, in->s.frametype ); hb_buffer_close( &in ); *buf_out = link_buf_list( pv ); |