avimux: do not write empty INFO list
authorThiago Santos <thiago.sousa.santos@collabora.co.uk>
Thu, 5 Nov 2009 15:13:44 +0000 (12:13 -0300)
committerThiago Santos <thiago.sousa.santos@collabora.co.uk>
Thu, 5 Nov 2009 15:31:56 +0000 (12:31 -0300)
avoid writing an empty INFO list chunk, both because
it is useless and because vlc refuses to play the
resulting file.

gst/avi/gstavimux.c

index 584f0e7..ac1e814 100644 (file)
@@ -1399,8 +1399,16 @@ gst_avi_mux_riff_get_avi_header (GstAviMux * avimux)
     GST_BUFFER_SIZE (buffer) += 12;
     buffdata = GST_BUFFER_DATA (buffer) + highmark;
 
-    /* update list size */
-    GST_WRITE_UINT32_LE (ptr, highmark - startsize - 4);
+    if (highmark - startsize - 4 == 4) {
+      /* no tags writen, remove the empty INFO LIST as it is useless
+       * and prevents playback in vlc */
+      highmark -= 12;
+      buffdata = GST_BUFFER_DATA (buffer) + highmark;
+      /* no need to erase the writen data, it will be overwriten anyway */
+    } else {
+      /* update list size */
+      GST_WRITE_UINT32_LE (ptr, highmark - startsize - 4);
+    }
   }
 
   /* avi data header */