|
38 | 38 |
|
39 | 39 | static int isom_bs_read_box_common( lsmash_bs_t *bs, isom_box_t *box ) |
40 | 40 | { |
| 41 | + static const uint8_t tfxd_uuid[] = { |
| 42 | + 0x6d, 0x1d, 0x9b, 0x05, 0x42, 0xd5, 0x44, 0xe6, |
| 43 | + 0x80, 0xe2, 0x14, 0x1d, 0xaf, 0xf7, 0x57, 0xb2 |
| 44 | + }; |
| 45 | + uint8_t read_uuid[16] = { 0 }; |
| 46 | + |
41 | 47 | assert( bs && box && box->file ); |
42 | 48 | /* Reset the counter so that we can use it to get position within the box. */ |
43 | 49 | lsmash_bs_reset_counter( bs ); |
@@ -80,13 +86,24 @@ static int isom_bs_read_box_common( lsmash_bs_t *bs, isom_box_t *box ) |
80 | 86 | if( box->type.fourcc == ISOM_BOX_TYPE_UUID.fourcc |
81 | 87 | && box->size >= lsmash_bs_count( bs ) + 16 ) |
82 | 88 | { |
83 | | - /* Get UUID. */ |
84 | | - lsmash_box_type_t *type = &box->type; |
| 89 | + /* First parse the UUID into a local variable. */ |
85 | 90 | uint64_t temp64 = lsmash_bs_get_be64( bs ); |
86 | | - type->user.fourcc = (temp64 >> 32) & 0xffffffff; |
87 | | - LSMASH_SET_BE32( &type->user.id[0], temp64 ); |
| 91 | + LSMASH_SET_BE64( &read_uuid[0], temp64 ); |
88 | 92 | temp64 = lsmash_bs_get_be64( bs ); |
89 | | - LSMASH_SET_BE64( &type->user.id[4], temp64 ); |
| 93 | + LSMASH_SET_BE64( &read_uuid[8], temp64 ); |
| 94 | + |
| 95 | + /* Compare against known vendor extension UUIDs */ |
| 96 | + if(!memcmp( read_uuid, tfxd_uuid, 16)) { |
| 97 | + box->type.fourcc = ISOM_BOX_TYPE_TFXD.fourcc; |
| 98 | + } else { |
| 99 | + /* This is a generic UUID box, mark it down as such */ |
| 100 | + lsmash_box_type_t *type = &box->type; |
| 101 | + |
| 102 | + LSMASH_SET_BE32( &type->user.fourcc, *((uint32_t *)&read_uuid[0]) ); |
| 103 | + LSMASH_SET_LE32( &type->user.id[0], *((uint32_t *)&read_uuid[4]) ); |
| 104 | + LSMASH_SET_LE32( &type->user.id[4], *((uint32_t *)&read_uuid[8]) ); |
| 105 | + LSMASH_SET_LE32( &type->user.id[8], *((uint32_t *)&read_uuid[12]) ); |
| 106 | + } |
90 | 107 | } |
91 | 108 | return bs->eob; |
92 | 109 | } |
|
0 commit comments