fftools/ffmpeg_filter: factor out binding an output stream to OutputFilter

While the new function is trivial for now, it will become more useful in
future commits.
pull/389/head
Anton Khirnov 2 years ago
parent dc5864a00c
commit 87b576135e
  1. 2
      fftools/ffmpeg.h
  2. 10
      fftools/ffmpeg_filter.c
  3. 3
      fftools/ffmpeg_mux_init.c

@ -756,6 +756,8 @@ int ifilter_parameters_from_dec(InputFilter *ifilter, const AVCodecContext *dec)
int ifilter_has_all_input_formats(FilterGraph *fg);
void ofilter_bind_ost(OutputFilter *ofilter, OutputStream *ost);
/**
* Create a new filtergraph in the global filtergraph list.
*

@ -464,6 +464,12 @@ static int ifilter_bind_ist(InputFilter *ifilter, InputStream *ist)
return 0;
}
void ofilter_bind_ost(OutputFilter *ofilter, OutputStream *ost)
{
ofilter->ost = ost;
av_freep(&ofilter->linklabel);
}
static InputFilter *ifilter_alloc(FilterGraph *fg)
{
InputFilterPriv *ifp = allocate_array_elem(&fg->inputs, sizeof(*ifp),
@ -624,14 +630,14 @@ int init_simple_filtergraph(InputStream *ist, OutputStream *ost,
return AVERROR(EINVAL);
}
fg->outputs[0]->ost = ost;
ost->filter = fg->outputs[0];
ret = ifilter_bind_ist(fg->inputs[0], ist);
if (ret < 0)
return ret;
ofilter_bind_ost(fg->outputs[0], ost);
return 0;
}

@ -1259,8 +1259,7 @@ static OutputStream *ost_add(Muxer *mux, const OptionsContext *o,
(type == AVMEDIA_TYPE_VIDEO || type == AVMEDIA_TYPE_AUDIO)) {
if (ofilter) {
ost->filter = ofilter;
ofilter->ost = ost;
av_freep(&ofilter->linklabel);
ofilter_bind_ost(ofilter, ost);
} else {
ret = init_simple_filtergraph(ost->ist, ost, filters);
if (ret < 0) {

Loading…
Cancel
Save