forked from FFmpeg/FFmpeg
fftools/ffmpeg_filter: only store complex filtergraphs in global array
Store simple filtergraphs in the stream they feed. Keeping the two separate will be useful in following commits.
This commit is contained in:
parent
d74cbcb963
commit
243a51490a
4 changed files with 22 additions and 3 deletions
|
@ -787,6 +787,11 @@ static int check_keyboard_interaction(int64_t cur_time)
|
||||||
(n = sscanf(buf, "%63[^ ] %lf %255[^ ] %255[^\n]", target, &time, command, arg)) >= 3) {
|
(n = sscanf(buf, "%63[^ ] %lf %255[^ ] %255[^\n]", target, &time, command, arg)) >= 3) {
|
||||||
av_log(NULL, AV_LOG_DEBUG, "Processing command target:%s time:%f command:%s arg:%s",
|
av_log(NULL, AV_LOG_DEBUG, "Processing command target:%s time:%f command:%s arg:%s",
|
||||||
target, time, command, arg);
|
target, time, command, arg);
|
||||||
|
for (OutputStream *ost = ost_iter(NULL); ost; ost = ost_iter(ost)) {
|
||||||
|
if (ost->fg_simple)
|
||||||
|
fg_send_command(ost->fg_simple, time, target, command, arg,
|
||||||
|
key == 'C');
|
||||||
|
}
|
||||||
for (i = 0; i < nb_filtergraphs; i++)
|
for (i = 0; i < nb_filtergraphs; i++)
|
||||||
fg_send_command(filtergraphs[i], time, target, command, arg,
|
fg_send_command(filtergraphs[i], time, target, command, arg,
|
||||||
key == 'C');
|
key == 'C');
|
||||||
|
|
|
@ -582,6 +582,8 @@ typedef struct OutputStream {
|
||||||
char *logfile_prefix;
|
char *logfile_prefix;
|
||||||
FILE *logfile;
|
FILE *logfile;
|
||||||
|
|
||||||
|
// simple filtergraph feeding this stream, if any
|
||||||
|
FilterGraph *fg_simple;
|
||||||
OutputFilter *filter;
|
OutputFilter *filter;
|
||||||
|
|
||||||
AVDictionary *encoder_opts;
|
AVDictionary *encoder_opts;
|
||||||
|
@ -653,6 +655,7 @@ extern int nb_input_files;
|
||||||
extern OutputFile **output_files;
|
extern OutputFile **output_files;
|
||||||
extern int nb_output_files;
|
extern int nb_output_files;
|
||||||
|
|
||||||
|
// complex filtergraphs
|
||||||
extern FilterGraph **filtergraphs;
|
extern FilterGraph **filtergraphs;
|
||||||
extern int nb_filtergraphs;
|
extern int nb_filtergraphs;
|
||||||
|
|
||||||
|
|
|
@ -1009,16 +1009,25 @@ int fg_create(FilterGraph **pfg, char *graph_desc, Scheduler *sch)
|
||||||
AVFilterGraph *graph;
|
AVFilterGraph *graph;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
fgp = allocate_array_elem(&filtergraphs, sizeof(*fgp), &nb_filtergraphs);
|
fgp = av_mallocz(sizeof(*fgp));
|
||||||
if (!fgp)
|
if (!fgp)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
fg = &fgp->fg;
|
fg = &fgp->fg;
|
||||||
|
|
||||||
if (pfg)
|
if (pfg) {
|
||||||
*pfg = fg;
|
*pfg = fg;
|
||||||
|
fg->index = -1;
|
||||||
|
} else {
|
||||||
|
ret = av_dynarray_add_nofree(&filtergraphs, &nb_filtergraphs, fgp);
|
||||||
|
if (ret < 0) {
|
||||||
|
av_freep(&fgp);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
fg->index = nb_filtergraphs - 1;
|
||||||
|
}
|
||||||
|
|
||||||
fg->class = &fg_class;
|
fg->class = &fg_class;
|
||||||
fg->index = nb_filtergraphs - 1;
|
|
||||||
fgp->graph_desc = graph_desc;
|
fgp->graph_desc = graph_desc;
|
||||||
fgp->disable_conversions = !auto_conversion_filters;
|
fgp->disable_conversions = !auto_conversion_filters;
|
||||||
fgp->sch = sch;
|
fgp->sch = sch;
|
||||||
|
@ -1135,6 +1144,7 @@ int init_simple_filtergraph(InputStream *ist, OutputStream *ost,
|
||||||
ret = fg_create(&fg, graph_desc, sch);
|
ret = fg_create(&fg, graph_desc, sch);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
ost->fg_simple = fg;
|
||||||
fgp = fgp_from_fg(fg);
|
fgp = fgp_from_fg(fg);
|
||||||
|
|
||||||
fgp->is_simple = 1;
|
fgp->is_simple = 1;
|
||||||
|
|
|
@ -797,6 +797,7 @@ static void ost_free(OutputStream **post)
|
||||||
ms = ms_from_ost(ost);
|
ms = ms_from_ost(ost);
|
||||||
|
|
||||||
enc_free(&ost->enc);
|
enc_free(&ost->enc);
|
||||||
|
fg_free(&ost->fg_simple);
|
||||||
|
|
||||||
if (ost->logfile) {
|
if (ost->logfile) {
|
||||||
if (fclose(ost->logfile))
|
if (fclose(ost->logfile))
|
||||||
|
|
Loading…
Add table
Reference in a new issue