summaryrefslogtreecommitdiff
path: root/libavcodec/bethsoftvideo.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2012-01-18 13:09:43 -0500
committerJustin Ruggles <justin.ruggles@gmail.com>2012-02-01 19:41:39 -0500
commitc3a06615bdf00fcf64747f12a0ba1a2c7fb2e576 (patch)
tree9e7bd417e32c6c9347f9b390c42925508798e7ba /libavcodec/bethsoftvideo.c
parent83ce51cc7d10c1589f07fda1b9f10fbc5aa93e77 (diff)
bethsoftvideo: fix palette reading.
Return the correct number of consumed bytes and set *data_size = 0. Returned size is 1 too small, leading to that 1 byte being read as the next frame, which results in an extra blank frame at the beginning of the stream.
Diffstat (limited to 'libavcodec/bethsoftvideo.c')
-rw-r--r--libavcodec/bethsoftvideo.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libavcodec/bethsoftvideo.c b/libavcodec/bethsoftvideo.c
index fa0457cc66..743e387cbe 100644
--- a/libavcodec/bethsoftvideo.c
+++ b/libavcodec/bethsoftvideo.c
@@ -59,7 +59,7 @@ static int set_palette(BethsoftvidContext *ctx)
palette[a] = bytestream2_get_be24u(&ctx->g) * 4;
}
ctx->frame.palette_has_changed = 1;
- return 256*3;
+ return 0;
}
static int bethsoftvid_decode_frame(AVCodecContext *avctx,
@@ -86,7 +86,13 @@ static int bethsoftvid_decode_frame(AVCodecContext *avctx,
switch(block_type = bytestream2_get_byte(&vid->g)){
case PALETTE_BLOCK: {
- return set_palette(vid);
+ int ret;
+ *data_size = 0;
+ if ((ret = set_palette(vid)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "error reading palette\n");
+ return ret;
+ }
+ return bytestream2_tell(&vid->g);
}
case VIDEO_YOFF_P_FRAME:
yoffset = bytestream2_get_le16(&vid->g);