*/
/**
- * @file 8bps.c
- * QT 8BPS Video Decoder by Roberto Togni <rtogni at bresciaonline dot it>
+ * @file
+ * QT 8BPS Video Decoder by Roberto Togni
* For more information about the 8BPS format, visit:
* http://www.pcisys.net/~melanson/codecs/
*
#include <stdio.h>
#include <stdlib.h>
+#include "libavutil/intreadwrite.h"
#include "avcodec.h"
-static const enum PixelFormat pixfmt_rgb24[] = {PIX_FMT_BGR24, PIX_FMT_RGB32, -1};
+static const enum PixelFormat pixfmt_rgb24[] = {PIX_FMT_BGR24, PIX_FMT_RGB32, PIX_FMT_NONE};
/*
* Decoder context
* Decode a frame
*
*/
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, const uint8_t *buf, int buf_size)
+static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
{
+ const uint8_t *buf = avpkt->data;
+ int buf_size = avpkt->size;
EightBpsContext * const c = avctx->priv_data;
const unsigned char *encoded = buf;
unsigned char *pixptr, *pixptr_end;
c->pic.data[0] = NULL;
- if (avcodec_check_dimensions(avctx, avctx->width, avctx->height) < 0) {
- return 1;
- }
-
- switch (avctx->bits_per_sample) {
+ switch (avctx->bits_per_coded_sample) {
case 8:
avctx->pix_fmt = PIX_FMT_PAL8;
c->planes = 1;
case 32:
avctx->pix_fmt = PIX_FMT_RGB32;
c->planes = 4;
-#ifdef WORDS_BIGENDIAN
+#if HAVE_BIGENDIAN
c->planemap[0] = 1; // 1st plane is red
c->planemap[1] = 2; // 2nd plane is green
c->planemap[2] = 3; // 3rd plane is blue
#endif
break;
default:
- av_log(avctx, AV_LOG_ERROR, "Error: Unsupported color depth: %u.\n", avctx->bits_per_sample);
+ av_log(avctx, AV_LOG_ERROR, "Error: Unsupported color depth: %u.\n", avctx->bits_per_coded_sample);
return -1;
}
AVCodec eightbps_decoder = {
"8bps",
- CODEC_TYPE_VIDEO,
+ AVMEDIA_TYPE_VIDEO,
CODEC_ID_8BPS,
sizeof(EightBpsContext),
decode_init,
decode_end,
decode_frame,
CODEC_CAP_DR1,
- .long_name = "QuickTime 8BPS video",
+ .long_name = NULL_IF_CONFIG_SMALL("QuickTime 8BPS video"),
};