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:
parent
3e5821efff
commit
a739b2c555
3 changed files with 36 additions and 24 deletions
|
@ -76,17 +76,25 @@ int main(int argc, char** argv)
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// parse options in FFMPEG format.
|
for (opt = 0; opt < argc; opt++) {
|
||||||
while ((opt = getopt(argc, argv, "i:y:")) != -1) {
|
srs_human_trace("argv[%d]=%s", opt, argv[opt]);
|
||||||
switch (opt) {
|
}
|
||||||
case 'i':
|
|
||||||
in_flv_file = optarg;
|
// fill the options for mac
|
||||||
break;
|
for (opt = 0; opt < argc - 1; opt++) {
|
||||||
case 'y':
|
// ignore all options except -i and -y.
|
||||||
out_rtmp_url = optarg;
|
char* p = argv[opt];
|
||||||
break;
|
|
||||||
default:
|
// only accept -x
|
||||||
break;
|
if (p[0] != '-' || p[1] == 0 || p[2] != 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// parse according the option name.
|
||||||
|
switch (p[1]) {
|
||||||
|
case 'i': in_flv_file = argv[opt + 1]; break;
|
||||||
|
case 'y': out_rtmp_url = argv[opt + 1]; break;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,17 +61,21 @@ int main(int argc, char** argv)
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// parse options in FFMPEG format.
|
// fill the options for mac
|
||||||
while ((opt = getopt(argc, argv, "i:y:")) != -1) {
|
for (opt = 0; opt < argc - 1; opt++) {
|
||||||
switch (opt) {
|
// ignore all options except -i and -y.
|
||||||
case 'i':
|
char* p = argv[opt];
|
||||||
in_rtmp_url = optarg;
|
|
||||||
break;
|
// only accept -x
|
||||||
case 'y':
|
if (p[0] != '-' || p[1] == 0 || p[2] != 0) {
|
||||||
out_rtmp_url = optarg;
|
continue;
|
||||||
break;
|
}
|
||||||
default:
|
|
||||||
break;
|
// 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -432,8 +432,8 @@ int SrsFFMPEG::start()
|
||||||
// memory leak in child process, it's ok.
|
// memory leak in child process, it's ok.
|
||||||
char** charpv_params = new char*[params.size() + 1];
|
char** charpv_params = new char*[params.size() + 1];
|
||||||
for (int i = 0; i < (int)params.size(); i++) {
|
for (int i = 0; i < (int)params.size(); i++) {
|
||||||
std::string p = params[i];
|
std::string& p = params[i];
|
||||||
charpv_params[i] = (char*)p.c_str();
|
charpv_params[i] = (char*)p.data();
|
||||||
}
|
}
|
||||||
// EOF: NULL
|
// EOF: NULL
|
||||||
charpv_params[params.size()] = NULL;
|
charpv_params[params.size()] = NULL;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue