[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [40785] trunk/blender/source/blender/ blenkernel/intern/writeffmpeg.c: Partial fix #27978: Problem exporting OGG Theora-Vorbis video (and other audio codecs)

Sergey Sharybin g.ulairi at gmail.com
Tue Oct 4 14:30:26 CEST 2011


Revision: 40785
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40785
Author:   nazgul
Date:     2011-10-04 12:30:26 +0000 (Tue, 04 Oct 2011)
Log Message:
-----------
Partial fix #27978: Problem exporting OGG Theora-Vorbis video (and other audio codecs)

Ogg format does support only vorbis, theora, speex and flac audio codecs.
Added check for result of av_write_header() and show info in header about
error while initializing streams.

This commit also fixed crash when using vorbis audio format.
It used to be floating point exception. SOlved by initializing
audio_stream->codec->time_base with proper rational value as it's
done in FFmpeg sources.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/writeffmpeg.c

Modified: trunk/blender/source/blender/blenkernel/intern/writeffmpeg.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/writeffmpeg.c	2011-10-04 12:27:48 UTC (rev 40784)
+++ trunk/blender/source/blender/blenkernel/intern/writeffmpeg.c	2011-10-04 12:30:26 UTC (rev 40785)
@@ -571,6 +571,10 @@
 		return NULL;
 	}
 
+	/* need to prevent floating point exception when using vorbis audio codec,
+	   initialize this value in the same way as it's done in FFmpeg iteslf (sergey) */
+	st->codec->time_base = (AVRational){1, st->codec->sample_rate};
+
 	audio_outbuf_size = FF_MIN_BUFFER_SIZE;
 
 	if((c->codec_id >= CODEC_ID_PCM_S16LE) && (c->codec_id <= CODEC_ID_PCM_DVD))
@@ -743,7 +747,11 @@
 		}
 	}
 
-	av_write_header(of);
+	if (av_write_header(of) < 0) {
+		BKE_report(reports, RPT_ERROR, "Could not initialize streams. Probably unsupported codec combination.");
+		return 0;
+	}
+
 	outfile = of;
 	av_dump_format(of, 0, name, 1);
 




More information about the Bf-blender-cvs mailing list