|
|
@ -91,7 +91,6 @@ static int init_filters(const char *filters_descr) |
|
|
|
AVFilterInOut *outputs = avfilter_inout_alloc(); |
|
|
|
AVFilterInOut *outputs = avfilter_inout_alloc(); |
|
|
|
AVFilterInOut *inputs = avfilter_inout_alloc(); |
|
|
|
AVFilterInOut *inputs = avfilter_inout_alloc(); |
|
|
|
enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE }; |
|
|
|
enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE }; |
|
|
|
AVBufferSinkParams *buffersink_params; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
filter_graph = avfilter_graph_alloc(); |
|
|
|
filter_graph = avfilter_graph_alloc(); |
|
|
|
if (!outputs || !inputs || !filter_graph) { |
|
|
|
if (!outputs || !inputs || !filter_graph) { |
|
|
@ -114,16 +113,20 @@ static int init_filters(const char *filters_descr) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* buffer video sink: to terminate the filter chain. */ |
|
|
|
/* buffer video sink: to terminate the filter chain. */ |
|
|
|
buffersink_params = av_buffersink_params_alloc(); |
|
|
|
|
|
|
|
buffersink_params->pixel_fmts = pix_fmts; |
|
|
|
|
|
|
|
ret = avfilter_graph_create_filter(&buffersink_ctx, buffersink, "out", |
|
|
|
ret = avfilter_graph_create_filter(&buffersink_ctx, buffersink, "out", |
|
|
|
NULL, buffersink_params, filter_graph); |
|
|
|
NULL, NULL, filter_graph); |
|
|
|
av_free(buffersink_params); |
|
|
|
|
|
|
|
if (ret < 0) { |
|
|
|
if (ret < 0) { |
|
|
|
av_log(NULL, AV_LOG_ERROR, "Cannot create buffer sink\n"); |
|
|
|
av_log(NULL, AV_LOG_ERROR, "Cannot create buffer sink\n"); |
|
|
|
goto end; |
|
|
|
goto end; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ret = av_opt_set_int_list(buffersink_ctx, "pix_fmts", pix_fmts, |
|
|
|
|
|
|
|
AV_PIX_FMT_NONE, AV_OPT_SEARCH_CHILDREN); |
|
|
|
|
|
|
|
if (ret < 0) { |
|
|
|
|
|
|
|
av_log(NULL, AV_LOG_ERROR, "Cannot set output pixel format\n"); |
|
|
|
|
|
|
|
goto end; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* Endpoints for the filter graph. */ |
|
|
|
/* Endpoints for the filter graph. */ |
|
|
|
outputs->name = av_strdup("in"); |
|
|
|
outputs->name = av_strdup("in"); |
|
|
|
outputs->filter_ctx = buffersrc_ctx; |
|
|
|
outputs->filter_ctx = buffersrc_ctx; |
|
|
|