comparison xan.c @ 1462:eabd6b8f83ed libavcodec

deploy palette control API
author tmmm
date Fri, 12 Sep 2003 03:48:14 +0000
parents 4d2098e8c875
children 51239e385475
comparison
equal deleted inserted replaced
1461:918f1772e7d2 1462:eabd6b8f83ed
113 int i; 113 int i;
114 114
115 s->avctx = avctx; 115 s->avctx = avctx;
116 116
117 if ((avctx->codec->id == CODEC_ID_XAN_WC3) && 117 if ((avctx->codec->id == CODEC_ID_XAN_WC3) &&
118 (s->avctx->extradata_size != PALETTE_CONTROL_SIZE)) { 118 (s->avctx->extradata_size != sizeof(AVPaletteControl))) {
119 printf (" WC3 Xan video: expected extradata_size of %d\n", 119 printf (" WC3 Xan video: expected extradata_size of %d\n",
120 PALETTE_CONTROL_SIZE); 120 sizeof(AVPaletteControl));
121 return -1; 121 return -1;
122 } 122 }
123 123
124 avctx->pix_fmt = PIX_FMT_PAL8; 124 avctx->pix_fmt = PIX_FMT_PAL8;
125 avctx->has_b_frames = 0; 125 avctx->has_b_frames = 0;
807 static int xan_decode_frame(AVCodecContext *avctx, 807 static int xan_decode_frame(AVCodecContext *avctx,
808 void *data, int *data_size, 808 void *data, int *data_size,
809 uint8_t *buf, int buf_size) 809 uint8_t *buf, int buf_size)
810 { 810 {
811 XanContext *s = avctx->priv_data; 811 XanContext *s = avctx->priv_data;
812 unsigned char *palette_control = avctx->extradata; 812 AVPaletteControl *palette_control = (AVPaletteControl *)avctx->extradata;
813 int keyframe = 0; 813 int keyframe = 0;
814 814
815 if (palette_control[0]) { 815 if (palette_control->palette_changed) {
816 /* load the new palette and reset the palette control */ 816 /* load the new palette and reset the palette control */
817 xan_wc3_build_palette(s, &palette_control[1]); 817 xan_wc3_build_palette(s, palette_control->palette);
818 palette_control[0] = 0; 818 palette_control->palette_changed = 0;
819 keyframe = 1; 819 keyframe = 1;
820 } 820 }
821 821
822 if (avctx->get_buffer(avctx, &s->current_frame)) { 822 if (avctx->get_buffer(avctx, &s->current_frame)) {
823 printf (" Xan Video: get_buffer() failed\n"); 823 printf (" Xan Video: get_buffer() failed\n");