#include "libavutil/imgutils.h"
#include "avcodec.h"
#include "bytestream.h"
+#include "internal.h"
#include "s3tc.h"
typedef struct TXDContext {
return 0;
}
-static int txd_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
+static int txd_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
AVPacket *avpkt) {
TXDContext * const s = avctx->priv_data;
GetByteContext gb;
AVFrame *picture = data;
AVFrame * const p = &s->picture;
- unsigned int version, w, h, d3d_format, depth, stride, mipmap_count, flags;
+ unsigned int version, w, h, d3d_format, depth, stride, flags;
unsigned int y, v;
uint8_t *ptr;
uint32_t *pal;
w = bytestream2_get_le16(&gb);
h = bytestream2_get_le16(&gb);
depth = bytestream2_get_byte(&gb);
- mipmap_count = bytestream2_get_byte(&gb);
- bytestream2_skip(&gb, 1);
+ bytestream2_skip(&gb, 2);
flags = bytestream2_get_byte(&gb);
if (version < 8 || version > 9) {
}
if (depth == 8) {
- avctx->pix_fmt = PIX_FMT_PAL8;
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
} else if (depth == 16 || depth == 32) {
- avctx->pix_fmt = PIX_FMT_RGB32;
+ avctx->pix_fmt = AV_PIX_FMT_RGB32;
} else {
av_log(avctx, AV_LOG_ERROR, "depth of %i is unsupported\n", depth);
return -1;
return -1;
if (w != avctx->width || h != avctx->height)
avcodec_set_dimensions(avctx, w, h);
- if (avctx->get_buffer(avctx, p) < 0) {
+ if (ff_get_buffer(avctx, p) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
}
*picture = s->picture;
- *data_size = sizeof(AVPicture);
+ *got_frame = 1;
return avpkt->size;
AVCodec ff_txd_decoder = {
.name = "txd",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_TXD,
+ .id = AV_CODEC_ID_TXD,
.priv_data_size = sizeof(TXDContext),
.init = txd_init,
.close = txd_end,