[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11740] branches/soc-2007-hcube/source/ blender/blenkernel/intern/writeffmpeg.c: Added skeleton of ffmpeg sound writing.

Csaba Hruska csaba.hruska at gmail.com
Mon Aug 20 14:17:03 CEST 2007


Revision: 11740
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11740
Author:   hcube
Date:     2007-08-20 14:17:03 +0200 (Mon, 20 Aug 2007)

Log Message:
-----------
Added skeleton of ffmpeg sound writing.

Modified Paths:
--------------
    branches/soc-2007-hcube/source/blender/blenkernel/intern/writeffmpeg.c

Modified: branches/soc-2007-hcube/source/blender/blenkernel/intern/writeffmpeg.c
===================================================================
--- branches/soc-2007-hcube/source/blender/blenkernel/intern/writeffmpeg.c	2007-08-20 12:16:11 UTC (rev 11739)
+++ branches/soc-2007-hcube/source/blender/blenkernel/intern/writeffmpeg.c	2007-08-20 12:17:03 UTC (rev 11740)
@@ -58,6 +58,10 @@
 #include "DNA_scene_types.h"
 #include "blendef.h"
 
+// by hcube
+#include "BAU_soundsystem.h"
+#include "BSE_seqaudio.h"
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
@@ -90,6 +94,8 @@
 
 static RenderData *ffmpeg_renderdata = 0;
 
+static int oldCFRA = 0;
+
 #define FFMPEG_AUTOSPLIT_SIZE 2000000000
 
 /* Delete a picture buffer */
@@ -122,11 +128,9 @@
 	c = get_codec_from_stream(audio_stream);
 
     // by hcube
-    /*
-	audiostream_fill(audio_input_buffer, 
-			 audio_input_frame_size 
-			 * sizeof(short) * c->channels);
-    */
+	CFRA = seqaudio_getframeposition();
+	audio_mixbuffer_fill(audio_input_buffer, audio_input_frame_size);
+
 	av_init_packet(&pkt);
 
 	pkt.size = avcodec_encode_audio(c, audio_output_buffer,
@@ -625,8 +629,13 @@
 			error("Error initializing audio stream");
 			return;
 		}
-        // by hcube
-		//audiostream_play(SFRA, 0, 1);
+	    // by hcube
+		if (!audio_mixbuffer_open(44100.0)) {
+			return;
+		}
+		oldCFRA = CFRA;
+		CFRA = SFRA;
+		seqaudio_play();
 	}
 	if (av_set_parameters(of, NULL) < 0) {
 		G.afbreek = 1;
@@ -755,6 +764,13 @@
 	if (outfile) {
 		av_write_trailer(outfile);
 	}
+
+	// by hcube
+	if (ffmpeg_multiplex_audio) {
+		seqaudio_stop();
+		audio_mixbuffer_close();
+		CFRA = oldCFRA;
+	}
 	
 	/* Close the video codec */
 





More information about the Bf-blender-cvs mailing list