1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avfiltergraph: shut up uninitialized variable warning.

The warning silenced was:
libavfilter/avfiltergraph.c: In function ‘avfilter_graph_config’:
libavfilter/avfiltergraph.c:500:13: warning: ‘best_idx’ may be used uninitialized in this function [-Wuninitialized]
This commit is contained in:
Anton Khirnov 2012-06-25 13:01:31 +02:00
parent fd2784c3b5
commit 61d158c321

View File

@ -29,6 +29,7 @@
#include "internal.h" #include "internal.h"
#include "libavutil/audioconvert.h" #include "libavutil/audioconvert.h"
#include "libavutil/avassert.h"
#include "libavutil/log.h" #include "libavutil/log.h"
static const AVClass filtergraph_class = { static const AVClass filtergraph_class = {
@ -497,7 +498,7 @@ static void swap_sample_fmts_on_filter(AVFilterContext *filter)
for (i = 0; i < filter->nb_outputs; i++) { for (i = 0; i < filter->nb_outputs; i++) {
AVFilterLink *outlink = filter->outputs[i]; AVFilterLink *outlink = filter->outputs[i];
int best_idx, best_score = INT_MIN; int best_idx = -1, best_score = INT_MIN;
if (outlink->type != AVMEDIA_TYPE_AUDIO || if (outlink->type != AVMEDIA_TYPE_AUDIO ||
outlink->in_formats->format_count < 2) outlink->in_formats->format_count < 2)
@ -530,6 +531,7 @@ static void swap_sample_fmts_on_filter(AVFilterContext *filter)
best_idx = j; best_idx = j;
} }
} }
av_assert0(best_idx >= 0);
FFSWAP(int, outlink->in_formats->formats[0], FFSWAP(int, outlink->in_formats->formats[0],
outlink->in_formats->formats[best_idx]); outlink->in_formats->formats[best_idx]);
} }