aboutsummaryrefslogtreecommitdiffstats
path: root/ffmpeg.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-08-28 20:47:06 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-08-29 20:16:06 +0200
commitbb22f39fe200b0de7c757407dddbf9d7bf4e6cde (patch)
tree859e339776ed7b158ae71d8a5ec509120daf83b8 /ffmpeg.c
parent1e5014c7c7dee0efe026eacafe80a967f04892c8 (diff)
downloadffmpeg-bb22f39fe200b0de7c757407dddbf9d7bf4e6cde.tar.gz
ffmpeg: Support passing commands to filters at runtime
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'ffmpeg.c')
-rw-r--r--ffmpeg.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index 95b325298f..e9dbc66416 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2681,6 +2681,22 @@ static int transcode(AVFormatContext **output_files,
do_pkt_dump = 1;
av_log_set_level(AV_LOG_DEBUG);
}
+ if (key == 'c' || key == 'C'){
+ char ret[4096], target[64], cmd[256], arg[256]={0};
+ fprintf(stderr, "\nEnter command: <target> <command>[ <argument>]\n");
+ if(scanf("%4095[^\n\r]%*c", ret) == 1 && sscanf(ret, "%63[^ ] %255[^ ] %255[^\n]", target, cmd, arg) >= 2){
+ for(i=0;i<nb_ostreams;i++) {
+ int r;
+ ost = ost_table[i];
+ if(ost->graph){
+ r= avfilter_graph_send_command(ost->graph, target, cmd, arg, ret, sizeof(ret), key == 'c' ? AVFILTER_CMD_FLAG_ONE : 0);
+ fprintf(stderr, "Command reply for %d: %d, %s\n", i, r, ret);
+ }
+ }
+ }else{
+ fprintf(stderr, "Parse error\n");
+ }
+ }
if (key == 'd' || key == 'D'){
int debug=0;
if(key == 'D') {
@@ -2705,6 +2721,7 @@ static int transcode(AVFormatContext **output_files,
"? show this help\n"
"+ increase verbosity\n"
"- decrease verbosity\n"
+ "c Send command to filtergraph\n"
"D cycle through available debug modes\n"
"h dump packets/hex press to cycle through the 3 states\n"
"q quit\n"