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:
Diffstat (limited to 'intern/audaspace')
-rw-r--r--intern/audaspace/CMakeLists.txt96
-rw-r--r--intern/audaspace/OpenAL/AUD_OpenALDevice.cpp18
-rw-r--r--intern/audaspace/OpenAL/AUD_OpenALDevice.h2
-rw-r--r--intern/audaspace/SConscript2
-rw-r--r--intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp24
5 files changed, 88 insertions, 54 deletions
diff --git a/intern/audaspace/CMakeLists.txt b/intern/audaspace/CMakeLists.txt
index 74f483eab05..7eef13b103b 100644
--- a/intern/audaspace/CMakeLists.txt
+++ b/intern/audaspace/CMakeLists.txt
@@ -1,7 +1,7 @@
# $Id$
# ***** BEGIN LGPL LICENSE BLOCK *****
#
-# Copyright 2009 Jörg Hermann Müller
+# Copyright 2009 Jrg Hermann Mller
#
# This file is part of AudaSpace.
#
@@ -22,10 +22,14 @@
set(INC
.
+ FX
+ SRC
intern
- FX SRC
- ${PTHREADS_INC}
- ${LIBSAMPLERATE_INC}
+ ../ffmpeg
+)
+
+set(INC_SYS
+ ${PTHREADS_INCLUDE_DIRS}
)
set(SRC
@@ -155,8 +159,13 @@ set(SRC
if(WITH_CODEC_FFMPEG)
add_definitions(-DWITH_FFMPEG)
- list(APPEND INC ffmpeg ${FFMPEG_INC})
- set(FFMPEGSRC
+ list(APPEND INC
+ ffmpeg
+ )
+ list(APPEND INC_SYS
+ ${FFMPEG_INCLUDE_DIRS}
+ )
+ list(APPEND SRC
ffmpeg/AUD_FFMPEGFactory.cpp
ffmpeg/AUD_FFMPEGReader.cpp
@@ -167,8 +176,13 @@ endif()
if(WITH_SDL)
add_definitions(-DWITH_SDL)
- list(APPEND INC SDL ${SDL_INCLUDE_DIR})
- set(SDLSRC
+ list(APPEND INC
+ SDL
+ )
+ list(APPEND INC_SYS
+ ${SDL_INCLUDE_DIR}
+ )
+ list(APPEND SRC
SDL/AUD_SDLDevice.cpp
SDL/AUD_SDLDevice.h
@@ -177,18 +191,28 @@ endif()
if(WITH_OPENAL)
add_definitions(-DWITH_OPENAL)
- list(APPEND INC OpenAL ${OPENAL_INCLUDE_DIR})
- set(OPENALSRC
+ list(APPEND INC
+ OpenAL
+ )
+ list(APPEND INC_SYS
+ ${OPENAL_INCLUDE_DIR}
+ )
+ list(APPEND SRC
OpenAL/AUD_OpenALDevice.cpp
OpenAL/AUD_OpenALDevice.h
- )
+ )
endif()
if(WITH_JACK)
add_definitions(-DWITH_JACK)
- list(APPEND INC jack ${JACK_INC})
- set(JACKSRC
+ list(APPEND INC
+ jack
+ )
+ list(APPEND INC_SYS
+ ${JACK_INCLUDE_DIRS}
+ )
+ list(APPEND SRC
jack/AUD_JackDevice.cpp
jack/AUD_JackDevice.h
@@ -197,8 +221,13 @@ endif()
if(WITH_CODEC_SNDFILE)
add_definitions(-DWITH_SNDFILE)
- list(APPEND INC sndfile ${SNDFILE_INC})
- set(SNDFILESRC
+ list(APPEND INC
+ sndfile
+ )
+ list(APPEND INC_SYS
+ ${SNDFILE_INCLUDE_DIRS}
+ )
+ list(APPEND SRC
sndfile/AUD_SndFileFactory.cpp
sndfile/AUD_SndFileReader.cpp
@@ -209,7 +238,10 @@ endif()
if(WITH_SAMPLERATE)
add_definitions(-DWITH_SAMPLERATE)
- set(SRCFILESRC
+ list(APPEND INC_SYS
+ ${SAMPLERATE_INCLUDE_DIRS}
+ )
+ list(APPEND SRC
SRC/AUD_SRCResampleFactory.cpp
SRC/AUD_SRCResampleReader.cpp
@@ -220,8 +252,13 @@ endif()
if(WITH_FFTW3 AND FALSE)
add_definitions(-DWITH_FFTW3)
- list(APPEND INC fftw ${FFTW3_INC})
- set(FFTW3SRC
+ list(APPEND INC
+ fftw
+ )
+ list(APPEND INC_SYS
+ ${FFTW3_INCLUDE_DIRS}
+ )
+ list(APPEND SRC
fftw/AUD_BandPassFactory.cpp
fftw/AUD_BandPassReader.cpp
@@ -231,8 +268,13 @@ if(WITH_FFTW3 AND FALSE)
endif()
if(WITH_PYTHON)
- list(APPEND INC Python ${PYTHON_INCLUDE_DIRS})
- set(PYTHONSRC
+ list(APPEND INC
+ Python
+ )
+ list(APPEND INC_SYS
+ ${PYTHON_INCLUDE_DIRS}
+ )
+ list(APPEND SRC
Python/AUD_PyAPI.cpp
Python/AUD_PyAPI.h
@@ -240,16 +282,4 @@ if(WITH_PYTHON)
add_definitions(-DWITH_PYTHON)
endif()
-set(SRC
- ${SRC}
- ${FFMPEGSRC}
- ${SNDFILESRC}
- ${SRCFILESRC}
- ${FFTW3SRC}
- ${SDLSRC}
- ${OPENALSRC}
- ${JACKSRC}
- ${PYTHONSRC}
-)
-
-blender_add_lib(bf_intern_audaspace "${SRC}" "${INC}")
+blender_add_lib(bf_intern_audaspace "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp b/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp
index b9e30bbf62a..71e7b7677e8 100644
--- a/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp
+++ b/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp
@@ -105,12 +105,15 @@ void* AUD_openalRunThread(void* device)
return NULL;
}
-void AUD_OpenALDevice::start()
+void AUD_OpenALDevice::start(bool join)
{
lock();
if(!m_playing)
{
+ if(join)
+ pthread_join(m_thread, NULL);
+
pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
@@ -271,8 +274,8 @@ void AUD_OpenALDevice::updateStreams()
// stop thread
if(m_playingSounds->empty() || (cerr != ALC_NO_ERROR))
{
- unlock();
m_playing = false;
+ unlock();
pthread_exit(NULL);
}
@@ -366,6 +369,8 @@ AUD_OpenALDevice::AUD_OpenALDevice(AUD_DeviceSpecs specs, int buffersize)
pthread_mutex_init(&m_mutex, &attr);
pthread_mutexattr_destroy(&attr);
+
+ start(false);
}
AUD_OpenALDevice::~AUD_OpenALDevice()
@@ -414,13 +419,8 @@ AUD_OpenALDevice::~AUD_OpenALDevice()
alcProcessContext(m_context);
// wait for the thread to stop
- if(m_playing)
- {
- unlock();
- pthread_join(m_thread, NULL);
- }
- else
- unlock();
+ unlock();
+ pthread_join(m_thread, NULL);
delete m_playingSounds;
delete m_pausedSounds;
diff --git a/intern/audaspace/OpenAL/AUD_OpenALDevice.h b/intern/audaspace/OpenAL/AUD_OpenALDevice.h
index 3bbbe85d7e6..127f69beca8 100644
--- a/intern/audaspace/OpenAL/AUD_OpenALDevice.h
+++ b/intern/audaspace/OpenAL/AUD_OpenALDevice.h
@@ -106,7 +106,7 @@ private:
/**
* Starts the streaming thread.
*/
- void start();
+ void start(bool join = true);
/**
* Checks if a handle is valid.
diff --git a/intern/audaspace/SConscript b/intern/audaspace/SConscript
index ecc94987185..67f859b0e5f 100644
--- a/intern/audaspace/SConscript
+++ b/intern/audaspace/SConscript
@@ -8,7 +8,7 @@ defs = []
if env['WITH_BF_FFMPEG']:
sources += env.Glob('ffmpeg/*.cpp')
- incs += ' ffmpeg ' + env['BF_FFMPEG_INC']
+ incs += ' ffmpeg #/intern/ffmpeg ' + env['BF_FFMPEG_INC']
defs.append('WITH_FFMPEG')
if env['WITH_BF_SDL']:
diff --git a/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp b/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp
index ea6e0c549fa..4597432e7d1 100644
--- a/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp
+++ b/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp
@@ -39,6 +39,7 @@
extern "C" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
+#include "ffmpeg_compat.h"
}
int AUD_FFMPEGReader::decode(AVPacket* packet, AUD_Buffer& buffer)
@@ -52,6 +53,10 @@ int AUD_FFMPEGReader::decode(AVPacket* packet, AUD_Buffer& buffer)
int read_length, data_size;
+ AVPacket tmp_pkt;
+
+ av_init_packet(&tmp_pkt);
+
// as long as there is still data in the package
while(audio_pkg_size > 0)
{
@@ -64,15 +69,14 @@ int AUD_FFMPEGReader::decode(AVPacket* packet, AUD_Buffer& buffer)
// read samples from the packet
data_size = buf_size - buf_pos;
- /*read_length = avcodec_decode_audio3(m_codecCtx,
- (int16_t*)(((data_t*)buffer.getBuffer())+buf_pos),
- &data_size,
- packet);*/
- read_length = avcodec_decode_audio2(m_codecCtx,
- (int16_t*)(((data_t*)buffer.getBuffer()) + buf_pos),
- &data_size,
- audio_pkg_data,
- audio_pkg_size);
+
+ tmp_pkt.data = audio_pkg_data;
+ tmp_pkt.size = audio_pkg_size;
+
+ read_length = avcodec_decode_audio3(
+ m_codecCtx,
+ (int16_t*)(((data_t*)buffer.getBuffer()) + buf_pos),
+ &data_size, &tmp_pkt);
// read error, next packet!
if(read_length < 0)
@@ -112,7 +116,7 @@ void AUD_FFMPEGReader::init()
for(unsigned int i = 0; i < m_formatCtx->nb_streams; i++)
{
- if((m_formatCtx->streams[i]->codec->codec_type == CODEC_TYPE_AUDIO)
+ if((m_formatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO)
&& (m_stream < 0))
{
m_stream=i;