allow building with ffmpeg but not aud

This commit is contained in:
Campbell Barton
2011-06-23 16:10:48 +00:00
parent bb3742fe91
commit 99253abef8
2 changed files with 14 additions and 5 deletions

View File

@@ -203,7 +203,7 @@ if(NOT WITH_GAMEENGINE AND WITH_PLAYER)
message(FATAL_ERROR "WITH_PLAYER requires WITH_GAMEENGINE") message(FATAL_ERROR "WITH_PLAYER requires WITH_GAMEENGINE")
endif() endif()
if(NOT WITH_AUDASPACE AND (WITH_OPENAL OR WITH_SDL OR WITH_JACK OR WITH_CODEC_FFMPEG)) if(NOT WITH_AUDASPACE AND (WITH_OPENAL OR WITH_SDL OR WITH_JACK))
message(FATAL_ERROR "WITH_OPENAL/WITH_SDL/WITH_JACK/WITH_CODEC_FFMPEG require WITH_AUDASPACE") message(FATAL_ERROR "WITH_OPENAL/WITH_SDL/WITH_JACK/WITH_CODEC_FFMPEG require WITH_AUDASPACE")
endif() endif()

View File

@@ -91,7 +91,9 @@ static uint8_t* audio_output_buffer = 0;
static int audio_outbuf_size = 0; static int audio_outbuf_size = 0;
static double audio_time = 0.0f; static double audio_time = 0.0f;
#ifdef WITH_AUDASPACE
static AUD_Device* audio_mixdown_device = 0; static AUD_Device* audio_mixdown_device = 0;
#endif
#define FFMPEG_AUTOSPLIT_SIZE 2000000000 #define FFMPEG_AUTOSPLIT_SIZE 2000000000
@@ -105,6 +107,7 @@ static void delete_picture(AVFrame* f)
} }
} }
#ifdef WITH_AUDASPACE
static int write_audio_frame(void) static int write_audio_frame(void)
{ {
AVCodecContext* c = NULL; AVCodecContext* c = NULL;
@@ -147,6 +150,7 @@ static int write_audio_frame(void)
} }
return 0; return 0;
} }
#endif // #ifdef WITH_AUDASPACE
/* Allocate a temporary frame */ /* Allocate a temporary frame */
static AVFrame* alloc_picture(int pix_fmt, int width, int height) static AVFrame* alloc_picture(int pix_fmt, int width, int height)
@@ -853,7 +857,7 @@ int start_ffmpeg(struct Scene *scene, RenderData *rd, int rectx, int recty, Repo
ffmpeg_autosplit_count = 0; ffmpeg_autosplit_count = 0;
success = start_ffmpeg_impl(rd, rectx, recty, reports); success = start_ffmpeg_impl(rd, rectx, recty, reports);
#ifdef WITH_AUDASPACE
if(audio_stream) if(audio_stream)
{ {
AVCodecContext* c = audio_stream->codec; AVCodecContext* c = audio_stream->codec;
@@ -863,12 +867,13 @@ int start_ffmpeg(struct Scene *scene, RenderData *rd, int rectx, int recty, Repo
specs.rate = rd->ffcodecdata.audio_mixrate; specs.rate = rd->ffcodecdata.audio_mixrate;
audio_mixdown_device = sound_mixdown(scene, specs, rd->sfra, rd->ffcodecdata.audio_volume); audio_mixdown_device = sound_mixdown(scene, specs, rd->sfra, rd->ffcodecdata.audio_volume);
} }
#endif
return success; return success;
} }
void end_ffmpeg(void); void end_ffmpeg(void);
#ifdef WITH_AUDASPACE
static void write_audio_frames(double to_pts) static void write_audio_frames(double to_pts)
{ {
int finished = 0; int finished = 0;
@@ -880,6 +885,7 @@ static void write_audio_frames(double to_pts)
} }
} }
} }
#endif
int append_ffmpeg(RenderData *rd, int frame, int *pixels, int rectx, int recty, ReportList *reports) int append_ffmpeg(RenderData *rd, int frame, int *pixels, int rectx, int recty, ReportList *reports)
{ {
@@ -907,8 +913,9 @@ int append_ffmpeg(RenderData *rd, int frame, int *pixels, int rectx, int recty,
} }
} }
#ifdef WITH_AUDASPACE
write_audio_frames((frame - rd->sfra) / (((double)rd->frs_sec) / rd->frs_sec_base)); write_audio_frames((frame - rd->sfra) / (((double)rd->frs_sec) / rd->frs_sec_base));
#endif
return success; return success;
} }
@@ -922,12 +929,14 @@ void end_ffmpeg(void)
write_audio_frames(); write_audio_frames();
}*/ }*/
#ifdef WITH_AUDASPACE
if(audio_mixdown_device) if(audio_mixdown_device)
{ {
AUD_closeReadDevice(audio_mixdown_device); AUD_closeReadDevice(audio_mixdown_device);
audio_mixdown_device = 0; audio_mixdown_device = 0;
} }
#endif
if (video_stream && video_stream->codec) { if (video_stream && video_stream->codec) {
fprintf(stderr, "Flushing delayed frames...\n"); fprintf(stderr, "Flushing delayed frames...\n");
flush_ffmpeg (); flush_ffmpeg ();