History

fftools/ffmpeg_filter: remove remaining OutputStream usage in init_simple_filtergraph()

With this, nothing in ffmpeg_filter acesses OutputStream anymore, thus there are no more direct ties between filtering and muxing. Rename init_simple_filtergraph() to fg_create_simple() for consistency.

Anton Khirnov committed 2 years ago

Commit d103b611 parent 72cd0c23 files · +21 −17Browse files

Unified · Split

3 files
  1. fftools/ffmpeg.h +5 −4
  2. fftools/ffmpeg_filter.c +11 −11
  3. fftools/ffmpeg_mux_init.c +5 −2
fftools/ffmpeg.h+5−4
@@ -755,10 +755,11 @@ int find_codec(void *logctx, const char *name, · 754 unmodified lines
755int parse_and_set_vsync(const char *arg, int *vsync_var, int file_idx, int st_idx, int is_global);755int parse_and_set_vsync(const char *arg, int *vsync_var, int file_idx, int st_idx, int is_global);
756 756
757int filtergraph_is_simple(const FilterGraph *fg);757int filtergraph_is_simple(const FilterGraph *fg);
758int init_simple_filtergraph(InputStream *ist, OutputStream *ost,758int fg_create_simple(FilterGraph **pfg,
759 char *graph_desc,759 InputStream *ist,
760 Scheduler *sch, unsigned sch_idx_enc,760 char *graph_desc,
761 const OutputFilterOptions *opts);761 Scheduler *sch, unsigned sched_idx_enc,
762 const OutputFilterOptions *opts);
762int fg_finalise_bindings(void);763int fg_finalise_bindings(void);
763 764
764/**765/**
fftools/ffmpeg_filter.c+11−11
@@ -1180,25 +1180,27 @@ fail: · 1179 unmodified lines
1180 return 0;1180 return 0;
1181}1181}
1182 1182
1183int init_simple_filtergraph(InputStream *ist, OutputStream *ost,1183int fg_create_simple(FilterGraph **pfg,
1184 char *graph_desc,1184 InputStream *ist,
1185 Scheduler *sch, unsigned sched_idx_enc,1185 char *graph_desc,
1186 const OutputFilterOptions *opts)1186 Scheduler *sch, unsigned sched_idx_enc,
1187 const OutputFilterOptions *opts)
1187{1188{
1189 const enum AVMediaType type = ist->par->codec_type;
1188 FilterGraph *fg;1190 FilterGraph *fg;
1189 FilterGraphPriv *fgp;1191 FilterGraphPriv *fgp;
1190 int ret;1192 int ret;
1191 1193
1192 ret = fg_create(&ost->fg_simple, graph_desc, sch);1194 ret = fg_create(pfg, graph_desc, sch);
1193 if (ret < 0)1195 if (ret < 0)
1194 return ret;1196 return ret;
1195 fg = ost->fg_simple;1197 fg = *pfg;
1196 fgp = fgp_from_fg(fg);1198 fgp = fgp_from_fg(fg);
1197 1199
1198 fgp->is_simple = 1;1200 fgp->is_simple = 1;
1199 1201
1200 snprintf(fgp->log_name, sizeof(fgp->log_name), "%cf%s",1202 snprintf(fgp->log_name, sizeof(fgp->log_name), "%cf%s",
1201 av_get_media_type_string(ost->type)[0], opts->name);1203 av_get_media_type_string(type)[0], opts->name);
1202 1204
1203 if (fg->nb_inputs != 1 || fg->nb_outputs != 1) {1205 if (fg->nb_inputs != 1 || fg->nb_outputs != 1) {
1204 av_log(fg, AV_LOG_ERROR, "Simple filtergraph '%s' was expected "1206 av_log(fg, AV_LOG_ERROR, "Simple filtergraph '%s' was expected "
@@ -1208,16 +1210,14 @@ int init_simple_filtergraph(InputStream *ist, OutputStream *ost, · 3 unmodified lines
1208 graph_desc, fg->nb_inputs, fg->nb_outputs);1210 graph_desc, fg->nb_inputs, fg->nb_outputs);
1209 return AVERROR(EINVAL);1211 return AVERROR(EINVAL);
1210 }1212 }
1211 if (fg->outputs[0]->type != ost->type) {1213 if (fg->outputs[0]->type != type) {
1212 av_log(fg, AV_LOG_ERROR, "Filtergraph has a %s output, cannot connect "1214 av_log(fg, AV_LOG_ERROR, "Filtergraph has a %s output, cannot connect "
1213 "it to %s output stream\n",1215 "it to %s output stream\n",
1214 av_get_media_type_string(fg->outputs[0]->type),1216 av_get_media_type_string(fg->outputs[0]->type),
1215 av_get_media_type_string(ost->type));1217 av_get_media_type_string(type));
1216 return AVERROR(EINVAL);1218 return AVERROR(EINVAL);
1217 }1219 }
1218 1220
1219 ost->filter = fg->outputs[0];
1220
1221 ret = ifilter_bind_ist(fg->inputs[0], ist, opts->vs);1221 ret = ifilter_bind_ist(fg->inputs[0], ist, opts->vs);
1222 if (ret < 0)1222 if (ret < 0)
1223 return ret;1223 return ret;
fftools/ffmpeg_mux_init.c+5−2
@@ -1010,8 +1010,11 @@ ost_bind_filter(const Muxer *mux, MuxStream *ms, OutputFilter *ofilter, · 1009 unmodified lines
1010 ost->filter = ofilter;1010 ost->filter = ofilter;
1011 ret = ofilter_bind_enc(ofilter, ms->sch_idx_enc, &opts);1011 ret = ofilter_bind_enc(ofilter, ms->sch_idx_enc, &opts);
1012 } else {1012 } else {
1013 ret = init_simple_filtergraph(ost->ist, ost, filters,1013 ret = fg_create_simple(&ost->fg_simple, ost->ist, filters,
1014 mux->sch, ms->sch_idx_enc, &opts);1014 mux->sch, ms->sch_idx_enc, &opts);
1015 if (ret >= 0)
1016 ost->filter = ost->fg_simple->outputs[0];
1017
1015 }1018 }
1016 av_freep(&opts.nb_threads);1019 av_freep(&opts.nb_threads);
1017 if (ret < 0)1020 if (ret < 0)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t