mirror of https://git.ffmpeg.org/ffmpeg.git
fftools/ffmpeg_filter: Avoid DynBuf-API for writing strings
It is not really natural, it requires internal allocations of its own and its error handling is horrible (i.e. the implicit (re)allocations here are unchecked). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
3be6fe9a56
commit
cf8925a096
|
@ -201,17 +201,15 @@ static char *describe_filter_link(FilterGraph *fg, AVFilterInOut *inout, int in)
|
||||||
AVFilterContext *ctx = inout->filter_ctx;
|
AVFilterContext *ctx = inout->filter_ctx;
|
||||||
AVFilterPad *pads = in ? ctx->input_pads : ctx->output_pads;
|
AVFilterPad *pads = in ? ctx->input_pads : ctx->output_pads;
|
||||||
int nb_pads = in ? ctx->nb_inputs : ctx->nb_outputs;
|
int nb_pads = in ? ctx->nb_inputs : ctx->nb_outputs;
|
||||||
AVIOContext *pb;
|
char *res;
|
||||||
uint8_t *res = NULL;
|
|
||||||
|
|
||||||
if (avio_open_dyn_buf(&pb) < 0)
|
|
||||||
exit_program(1);
|
|
||||||
|
|
||||||
avio_printf(pb, "%s", ctx->filter->name);
|
|
||||||
if (nb_pads > 1)
|
if (nb_pads > 1)
|
||||||
avio_printf(pb, ":%s", avfilter_pad_get_name(pads, inout->pad_idx));
|
res = av_strdup(ctx->filter->name);
|
||||||
avio_w8(pb, 0);
|
else
|
||||||
avio_close_dyn_buf(pb, &res);
|
res = av_asprintf("%s:%s", ctx->filter->name,
|
||||||
|
avfilter_pad_get_name(pads, inout->pad_idx));
|
||||||
|
if (!res)
|
||||||
|
exit_program(1);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue