]> git.sesse.net Git - ffmpeg/commitdiff
avformat/lavfi: force probesize to cover at least 30 frames
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 28 Feb 2013 19:24:05 +0000 (20:24 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 28 Feb 2013 19:28:59 +0000 (20:28 +0100)
This ensures that fps and other values are estimated correctly,
the probesize also is intended to limit disk/protocol reads which
does not apply to lavfi inputs at all.

Fixes Ticket1051

Something similar could be usefull to other input devices

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavdevice/lavfi.c

index e4cacb640e1bc2d9914e9a4bfd595a5f6c8f4a11..3b6f0c382cb7864d464b35d0c179be88fe7ae249 100644 (file)
@@ -282,6 +282,10 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx)
             st->codec->height     = link->h;
             st       ->sample_aspect_ratio =
             st->codec->sample_aspect_ratio = link->sample_aspect_ratio;
+            avctx->probesize = FFMAX(avctx->probesize,
+                                     link->w * link->h *
+                                     av_get_padded_bits_per_pixel(av_pix_fmt_desc_get(link->format)) *
+                                     30);
         } else if (link->type == AVMEDIA_TYPE_AUDIO) {
             st->codec->codec_id    = av_get_pcm_codec(link->format, -1);
             st->codec->channels    = av_get_channel_layout_nb_channels(link->channel_layout);