summaryrefslogtreecommitdiff
path: root/libavcodec/interplayvideo.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-04-17 23:36:57 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-04-17 23:43:54 +0200
commitc40798441f47341c310b38e8f329cfb943924faf (patch)
treec23fbec614c59bcf14c7377d1c6ff7abdfa34353 /libavcodec/interplayvideo.c
parentc96786008172f669e546ca987e7aaa3c3469be71 (diff)
parentfd0c3403f611d31b944216cfa1585a2d28f7f0da (diff)
Merge remote branch 'qatar/master'
* qatar/master: ac3dec: fix processing of delta bit allocation information. vc1: fix fate-vc1 after previous commit. wmv3dec: fix playback of complex WMV3 files using simple_idct. make av_dup_packet() more cautious on allocation failures make containers pass palette change in AVPacket introduce side information for AVPacket Politic commits that have not been pulled: Update regtest checksums after revision 6001dad. Replace more FFmpeg references by Libav. Replace references to ffmpeg-devel with libav-devel; fix roundup URL. Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/interplayvideo.c')
-rw-r--r--libavcodec/interplayvideo.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/libavcodec/interplayvideo.c b/libavcodec/interplayvideo.c
index 18702b21d0..d2b8345607 100644
--- a/libavcodec/interplayvideo.c
+++ b/libavcodec/interplayvideo.c
@@ -77,6 +77,7 @@ typedef struct IpvideoContext {
int stride;
int upper_motion_limit_offset;
+ uint32_t pal[256];
} IpvideoContext;
#define CHECK_STREAM_PTR(stream_ptr, stream_end, n) \
@@ -969,7 +970,7 @@ static void ipvideo_decode_opcodes(IpvideoContext *s)
if (!s->is_16bpp) {
/* this is PAL8, so make the palette available */
- memcpy(s->current_frame.data[1], s->avctx->palctrl->palette, PALETTE_COUNT * 4);
+ memcpy(s->current_frame.data[1], s->pal, AVPALETTE_SIZE);
s->stride = s->current_frame.linesize[0];
s->stream_ptr = s->buf + 14; /* data starts 14 bytes in */
@@ -1023,10 +1024,6 @@ static av_cold int ipvideo_decode_init(AVCodecContext *avctx)
s->is_16bpp = avctx->bits_per_coded_sample == 16;
avctx->pix_fmt = s->is_16bpp ? PIX_FMT_RGB555 : PIX_FMT_PAL8;
- if (!s->is_16bpp && s->avctx->palctrl == NULL) {
- av_log(avctx, AV_LOG_ERROR, " Interplay video: palette expected.\n");
- return -1;
- }
dsputil_init(&s->dsp, avctx);
@@ -1046,7 +1043,6 @@ static int ipvideo_decode_frame(AVCodecContext *avctx,
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
IpvideoContext *s = avctx->priv_data;
- AVPaletteControl *palette_control = avctx->palctrl;
/* compressed buffer needs to be large enough to at least hold an entire
* decoding map */
@@ -1063,13 +1059,16 @@ static int ipvideo_decode_frame(AVCodecContext *avctx,
return -1;
}
- ipvideo_decode_opcodes(s);
-
- if (!s->is_16bpp && palette_control->palette_changed) {
- palette_control->palette_changed = 0;
- s->current_frame.palette_has_changed = 1;
+ if (!s->is_16bpp) {
+ const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
+ if (pal) {
+ s->current_frame.palette_has_changed = 1;
+ memcpy(s->pal, pal, AVPALETTE_SIZE);
+ }
}
+ ipvideo_decode_opcodes(s);
+
*data_size = sizeof(AVFrame);
*(AVFrame*)data = s->current_frame;