Commit e7053f33 authored by bnnm's avatar bnnm Committed by Michael Niedermayer

lavf/bink: fix latest header and add all existing revisions

KB2 'i' found in Life is Strange (Xbox 360), rest verified against binkconv.exe
Signed-off-by: 's avatarbnnm <bananaman255@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent e7b9d136
......@@ -65,10 +65,12 @@ static int probe(AVProbeData *p)
int smush = AV_RN32(p->buf) == AV_RN32("SMUS");
do {
if (((b[0] == 'B' && b[1] == 'I' && b[2] == 'K' &&
(b[3] == 'b' || b[3] == 'f' || b[3] == 'g' || b[3] == 'h' || b[3] == 'i')) ||
if (((b[0] == 'B' && b[1] == 'I' && b[2] == 'K' && /* Bink 1 */
(b[3] == 'b' || b[3] == 'f' || b[3] == 'g' || b[3] == 'h' || b[3] == 'i' ||
b[3] == 'k')) ||
(b[0] == 'K' && b[1] == 'B' && b[2] == '2' && /* Bink 2 */
(b[3] == 'a' || b[3] == 'd' || b[3] == 'f' || b[3] == 'g'))) &&
(b[3] == 'a' || b[3] == 'd' || b[3] == 'f' || b[3] == 'g' || b[3] == 'h' ||
b[3] == 'i' || b[3] == 'j' || b[3] == 'k'))) &&
AV_RL32(b+8) > 0 && // num_frames
AV_RL32(b+20) > 0 && AV_RL32(b+20) <= BINK_MAX_WIDTH &&
AV_RL32(b+24) > 0 && AV_RL32(b+24) <= BINK_MAX_HEIGHT &&
......@@ -159,7 +161,14 @@ static int read_header(AVFormatContext *s)
}
if (bink->num_audio_tracks) {
avio_skip(pb, 4 * bink->num_audio_tracks);
uint32_t signature = (vst->codecpar->codec_tag & 0xFFFFFF);
uint8_t revision = ((vst->codecpar->codec_tag >> 24) % 0xFF);
if ((signature == AV_RL32("BIK") && (revision == 0x6b)) || /* k */
(signature == AV_RL32("KB2") && (revision == 0x69 || revision == 0x6a || revision == 0x6b))) /* i,j,k */
avio_skip(pb, 4); /* unknown new field */
avio_skip(pb, 4 * bink->num_audio_tracks); /* max decoded size */
for (i = 0; i < bink->num_audio_tracks; i++) {
ast = avformat_new_stream(s, NULL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment