Originally committed as revision 21979 to svn://svn.ffmpeg.org/ffmpeg/trunk
Kostya Shishkov authored on 2010/02/23 15:39:23... | ... |
@@ -27,6 +27,9 @@ |
27 | 27 |
#define ALT_BITSTREAM_READER_LE |
28 | 28 |
#include "get_bits.h" |
29 | 29 |
|
30 |
+#define BINK_FLAG_ALPHA 0x00100000 |
|
31 |
+#define BINK_FLAG_GRAY 0x00020000 |
|
32 |
+ |
|
30 | 33 |
static VLC bink_trees[16]; |
31 | 34 |
|
32 | 35 |
/** |
... | ... |
@@ -930,13 +933,19 @@ static av_cold int decode_init(AVCodecContext *avctx) |
930 | 930 |
BinkContext * const c = avctx->priv_data; |
931 | 931 |
static VLC_TYPE table[16 * 128][2]; |
932 | 932 |
int i; |
933 |
+ int flags; |
|
933 | 934 |
|
934 | 935 |
c->version = avctx->codec_tag >> 24; |
935 | 936 |
if (c->version < 'c') { |
936 | 937 |
av_log(avctx, AV_LOG_ERROR, "Too old version '%c'\n", c->version); |
937 | 938 |
return -1; |
938 | 939 |
} |
939 |
- c->has_alpha = 0; //TODO: demuxer should supply decoder with flags |
|
940 |
+ if (avctx->extradata_size < 4) { |
|
941 |
+ av_log(avctx, AV_LOG_ERROR, "Extradata missing or too short\n"); |
|
942 |
+ return -1; |
|
943 |
+ } |
|
944 |
+ flags = AV_RL32(avctx->extradata); |
|
945 |
+ c->has_alpha = flags & BINK_FLAG_ALPHA; |
|
940 | 946 |
c->swap_planes = c->version >= 'i'; |
941 | 947 |
if (!bink_trees[15].table) { |
942 | 948 |
for (i = 0; i < 16; i++) { |