1
0
Fork 0

mpls: accept version 0300 files

This commit is contained in:
hpi1 2017-08-30 10:10:58 +03:00
parent 440d9a46de
commit 7e31c24f4c
1 changed files with 7 additions and 32 deletions

View File

@ -25,6 +25,7 @@
#include "mpls_parse.h"
#include "extdata_parse.h"
#include "bdmv_parse.h"
#include "uo_mask.h"
#include "disc/disc.h"
@ -37,23 +38,7 @@
#include <stdlib.h>
#include <string.h>
#define MPLS_SIG1 ('M' << 24 | 'P' << 16 | 'L' << 8 | 'S')
#define MPLS_SIG2A ('0' << 24 | '2' << 16 | '0' << 8 | '0')
#define MPLS_SIG2B ('0' << 24 | '1' << 16 | '0' << 8 | '0')
static void
_human_readable_sig(char *sig, uint32_t s1, uint32_t s2)
{
sig[0] = (s1 >> 24) & 0xFF;
sig[1] = (s1 >> 16) & 0xFF;
sig[2] = (s1 >> 8) & 0xFF;
sig[3] = (s1 ) & 0xFF;
sig[4] = (s2 >> 24) & 0xFF;
sig[5] = (s2 >> 16) & 0xFF;
sig[6] = (s2 >> 8) & 0xFF;
sig[7] = (s2 ) & 0xFF;
sig[8] = 0;
}
#define MPLS_SIG1 ('M' << 24 | 'P' << 16 | 'L' << 8 | 'S')
static int
_parse_uo(BITSTREAM *bits, BD_UO_MASK *uo)
@ -103,26 +88,16 @@ _parse_appinfo(BITSTREAM *bits, MPLS_AI *ai)
static int
_parse_header(BITSTREAM *bits, MPLS_PL *pl)
{
pl->type_indicator = MPLS_SIG1;
if (!bdmv_parse_header(bits, pl->type_indicator, &pl->type_indicator2)) {
return 0;
}
if (bs_avail(bits) < 5 * 32 + 160) {
BD_DEBUG(DBG_NAV | DBG_CRIT, "_parse_header: unexpected end of file\n");
return 0;
}
pl->type_indicator = bs_read(bits, 32);
pl->type_indicator2 = bs_read(bits, 32);
if (pl->type_indicator != MPLS_SIG1 ||
(pl->type_indicator2 != MPLS_SIG2A &&
pl->type_indicator2 != MPLS_SIG2B)) {
char sig[9];
char expect[9];
_human_readable_sig(sig, pl->type_indicator, pl->type_indicator2);
_human_readable_sig(expect, MPLS_SIG1, MPLS_SIG2A);
BD_DEBUG(DBG_NAV | DBG_CRIT, "failed signature match, expected (%s) got (%s)\n",
expect, sig);
return 0;
}
pl->list_pos = bs_read(bits, 32);
pl->mark_pos = bs_read(bits, 32);
pl->ext_pos = bs_read(bits, 32);