]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/txd.c
rtpdec: Cosmetic cleanup of the header
[ffmpeg] / libavcodec / txd.c
index bfb2bb6ea265fa3b2fd056247d4d46c3f43d4efa..8a10385b92cb42e09779e4bc19bc8207cc1bf52b 100644 (file)
@@ -25,6 +25,7 @@
 #include "libavutil/imgutils.h"
 #include "avcodec.h"
 #include "bytestream.h"
+#include "internal.h"
 #include "s3tc.h"
 
 typedef struct TXDContext {
@@ -40,13 +41,13 @@ static av_cold int txd_init(AVCodecContext *avctx) {
     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;
@@ -58,8 +59,7 @@ static int txd_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
     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) {
@@ -69,9 +69,9 @@ static int txd_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
     }
 
     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;
@@ -84,7 +84,7 @@ static int txd_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
         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;
     }
@@ -135,7 +135,7 @@ static int txd_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
     }
 
     *picture   = s->picture;
-    *data_size = sizeof(AVPicture);
+    *got_frame = 1;
 
     return avpkt->size;
 
@@ -156,7 +156,7 @@ static av_cold int txd_end(AVCodecContext *avctx) {
 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,