summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mpvcore/input/input.c15
-rw-r--r--mpvcore/options.c3
-rwxr-xr-xold-configure4
-rw-r--r--osdep/io.c7
-rw-r--r--stream/stream.c7
-rw-r--r--video/decode/lavc_dr1.c8
-rw-r--r--video/mp_image.c7
-rw-r--r--video/mp_image_pool.c11
-rw-r--r--wscript9
-rw-r--r--wscript_build.py2
10 files changed, 17 insertions, 56 deletions
diff --git a/mpvcore/input/input.c b/mpvcore/input/input.c
index d36fee3b94..4aa2f280dd 100644
--- a/mpvcore/input/input.c
+++ b/mpvcore/input/input.c
@@ -29,6 +29,7 @@
#include <sys/time.h>
#include <fcntl.h>
#include <ctype.h>
+#include <pthread.h>
#include <assert.h>
#include <libavutil/avstring.h>
@@ -65,16 +66,8 @@
#include "osdep/macosx_events.h"
#endif
-#if HAVE_PTHREADS
-#include <pthread.h>
#define input_lock(ictx) pthread_mutex_lock(&ictx->mutex)
#define input_unlock(ictx) pthread_mutex_unlock(&ictx->mutex)
-#define input_destroy(ictx) pthread_mutex_destroy(&ictx->mutex)
-#else
-#define input_lock(ictx) 0
-#define input_unlock(ictx) 0
-#define input_destroy(ictx) 0
-#endif
#define MP_MAX_KEY_DOWN 4
@@ -549,9 +542,7 @@ struct cmd_queue {
};
struct input_ctx {
-#if HAVE_PTHREADS
pthread_mutex_t mutex;
-#endif
struct mp_log *log;
bool using_ar;
@@ -2299,13 +2290,11 @@ struct input_ctx *mp_input_init(struct mpv_global *global)
.wakeup_pipe = {-1, -1},
};
-#if HAVE_PTHREADS
pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr);
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
pthread_mutex_init(&ictx->mutex, &attr);
pthread_mutexattr_destroy(&attr);
-#endif
// Setup default section, so that it does nothing.
mp_input_enable_section(ictx, NULL, MP_INPUT_ALLOW_VO_DRAGGING |
@@ -2447,7 +2436,7 @@ void mp_input_uninit(struct input_ctx *ictx)
}
clear_queue(&ictx->cmd_queue);
talloc_free(ictx->current_down_cmd);
- input_destroy(ictx);
+ pthread_mutex_destroy(&ictx->mutex);
talloc_free(ictx);
}
diff --git a/mpvcore/options.c b/mpvcore/options.c
index 11819c5286..f8aad2eeb6 100644
--- a/mpvcore/options.c
+++ b/mpvcore/options.c
@@ -352,7 +352,6 @@ const m_option_t mp_opts[] = {
// ------------------------- stream options --------------------
-#if HAVE_STREAM_CACHE
OPT_CHOICE_OR_INT("cache", stream_cache_size, 0, 32, 0x7fffffff,
({"no", 0},
{"auto", -1}),
@@ -364,7 +363,7 @@ const m_option_t mp_opts[] = {
OPT_FLOATRANGE("cache-seek-min", stream_cache_seek_min_percent, 0, 0, 99),
OPT_CHOICE_OR_INT("cache-pause", stream_cache_pause, 0,
0, 40, ({"no", -1})),
-#endif /* HAVE_STREAM_CACHE */
+
{"cdrom-device", &cdrom_device, CONF_TYPE_STRING, 0, 0, 0, NULL},
#if HAVE_DVDREAD
{"dvd-device", &dvd_device, CONF_TYPE_STRING, 0, 0, 0, NULL},
diff --git a/old-configure b/old-configure
index 995ccb9aa4..564b1c9331 100755
--- a/old-configure
+++ b/old-configure
@@ -1325,6 +1325,10 @@ else
fi
echores "$_pthreads"
+if test "$_pthreads" = no ; then
+ die "Unable to find pthreads support."
+fi
+
if test "$_pthreads" = yes ; then
# Cargo-cult for -lrt, which is needed on not so recent glibc version for
diff --git a/osdep/io.c b/osdep/io.c
index cc99c24370..94bd90a676 100644
--- a/osdep/io.c
+++ b/osdep/io.c
@@ -59,10 +59,7 @@ char *mp_to_utf8(void *talloc_ctx, const wchar_t *s)
#include <io.h>
#include <fcntl.h>
-
-#if HAVE_PTHREADS
#include <pthread.h>
-#endif
#include "mpvcore/mp_talloc.h"
@@ -300,12 +297,8 @@ static void init_getenv(void)
char *mp_getenv(const char *name)
{
-#if HAVE_PTHREADS
static pthread_once_t once_init_getenv = PTHREAD_ONCE_INIT;
pthread_once(&once_init_getenv, init_getenv);
-#else
- init_getenv();
-#endif
// Copied from musl, http://git.musl-libc.org/cgit/musl/tree/COPYRIGHT
// Copyright © 2005-2013 Rich Felker, standard MIT license
int i;
diff --git a/stream/stream.c b/stream/stream.c
index 94db8d8ab5..74715970af 100644
--- a/stream/stream.c
+++ b/stream/stream.c
@@ -809,12 +809,7 @@ static int stream_enable_cache(stream_t **stream, int64_t size, int64_t min,
cache->start_pos = orig->start_pos;
cache->end_pos = orig->end_pos;
- int res = -1;
-
-#if HAVE_STREAM_CACHE
- res = stream_cache_init(cache, orig, size, min, seek_limit);
-#endif
-
+ int res = stream_cache_init(cache, orig, size, min, seek_limit);
if (res <= 0) {
cache->uncached_stream = NULL; // don't free original stream
free_stream(cache);
diff --git a/video/decode/lavc_dr1.c b/video/decode/lavc_dr1.c
index cf1852b1ab..03e2b5b873 100644
--- a/video/decode/lavc_dr1.c
+++ b/video/decode/lavc_dr1.c
@@ -30,7 +30,7 @@
#include <stdlib.h>
#include <errno.h>
#include <math.h>
-
+#include <pthread.h>
#include <libavcodec/avcodec.h>
#include <libavutil/avassert.h>
@@ -44,15 +44,9 @@
#include "lavc.h"
#include "video/decode/dec_video.h"
-#if HAVE_PTHREADS
-#include <pthread.h>
static pthread_mutex_t pool_mutex = PTHREAD_MUTEX_INITIALIZER;
#define pool_lock() pthread_mutex_lock(&pool_mutex)
#define pool_unlock() pthread_mutex_unlock(&pool_mutex)
-#else
-#define pool_lock() 0
-#define pool_unlock() 0
-#endif
typedef struct FramePool {
struct FrameBuffer *list;
diff --git a/video/mp_image.c b/video/mp_image.c
index 9b96bab67d..242e09e2d0 100644
--- a/video/mp_image.c
+++ b/video/mp_image.c
@@ -21,6 +21,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <pthread.h>
#include <assert.h>
#include <libavutil/mem.h>
@@ -38,15 +39,9 @@
#include "video/filter/vf.h"
-#if HAVE_PTHREADS
-#include <pthread.h>
static pthread_mutex_t refcount_mutex = PTHREAD_MUTEX_INITIALIZER;
#define refcount_lock() pthread_mutex_lock(&refcount_mutex)
#define refcount_unlock() pthread_mutex_unlock(&refcount_mutex)
-#else
-#define refcount_lock() 0
-#define refcount_unlock() 0
-#endif
struct m_refcount {
void *arg;
diff --git a/video/mp_image_pool.c b/video/mp_image_pool.c
index 1ef08b5e2d..d7f992483e 100644
--- a/video/mp_image_pool.c
+++ b/video/mp_image_pool.c
@@ -20,6 +20,7 @@
#include <stddef.h>
#include <stdbool.h>
+#include <pthread.h>
#include <assert.h>
#include "talloc.h"
@@ -29,19 +30,13 @@
#include "mp_image_pool.h"
-#if HAVE_PTHREADS
-#include <pthread.h>
static pthread_mutex_t pool_mutex = PTHREAD_MUTEX_INITIALIZER;
#define pool_lock() pthread_mutex_lock(&pool_mutex)
#define pool_unlock() pthread_mutex_unlock(&pool_mutex)
-#else
-#define pool_lock() 0
-#define pool_unlock() 0
-#endif
// Thread-safety: the pool itself is not thread-safe, but pool-allocated images
-// can be referenced and unreferenced from other threads. (As long as compiled
-// with pthreads, and the image destructors are thread-safe.)
+// can be referenced and unreferenced from other threads. (As long as the image
+// destructors are thread-safe.)
struct mp_image_pool {
int max_count;
diff --git a/wscript b/wscript
index 17dec8d1f9..9e42001048 100644
--- a/wscript
+++ b/wscript
@@ -88,9 +88,11 @@ main_dependencies = [
'desc': 'mman.h',
'func': check_statement('sys/mman.h', 'mmap(0, 0, 0, 0, 0, 0)')
}, {
- 'name': '--pthreads',
+ 'name': 'pthreads',
'desc': 'POSIX threads',
'func': check_pthreads,
+ 'req': True,
+ 'fmsg': 'Unable to find pthreads support.'
}, {
'name': 'librt',
'desc': 'linking with -lrt',
@@ -115,11 +117,6 @@ iconv support use --disable-iconv.",
'deps_any': [ 'os-win32', 'os-cygwin'],
'func': check_true
}, {
- 'name': 'stream-cache',
- 'desc': 'stream cache',
- 'deps': [ 'pthreads' ],
- 'func': check_true
- }, {
'name': 'soundcard',
'desc': 'soundcard.h',
'func': check_headers('soundcard.h', 'sys/soundcard.h')
diff --git a/wscript_build.py b/wscript_build.py
index 55c2f6bfef..b7e03b92cc 100644
--- a/wscript_build.py
+++ b/wscript_build.py
@@ -226,7 +226,7 @@ def build(ctx):
( "stream/ai_oss.c", "oss-audio" ),
( "stream/ai_sndio.c", "sndio" ),
( "stream/audio_in.c", "audio-input" ),
- ( "stream/cache.c", "stream-cache"),
+ ( "stream/cache.c" ),
( "stream/cdinfo.c", "cdda"),
( "stream/cookies.c" ),
( "stream/dvb_tune.c", "dvbin" ),