]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/avf_abitscope.c
avfilter/vf_mix: Check sscanf() return value
[ffmpeg] / libavfilter / avf_abitscope.c
index 221ca566a9cf62f0de923cecb28f09b8fbdf26d8..759f821e74033d4498a3d7fe46a2d66de3610d93 100644 (file)
@@ -96,7 +96,7 @@ static int config_input(AVFilterLink *inlink)
     int ch;
     char *colors, *saveptr = NULL;
 
-    s->nb_samples = FFMAX(1, ((double)inlink->sample_rate / av_q2d(s->frame_rate)) + 0.5);
+    s->nb_samples = FFMAX(1, av_rescale(inlink->sample_rate, s->frame_rate.den, s->frame_rate.num));
     s->nb_channels = inlink->channels;
     s->depth = inlink->format == AV_SAMPLE_FMT_S16P ? 16 : 32;
 
@@ -142,7 +142,7 @@ static void count_bits(AudioBitScopeContext *s, uint32_t sample, int max)
     int i;
 
     for (i = 0; i < max; i++) {
-        if (sample & (1 << i))
+        if (sample & (1U << i))
             s->counter[i]++;
     }
 }