fftools/ffmpeg: add a function adding a destination filter for InputStream

This way filtering code does not directly mess with InputStream
internals. Will become more useful in following commits.
pull/389/head
Anton Khirnov 2 years ago
parent c7438e8737
commit ae071c9e39
  1. 1
      fftools/ffmpeg.h
  2. 6
      fftools/ffmpeg_demux.c
  3. 8
      fftools/ffmpeg_filter.c

@ -880,6 +880,7 @@ void ifile_close(InputFile **f);
int ifile_get_packet(InputFile *f, AVPacket **pkt); int ifile_get_packet(InputFile *f, AVPacket **pkt);
void ist_output_add(InputStream *ist, OutputStream *ost); void ist_output_add(InputStream *ist, OutputStream *ost);
void ist_filter_add(InputStream *ist, InputFilter *ifilter);
/* iterate over all input streams in all input files; /* iterate over all input streams in all input files;
* pass NULL to start iteration */ * pass NULL to start iteration */

@ -567,6 +567,12 @@ void ist_output_add(InputStream *ist, OutputStream *ost)
ist->outputs[ist->nb_outputs - 1] = ost; ist->outputs[ist->nb_outputs - 1] = ost;
} }
void ist_filter_add(InputStream *ist, InputFilter *ifilter)
{
GROW_ARRAY(ist->filters, ist->nb_filters);
ist->filters[ist->nb_filters - 1] = ifilter;
}
static const AVCodec *choose_decoder(const OptionsContext *o, AVFormatContext *s, AVStream *st, static const AVCodec *choose_decoder(const OptionsContext *o, AVFormatContext *s, AVStream *st,
enum HWAccelID hwaccel_id, enum AVHWDeviceType hwaccel_device_type) enum HWAccelID hwaccel_id, enum AVHWDeviceType hwaccel_device_type)

@ -212,12 +212,11 @@ int init_simple_filtergraph(InputStream *ist, OutputStream *ost)
if (!ifilter->frame_queue) if (!ifilter->frame_queue)
report_and_exit(AVERROR(ENOMEM)); report_and_exit(AVERROR(ENOMEM));
GROW_ARRAY(ist->filters, ist->nb_filters);
ist->filters[ist->nb_filters - 1] = ifilter;
GROW_ARRAY(filtergraphs, nb_filtergraphs); GROW_ARRAY(filtergraphs, nb_filtergraphs);
filtergraphs[nb_filtergraphs - 1] = fg; filtergraphs[nb_filtergraphs - 1] = fg;
ist_filter_add(ist, ifilter);
return 0; return 0;
} }
@ -319,8 +318,7 @@ static void init_input_filter(FilterGraph *fg, AVFilterInOut *in)
if (!ifilter->frame_queue) if (!ifilter->frame_queue)
report_and_exit(AVERROR(ENOMEM)); report_and_exit(AVERROR(ENOMEM));
GROW_ARRAY(ist->filters, ist->nb_filters); ist_filter_add(ist, ifilter);
ist->filters[ist->nb_filters - 1] = ifilter;
} }
static int read_binary(const char *path, uint8_t **data, int *len) static int read_binary(const char *path, uint8_t **data, int *len)

Loading…
Cancel
Save