summaryrefslogtreecommitdiffstats
path: root/mpvcore
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-11-28 19:28:38 +0100
committerwm4 <wm4@nowhere>2013-11-28 19:28:38 +0100
commit0d255f07bf46948289a2698a4a7063514d0e1ef9 (patch)
tree640b11bf0a569aa9292db6e31e697ada2ccdba7f /mpvcore
parent0a18f3eb9a163b1cd656129dac6164d7914ecc41 (diff)
downloadmpv-0d255f07bf46948289a2698a4a7063514d0e1ef9.tar.bz2
mpv-0d255f07bf46948289a2698a4a7063514d0e1ef9.tar.xz
build: make pthreads mandatory
pthreads should be available anywhere. Even if not, for environment without threads a pthread wrapper could be provided that can't actually start threads, thus disabling features that require threads. Make pthreads mandatory in order to simplify build dependencies and to reduce ifdeffery. (Admittedly, there wasn't much complexity, but maybe we will use pthreads more in the future, and then it'd become a real bother.)
Diffstat (limited to 'mpvcore')
-rw-r--r--mpvcore/input/input.c15
-rw-r--r--mpvcore/options.c3
2 files changed, 3 insertions, 15 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},