summaryrefslogtreecommitdiff
path: root/libavcodec/bink.c
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2010-02-23 06:39:23 +0000
committerKostya Shishkov <kostya.shishkov@gmail.com>2010-02-23 06:39:23 +0000
commitba3e8214144d92a20a951996e17b0c9f17695560 (patch)
tree68badd5acfe0756cc025aeee13aa5d5f4abbd336 /libavcodec/bink.c
parenta45972a806f842edbd11c92b75e740c6df66e3b5 (diff)
Bink video decoder now can use extradata to detect alpha plane presence
Originally committed as revision 21979 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/bink.c')
-rw-r--r--libavcodec/bink.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/libavcodec/bink.c b/libavcodec/bink.c
index a573d7be30..bd1326c473 100644
--- a/libavcodec/bink.c
+++ b/libavcodec/bink.c
@@ -27,6 +27,9 @@
#define ALT_BITSTREAM_READER_LE
#include "get_bits.h"
+#define BINK_FLAG_ALPHA 0x00100000
+#define BINK_FLAG_GRAY 0x00020000
+
static VLC bink_trees[16];
/**
@@ -930,13 +933,19 @@ static av_cold int decode_init(AVCodecContext *avctx)
BinkContext * const c = avctx->priv_data;
static VLC_TYPE table[16 * 128][2];
int i;
+ int flags;
c->version = avctx->codec_tag >> 24;
if (c->version < 'c') {
av_log(avctx, AV_LOG_ERROR, "Too old version '%c'\n", c->version);
return -1;
}
- c->has_alpha = 0; //TODO: demuxer should supply decoder with flags
+ if (avctx->extradata_size < 4) {
+ av_log(avctx, AV_LOG_ERROR, "Extradata missing or too short\n");
+ return -1;
+ }
+ flags = AV_RL32(avctx->extradata);
+ c->has_alpha = flags & BINK_FLAG_ALPHA;
c->swap_planes = c->version >= 'i';
if (!bink_trees[15].table) {
for (i = 0; i < 16; i++) {