Skip to content

Commit

Permalink
misc fixes in MP4Box args parsing - cf #873
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanlf committed Jul 17, 2017
1 parent d1ee384 commit e86edeb
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions applications/mp4box/fileimport.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ GF_Err import_file(GF_ISOFile *dest, char *inName, u32 import_flags, Double forc
handler_name = NULL;
rvc_config = NULL;
while (ext) {
Bool is_filename = GF_FALSE;
char *ext2 = strchr(ext+1, ':');
if (ext2 && !strncmp(ext2, "://", 3)) ext2 = strchr(ext2+1, ':');
if (ext2 && !strncmp(ext2, ":\\", 2)) ext2 = strchr(ext2+1, ':');
Expand All @@ -322,13 +323,20 @@ GF_Err import_file(GF_ISOFile *dest, char *inName, u32 import_flags, Double forc
if (!stricmp(ext+5, "none")) {
par_n = par_d = -1;
} else {
char *ext3=NULL;
if (ext2) ext2[0] = ':';
if (ext2) ext2 = strchr(ext2+1, ':');
if (ext2) ext2[0] = 0;
if (ext2) ext3 = strchr(ext2+1, ':');
if (ext3) ext3[0] = 0;
sscanf(ext+5, "%d:%d", &par_n, &par_d);
if (ext3) ext3[0] = ':';
if (ext2) ext = ext2+1;
ext2 = NULL;
}
}
else if (!strnicmp(ext+1, "name=", 5)) handler_name = gf_strdup(ext+6);
else if (!strnicmp(ext+1, "name=", 5)) {
handler_name = gf_strdup(ext+6);
is_filename = GF_TRUE;
}
else if (!strnicmp(ext+1, "ext=", 4)) {
/*extensions begin with '.'*/
if (*(ext+5) == '.')
Expand Down Expand Up @@ -424,9 +432,13 @@ GF_Err import_file(GF_ISOFile *dest, char *inName, u32 import_flags, Double forc
stype = GF_4CC(ext[7], ext[8], ext[9], ext[10]);
}
else if (!stricmp(ext+1, "chap")) is_chap = 1;
else if (!strnicmp(ext+1, "chapter=", 8)) chapter_name = gf_strdup(ext+9);
else if (!strnicmp(ext+1, "chapter=", 8)) {
chapter_name = gf_strdup(ext+9);
is_filename = GF_TRUE;
}
else if (!strnicmp(ext+1, "chapfile=", 9)) {
chapter_name = gf_strdup(ext+10);
is_filename = GF_TRUE;
is_chap_file=1;
}
else if (!strnicmp(ext+1, "layout=", 7)) {
Expand Down Expand Up @@ -521,6 +533,12 @@ GF_Err import_file(GF_ISOFile *dest, char *inName, u32 import_flags, Double forc

if (ext2) ext2[0] = ':';

if (is_filename) {
char *sep;
sep = strchr(ext+6, ':');
if (sep) ext = sep+1;
}

ext[0] = 0;
ext = strchr(ext+1, ':');
}
Expand Down

0 comments on commit e86edeb

Please sign in to comment.