Skip to content

Commit

Permalink
fix :arguments parsing for #873 and #879
Browse files Browse the repository at this point in the history
  • Loading branch information
aureliendavid committed Aug 22, 2017
1 parent 103a66b commit 03c8d85
Showing 1 changed file with 13 additions and 18 deletions.
31 changes: 13 additions & 18 deletions applications/mp4box/fileimport.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,13 @@ 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, ':');

// if the colon is part of a file path/url we keep it
if (ext2 && ( !strncmp(ext2, "://", 3) || !strncmp(ext2, ":\\", 2) ) ) {
ext2[0] = ':';
ext2 = strchr(ext2+1, ':');
}
if (ext2) ext2[0] = 0;

/*all extensions for track-based importing*/
Expand All @@ -331,17 +334,13 @@ GF_Err import_file(GF_ISOFile *dest, char *inName, u32 import_flags, Double forc
} else {
char *ext3=NULL;
if (ext2) ext2[0] = ':';
if (ext2) ext3 = strchr(ext2+1, ':');
if (ext3) ext3[0] = 0;
if (ext2) ext2 = strchr(ext2+1, ':');
if (ext2) ext2[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);
is_filename = GF_TRUE;
}
else if (!strnicmp(ext+1, "ext=", 4)) {
/*extensions begin with '.'*/
Expand Down Expand Up @@ -441,11 +440,9 @@ GF_Err import_file(GF_ISOFile *dest, char *inName, u32 import_flags, Double forc
else if (!stricmp(ext+1, "chap")) is_chap = 1;
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 @@ -540,14 +537,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, ':');

/* restart from where we stopped
* if we didn't stop (ext2 null) then the end has been reached
* so we can stop the whole thing */
ext = ext2;
}

/*check duration import (old syntax)*/
Expand Down

0 comments on commit 03c8d85

Please sign in to comment.