@@ -384,6 +384,11 @@ add_library(carla::native-plugins ALIAS carla-native-plugins) | |||||
set_common_target_properties(carla-native-plugins) | set_common_target_properties(carla-native-plugins) | ||||
target_compile_definitions(carla-native-plugins | |||||
PRIVATE | |||||
$<$<BOOL:${MSVC}>:_USE_MATH_DEFINES> | |||||
) | |||||
target_include_directories(carla-native-plugins | target_include_directories(carla-native-plugins | ||||
PRIVATE | PRIVATE | ||||
../source/includes | ../source/includes | ||||
@@ -435,6 +440,7 @@ target_link_libraries(carla-rtmempool | |||||
PRIVATE | PRIVATE | ||||
${CARLA_LIBDL} | ${CARLA_LIBDL} | ||||
${CARLA_LIBRT} | ${CARLA_LIBRT} | ||||
${CARLA_PTHREADS} | |||||
) | ) | ||||
target_sources(carla-rtmempool | target_sources(carla-rtmempool | ||||
@@ -494,6 +500,7 @@ target_link_libraries(carla-water | |||||
$<$<BOOL:${WIN32}>:winmm> | $<$<BOOL:${WIN32}>:winmm> | ||||
${CARLA_LIBDL} | ${CARLA_LIBDL} | ||||
${CARLA_LIBRT} | ${CARLA_LIBRT} | ||||
${CARLA_PTHREADS} | |||||
) | ) | ||||
target_sources(carla-water | target_sources(carla-water | ||||
@@ -630,6 +637,11 @@ target_include_directories(carla-zita-resampler | |||||
../source/includes | ../source/includes | ||||
) | ) | ||||
target_link_libraries(carla-zita-resampler | |||||
PRIVATE | |||||
${CARLA_PTHREADS} | |||||
) | |||||
target_sources(carla-zita-resampler | target_sources(carla-zita-resampler | ||||
PRIVATE | PRIVATE | ||||
../source/modules/zita-resampler/cresampler.cc | ../source/modules/zita-resampler/cresampler.cc | ||||
@@ -16,16 +16,17 @@ | |||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||||
*/ | */ | ||||
#include "ad_plugin.h" | |||||
#ifdef HAVE_FFMPEG | |||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <string.h> | #include <string.h> | ||||
#include <unistd.h> | #include <unistd.h> | ||||
#include <math.h> | #include <math.h> | ||||
#include "ad_plugin.h" | |||||
#ifdef HAVE_FFMPEG | |||||
#include "ffcompat.h" | #include "ffcompat.h" | ||||
#ifndef MIN | #ifndef MIN | ||||
@@ -93,10 +94,10 @@ static int ad_info_ffmpeg(void *sf, struct adinfo *nfo) { | |||||
static void *ad_open_ffmpeg(const char *fn, struct adinfo *nfo) { | static void *ad_open_ffmpeg(const char *fn, struct adinfo *nfo) { | ||||
ffmpeg_audio_decoder *priv = (ffmpeg_audio_decoder*) calloc(1, sizeof(ffmpeg_audio_decoder)); | ffmpeg_audio_decoder *priv = (ffmpeg_audio_decoder*) calloc(1, sizeof(ffmpeg_audio_decoder)); | ||||
priv->m_tmpBufferStart=NULL; | priv->m_tmpBufferStart=NULL; | ||||
priv->m_tmpBufferLen=0; | priv->m_tmpBufferLen=0; | ||||
priv->decoder_clock=priv->output_clock=priv->seek_frame=0; | |||||
priv->decoder_clock=priv->output_clock=priv->seek_frame=0; | |||||
priv->packet.size=0; priv->packet.data=NULL; | priv->packet.size=0; priv->packet.data=NULL; | ||||
if (avformat_open_input(&priv->formatContext, fn, NULL, NULL) <0) { | if (avformat_open_input(&priv->formatContext, fn, NULL, NULL) <0) { | ||||
@@ -154,7 +155,7 @@ static void *ad_open_ffmpeg(const char *fn, struct adinfo *nfo) { | |||||
} | } | ||||
dbg(1, "ffmpeg - %s", fn); | dbg(1, "ffmpeg - %s", fn); | ||||
if (nfo) | |||||
if (nfo) | |||||
dbg(1, "ffmpeg - sr:%i c:%i d:%"PRIi64" f:%"PRIi64, nfo->sample_rate, nfo->channels, nfo->length, nfo->frames); | dbg(1, "ffmpeg - sr:%i c:%i d:%"PRIi64" f:%"PRIi64, nfo->sample_rate, nfo->channels, nfo->length, nfo->frames); | ||||
return (void*) priv; | return (void*) priv; | ||||
@@ -275,9 +276,9 @@ static ssize_t ad_read_ffmpeg(void *sf, float* d, size_t len) { | |||||
} | } | ||||
/* align buffer after seek. */ | /* align buffer after seek. */ | ||||
if (priv->seek_frame > 0) { | |||||
if (priv->seek_frame > 0) { | |||||
const int diff = priv->output_clock-priv->decoder_clock; | const int diff = priv->output_clock-priv->decoder_clock; | ||||
if (diff<0) { | |||||
if (diff<0) { | |||||
/* seek ended up past the wanted sample */ | /* seek ended up past the wanted sample */ | ||||
dbg(0, " !!! Audio seek failed."); | dbg(0, " !!! Audio seek failed."); | ||||
return -1; | return -1; | ||||
@@ -335,16 +336,16 @@ static int64_t ad_seek_ffmpeg(void *sf, int64_t pos) { | |||||
const int64_t timestamp = pos / av_q2d(priv->formatContext->streams[priv->audioStream]->time_base) / priv->samplerate; | const int64_t timestamp = pos / av_q2d(priv->formatContext->streams[priv->audioStream]->time_base) / priv->samplerate; | ||||
dbg(2, "seek frame:%"PRIi64" - idx:%"PRIi64, pos, timestamp); | dbg(2, "seek frame:%"PRIi64" - idx:%"PRIi64, pos, timestamp); | ||||
av_seek_frame(priv->formatContext, priv->audioStream, timestamp, AVSEEK_FLAG_ANY | AVSEEK_FLAG_BACKWARD); | av_seek_frame(priv->formatContext, priv->audioStream, timestamp, AVSEEK_FLAG_ANY | AVSEEK_FLAG_BACKWARD); | ||||
avcodec_flush_buffers(priv->codecContext); | avcodec_flush_buffers(priv->codecContext); | ||||
return pos; | return pos; | ||||
} | } | ||||
static int ad_eval_ffmpeg(const char *f) { | |||||
static int ad_eval_ffmpeg(const char *f) { | |||||
char *ext = strrchr(f, '.'); | char *ext = strrchr(f, '.'); | ||||
if (!ext) return 10; | if (!ext) return 10; | ||||
// libavformat.. guess_format.. | |||||
// libavformat.. guess_format.. | |||||
return 40; | return 40; | ||||
} | } | ||||
#endif | #endif | ||||
@@ -382,7 +383,7 @@ const ad_plugin * adp_get_ffmpeg() { | |||||
avcodec_register_all(); | avcodec_register_all(); | ||||
if(ad_debug_level <= 1) | if(ad_debug_level <= 1) | ||||
av_log_set_level(AV_LOG_QUIET); | av_log_set_level(AV_LOG_QUIET); | ||||
else | |||||
else | |||||
av_log_set_level(AV_LOG_VERBOSE); | av_log_set_level(AV_LOG_VERBOSE); | ||||
} | } | ||||
#endif | #endif | ||||
@@ -16,11 +16,10 @@ | |||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||||
*/ | */ | ||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <string.h> | #include <string.h> | ||||
#include <strings.h> | |||||
#include <unistd.h> | |||||
#include <math.h> | #include <math.h> | ||||
#include "ad_plugin.h" | #include "ad_plugin.h" | ||||
@@ -16,11 +16,11 @@ | |||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||||
*/ | */ | ||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <stdarg.h> | #include <stdarg.h> | ||||
#include <string.h> | #include <string.h> | ||||
#include <unistd.h> | |||||
#include <math.h> | #include <math.h> | ||||
#include "ad_plugin.h" | #include "ad_plugin.h" | ||||
@@ -16,11 +16,10 @@ | |||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||||
*/ | */ | ||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <string.h> | #include <string.h> | ||||
#include <strings.h> | |||||
#include <unistd.h> | |||||
#include <math.h> | #include <math.h> | ||||
#include "ad_plugin.h" | #include "ad_plugin.h" | ||||
@@ -85,7 +84,7 @@ static void *ad_open_sndfile(const char *fn, struct adinfo *nfo) { | |||||
static int ad_close_sndfile(void *sf) { | static int ad_close_sndfile(void *sf) { | ||||
sndfile_audio_decoder *priv = (sndfile_audio_decoder*) sf; | sndfile_audio_decoder *priv = (sndfile_audio_decoder*) sf; | ||||
if (!priv) return -1; | if (!priv) return -1; | ||||
if(!sf || sf_close(priv->sffile)) { | |||||
if(!sf || sf_close(priv->sffile)) { | |||||
dbg(0, "fatal: bad file close.\n"); | dbg(0, "fatal: bad file close.\n"); | ||||
return -1; | return -1; | ||||
} | } | ||||
@@ -111,7 +110,7 @@ static int ad_get_bitrate_sndfile(void *sf) { | |||||
return parse_bit_depth(priv->sfinfo.format) * priv->sfinfo.channels * priv->sfinfo.samplerate; | return parse_bit_depth(priv->sfinfo.format) * priv->sfinfo.channels * priv->sfinfo.samplerate; | ||||
} | } | ||||
static int ad_eval_sndfile(const char *f) { | |||||
static int ad_eval_sndfile(const char *f) { | |||||
char *ext = strrchr(f, '.'); | char *ext = strrchr(f, '.'); | ||||
if (strstr (f, "://")) return 0; | if (strstr (f, "://")) return 0; | ||||
if (!ext) return 5; | if (!ext) return 5; | ||||