X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Froqvideodec.c;h=06d1309d650dfc7bb33e103d7febcb52c39bb946;hb=2caf19e90f270abe1e80a3e85acaf0eb5c9d0aac;hp=32da3fd9195317615b9a69df23282a85e184618d;hpb=35c621e753c29d256dee0932fad59b83bf506ff4;p=ffmpeg diff --git a/libavcodec/roqvideodec.c b/libavcodec/roqvideodec.c index 32da3fd9195..06d1309d650 100644 --- a/libavcodec/roqvideodec.c +++ b/libavcodec/roqvideodec.c @@ -1,39 +1,36 @@ /* * Copyright (C) 2003 the ffmpeg project * - * 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 roqvideodec.c - * Id RoQ Video Decoder by Dr. Tim Ferguson - * For more information about the Id RoQ format, visit: + * @file + * id RoQ Video Decoder by Dr. Tim Ferguson + * For more information about the id RoQ format, visit: * http://www.csse.monash.edu.au/~timf/ */ #include #include #include -#include #include "avcodec.h" #include "bytestream.h" -#include "dsputil.h" #include "roqvideo.h" static void roqvideo_decode_frame(RoqContext *ri) @@ -44,8 +41,8 @@ static void roqvideo_decode_frame(RoqContext *ri) int vqid, bpos, xpos, ypos, xp, yp, x, y, mx, my; int frame_stats[2][4] = {{0},{0}}; roq_qcell *qcell; - unsigned char *buf = ri->buf; - unsigned char *buf_end = ri->buf + ri->size; + const unsigned char *buf = ri->buf; + const unsigned char *buf_end = ri->buf + ri->size; while (buf < buf_end) { chunk_id = bytestream_get_le16(&buf); @@ -155,7 +152,7 @@ static void roqvideo_decode_frame(RoqContext *ri) } -static int roq_decode_init(AVCodecContext *avctx) +static av_cold int roq_decode_init(AVCodecContext *avctx) { RoqContext *s = avctx->priv_data; @@ -165,22 +162,28 @@ static int roq_decode_init(AVCodecContext *avctx) s->last_frame = &s->frames[0]; s->current_frame = &s->frames[1]; avctx->pix_fmt = PIX_FMT_YUV444P; - dsputil_init(&s->dsp, avctx); return 0; } static int roq_decode_frame(AVCodecContext *avctx, void *data, int *data_size, - uint8_t *buf, int buf_size) + AVPacket *avpkt) { + const uint8_t *buf = avpkt->data; + int buf_size = avpkt->size; RoqContext *s = avctx->priv_data; + int copy= !s->current_frame->data[0]; if (avctx->reget_buffer(avctx, s->current_frame)) { av_log(avctx, AV_LOG_ERROR, " RoQ: get_buffer() failed\n"); return -1; } + if(copy) + av_picture_copy((AVPicture*)s->current_frame, (AVPicture*)s->last_frame, + avctx->pix_fmt, avctx->width, avctx->height); + s->buf = buf; s->size = buf_size; roqvideo_decode_frame(s); @@ -194,7 +197,7 @@ static int roq_decode_frame(AVCodecContext *avctx, return buf_size; } -static int roq_decode_end(AVCodecContext *avctx) +static av_cold int roq_decode_end(AVCodecContext *avctx) { RoqContext *s = avctx->priv_data; @@ -207,9 +210,9 @@ static int roq_decode_end(AVCodecContext *avctx) return 0; } -AVCodec roq_decoder = { +AVCodec ff_roq_decoder = { "roqvideo", - CODEC_TYPE_VIDEO, + AVMEDIA_TYPE_VIDEO, CODEC_ID_ROQ, sizeof(RoqContext), roq_decode_init, @@ -217,4 +220,5 @@ AVCodec roq_decoder = { roq_decode_end, roq_decode_frame, CODEC_CAP_DR1, + .long_name = NULL_IF_CONFIG_SMALL("id RoQ video"), };