fftools/ffmpeg_mux_init: drop OutputStream.filters[_script]

They are not needed outside of ost_get_filters(), so make them stack
variables there.
pull/389/head
Anton Khirnov 2 years ago
parent 84e1e0fa73
commit ecb44ca877
  1. 2
      fftools/ffmpeg.h
  2. 28
      fftools/ffmpeg_mux_init.c

@ -639,8 +639,6 @@ typedef struct OutputStream {
OutputFilter *filter;
char *avfilter;
char *filters; ///< filtergraph associated to the -filter option
char *filters_script; ///< filtergraph script associated to the -filter_script option
AVDictionary *encoder_opts;
AVDictionary *sws_dict;

@ -423,43 +423,45 @@ static MuxStream *mux_stream_alloc(Muxer *mux, enum AVMediaType type)
static int ost_get_filters(const OptionsContext *o, AVFormatContext *oc,
OutputStream *ost)
{
MATCH_PER_STREAM_OPT(filter_scripts, str, ost->filters_script, oc, ost->st);
MATCH_PER_STREAM_OPT(filters, str, ost->filters, oc, ost->st);
const char *filters = NULL, *filters_script = NULL;
MATCH_PER_STREAM_OPT(filter_scripts, str, filters_script, oc, ost->st);
MATCH_PER_STREAM_OPT(filters, str, filters, oc, ost->st);
if (!ost->enc) {
if (ost->filters_script || ost->filters) {
if (filters_script || filters) {
av_log(ost, AV_LOG_ERROR,
"%s '%s' was specified, but codec copy was selected. "
"Filtering and streamcopy cannot be used together.\n",
ost->filters ? "Filtergraph" : "Filtergraph script",
ost->filters ? ost->filters : ost->filters_script);
filters ? "Filtergraph" : "Filtergraph script",
filters ? filters : filters_script);
return AVERROR(ENOSYS);
}
return 0;
}
if (!ost->ist) {
if (ost->filters_script || ost->filters) {
if (filters_script || filters) {
av_log(ost, AV_LOG_ERROR,
"%s '%s' was specified for a stream fed from a complex "
"filtergraph. Simple and complex filtering cannot be used "
"together for the same stream.\n",
ost->filters ? "Filtergraph" : "Filtergraph script",
ost->filters ? ost->filters : ost->filters_script);
filters ? "Filtergraph" : "Filtergraph script",
filters ? filters : filters_script);
return AVERROR(EINVAL);
}
return 0;
}
if (ost->filters_script && ost->filters) {
if (filters_script && filters) {
av_log(ost, AV_LOG_ERROR, "Both -filter and -filter_script set\n");
exit_program(1);
}
if (ost->filters_script)
ost->avfilter = file_read(ost->filters_script);
else if (ost->filters)
ost->avfilter = av_strdup(ost->filters);
if (filters_script)
ost->avfilter = file_read(filters_script);
else if (filters)
ost->avfilter = av_strdup(filters);
else
ost->avfilter = av_strdup(ost->type == AVMEDIA_TYPE_VIDEO ? "null" : "anull");
return ost->avfilter ? 0 : AVERROR(ENOMEM);

Loading…
Cancel
Save