summaryrefslogtreecommitdiff
path: root/libavcodec/bethsoftvideo.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2012-01-18 15:45:47 -0500
committerJustin Ruggles <justin.ruggles@gmail.com>2012-02-16 10:47:11 -0500
commitf320fb894c695044ef15239d27844d9ac01c9d16 (patch)
tree5458cacb00c378f6d4dfe95bde29d07cfc0846e0 /libavcodec/bethsoftvideo.c
parentf3a094f2da26f62f3461e78a22b115ab8a700b8d (diff)
downloadffmpeg-f320fb894c695044ef15239d27844d9ac01c9d16.tar.gz
bethsoftvid: pass palette in side data instead of in a separate packet.
Update FATE reference to account for now non-existent palette packet. This also fixes the FATE test if frame data is not initialized in get_buffer(), so update comment in avconv accordingly.
Diffstat (limited to 'libavcodec/bethsoftvideo.c')
-rw-r--r--libavcodec/bethsoftvideo.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/libavcodec/bethsoftvideo.c b/libavcodec/bethsoftvideo.c
index 743e387cbe..c57aa9fb03 100644
--- a/libavcodec/bethsoftvideo.c
+++ b/libavcodec/bethsoftvideo.c
@@ -71,14 +71,23 @@ static int bethsoftvid_decode_frame(AVCodecContext *avctx,
uint8_t * dst;
uint8_t * frame_end;
int remaining = avctx->width; // number of bytes remaining on a line
- const int wrap_to_next_line = vid->frame.linesize[0] - avctx->width;
- int code;
+ int wrap_to_next_line;
+ int code, ret;
int yoffset;
if (avctx->reget_buffer(avctx, &vid->frame)) {
av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
return -1;
}
+ wrap_to_next_line = vid->frame.linesize[0] - avctx->width;
+
+ if (avpkt->side_data_elems > 0 &&
+ avpkt->side_data[0].type == AV_PKT_DATA_PALETTE) {
+ bytestream2_init(&vid->g, avpkt->side_data[0].data,
+ avpkt->side_data[0].size);
+ if ((ret = set_palette(vid)) < 0)
+ return ret;
+ }
bytestream2_init(&vid->g, avpkt->data, avpkt->size);
dst = vid->frame.data[0];
@@ -86,7 +95,6 @@ static int bethsoftvid_decode_frame(AVCodecContext *avctx,
switch(block_type = bytestream2_get_byte(&vid->g)){
case PALETTE_BLOCK: {
- int ret;
*data_size = 0;
if ((ret = set_palette(vid)) < 0) {
av_log(avctx, AV_LOG_ERROR, "error reading palette\n");