Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoerg Mueller <nexyon@gmail.com>2009-08-10 01:16:39 +0400
committerJoerg Mueller <nexyon@gmail.com>2009-08-10 01:16:39 +0400
commit6c5c58e05799f2b593cd81fcff57e6ef72ad57fb (patch)
tree8add929ef94d03fc69aecce6ef2baf283505782f /source/blender/blenkernel/intern/writeffmpeg.c
parentc1ca2ab5dceb8d5355215a3c7a80b171f394e487 (diff)
2.5: Sound branch merge!
See mailing list for additional information.
Diffstat (limited to 'source/blender/blenkernel/intern/writeffmpeg.c')
-rw-r--r--source/blender/blenkernel/intern/writeffmpeg.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index 5e3c8024524..e7164dc4794 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -65,6 +65,10 @@
#include "DNA_scene_types.h"
+#include "AUD_C-API.h"
+#include "BKE_sound.h"
+#include "BKE_main.h"
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -96,6 +100,8 @@ static int audio_input_frame_size = 0;
static uint8_t* audio_output_buffer = 0;
static int audio_outbuf_size = 0;
+static AUD_Device* audio_mixdown_device = 0;
+
#define FFMPEG_AUTOSPLIT_SIZE 2000000000
/* Delete a picture buffer */
@@ -127,9 +133,8 @@ static int write_audio_frame(void)
c = get_codec_from_stream(audio_stream);
- //XXX audiostream_fill(audio_input_buffer,
- // audio_input_frame_size
- // * sizeof(short) * c->channels);
+ if(audio_mixdown_device)
+ AUD_readDevice(audio_mixdown_device, audio_input_buffer, audio_input_frame_size);
av_init_packet(&pkt);
@@ -827,11 +832,21 @@ static void makeffmpegstring(RenderData* rd, char* string) {
}
-void start_ffmpeg(RenderData *rd, int rectx, int recty)
+void start_ffmpeg(struct Scene *scene, RenderData *rd, int rectx, int recty)
{
ffmpeg_autosplit_count = 0;
start_ffmpeg_impl(rd, rectx, recty);
+
+ if(ffmpeg_multiplex_audio && audio_stream)
+ {
+ AVCodecContext* c = get_codec_from_stream(audio_stream);
+ AUD_Specs specs;
+ specs.channels = c->channels;
+ specs.format = AUD_FORMAT_S16;
+ specs.rate = rd->audio.mixrate;
+ audio_mixdown_device = sound_mixdown(scene, specs, rd->sfra, rd->efra);
+ }
}
void end_ffmpeg(void);
@@ -884,6 +899,12 @@ void end_ffmpeg(void)
if (audio_stream && video_stream) {
write_audio_frames();
}
+
+ if(audio_mixdown_device)
+ {
+ AUD_closeReadDevice(audio_mixdown_device);
+ audio_mixdown_device = 0;
+ }
if (outfile) {
av_write_trailer(outfile);