1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

fix the bug for fork ffmpeg in mac, the local variable is unvailable.

This commit is contained in:
winlin 2015-03-11 15:54:31 +08:00
parent 3e5821efff
commit a739b2c555
3 changed files with 36 additions and 24 deletions

View file

@ -61,17 +61,21 @@ int main(int argc, char** argv)
exit(-1);
}
// parse options in FFMPEG format.
while ((opt = getopt(argc, argv, "i:y:")) != -1) {
switch (opt) {
case 'i':
in_rtmp_url = optarg;
break;
case 'y':
out_rtmp_url = optarg;
break;
default:
break;
// fill the options for mac
for (opt = 0; opt < argc - 1; opt++) {
// ignore all options except -i and -y.
char* p = argv[opt];
// only accept -x
if (p[0] != '-' || p[1] == 0 || p[2] != 0) {
continue;
}
// parse according the option name.
switch (p[1]) {
case 'i': in_rtmp_url = argv[opt + 1]; break;
case 'y': out_rtmp_url = argv[opt + 1]; break;
default: break;
}
}