aboutsummaryrefslogtreecommitdiffstats
path: root/ffmpeg.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-08-30 20:17:07 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-08-30 20:27:11 +0200
commite312543c82b493422911213ab792cb94f3a9e5b4 (patch)
treef70f53930135d8b4fd5da5ea54490a373d2121af /ffmpeg.c
parent3016c7f543a91490457b8a3d21ccef6fd5ff7226 (diff)
downloadffmpeg-e312543c82b493422911213ab792cb94f3a9e5b4.tar.gz
ffmpeg: fix reading commands from stdin
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'ffmpeg.c')
-rw-r--r--ffmpeg.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index 6453e05f0e..739b866e63 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -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];