[FFmpeg-devel] libavformat/utils.c - bug when using AVFMT_NOFILE.

wallak at free.fr wallak at free.fr
Wed Jun 22 23:19:33 CEST 2011


I was trying softdevice (a vdr plugin) with the last ffmpeg trunk. A regression
seems to be added this month. The code was modified and show some
inconsistencies. A fix is available below.

Best Regards,
Wallak.

---
ffmpeg-20110619-0aed4f81fe5b9b15ab9b35baa4300f29ab03d65f/libavformat/utils.c.orig
  2011-06-21 23:09:04.000000000 +0200
+++ ffmpeg-20110619-0aed4f81fe5b9b15ab9b35baa4300f29ab03d65f/libavformat/utils.c
       2011-06-22 01:35:41.000000000 +0200
@@ -454,7 +454,7 @@
     opts = convert_format_parameters(ap);

     if(!ap->prealloced_context)
-        ic = avformat_alloc_context();
+      { ic = avformat_alloc_context(); if (ic_ptr) *ic_ptr = ic; }
     else
         ic = *ic_ptr;
     if (!ic) {
@@ -583,6 +583,9 @@
     int ret;
     AVProbeData pd = {filename, NULL, 0};

+    if ( (s->iformat && s->iformat->flags & AVFMT_NOFILE) )
+      return 0;
+
     if (s->pb) {
         s->flags |= AVFMT_FLAG_CUSTOM_IO;
         if (!s->iformat)
@@ -592,8 +595,7 @@
         return 0;
     }

-    if ( (s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
-        (!s->iformat && (s->iformat = av_probe_input_format(&pd, 0))))
+    if ( (!s->iformat && (s->iformat = av_probe_input_format(&pd, 0))))
         return 0;

     if ((ret = avio_open(&s->pb, filename, AVIO_FLAG_READ)) < 0)



More information about the ffmpeg-devel mailing list