diff options
author | wm4 <wm4@nowhere> | 2016-04-26 19:38:51 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-04-26 19:38:51 +0200 |
commit | 0c6c62cb173bb25e5be51c9147a119bb42f163ab (patch) | |
tree | 18ce7565207faf0249052e9263a428769f948ca6 /player | |
parent | da59726776b61d4c8d2e0d358167ffa6d2d49a42 (diff) | |
download | mpv-0c6c62cb173bb25e5be51c9147a119bb42f163ab.tar.bz2 mpv-0c6c62cb173bb25e5be51c9147a119bb42f163ab.tar.xz |
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.)
Diffstat (limited to 'player')
-rw-r--r-- | player/lavfi.c | 10 |
1 files changed, 8 insertions, 2 deletions
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); |