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>2011-06-23 21:30:56 +0400
committerJoerg Mueller <nexyon@gmail.com>2011-06-23 21:30:56 +0400
commit413bc87e4f18bb46eeb2f2f52b5278d182b51de8 (patch)
tree6d67ac820f672bd132ebb628381b0a793403ff7c /source/blender/blenkernel
parentcc246eaca7bc385738658672e66a5bca8872d5a1 (diff)
parente7c6b535b0140876ef1b5650c7b259093f07c4b3 (diff)
Merge with trunk r37757.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/CMakeLists.txt10
-rw-r--r--source/blender/blenkernel/intern/sequencer.c19
-rw-r--r--source/blender/blenkernel/intern/sound.c150
-rw-r--r--source/blender/blenkernel/intern/writeffmpeg.c21
4 files changed, 136 insertions, 64 deletions
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index 9c06e325ce2..a19d48daa75 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -43,8 +43,6 @@ set(INC
../nodes
../editors/include
../render/extern/include
- ../../../intern/audaspace/intern
- ../../../intern/ffmpeg
../../../intern/bsp/extern ../blenfont
../../../intern/decimation/extern
../../../intern/elbeem/extern
@@ -237,6 +235,13 @@ set(SRC
add_definitions(-DGLEW_STATIC)
+if(WITH_AUDASPACE)
+ list(APPEND INC
+ ../../../intern/audaspace/intern
+ )
+ add_definitions(-DWITH_AUDASPACE)
+endif()
+
if(WITH_BULLET)
list(APPEND INC ../../../extern/bullet2/src)
add_definitions(-DUSE_BULLET)
@@ -278,6 +283,7 @@ if(WITH_CODEC_QUICKTIME)
endif()
if(WITH_CODEC_FFMPEG)
+ list(APPEND INC ../../../intern/ffmpeg)
list(APPEND INC_SYS ${FFMPEG_INCLUDE_DIRS})
add_definitions(-DWITH_FFMPEG)
endif()
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 550b81e8a0f..8f7076c3374 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -73,7 +73,10 @@
#include "BKE_context.h"
#include "BKE_sound.h"
-#include "AUD_C-API.h"
+
+#ifdef WITH_AUDASPACE
+# include "AUD_C-API.h"
+#endif
#ifdef WIN32
#define snprintf _snprintf
@@ -697,6 +700,7 @@ void reload_sequence_new_file(Scene *scene, Sequence * seq, int lock_range)
}
seq->strip->len = seq->len;
case SEQ_SOUND:
+#ifdef WITH_AUDASPACE
if(!seq->sound)
return;
seq->len = ceil(AUD_getInfo(seq->sound->playback_handle).length * FPS);
@@ -706,6 +710,9 @@ void reload_sequence_new_file(Scene *scene, Sequence * seq, int lock_range)
seq->len = 0;
}
seq->strip->len = seq->len;
+#else
+ return;
+#endif
break;
case SEQ_SCENE:
{
@@ -3494,6 +3501,7 @@ Sequence *sequencer_add_image_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
return seq;
}
+#ifdef WITH_AUDASPACE
Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo *seq_load)
{
Scene *scene= CTX_data_scene(C); /* only for sound */
@@ -3551,6 +3559,15 @@ Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
return seq;
}
+#else // WITH_AUDASPACE
+Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo *seq_load)
+{
+ (void)C;
+ (void)seqbasep;
+ (void)seq_load;
+ return NULL;
+}
+#endif // WITH_AUDASPACE
Sequence *sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo *seq_load)
{
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index 9b86b8752db..eb8703877ba 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -21,7 +21,9 @@
#include "DNA_screen_types.h"
#include "DNA_sound_types.h"
-#include "AUD_C-API.h"
+#ifdef WITH_AUDASPACE
+# include "AUD_C-API.h"
+#endif
#include "BKE_utildefines.h"
#include "BKE_global.h"
@@ -36,6 +38,66 @@
static int force_device = -1;
+
+struct bSound* sound_new_file(struct Main *bmain, const char *filename)
+{
+ bSound* sound = NULL;
+
+ char str[FILE_MAX];
+ char *path;
+
+ int len;
+
+ strcpy(str, filename);
+
+ path = /*bmain ? bmain->name :*/ G.main->name;
+
+ BLI_path_abs(str, path);
+
+ len = strlen(filename);
+ while(len > 0 && filename[len-1] != '/' && filename[len-1] != '\\')
+ len--;
+
+ sound = alloc_libblock(&bmain->sound, ID_SO, filename+len);
+ BLI_strncpy(sound->name, filename, FILE_MAX);
+// XXX unused currently sound->type = SOUND_TYPE_FILE;
+
+ sound_load(bmain, sound);
+
+ if(!sound->playback_handle)
+ {
+ free_libblock(&bmain->sound, sound);
+ sound = NULL;
+ }
+
+ return sound;
+}
+
+void sound_free(struct bSound* sound)
+{
+ if (sound->packedfile)
+ {
+ freePackedFile(sound->packedfile);
+ sound->packedfile = NULL;
+ }
+
+#ifdef WITH_AUDASPACE
+ if(sound->handle)
+ {
+ AUD_unload(sound->handle);
+ sound->handle = NULL;
+ sound->playback_handle = NULL;
+ }
+
+ if(sound->cache)
+ {
+ AUD_unload(sound->cache);
+ }
+#endif // WITH_AUDASPACE
+}
+
+#ifdef WITH_AUDASPACE
+
#ifdef WITH_JACK
static void sound_sync_callback(void* data, int mode, float time)
{
@@ -124,40 +186,6 @@ void sound_exit(void)
AUD_exit();
}
-struct bSound* sound_new_file(struct Main *bmain, const char *filename)
-{
- bSound* sound = NULL;
-
- char str[FILE_MAX];
- char *path;
-
- int len;
-
- strcpy(str, filename);
-
- path = /*bmain ? bmain->name :*/ G.main->name;
-
- BLI_path_abs(str, path);
-
- len = strlen(filename);
- while(len > 0 && filename[len-1] != '/' && filename[len-1] != '\\')
- len--;
-
- sound = alloc_libblock(&bmain->sound, ID_SO, filename+len);
- BLI_strncpy(sound->name, filename, FILE_MAX);
-// XXX unused currently sound->type = SOUND_TYPE_FILE;
-
- sound_load(bmain, sound);
-
- if(!sound->playback_handle)
- {
- free_libblock(&bmain->sound, sound);
- sound = NULL;
- }
-
- return sound;
-}
-
// XXX unused currently
#if 0
struct bSound* sound_new_buffer(struct bContext *C, struct bSound *source)
@@ -302,27 +330,6 @@ void sound_load(struct Main *bmain, struct bSound* sound)
}
}
-void sound_free(struct bSound* sound)
-{
- if (sound->packedfile)
- {
- freePackedFile(sound->packedfile);
- sound->packedfile = NULL;
- }
-
- if(sound->handle)
- {
- AUD_unload(sound->handle);
- sound->handle = NULL;
- sound->playback_handle = NULL;
- }
-
- if(sound->cache)
- {
- AUD_unload(sound->cache);
- }
-}
-
static float sound_get_volume(Scene* scene, Sequence* sequence, float time)
{
AnimData *adt= BKE_animdata_from_id(&scene->id);
@@ -547,3 +554,34 @@ void* sound_get_factory(void* sound)
{
return ((struct bSound*) sound)->playback_handle;
}
+
+#else // WITH_AUDASPACE
+
+#include "BLI_utildefines.h"
+
+int sound_define_from_str(const char *UNUSED(str)) { return -1;}
+void sound_force_device(int UNUSED(device)) {}
+void sound_init_once(void) {}
+void sound_init(struct Main *UNUSED(bmain)) {}
+void sound_exit(void) {}
+void sound_cache(struct bSound* UNUSED(sound), int UNUSED(ignore)) { }
+void sound_delete_cache(struct bSound* UNUSED(sound)) {}
+void sound_load(struct Main *UNUSED(bmain), struct bSound* UNUSED(sound)) {}
+void sound_create_scene(struct Scene *UNUSED(scene)) {}
+void sound_destroy_scene(struct Scene *UNUSED(scene)) {}
+void sound_mute_scene(struct Scene *UNUSED(scene), int UNUSED(muted)) {}
+void* sound_scene_add_scene_sound(struct Scene *UNUSED(scene), struct Sequence* UNUSED(sequence), int UNUSED(startframe), int UNUSED(endframe), int UNUSED(frameskip)) { return NULL; }
+void* sound_add_scene_sound(struct Scene *UNUSED(scene), struct Sequence* UNUSED(sequence), int UNUSED(startframe), int UNUSED(endframe), int UNUSED(frameskip)) { return NULL; }
+void sound_remove_scene_sound(struct Scene *UNUSED(scene), void* UNUSED(handle)) {}
+void sound_mute_scene_sound(struct Scene *UNUSED(scene), void* UNUSED(handle), char UNUSED(mute)) {}
+void sound_move_scene_sound(struct Scene *UNUSED(scene), void* UNUSED(handle), int UNUSED(startframe), int UNUSED(endframe), int UNUSED(frameskip)) {}
+static void sound_start_play_scene(struct Scene *UNUSED(scene)) {}
+void sound_play_scene(struct Scene *UNUSED(scene)) {}
+void sound_stop_scene(struct Scene *UNUSED(scene)) {}
+void sound_seek_scene(struct bContext *UNUSED(C)) {}
+float sound_sync_scene(struct Scene *UNUSED(scene)) { return 0.0f; }
+int sound_scene_playing(struct Scene *UNUSED(scene)) { return 0; }
+int sound_read_sound_buffer(struct bSound* UNUSED(sound), float* UNUSED(buffer), int UNUSED(length), float UNUSED(start), float UNUSED(end)) { return 0; }
+int sound_get_channels(struct bSound* UNUSED(sound)) { return 1; }
+
+#endif // WITH_AUDASPACE
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index 0ce57a57fe7..ae4387c12f9 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -49,7 +49,9 @@
#include "BLI_blenlib.h"
-#include "AUD_C-API.h" /* must be before BKE_sound.h for define */
+#ifdef WITH_AUDASPACE
+# include "AUD_C-API.h"
+#endif
#include "BKE_global.h"
#include "BKE_idprop.h"
@@ -89,7 +91,9 @@ static uint8_t* audio_output_buffer = 0;
static int audio_outbuf_size = 0;
static double audio_time = 0.0f;
+#ifdef WITH_AUDASPACE
static AUD_Device* audio_mixdown_device = 0;
+#endif
#define FFMPEG_AUTOSPLIT_SIZE 2000000000
@@ -103,6 +107,7 @@ static void delete_picture(AVFrame* f)
}
}
+#ifdef WITH_AUDASPACE
static int write_audio_frame(void)
{
AVCodecContext* c = NULL;
@@ -145,6 +150,7 @@ static int write_audio_frame(void)
}
return 0;
}
+#endif // #ifdef WITH_AUDASPACE
/* Allocate a temporary frame */
static AVFrame* alloc_picture(int pix_fmt, int width, int height)
@@ -850,7 +856,7 @@ int start_ffmpeg(struct Scene *scene, RenderData *rd, int rectx, int recty, Repo
ffmpeg_autosplit_count = 0;
success = start_ffmpeg_impl(rd, rectx, recty, reports);
-
+#ifdef WITH_AUDASPACE
if(audio_stream)
{
AVCodecContext* c = audio_stream->codec;
@@ -864,12 +870,13 @@ int start_ffmpeg(struct Scene *scene, RenderData *rd, int rectx, int recty, Repo
c->time_base.num = 1;
#endif
}
-
+#endif
return success;
}
void end_ffmpeg(void);
+#ifdef WITH_AUDASPACE
static void write_audio_frames(double to_pts)
{
int finished = 0;
@@ -881,6 +888,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)
{
@@ -908,8 +916,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));
-
+#endif
return success;
}
@@ -923,12 +932,14 @@ void end_ffmpeg(void)
write_audio_frames();
}*/
+#ifdef WITH_AUDASPACE
if(audio_mixdown_device)
{
AUD_closeReadDevice(audio_mixdown_device);
audio_mixdown_device = 0;
}
-
+#endif
+
if (video_stream && video_stream->codec) {
fprintf(stderr, "Flushing delayed frames...\n");
flush_ffmpeg ();