int ret = 0;
int len_mask = 0x80;
unsigned int size = 1, n = 1, total = 0;
- char probe_data[] = { 'm', 'a', 't', 'r', 'o', 's', 'k', 'a' };
-
+ //char probe_data[] = { 'm', 'a', 't', 'r', 'o', 's', 'k', 'a' };
+ /*support webm, add probe data*/
+ const char * probe_data[2] = { "matroska", "webm" };
if (fp == NULL) {
ret = mmfile_open(&fp, mmfileuri, MMFILE_RDONLY);
if (ret == MMFILE_IO_FAILED) {
if (_MMFILE_MKV_READ_BUFFER_LENGTH < 4 + size + total)
return 0;
- for (n = 4 + size ; n <= 4 + size + total - sizeof(probe_data); n++) {
- if (!memcmp(&buffer[n], probe_data, sizeof(probe_data))) {
- debug_msg(RELEASE, "String matroska found!!!\n");
- ret = 1;
- goto exit;
+ /*compare two kinds of probe data*/
+ for (int i = 0; i < 2; i++) {
+ unsigned int probelen = strlen(probe_data[i]);
+ if (total < probelen)
+ continue;
+ for (n = 4 + size ; n <= 4 + size + total - probelen; n++) {
+ if (!memcmp(&buffer[n], probe_data[i], probelen)) {
+ debug_msg(RELEASE, "String %s found!!!\n", probe_data[i]);
+ ret = 1;
+ goto exit;
+ }
}
}