forked from ponchio/untrunc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
codec_mbex.cpp
29 lines (25 loc) · 864 Bytes
/
codec_mbex.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "codec.h"
#include "log.h"
#include <string.h>
using namespace std;
/* mbex is a codec for some editing data I cannot find documentation for.
* for the few examples I got they are very small packets (8, 10, 100 bytes
* large packets included crec and cist atoms.
* Examples:
*
* Length 8: 00 00 00 08 00 00 00 00 01 3E 15 29
* Length 10: 00 00 00 0A 00 00 00 01 00 06 00 00 23 95
* Length 100: 00 00 00 64 00 00 00 01 00 00 00 5C 63 72 65 63 00 00 00 54 63 69 74 73 00 00 00 0C 00 00 00 02 00 00 00 01
*/
Match Codec::mbexMatch(const unsigned char *start, int maxlength) {
Match match;
uint32_t length = readBE<uint32_t>(start);
if(length > 200) return match;
match.chances = 1e10/200.0f;
match.length = length;
if(!strncmp((char *)start + 8, "crec", 4)) {
match.chances *= 1e10;
return match;
}
return match;
}