static av_cold int init(AVFilterContext *ctx, const char *args0, void *opaque) { AConvertContext *aconvert = ctx->priv; char *arg, *ptr = NULL; int ret = 0; char *args = av_strdup(args0); aconvert->out_sample_fmt = AV_SAMPLE_FMT_NONE; aconvert->out_chlayout = 0; aconvert->out_packing_fmt = -1; if ((arg = av_strtok(args, ":", &ptr)) && strcmp(arg, "auto")) { if ((ret = ff_parse_sample_format(&aconvert->out_sample_fmt, arg, ctx)) < 0) goto end; } if ((arg = av_strtok(NULL, ":", &ptr)) && strcmp(arg, "auto")) { if ((ret = ff_parse_channel_layout(&aconvert->out_chlayout, arg, ctx)) < 0) goto end; } if ((arg = av_strtok(NULL, ":", &ptr)) && strcmp(arg, "auto")) { if ((ret = ff_parse_packing_format((int *)&aconvert->out_packing_fmt, arg, ctx)) < 0) goto end; } end: av_freep(&args); return ret; }
static av_cold int init(AVFilterContext *ctx) { AConvertContext *aconvert = ctx->priv; char *arg, *ptr = NULL; int ret = 0; char *args = av_strdup(NULL); av_log(ctx, AV_LOG_WARNING, "This filter is deprecated, use aformat instead\n"); aconvert->out_sample_fmt = AV_SAMPLE_FMT_NONE; aconvert->out_chlayout = 0; if ((arg = av_strtok(args, ":", &ptr)) && strcmp(arg, "auto")) { if ((ret = ff_parse_sample_format(&aconvert->out_sample_fmt, arg, ctx)) < 0) goto end; } if ((arg = av_strtok(NULL, ":", &ptr)) && strcmp(arg, "auto")) { if ((ret = ff_parse_channel_layout(&aconvert->out_chlayout, arg, ctx)) < 0) goto end; } end: av_freep(&args); return ret; }