1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

ffmpeg: fix reading commands from stdin

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2011-08-30 20:17:07 +02:00
parent 3016c7f543
commit e312543c82

View File

@ -2325,8 +2325,13 @@ static int transcode(OutputFile *output_files,
if (key == 'c' || key == 'C'){
char ret[4096], target[64], cmd[256], arg[256]={0};
double ts;
int k;
fprintf(stderr, "\nEnter command: <target> <time> <command>[ <argument>]\n");
if(scanf("%4095[^\n\r]%*c", ret) == 1 && sscanf(ret, "%63[^ ] %lf %255[^ ] %255[^\n]", target, &ts, cmd, arg) >= 3){
i=0;
while((k=read_key()) > 0 && k!='\n' && k!='\r' && i<sizeof(ret)-1)
ret[i++]= k;
ret[i]= 0;
if(k>0 && sscanf(ret, "%63[^ ] %lf %255[^ ] %255[^\n]", target, &ts, cmd, arg) >= 3){
for(i=0;i<nb_output_streams;i++) {
int r;
ost = &output_streams[i];