#include "avcodec.h"
#include "bytestream.h"
+#include "decode.h"
#include "internal.h"
typedef struct QpegContext{
} else {
if (bytestream2_get_bytes_left(&qctx->buffer) < copy)
copy = bytestream2_get_bytes_left(&qctx->buffer);
- for(i = 0; i < copy; i++) {
- dst[filled++] = bytestream2_get_byte(&qctx->buffer);
+ while (copy > 0) {
+ int step = FFMIN(copy, width - filled);
+ bytestream2_get_bufferu(&qctx->buffer, dst + filled, step);
+ filled += step;
+ copy -= step;
if (filled >= width) {
filled = 0;
dst -= stride;
AVFrame * const ref = a->ref;
uint8_t* outdata;
int delta, intra, ret;
- int pal_size;
- const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &pal_size);
if (avpkt->size < 0x86) {
av_log(avctx, AV_LOG_ERROR, "Packet is too small\n");
}
/* make the palette available on the way out */
- if (pal && pal_size == AVPALETTE_SIZE) {
- p->palette_has_changed = 1;
- memcpy(a->pal, pal, AVPALETTE_SIZE);
- } else if (pal) {
- av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", pal_size);
- }
+ p->palette_has_changed = ff_copy_palette(a->pal, avpkt, avctx);
memcpy(p->data[1], a->pal, AVPALETTE_SIZE);
av_frame_unref(ref);
return 0;
}
-AVCodec ff_qpeg_decoder = {
+const AVCodec ff_qpeg_decoder = {
.name = "qpeg",
.long_name = NULL_IF_CONFIG_SMALL("Q-team QPEG"),
.type = AVMEDIA_TYPE_VIDEO,