X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fkmvc.c;h=718cdfd932e5025279412eb2fc76684c7703d918;hb=da55ee6ccc05efdd9006bb8c31db9012a3326857;hp=f4b54a138f452baf9e01cd67b427a73023391362;hpb=c7af8b4e07cb1361665b0688898248ba2df10271;p=ffmpeg diff --git a/libavcodec/kmvc.c b/libavcodec/kmvc.c index f4b54a138f4..718cdfd932e 100644 --- a/libavcodec/kmvc.c +++ b/libavcodec/kmvc.c @@ -2,25 +2,25 @@ * KMVC decoder * Copyright (c) 2006 Konstantin Shishkov * - * This file is part of FFmpeg. + * This file is part of Libav. * - * FFmpeg is free software; you can redistribute it and/or + * Libav is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * FFmpeg is distributed in the hope that it will be useful, + * Libav is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software + * License along with Libav; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** - * @file libavcodec/kmvc.c + * @file * Karl Morton's Video Codec decoder */ @@ -233,6 +233,7 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *data_size, AVPa int i; int header; int blocksize; + const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); if (ctx->pic.data[0]) avctx->release_buffer(avctx, &ctx->pic); @@ -258,17 +259,10 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *data_size, AVPa if (header & KMVC_KEYFRAME) { ctx->pic.key_frame = 1; - ctx->pic.pict_type = FF_I_TYPE; + ctx->pic.pict_type = AV_PICTURE_TYPE_I; } else { ctx->pic.key_frame = 0; - ctx->pic.pict_type = FF_P_TYPE; - } - - /* if palette has been changed, copy it from palctrl */ - if (ctx->avctx->palctrl && ctx->avctx->palctrl->palette_changed) { - memcpy(ctx->pal, ctx->avctx->palctrl->palette, AVPALETTE_SIZE); - ctx->setpal = 1; - ctx->avctx->palctrl->palette_changed = 0; + ctx->pic.pict_type = AV_PICTURE_TYPE_P; } if (header & KMVC_PALETTE) { @@ -279,6 +273,11 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *data_size, AVPa } } + if (pal) { + ctx->pic.palette_has_changed = 1; + memcpy(ctx->pal, pal, AVPALETTE_SIZE); + } + if (ctx->setpal) { ctx->setpal = 0; ctx->pic.palette_has_changed = 1; @@ -374,9 +373,6 @@ static av_cold int decode_init(AVCodecContext * avctx) src += 4; } c->setpal = 1; - if (c->avctx->palctrl) { - c->avctx->palctrl->palette_changed = 0; - } } avctx->pix_fmt = PIX_FMT_PAL8; @@ -401,9 +397,9 @@ static av_cold int decode_end(AVCodecContext * avctx) return 0; } -AVCodec kmvc_decoder = { +AVCodec ff_kmvc_decoder = { "kmvc", - CODEC_TYPE_VIDEO, + AVMEDIA_TYPE_VIDEO, CODEC_ID_KMVC, sizeof(KmvcContext), decode_init,