diff --git a/intern/audaspace/intern/AUD_C-API.cpp b/intern/audaspace/intern/AUD_C-API.cpp index f7394e36c4d..32cfd2098b0 100644 --- a/intern/audaspace/intern/AUD_C-API.cpp +++ b/intern/audaspace/intern/AUD_C-API.cpp @@ -84,11 +84,15 @@ static AUD_IDevice* AUD_device = NULL; static int AUD_available_devices[4]; static AUD_I3DDevice* AUD_3ddevice = NULL; -int AUD_init(AUD_DeviceType device, AUD_DeviceSpecs specs, int buffersize) +void AUD_initOnce() { #ifdef WITH_FFMPEG av_register_all(); #endif +} + +int AUD_init(AUD_DeviceType device, AUD_DeviceSpecs specs, int buffersize) +{ AUD_IDevice* dev = NULL; if(AUD_device) diff --git a/intern/audaspace/intern/AUD_C-API.h b/intern/audaspace/intern/AUD_C-API.h index a7372c29885..55aed02153f 100644 --- a/intern/audaspace/intern/AUD_C-API.h +++ b/intern/audaspace/intern/AUD_C-API.h @@ -55,6 +55,11 @@ typedef struct typedef void (*AUD_syncFunction)(void*, int, float); #endif +/** + * Initializes FFMPEG if it is enabled. + */ +extern void AUD_initOnce(); + /** * Initializes an audio device. * \param device The device type that should be used. diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h index b89767d2586..50c86e80b08 100644 --- a/source/blender/blenkernel/BKE_sound.h +++ b/source/blender/blenkernel/BKE_sound.h @@ -38,6 +38,8 @@ struct ListBase; struct Main; struct Sequence; +void sound_init_once(); + void sound_init(struct Main *main); void sound_exit(); diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index fc003b12959..24e5014a741 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -73,6 +73,11 @@ void sound_force_device(int device) force_device = device; } +void sound_init_once() +{ + AUD_initOnce(); +} + void sound_init(struct Main *bmain) { AUD_DeviceSpecs specs; diff --git a/source/creator/creator.c b/source/creator/creator.c index 68b99b20d01..436275e8c6b 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -1001,6 +1001,10 @@ int main(int argc, char **argv) /* background render uses this font too */ BKE_font_register_builtin(datatoc_Bfont, datatoc_Bfont_size); + + /* Initialiaze ffmpeg if built in, also needed for bg mode if videos are + rendered via ffmpeg */ + sound_init_once(); init_def_material(); @@ -1015,11 +1019,13 @@ int main(int argc, char **argv) #ifndef DISABLE_SDL BLI_setenv("SDL_VIDEODRIVER", "dummy"); +/* I think this is not necessary anymore (04-24-2010 neXyon) #ifdef __linux__ - /* On linux the default SDL driver dma often would not play - * use alsa if none is set */ + // On linux the default SDL driver dma often would not play + // use alsa if none is set setenv("SDL_AUDIODRIVER", "alsa", 0); #endif +*/ #endif } else {