summaryrefslogtreecommitdiff
path: root/libavcodec/smc.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/smc.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/smc.c')
-rw-r--r--libavcodec/smc.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/libavcodec/smc.c b/libavcodec/smc.c
index f8b994c1d1..3f1b9742b8 100644
--- a/libavcodec/smc.c
+++ b/libavcodec/smc.c
@@ -54,6 +54,7 @@ typedef struct SmcContext {
unsigned char color_quads[COLORS_PER_TABLE * CQUAD];
unsigned char color_octets[COLORS_PER_TABLE * COCTET];
+ uint32_t pal[256];
} SmcContext;
#define GET_BLOCK_COUNT() \
@@ -110,11 +111,7 @@ static void smc_decode_stream(SmcContext *s)
int color_octet_index = 0;
/* make the palette available */
- memcpy(s->frame.data[1], s->avctx->palctrl->palette, AVPALETTE_SIZE);
- if (s->avctx->palctrl->palette_changed) {
- s->frame.palette_has_changed = 1;
- s->avctx->palctrl->palette_changed = 0;
- }
+ memcpy(s->frame.data[1], s->pal, AVPALETTE_SIZE);
chunk_size = AV_RB32(&s->buf[stream_ptr]) & 0x00FFFFFF;
stream_ptr += 4;
@@ -440,6 +437,7 @@ static int smc_decode_frame(AVCodecContext *avctx,
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
SmcContext *s = avctx->priv_data;
+ const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
s->buf = buf;
s->size = buf_size;
@@ -452,6 +450,11 @@ static int smc_decode_frame(AVCodecContext *avctx,
return -1;
}
+ if (pal) {
+ s->frame.palette_has_changed = 1;
+ memcpy(s->pal, pal, AVPALETTE_SIZE);
+ }
+
smc_decode_stream(s);
*data_size = sizeof(AVFrame);