diff --git a/ffmpeg.c b/ffmpeg.c index 59b8e8d..be49ff9 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -144,9 +144,11 @@ } static int _read_data(void *opaque, u8_t *buffer, int buf_size) { + size_t bytes; + LOCK_S; - size_t bytes = min(_buf_used(streambuf), _buf_cont_read(streambuf)); + bytes = min(_buf_used(streambuf), _buf_cont_read(streambuf)); ff->end_of_stream = (stream.state <= DISCONNECT && bytes == 0); bytes = min(bytes, buf_size); @@ -590,6 +592,8 @@ ff->avcodec_alloc_frame = dlsym(handle_codec, "avcodec_alloc_frame"); ff->avcodec_free_frame = dlsym(handle_codec, "avcodec_free_frame"); ff->avcodec_decode_audio4 = dlsym(handle_codec, "avcodec_decode_audio4"); + ff->av_init_packet = dlsym(handle_codec, "av_init_packet"); + ff->av_free_packet = dlsym(handle_codec, "av_free_packet"); if ((err = dlerror()) != NULL) { LOG_INFO("dlerror: %s", err); @@ -605,8 +609,6 @@ ff->avformat_open_input = dlsym(handle_format, "avformat_open_input"); ff->avformat_find_stream_info = dlsym(handle_format, "avformat_find_stream_info"); ff->avio_alloc_context = dlsym(handle_format, "avio_alloc_context"); - ff->av_init_packet = dlsym(handle_format, "av_init_packet"); - ff->av_free_packet = dlsym(handle_format, "av_free_packet"); ff->av_read_frame = dlsym(handle_format, "av_read_frame"); ff->av_find_input_format= dlsym(handle_format, "av_find_input_format"); ff->av_register_all = dlsym(handle_format, "av_register_all"); diff --git a/squeezelite.h b/squeezelite.h index 4df3172..3c6f6bb 100644 --- a/squeezelite.h +++ b/squeezelite.h @@ -72,7 +72,7 @@ #define PROCESS 0 #endif -#if defined(FFMPEG) && !WIN +#if defined(FFMPEG) #undef FFMPEG #define FFMPEG 1 #else @@ -112,6 +112,9 @@ #define LIBVORBIS "libvorbisfile.dll" #define LIBTREMOR "libvorbisidec.dll" #define LIBFAAD "libfaad2.dll" +#define LIBAVUTIL "avutil-%d.dll" +#define LIBAVCODEC "avcodec-%d.dll" +#define LIBAVFORMAT "avformat-%d.dll" #endif // config options