X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Ftxd.c;h=a3cbde5f0b495c3cd06d3ac9ce168d0a461db122;hb=5967e1413e174ef362904f9ca71571fc4926f6d1;hp=fd0d7ae93aea889b2a5b29dea2d1952a92169cf1;hpb=d6bb52acdcde23fa4e4094a30f4a38dcab123e0d;p=ffmpeg diff --git a/libavcodec/txd.c b/libavcodec/txd.c index fd0d7ae93ae..a3cbde5f0b4 100644 --- a/libavcodec/txd.c +++ b/libavcodec/txd.c @@ -21,6 +21,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/intreadwrite.h" #include "avcodec.h" #include "s3tc.h" @@ -28,7 +29,7 @@ typedef struct TXDContext { AVFrame picture; } TXDContext; -static int txd_init(AVCodecContext *avctx) { +static av_cold int txd_init(AVCodecContext *avctx) { TXDContext *s = avctx->priv_data; avcodec_get_frame_defaults(&s->picture); @@ -38,14 +39,17 @@ static int txd_init(AVCodecContext *avctx) { } static int txd_decode_frame(AVCodecContext *avctx, void *data, int *data_size, - uint8_t *buf, int buf_size) { + AVPacket *avpkt) { + const uint8_t *buf = avpkt->data; TXDContext * const s = avctx->priv_data; AVFrame *picture = data; AVFrame * const p = &s->picture; unsigned int version, w, h, d3d_format, depth, stride, mipmap_count, flags; unsigned int y, v; - uint8_t *ptr, *cur = buf; - uint32_t *palette = (uint32_t *)(cur + 88), *pal; + uint8_t *ptr; + const uint8_t *cur = buf; + const uint32_t *palette = (const uint32_t *)(cur + 88); + uint32_t *pal; version = AV_RL32(cur); d3d_format = AV_RL32(cur+76); @@ -141,7 +145,7 @@ unsupported: return -1; } -static int txd_end(AVCodecContext *avctx) { +static av_cold int txd_end(AVCodecContext *avctx) { TXDContext *s = avctx->priv_data; if (s->picture.data[0]) @@ -160,5 +164,6 @@ AVCodec txd_decoder = { txd_end, txd_decode_frame, 0, - NULL + NULL, + .long_name = NULL_IF_CONFIG_SMALL("Renderware TXD (TeXture Dictionary) image"), };