From 0c6c62cb173bb25e5be51c9147a119bb42f163ab Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 26 Apr 2016 19:38:51 +0200 Subject: lavfi: shut up false positive compiler warnings As a positive side-effect, this also errors out gracefully for the extremely unlikely but possible case certain builtin filters are not available. (This could happen only with crippled libavfilter builds that can't be used by anything using its public API.) --- player/lavfi.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'player/lavfi.c') diff --git a/player/lavfi.c b/player/lavfi.c index ada66e7475..50c2fd8fc2 100644 --- a/player/lavfi.c +++ b/player/lavfi.c @@ -339,7 +339,7 @@ static bool init_pads(struct lavfi *c) goto error; // can happen if pad reassociation fails if (pad->dir == LAVFI_OUT) { - AVFilter *dst_filter; + AVFilter *dst_filter = NULL; if (pad->type == STREAM_AUDIO) { dst_filter = avfilter_get_by_name("abuffersink"); } else if (pad->type == STREAM_VIDEO) { @@ -348,6 +348,9 @@ static bool init_pads(struct lavfi *c) assert(0); } + if (!dst_filter) + goto error; + char name[256]; snprintf(name, sizeof(name), "mpv_sink_%s", pad->name); @@ -359,7 +362,7 @@ static bool init_pads(struct lavfi *c) goto error; } else { char src_args[256]; - AVFilter *src_filter; + AVFilter *src_filter = NULL; pad->input_eof |= !pad->connected; @@ -410,6 +413,9 @@ static bool init_pads(struct lavfi *c) assert(0); } + if (!src_filter) + goto error; + char name[256]; snprintf(name, sizeof(name), "mpv_src_%s", pad->name); -- cgit v1.2.3