Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Sabatini <stefano.sabatini-lala@poste.it>2011-04-25 22:26:15 +0400
committerStefano Sabatini <stefano.sabatini-lala@poste.it>2011-04-26 12:41:33 +0400
commitff558d7b0166dab5a84dc1c565c2beafa8590c86 (patch)
treead9f3baeff05b2f4a37c33a1bd4e430526ebac43 /libavcodec/bfi.c
parent3788a3c0c03585b0f8180a16d2a15b8e0e033313 (diff)
bfi: store palette data in the context
Store palette data in the codec context, do not assume that the frame allocated the first time by avctx->get_buffer will be returned again. This requires to store the palette which comes with the first frame in the context, and copy it to the following frames. Fix trac issue #84. Signed-off-by: Stefano Sabatini <stefano.sabatini-lala@poste.it>
Diffstat (limited to 'libavcodec/bfi.c')
-rw-r--r--libavcodec/bfi.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/bfi.c b/libavcodec/bfi.c
index ff74233df9..6fc1628d2b 100644
--- a/libavcodec/bfi.c
+++ b/libavcodec/bfi.c
@@ -34,6 +34,7 @@ typedef struct BFIContext {
AVCodecContext *avctx;
AVFrame frame;
uint8_t *dst;
+ uint32_t pal[256];
} BFIContext;
static av_cold int bfi_decode_init(AVCodecContext * avctx)
@@ -85,10 +86,13 @@ static int bfi_decode_frame(AVCodecContext * avctx, void *data,
(avctx->extradata[i * 3 + j] >> 4)) << shift;
pal++;
}
+ memcpy(bfi->pal, bfi->frame.data[1], sizeof(bfi->pal));
bfi->frame.palette_has_changed = 1;
} else {
bfi->frame.pict_type = FF_P_TYPE;
bfi->frame.key_frame = 0;
+ bfi->frame.palette_has_changed = 0;
+ memcpy(bfi->frame.data[1], bfi->pal, sizeof(bfi->pal));
}
buf += 4; //Unpacked size, not required.