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.)
This commit is contained in:
wm4 2016-04-26 19:38:51 +02:00
parent da59726776
commit 0c6c62cb17
1 changed files with 8 additions and 2 deletions

View File

@ -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);