mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-02-09 14:14:39 +02:00
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.
This commit is contained in:
parent
dc5864a00c
commit
87b576135e
@ -756,6 +756,8 @@ int ifilter_parameters_from_dec(InputFilter *ifilter, const AVCodecContext *dec)
|
|||||||
|
|
||||||
int ifilter_has_all_input_formats(FilterGraph *fg);
|
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.
|
* Create a new filtergraph in the global filtergraph list.
|
||||||
*
|
*
|
||||||
|
@ -464,6 +464,12 @@ static int ifilter_bind_ist(InputFilter *ifilter, InputStream *ist)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ofilter_bind_ost(OutputFilter *ofilter, OutputStream *ost)
|
||||||
|
{
|
||||||
|
ofilter->ost = ost;
|
||||||
|
av_freep(&ofilter->linklabel);
|
||||||
|
}
|
||||||
|
|
||||||
static InputFilter *ifilter_alloc(FilterGraph *fg)
|
static InputFilter *ifilter_alloc(FilterGraph *fg)
|
||||||
{
|
{
|
||||||
InputFilterPriv *ifp = allocate_array_elem(&fg->inputs, sizeof(*ifp),
|
InputFilterPriv *ifp = allocate_array_elem(&fg->inputs, sizeof(*ifp),
|
||||||
@ -624,14 +630,14 @@ int init_simple_filtergraph(InputStream *ist, OutputStream *ost,
|
|||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
fg->outputs[0]->ost = ost;
|
|
||||||
|
|
||||||
ost->filter = fg->outputs[0];
|
ost->filter = fg->outputs[0];
|
||||||
|
|
||||||
ret = ifilter_bind_ist(fg->inputs[0], ist);
|
ret = ifilter_bind_ist(fg->inputs[0], ist);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
ofilter_bind_ost(fg->outputs[0], ost);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1259,8 +1259,7 @@ static OutputStream *ost_add(Muxer *mux, const OptionsContext *o,
|
|||||||
(type == AVMEDIA_TYPE_VIDEO || type == AVMEDIA_TYPE_AUDIO)) {
|
(type == AVMEDIA_TYPE_VIDEO || type == AVMEDIA_TYPE_AUDIO)) {
|
||||||
if (ofilter) {
|
if (ofilter) {
|
||||||
ost->filter = ofilter;
|
ost->filter = ofilter;
|
||||||
ofilter->ost = ost;
|
ofilter_bind_ost(ofilter, ost);
|
||||||
av_freep(&ofilter->linklabel);
|
|
||||||
} else {
|
} else {
|
||||||
ret = init_simple_filtergraph(ost->ist, ost, filters);
|
ret = init_simple_filtergraph(ost->ist, ost, filters);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user