configure: uniform the defines to #define HAVE_xxx (0|1)

The configure followed 5 different convetions of defines because the next guy
always wanted to introduce a new better way to uniform it[1]. For an
hypothetic feature 'hurr' you could have had:

  * #define HAVE_HURR 1   / #undef HAVE_DURR
  * #define HAVE_HURR     / #undef HAVE_DURR
  * #define CONFIG_HURR 1 / #undef CONFIG_DURR
  * #define HAVE_HURR 1   / #define HAVE_DURR 0
  * #define CONFIG_HURR 1 / #define CONFIG_DURR 0

All is now uniform and uses:
  * #define HAVE_HURR 1
  * #define HAVE_DURR 0

We like definining to 0 as opposed to `undef` bcause it can help spot typos
and is very helpful when doing big reorganizations in the code.

[1]: http://xkcd.com/927/ related
This commit is contained in:
Stefano Pigozzi 2013-07-16 13:28:28 +02:00
parent 891a2a1f47
commit 37388ebb0e
52 changed files with 528 additions and 500 deletions

View File

@ -46,7 +46,7 @@ extern const struct ad_functions ad_lavc;
extern const struct ad_functions ad_spdif;
static const struct ad_functions * const ad_drivers[] = {
#ifdef CONFIG_MPG123
#if HAVE_MPG123
&ad_mpg123,
#endif
&ad_lavc,

View File

@ -65,7 +65,7 @@ static struct af_info* filter_list[] = {
&af_info_pan,
&af_info_surround,
&af_info_sub,
#ifdef HAVE_SYS_MMAN_H
#if HAVE_SYS_MMAN_H
&af_info_export,
#endif
&af_info_drc,
@ -74,17 +74,17 @@ static struct af_info* filter_list[] = {
&af_info_lavrresample,
&af_info_sweep,
&af_info_hrtf,
#ifdef CONFIG_LADSPA
#if HAVE_LADSPA
&af_info_ladspa,
#endif
&af_info_center,
&af_info_sinesuppress,
&af_info_karaoke,
&af_info_scaletempo,
#ifdef CONFIG_LIBBS2B
#if HAVE_LIBBS2B
&af_info_bs2b,
#endif
#ifdef CONFIG_AF_LAVFI
#if HAVE_AF_LAVFI
&af_info_lavfi,
#endif
// Must come last, because they're fallback format conversion filter

View File

@ -33,10 +33,10 @@
#include "talloc.h"
#include "config.h"
#if defined(CONFIG_LIBAVRESAMPLE)
#if HAVE_LIBAVRESAMPLE
#include <libavresample/avresample.h>
#define USE_SET_CHANNEL_MAPPING HAVE_AVRESAMPLE_SET_CHANNEL_MAPPING
#elif defined(CONFIG_LIBSWRESAMPLE)
#elif HAVE_LIBSWRESAMPLE
#include <libswresample/swresample.h>
#define AVAudioResampleContext SwrContext
#define avresample_alloc_context swr_alloc
@ -49,7 +49,7 @@
#define avresample_set_channel_mapping swr_set_channel_mapping
#define USE_SET_CHANNEL_MAPPING 1
#else
#error "config.h broken"
#error "config.h broken or no resampler found"
#endif
#include "mpvcore/mp_msg.h"
@ -86,7 +86,7 @@ struct af_resample {
uint8_t *reorder_buffer;
};
#ifdef CONFIG_LIBAVRESAMPLE
#if HAVE_LIBAVRESAMPLE
static int get_delay(struct af_resample *s)
{
return avresample_get_delay(s->avrctx);

View File

@ -50,47 +50,47 @@ extern const struct ao_driver audio_out_sdl;
static const struct ao_driver * const audio_out_drivers[] = {
// native:
#ifdef CONFIG_COREAUDIO
#if HAVE_COREAUDIO
&audio_out_coreaudio,
#endif
#ifdef CONFIG_PULSE
#if HAVE_PULSE
&audio_out_pulse,
#endif
#ifdef CONFIG_SNDIO
#if HAVE_SNDIO
&audio_out_sndio,
#endif
#ifdef CONFIG_ALSA
#if HAVE_ALSA
&audio_out_alsa,
#endif
#ifdef CONFIG_WASAPI
#if HAVE_WASAPI
&audio_out_wasapi,
#endif
#ifdef CONFIG_OSS_AUDIO
#if HAVE_OSS_AUDIO
&audio_out_oss,
#endif
#ifdef CONFIG_DSOUND
#if HAVE_DSOUND
&audio_out_dsound,
#endif
#ifdef CONFIG_PORTAUDIO
#if HAVE_PORTAUDIO
&audio_out_portaudio,
#endif
// wrappers:
#ifdef CONFIG_JACK
#if HAVE_JACK
&audio_out_jack,
#endif
#ifdef CONFIG_OPENAL
#if HAVE_OPENAL
&audio_out_openal,
#endif
#ifdef CONFIG_SDL
#if HAVE_SDL || HAVE_SDL2
&audio_out_sdl,
#endif
&audio_out_null,
// should not be auto-selected:
&audio_out_pcm,
#ifdef CONFIG_ENCODING
#if HAVE_ENCODING
&audio_out_lavc,
#endif
#ifdef CONFIG_RSOUND
#if HAVE_RSOUND
&audio_out_rsound,
#endif
NULL

View File

@ -38,10 +38,10 @@
#include "mpvcore/options.h"
#include "mpvcore/mp_msg.h"
#ifdef HAVE_SYS_SOUNDCARD_H
#if HAVE_SYS_SOUNDCARD_H
#include <sys/soundcard.h>
#else
#ifdef HAVE_SOUNDCARD_H
#if HAVE_SOUNDCARD_H
#include <soundcard.h>
#endif
#endif
@ -349,7 +349,7 @@ ac3_retry:
// Measuring buffer size:
void *data;
p->buffersize = 0;
#ifdef HAVE_AUDIO_SELECT
#if HAVE_AUDIO_SELECT
data = malloc(p->outburst);
memset(data, 0, p->outburst);
while (p->buffersize < 0x40000) {
@ -367,7 +367,7 @@ ac3_retry:
free(data);
if (p->buffersize == 0) {
MP_ERR(ao, "*** Your audio driver DOES NOT support select() ***\n");
MP_ERR(ao, "Recompile mpv with #undef HAVE_AUDIO_SELECT in config.h!\n");
MP_ERR(ao, "Recompile mpv with #define HAVE_AUDIO_SELECT 0 in config.h!\n");
return -1;
}
#endif
@ -456,7 +456,7 @@ static int get_space(struct ao *ao)
#endif
// check buffer
#ifdef HAVE_AUDIO_SELECT
#if HAVE_AUDIO_SELECT
{
fd_set rfds;
struct timeval tv;

370
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -70,16 +70,16 @@ const demuxer_desc_t *const demuxer_list[] = {
&demuxer_desc_cue,
&demuxer_desc_rawaudio,
&demuxer_desc_rawvideo,
#ifdef CONFIG_TV
#if HAVE_TV
&demuxer_desc_tv,
#endif
#ifdef CONFIG_ASS
#if HAVE_LIBASS
&demuxer_desc_libass,
#endif
&demuxer_desc_matroska,
&demuxer_desc_lavf,
&demuxer_desc_mf,
#ifdef CONFIG_MNG
#if HAVE_MNG
&demuxer_desc_mng,
#endif
&demuxer_desc_playlist,

View File

@ -37,7 +37,7 @@
#include "config.h"
#if CONFIG_ZLIB
#if HAVE_ZLIB
#include <zlib.h>
#endif
@ -267,7 +267,7 @@ static bstr demux_mkv_decode(mkv_track_t *track, bstr data, uint32_t type)
src = dest; // output from last iteration is new source
if (enc->comp_algo == 0) {
#if CONFIG_ZLIB
#if HAVE_ZLIB
/* zlib encoded track */
if (size == 0)
@ -457,7 +457,7 @@ static void parse_trackencodings(struct demuxer *demuxer,
"[mkv] algorithm (%" PRIu64 "). Skipping track.\n",
track->tnum, e.comp_algo);
}
#if !CONFIG_ZLIB
#if !HAVE_ZLIB
else if (e.comp_algo == 0) {
mp_tmsg(MSGT_DEMUX, MSGL_WARN,
"[mkv] Track %u was compressed with zlib "

View File

@ -30,7 +30,7 @@
#include "config.h"
#ifdef HAVE_GLOB
#if HAVE_GLOB
#include <glob.h>
#else
#include "osdep/glob.h"

View File

@ -33,18 +33,18 @@
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
#ifdef CONFIG_LIBAVDEVICE
#if HAVE_LIBAVDEVICE
#include <libavdevice/avdevice.h>
#endif
#ifdef CONFIG_LIBAVFILTER
#if HAVE_LIBAVFILTER
#include <libavfilter/avfilter.h>
#endif
#ifdef CONFIG_LIBAVRESAMPLE
#if HAVE_LIBAVRESAMPLE
#include <libavresample/avresample.h>
#endif
#ifdef CONFIG_LIBSWRESAMPLE
#if HAVE_LIBSWRESAMPLE
#include <libswresample/swresample.h>
#endif
@ -138,10 +138,10 @@ void init_libav(void)
av_register_all();
avformat_network_init();
#ifdef CONFIG_LIBAVFILTER
#if HAVE_LIBAVFILTER
avfilter_register_all();
#endif
#ifdef CONFIG_LIBAVDEVICE
#if HAVE_LIBAVDEVICE
avdevice_register_all();
#endif
}
@ -164,13 +164,13 @@ void print_libav_versions(int v)
print_version(v, "libavcodec", LIBAVCODEC_VERSION_INT, avcodec_version());
print_version(v, "libavformat", LIBAVFORMAT_VERSION_INT, avformat_version());
print_version(v, "libswscale", LIBSWSCALE_VERSION_INT, swscale_version());
#ifdef CONFIG_LIBAVFILTER
#if HAVE_LIBAVFILTER
print_version(v, "libavfilter", LIBAVFILTER_VERSION_INT, avfilter_version());
#endif
#ifdef CONFIG_LIBAVRESAMPLE
#if HAVE_LIBAVRESAMPLE
print_version(v, "libavresample", LIBAVRESAMPLE_VERSION_INT, avresample_version());
#endif
#ifdef CONFIG_LIBSWRESAMPLE
#if HAVE_LIBSWRESAMPLE
print_version(v, "libswresample", LIBSWRESAMPLE_VERSION_INT, swresample_version());
#endif
}

View File

@ -27,15 +27,15 @@
#include "mpvcore/mp_msg.h"
#ifdef CONFIG_ENCA
#if HAVE_ENCA
#include <enca.h>
#endif
#ifdef CONFIG_LIBGUESS
#if HAVE_LIBGUESS
#include <libguess.h>
#endif
#ifdef CONFIG_ICONV
#if HAVE_ICONV
#include <iconv.h>
#endif
@ -85,7 +85,7 @@ bool mp_charset_requires_guess(const char *user_cp)
(r > 1 && bstrcasecmp0(res[0], "utf8") == 0);
}
#ifdef CONFIG_ENCA
#if HAVE_ENCA
static const char *enca_guess(bstr buf, const char *language)
{
if (!language || !language[0])
@ -117,7 +117,7 @@ static const char *enca_guess(bstr buf, const char *language)
}
#endif
#ifdef CONFIG_LIBGUESS
#if HAVE_LIBGUESS
static const char *libguess_guess(bstr buf, const char *language)
{
if (!language || !language[0] || strcmp(language, "help") == 0) {
@ -157,11 +157,11 @@ const char *mp_charset_guess(bstr buf, const char *user_cp, int flags)
const char *res = NULL;
#ifdef CONFIG_ENCA
#if HAVE_ENCA
if (bstrcasecmp0(type, "enca") == 0)
res = enca_guess(buf, lang);
#endif
#ifdef CONFIG_LIBGUESS
#if HAVE_LIBGUESS
if (bstrcasecmp0(type, "guess") == 0)
res = libguess_guess(buf, lang);
#endif
@ -212,7 +212,7 @@ bstr mp_charset_guess_and_conv_to_utf8(bstr buf, const char *user_cp, int flags)
// returns: buf (no conversion), .start==NULL (error), or allocated buffer
bstr mp_iconv_to_utf8(bstr buf, const char *cp, int flags)
{
#ifdef CONFIG_ICONV
#if HAVE_ICONV
if (!cp || !cp[0] || mp_charset_is_utf8(cp))
return buf;

View File

@ -53,15 +53,15 @@
#include "joystick.h"
#ifdef CONFIG_LIRC
#if HAVE_LIRC
#include "lirc.h"
#endif
#ifdef CONFIG_LIRCC
#if HAVE_LIRCC
#include <lirc/lircc.h>
#endif
#ifdef CONFIG_COCOA
#if HAVE_COCOA
#include "osdep/macosx_events.h"
#endif
@ -616,7 +616,7 @@ const m_option_t mp_input_opts[] = {
OPT_FLAG("joystick", input.use_joystick, CONF_GLOBAL),
OPT_FLAG("lirc", input.use_lirc, CONF_GLOBAL),
OPT_FLAG("lircc", input.use_lircc, CONF_GLOBAL),
#ifdef CONFIG_COCOA
#if HAVE_COCOA
OPT_FLAG("ar", input.use_ar, CONF_GLOBAL),
OPT_FLAG("media-keys", input.use_media_keys, CONF_GLOBAL),
#endif
@ -1734,7 +1734,7 @@ static void remove_dead_fds(struct input_ctx *ictx)
}
}
#ifdef HAVE_POSIX_SELECT
#if HAVE_POSIX_SELECT
static void input_wait_read(struct input_ctx *ictx, int time)
{
@ -2310,7 +2310,7 @@ struct input_ctx *mp_input_init(struct mpv_global *global)
"input config\n");
}
#ifdef CONFIG_JOYSTICK
#if HAVE_JOYSTICK
if (input_conf->use_joystick) {
int fd = mp_input_joystick_init(input_conf->js_dev);
if (fd < 0)
@ -2321,7 +2321,7 @@ struct input_ctx *mp_input_init(struct mpv_global *global)
}
#endif
#ifdef CONFIG_LIRC
#if HAVE_LIRC
if (input_conf->use_lirc) {
int fd = mp_input_lirc_init();
if (fd > 0)
@ -2330,7 +2330,7 @@ struct input_ctx *mp_input_init(struct mpv_global *global)
}
#endif
#ifdef CONFIG_LIRCC
#if HAVE_LIRCC
if (input_conf->use_lircc) {
int fd = lircc_init("mpv", NULL);
if (fd >= 0)
@ -2338,7 +2338,7 @@ struct input_ctx *mp_input_init(struct mpv_global *global)
}
#endif
#ifdef CONFIG_COCOA
#if HAVE_COCOA
if (input_conf->use_ar) {
cocoa_init_apple_remote();
ictx->using_ar = true;
@ -2386,7 +2386,7 @@ void mp_input_uninit(struct input_ctx *ictx)
if (!ictx)
return;
#ifdef CONFIG_COCOA
#if HAVE_COCOA
if (ictx->using_ar) {
cocoa_uninit_apple_remote();
}

View File

@ -72,7 +72,7 @@ static int print_version_opt(const m_option_t *opt, const char *name,
exit(0);
}
#ifdef CONFIG_RADIO
#if HAVE_RADIO
static const m_option_t radioopts_conf[]={
{"device", &stream_radio_defaults.device, CONF_TYPE_STRING, 0, 0 ,0, NULL},
{"driver", &stream_radio_defaults.driver, CONF_TYPE_STRING, 0, 0 ,0, NULL},
@ -83,9 +83,9 @@ static const m_option_t radioopts_conf[]={
{"achannels", &stream_radio_defaults.achannels, CONF_TYPE_INT, CONF_MIN, 0 ,0, NULL},
{NULL, NULL, 0, 0, 0, 0, NULL}
};
#endif /* CONFIG_RADIO */
#endif /* HAVE_RADIO */
#ifdef CONFIG_TV
#if HAVE_TV
static const m_option_t tvopts_conf[]={
{"immediatemode", &stream_tv_defaults.immediate, CONF_TYPE_INT, CONF_RANGE, 0, 1, NULL},
{"audio", &stream_tv_defaults.noaudio, CONF_TYPE_FLAG, 0, 1, 0, NULL},
@ -97,7 +97,7 @@ static const m_option_t tvopts_conf[]={
{"chanlist", &stream_tv_defaults.chanlist, CONF_TYPE_STRING, 0, 0, 0, NULL},
{"norm", &stream_tv_defaults.norm, CONF_TYPE_STRING, 0, 0, 0, NULL},
{"automute", &stream_tv_defaults.automute, CONF_TYPE_INT, CONF_RANGE, 0, 255, NULL},
#if defined(CONFIG_TV_V4L2)
#if HAVE_TV_V4L2
{"normid", &stream_tv_defaults.normid, CONF_TYPE_INT, 0, 0, 0, NULL},
#endif
{"width", &stream_tv_defaults.width, CONF_TYPE_INT, 0, 0, 4096, NULL},
@ -111,7 +111,7 @@ static const m_option_t tvopts_conf[]={
{"hue", &stream_tv_defaults.hue, CONF_TYPE_INT, CONF_RANGE, -100, 100, NULL},
{"saturation", &stream_tv_defaults.saturation, CONF_TYPE_INT, CONF_RANGE, -100, 100, NULL},
{"gain", &stream_tv_defaults.gain, CONF_TYPE_INT, CONF_RANGE, -1, 100, NULL},
#if defined(CONFIG_TV_V4L2)
#if HAVE_TV_V4L2
{"amode", &stream_tv_defaults.amode, CONF_TYPE_INT, CONF_RANGE, 0, 3, NULL},
{"volume", &stream_tv_defaults.volume, CONF_TYPE_INT, CONF_RANGE, 0, 65535, NULL},
{"bass", &stream_tv_defaults.bass, CONF_TYPE_INT, CONF_RANGE, 0, 65535, NULL},
@ -123,15 +123,15 @@ static const m_option_t tvopts_conf[]={
{"mjpeg", &stream_tv_defaults.mjpeg, CONF_TYPE_FLAG, 0, 0, 1, NULL},
{"decimation", &stream_tv_defaults.decimation, CONF_TYPE_INT, CONF_RANGE, 1, 4, NULL},
{"quality", &stream_tv_defaults.quality, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL},
#ifdef CONFIG_ALSA
#if HAVE_ALSA
{"alsa", &stream_tv_defaults.alsa, CONF_TYPE_FLAG, 0, 0, 1, NULL},
#endif /* CONFIG_ALSA */
#endif /* defined(CONFIG_TV_V4L2) */
#endif /* HAVE_ALSA */
#endif /* HAVE_TV_V4L2 */
{"adevice", &stream_tv_defaults.adevice, CONF_TYPE_STRING, 0, 0, 0, NULL},
{"audioid", &stream_tv_defaults.audio_id, CONF_TYPE_INT, CONF_RANGE, 0, 9, NULL},
{NULL, NULL, 0, 0, 0, 0, NULL}
};
#endif /* CONFIG_TV */
#endif /* HAVE_TV */
extern int pvr_param_aspect_ratio;
extern int pvr_param_sample_rate;
@ -143,7 +143,7 @@ extern char *pvr_param_bitrate_mode;
extern int pvr_param_bitrate_peak;
extern char *pvr_param_stream_type;
#ifdef CONFIG_PVR
#if HAVE_PVR
static const m_option_t pvropts_conf[]={
{"aspect", &pvr_param_aspect_ratio, CONF_TYPE_INT, 0, 1, 4, NULL},
{"arate", &pvr_param_sample_rate, CONF_TYPE_INT, 0, 32000, 48000, NULL},
@ -156,7 +156,7 @@ static const m_option_t pvropts_conf[]={
{"fmt", &pvr_param_stream_type, CONF_TYPE_STRING, 0, 0, 0, NULL},
{NULL, NULL, 0, 0, 0, 0, NULL}
};
#endif /* CONFIG_PVR */
#endif /* HAVE_PVR */
extern const m_option_t dvbin_opts_conf[];
extern const m_option_t lavfdopts_conf[];
@ -290,7 +290,7 @@ static const m_option_t msgl_config[]={
};
#ifdef CONFIG_TV
#if HAVE_TV
static const m_option_t tvscan_conf[]={
{"autostart", &stream_tv_defaults.scan, CONF_TYPE_FLAG, 0, 0, 1, NULL},
{"threshold", &stream_tv_defaults.scan_threshold, CONF_TYPE_INT, CONF_RANGE, 1, 100, NULL},
@ -340,20 +340,20 @@ const m_option_t mp_opts[] = {
{"msglevel", (void *) msgl_config, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL},
{"msgcolor", &mp_msg_color, CONF_TYPE_FLAG, CONF_GLOBAL | CONF_PRE_PARSE, 0, 1, NULL},
{"msgmodule", &mp_msg_module, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL},
#ifdef CONFIG_PRIORITY
#if HAVE_PRIORITY
{"priority", &proc_priority, CONF_TYPE_STRING, 0, 0, 0, NULL},
#endif
OPT_FLAG("config", load_config, CONF_GLOBAL | CONF_NOCFG | CONF_PRE_PARSE),
OPT_STRINGLIST("reset-on-next-file", reset_options, CONF_GLOBAL),
#ifdef CONFIG_LUA
#if HAVE_LUA
OPT_STRINGLIST("lua", lua_files, CONF_GLOBAL),
OPT_FLAG("osc", lua_load_osc, CONF_GLOBAL),
#endif
// ------------------------- stream options --------------------
#ifdef CONFIG_STREAM_CACHE
#if HAVE_STREAM_CACHE
OPT_CHOICE_OR_INT("cache", stream_cache_size, 0, 32, 0x7fffffff,
({"no", 0},
{"auto", -1}),
@ -365,20 +365,20 @@ 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 /* CONFIG_STREAM_CACHE */
#endif /* HAVE_STREAM_CACHE */
{"cdrom-device", &cdrom_device, CONF_TYPE_STRING, 0, 0, 0, NULL},
#ifdef CONFIG_DVDREAD
#if HAVE_DVDREAD
{"dvd-device", &dvd_device, CONF_TYPE_STRING, 0, 0, 0, NULL},
{"dvd-speed", &dvd_speed, CONF_TYPE_INT, 0, 0, 0, NULL},
{"dvdangle", &dvd_angle, CONF_TYPE_INT, CONF_RANGE, 1, 99, NULL},
#endif /* CONFIG_DVDREAD */
#endif /* HAVE_DVDREAD */
OPT_INTPAIR("chapter", chapterrange, 0),
OPT_CHOICE_OR_INT("edition", edition_id, 0, 0, 8190,
({"auto", -1})),
#ifdef CONFIG_LIBBLURAY
#if HAVE_LIBBLURAY
{"bluray-device", &bluray_device, CONF_TYPE_STRING, 0, 0, 0, NULL},
{"bluray-angle", &bluray_angle, CONF_TYPE_INT, CONF_RANGE, 0, 999, NULL},
#endif /* CONFIG_LIBBLURAY */
#endif /* HAVE_LIBBLURAY */
{"http-header-fields", &network_http_header_fields, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL},
{"user-agent", &network_useragent, CONF_TYPE_STRING, 0, 0, 0, NULL},
@ -426,7 +426,7 @@ const m_option_t mp_opts[] = {
OPT_STRING("quvi-format", quvi_format, 0),
#ifdef CONFIG_CDDA
#if HAVE_CDDA
{ "cdda", (void *)&cdda_opts, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
#endif
@ -438,16 +438,16 @@ const m_option_t mp_opts[] = {
OPT_STRING("sub-demuxer", sub_demuxer_name, 0),
{"mf", (void *) mfopts_conf, CONF_TYPE_SUBCONFIG, 0,0,0, NULL},
#ifdef CONFIG_RADIO
#if HAVE_RADIO
{"radio", (void *) radioopts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
#endif /* CONFIG_RADIO */
#ifdef CONFIG_TV
#endif /* HAVE_RADIO */
#if HAVE_TV
{"tv", (void *) tvopts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
#endif /* CONFIG_TV */
#ifdef CONFIG_PVR
#endif /* HAVE_TV */
#if HAVE_PVR
{"pvr", (void *) pvropts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
#endif /* CONFIG_PVR */
#ifdef CONFIG_DVBIN
#endif /* HAVE_PVR */
#if HAVE_DVBIN
{"dvbin", (void *) dvbin_opts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
#endif
@ -494,7 +494,7 @@ const m_option_t mp_opts[] = {
// postprocessing:
OPT_INT("pp", divx_quality, 0),
#ifdef CONFIG_LIBPOSTPROC
#if HAVE_LIBPOSTPROC
{"pphelp", (void *) &pp_help, CONF_TYPE_PRINT, CONF_GLOBAL | CONF_NOCFG, 0, 0, NULL},
#endif
@ -633,7 +633,7 @@ const m_option_t mp_opts[] = {
OPT_FLAG("stop-screensaver", stop_screensaver, 0),
OPT_INT64("wid", vo.WinID, CONF_GLOBAL),
#ifdef CONFIG_X11
#if HAVE_X11
OPT_STRINGLIST("fstype", vo.fstype_list, 0),
#endif
OPT_STRING("heartbeat-cmd", heartbeat_cmd, 0),
@ -645,7 +645,7 @@ const m_option_t mp_opts[] = {
OPT_CHOICE_OR_INT("fs-screen", vo.fsscreen_id, 0, 0, 32,
({"all", -2}, {"current", -1})),
#ifdef CONFIG_COCOA
#if HAVE_COCOA
OPT_FLAG("native-fs", vo.native_fs, 0),
#endif
@ -677,7 +677,7 @@ const m_option_t mp_opts[] = {
OPT_STRING("stream-capture", stream_capture, 0),
OPT_STRING("stream-dump", stream_dump, 0),
#ifdef CONFIG_LIRC
#if HAVE_LIRC
{"lircconf", &lirc_configfile, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL},
#endif
@ -724,9 +724,9 @@ const m_option_t mp_opts[] = {
OPT_INTRANGE("key-fifo-size", input.key_fifo_size, CONF_GLOBAL, 2, 65000),
OPT_FLAG("consolecontrols", consolecontrols, CONF_GLOBAL),
OPT_FLAG("mouse-movements", vo.enable_mouse_movements, CONF_GLOBAL),
#ifdef CONFIG_TV
#if HAVE_TV
{"tvscan", (void *) tvscan_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
#endif /* CONFIG_TV */
#endif /* HAVE_TV */
{"screenshot", (void *) screenshot_conf, CONF_TYPE_SUBCONFIG},
@ -739,7 +739,7 @@ const m_option_t mp_opts[] = {
{"version", (void *)print_version_opt, CONF_TYPE_PRINT_FUNC, CONF_NOCFG|CONF_GLOBAL|M_OPT_PRE_PARSE},
{"V", (void *)print_version_opt, CONF_TYPE_PRINT_FUNC, CONF_NOCFG|CONF_GLOBAL|M_OPT_PRE_PARSE},
#ifdef CONFIG_ENCODING
#if HAVE_ENCODING
OPT_STRING("o", encode_output.file, CONF_GLOBAL),
OPT_STRING("of", encode_output.format, CONF_GLOBAL),
OPT_STRINGLIST("ofopts*", encode_output.fopts, CONF_GLOBAL),
@ -836,7 +836,7 @@ const struct MPOpts mp_default_opts = {
.field_dominance = -1,
.sub_auto = 1,
.osd_bar_visible = 1,
#ifdef CONFIG_ASS
#if HAVE_LIBASS
.ass_enabled = 1,
#endif
.sub_scale = 1,
@ -847,7 +847,7 @@ const struct MPOpts mp_default_opts = {
.ass_shaper = 1,
.use_embedded_fonts = 1,
.suboverlap_enabled = 0,
#ifdef CONFIG_ENCA
#if HAVE_ENCA
.sub_cp = "enca",
#else
.sub_cp = "UTF-8:UTF-8-BROKEN",
@ -875,7 +875,7 @@ const struct MPOpts mp_default_opts = {
.use_joystick = 1,
.use_lirc = 1,
.use_lircc = 1,
#ifdef CONFIG_COCOA
#if HAVE_COCOA
.use_ar = 1,
.use_media_keys = 1,
#endif

View File

@ -42,7 +42,7 @@
typedef char *(*lookup_fun)(const char *);
static const lookup_fun config_lookup_functions[] = {
mp_find_user_config_file,
#ifdef CONFIG_COCOA
#if HAVE_COCOA
mp_get_macosx_bundled_path,
#endif
mp_find_global_config_file,

View File

@ -56,11 +56,11 @@
#include "stream/tv.h"
#include "stream/stream_radio.h"
#include "stream/pvr.h"
#ifdef CONFIG_DVBIN
#if HAVE_DVBIN
#include "stream/dvbin.h"
#endif
#include "screenshot.h"
#ifdef HAVE_SYS_MMAN_H
#if HAVE_SYS_MMAN_H
#include <sys/mman.h>
#endif
@ -1137,11 +1137,11 @@ static int mp_property_fullscreen(m_option_t *prop,
#define VF_DEINTERLACE_LABEL "deinterlace"
static const char *deint_filters[] = {
#ifdef CONFIG_VF_LAVFI
#if HAVE_VF_LAVFI
"lavfi=yadif",
#endif
"yadif",
#if CONFIG_VAAPI_VPP
#if HAVE_VAAPI_VPP
"vavpp",
#endif
NULL
@ -1608,7 +1608,7 @@ static int mp_property_sub_pos(m_option_t *prop, int action, void *arg,
return property_osd_helper(prop, action, arg, mpctx);
}
#ifdef CONFIG_TV
#if HAVE_TV
static tvi_handle_t *get_tvh(struct MPContext *mpctx)
{
@ -1955,7 +1955,7 @@ static const m_option_t mp_properties[] = {
M_OPTION_PROPERTY_CUSTOM("sub-visibility", property_osd_helper),
M_OPTION_PROPERTY_CUSTOM("sub-forced-only", property_osd_helper),
M_OPTION_PROPERTY_CUSTOM("sub-scale", property_osd_helper),
#ifdef CONFIG_ASS
#if HAVE_LIBASS
M_OPTION_PROPERTY_CUSTOM("ass-use-margins", property_osd_helper),
M_OPTION_PROPERTY_CUSTOM("ass-vsfilter-aspect-compat", property_osd_helper),
M_OPTION_PROPERTY_CUSTOM("ass-style-override", property_osd_helper),
@ -1964,7 +1964,7 @@ static const m_option_t mp_properties[] = {
M_OPTION_PROPERTY_CUSTOM("vf*", mp_property_vf),
M_OPTION_PROPERTY_CUSTOM("af*", mp_property_af),
#ifdef CONFIG_TV
#if HAVE_TV
{ "tv-brightness", mp_property_tv_color, CONF_TYPE_INT,
M_OPT_RANGE, -100, 100, .offset = TV_COLOR_BRIGHTNESS },
{ "tv-contrast", mp_property_tv_color, CONF_TYPE_INT,
@ -2071,7 +2071,7 @@ static struct property_osd_display {
{ "ass-style-override", _("ASS subtitle style override")},
{ "vf*", _("Video filters"), .msg = "Video filters:\n${vf}"},
{ "af*", _("Audio filters"), .msg = "Audio filters:\n${af}"},
#ifdef CONFIG_TV
#if HAVE_TV
{ "tv-brightness", _("Brightness"), .osd_progbar = OSD_BRIGHTNESS },
{ "tv-hue", _("Hue"), .osd_progbar = OSD_HUE},
{ "tv-saturation", _("Saturation"), .osd_progbar = OSD_SATURATION },
@ -2272,7 +2272,7 @@ static int edit_filters_osd(struct MPContext *mpctx, enum stream_type mediatype,
return r;
}
#ifdef HAVE_SYS_MMAN_H
#if HAVE_SYS_MMAN_H
static int ext2_sub_find(struct MPContext *mpctx, int id)
{
@ -2723,7 +2723,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
(bar_osd ? OSD_SEEK_INFO_BAR : 0);
break;
#ifdef CONFIG_RADIO
#if HAVE_RADIO
case MP_CMD_RADIO_STEP_CHANNEL:
if (mpctx->stream && mpctx->stream->type == STREAMTYPE_RADIO) {
int v = cmd->args[0].v.i;
@ -2761,7 +2761,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
break;
#endif
#ifdef CONFIG_TV
#if HAVE_TV
case MP_CMD_TV_START_SCAN:
if (get_tvh(mpctx))
tv_start_scan(get_tvh(mpctx), 1);
@ -2769,27 +2769,27 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
case MP_CMD_TV_SET_FREQ:
if (get_tvh(mpctx))
tv_set_freq(get_tvh(mpctx), cmd->args[0].v.f * 16.0);
#ifdef CONFIG_PVR
#if HAVE_PVR
else if (mpctx->stream && mpctx->stream->type == STREAMTYPE_PVR) {
pvr_set_freq(mpctx->stream, ROUND(cmd->args[0].v.f));
set_osd_msg(mpctx, OSD_MSG_TV_CHANNEL, osdl, osd_duration, "%s: %s",
pvr_get_current_channelname(mpctx->stream),
pvr_get_current_stationname(mpctx->stream));
}
#endif /* CONFIG_PVR */
#endif /* HAVE_PVR */
break;
case MP_CMD_TV_STEP_FREQ:
if (get_tvh(mpctx))
tv_step_freq(get_tvh(mpctx), cmd->args[0].v.f * 16.0);
#ifdef CONFIG_PVR
#if HAVE_PVR
else if (mpctx->stream && mpctx->stream->type == STREAMTYPE_PVR) {
pvr_force_freq_step(mpctx->stream, ROUND(cmd->args[0].v.f));
set_osd_msg(mpctx, OSD_MSG_TV_CHANNEL, osdl, osd_duration, "%s: f %d",
pvr_get_current_channelname(mpctx->stream),
pvr_get_current_frequency(mpctx->stream));
}
#endif /* CONFIG_PVR */
#endif /* HAVE_PVR */
break;
case MP_CMD_TV_SET_NORM:
@ -2810,7 +2810,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
"Channel: %s", tv_channel_current->name);
}
}
#ifdef CONFIG_PVR
#if HAVE_PVR
else if (mpctx->stream &&
mpctx->stream->type == STREAMTYPE_PVR) {
pvr_set_channel_step(mpctx->stream, cmd->args[0].v.i);
@ -2818,8 +2818,8 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
pvr_get_current_channelname(mpctx->stream),
pvr_get_current_stationname(mpctx->stream));
}
#endif /* CONFIG_PVR */
#ifdef CONFIG_DVBIN
#endif /* HAVE_PVR */
#if HAVE_DVBIN
if (mpctx->stream->type == STREAMTYPE_DVB) {
int dir;
int v = cmd->args[0].v.i;
@ -2836,7 +2836,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
mpctx->dvbin_reopen = 1;
}
}
#endif /* CONFIG_DVBIN */
#endif /* HAVE_DVBIN */
break;
case MP_CMD_TV_SET_CHANNEL:
@ -2847,17 +2847,17 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
"Channel: %s", tv_channel_current->name);
}
}
#ifdef CONFIG_PVR
#if HAVE_PVR
else if (mpctx->stream && mpctx->stream->type == STREAMTYPE_PVR) {
pvr_set_channel(mpctx->stream, cmd->args[0].v.s);
set_osd_msg(mpctx, OSD_MSG_TV_CHANNEL, osdl, osd_duration, "%s: %s",
pvr_get_current_channelname(mpctx->stream),
pvr_get_current_stationname(mpctx->stream));
}
#endif /* CONFIG_PVR */
#endif /* HAVE_PVR */
break;
#ifdef CONFIG_DVBIN
#if HAVE_DVBIN
case MP_CMD_DVB_SET_CHANNEL:
if (mpctx->stream->type == STREAMTYPE_DVB) {
mpctx->last_dvb_step = 1;
@ -2869,7 +2869,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
}
}
break;
#endif /* CONFIG_DVBIN */
#endif /* HAVE_DVBIN */
case MP_CMD_TV_LAST_CHANNEL:
if (get_tvh(mpctx)) {
@ -2879,14 +2879,14 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
"Channel: %s", tv_channel_current->name);
}
}
#ifdef CONFIG_PVR
#if HAVE_PVR
else if (mpctx->stream && mpctx->stream->type == STREAMTYPE_PVR) {
pvr_set_lastchannel(mpctx->stream);
set_osd_msg(mpctx, OSD_MSG_TV_CHANNEL, osdl, osd_duration, "%s: %s",
pvr_get_current_channelname(mpctx->stream),
pvr_get_current_stationname(mpctx->stream));
}
#endif /* CONFIG_PVR */
#endif /* HAVE_PVR */
break;
case MP_CMD_TV_STEP_NORM:
@ -2898,7 +2898,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
if (get_tvh(mpctx))
tv_step_chanlist(get_tvh(mpctx));
break;
#endif /* CONFIG_TV */
#endif /* HAVE_TV */
case MP_CMD_SUB_ADD:
mp_add_subtitles(mpctx, cmd->args[0].v.s);
@ -2978,14 +2978,14 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
case MP_CMD_SCRIPT_DISPATCH:
if (mpctx->lua_ctx) {
#ifdef CONFIG_LUA
#if HAVE_LUA
mp_lua_script_dispatch(mpctx, cmd->args[0].v.s, cmd->args[1].v.i,
cmd->key_up_follows ? "keyup_follows" : "press");
#endif
}
break;
#ifdef HAVE_SYS_MMAN_H
#if HAVE_SYS_MMAN_H
case MP_CMD_OVERLAY_ADD:
overlay_add(mpctx,
cmd->args[0].v.i, cmd->args[1].v.i, cmd->args[2].v.i,
@ -3052,7 +3052,7 @@ void mp_notify(struct MPContext *mpctx, enum mp_event event, void *arg)
static void handle_script_event(struct MPContext *mpctx, const char *name,
const char *arg)
{
#ifdef CONFIG_LUA
#if HAVE_LUA
mp_lua_event(mpctx, name, arg);
#endif
}

View File

@ -202,11 +202,11 @@ char *mp_get_playback_resume_config_filename(const char *fname,
goto exit;
realpath = mp_path_join(tmp, bstr0(cwd), bstr0(fname));
}
#ifdef CONFIG_DVDREAD
#if HAVE_DVDREAD
if (bstr_startswith0(bfname, "dvd://"))
realpath = talloc_asprintf(tmp, "%s - %s", realpath, dvd_device);
#endif
#ifdef CONFIG_LIBBLURAY
#if HAVE_LIBBLURAY
if (bstr_startswith0(bfname, "br://") || bstr_startswith0(bfname, "bd://") ||
bstr_startswith0(bfname, "bluray://"))
realpath = talloc_asprintf(tmp, "%s - %s", realpath, bluray_device);

View File

@ -56,7 +56,7 @@
#include "mp_core.h"
#include "command.h"
#ifdef CONFIG_DVBIN
#if HAVE_DVBIN
#include "stream/dvbin.h"
#endif
@ -85,7 +85,7 @@ void uninit_player(struct MPContext *mpctx, unsigned int mask)
if (mask & INITIALIZED_LIBASS) {
mpctx->initialized_flags &= ~INITIALIZED_LIBASS;
#ifdef CONFIG_ASS
#if HAVE_LIBASS
if (mpctx->osd->ass_renderer)
ass_renderer_done(mpctx->osd->ass_renderer);
mpctx->osd->ass_renderer = NULL;
@ -472,7 +472,7 @@ void add_demuxer_tracks(struct MPContext *mpctx, struct demuxer *demuxer)
static void add_dvd_tracks(struct MPContext *mpctx)
{
#ifdef CONFIG_DVDREAD
#if HAVE_DVDREAD
struct demuxer *demuxer = mpctx->demuxer;
struct stream *stream = demuxer->stream;
struct stream_dvd_info_req info;
@ -818,7 +818,7 @@ static bool attachment_is_font(struct demux_attachment *att)
static void add_subtitle_fonts_from_sources(struct MPContext *mpctx)
{
#ifdef CONFIG_ASS
#if HAVE_LIBASS
if (mpctx->opts->ass_enabled) {
for (int j = 0; j < mpctx->num_sources; j++) {
struct demuxer *d = mpctx->sources[j];
@ -835,7 +835,7 @@ static void add_subtitle_fonts_from_sources(struct MPContext *mpctx)
static void init_sub_renderer(struct MPContext *mpctx)
{
#ifdef CONFIG_ASS
#if HAVE_LIBASS
assert(!(mpctx->initialized_flags & INITIALIZED_LIBASS));
assert(!mpctx->osd->ass_renderer);
@ -853,7 +853,7 @@ static struct mp_resolve_result *resolve_url(const char *filename,
{
if (!mp_is_url(bstr0(filename)))
return NULL;
#if defined(CONFIG_LIBQUVI) || defined(CONFIG_LIBQUVI9)
#if HAVE_LIBQUVI4 || HAVE_LIBQUVI9
return mp_resolve_quvi(filename, opts);
#else
return NULL;
@ -979,7 +979,7 @@ static void play_current_file(struct MPContext *mpctx)
if (!mpctx->filename)
goto terminate_playback;
#ifdef CONFIG_ENCODING
#if HAVE_ENCODING
encode_lavc_discontinuity(mpctx->encode_lavc_ctx);
#endif
@ -1026,7 +1026,7 @@ static void play_current_file(struct MPContext *mpctx)
MP_DBG(mpctx, "\n[[[init getch2]]]\n");
}
#ifdef CONFIG_ASS
#if HAVE_LIBASS
if (opts->ass_style_override)
ass_set_style_overrides(mpctx->ass_library, opts->ass_force_style_list);
#endif
@ -1077,7 +1077,7 @@ static void play_current_file(struct MPContext *mpctx)
stream_set_capture_file(mpctx->stream, opts->stream_capture);
#ifdef CONFIG_DVBIN
#if HAVE_DVBIN
goto_reopen_demuxer: ;
#endif
@ -1164,7 +1164,7 @@ goto_reopen_demuxer: ;
preselect_demux_streams(mpctx);
#ifdef CONFIG_ENCODING
#if HAVE_ENCODING
if (mpctx->encode_lavc_ctx && mpctx->current_track[STREAM_VIDEO])
encode_lavc_expect_stream(mpctx->encode_lavc_ctx, AVMEDIA_TYPE_VIDEO);
if (mpctx->encode_lavc_ctx && mpctx->current_track[STREAM_AUDIO])
@ -1186,7 +1186,7 @@ goto_reopen_demuxer: ;
if (!mpctx->sh_video && !mpctx->sh_audio) {
MP_FATAL(mpctx, "No video or audio streams selected.\n");
#ifdef CONFIG_DVBIN
#if HAVE_DVBIN
if (mpctx->stream->type == STREAMTYPE_DVB) {
int dir;
int v = mpctx->last_dvb_step;
@ -1262,7 +1262,7 @@ goto_reopen_demuxer: ;
MP_VERBOSE(mpctx, "EOF code: %d \n", mpctx->stop_play);
#ifdef CONFIG_DVBIN
#if HAVE_DVBIN
if (mpctx->dvbin_reopen) {
mpctx->stop_play = 0;
uninit_player(mpctx, INITIALIZED_ALL - (INITIALIZED_STREAM | INITIALIZED_GETCH2 | (opts->fixed_vo ? INITIALIZED_VO : 0)));

View File

@ -64,11 +64,11 @@
#include "command.h"
#include "screenshot.h"
#ifdef CONFIG_X11
#if HAVE_X11
#include "video/out/x11_common.h"
#endif
#ifdef CONFIG_COCOA
#if HAVE_COCOA
#include "osdep/macosx_application.h"
#endif
@ -109,14 +109,14 @@ static MP_NORETURN void exit_player(struct MPContext *mpctx,
int rc;
uninit_player(mpctx, INITIALIZED_ALL);
#ifdef CONFIG_ENCODING
#if HAVE_ENCODING
encode_lavc_finish(mpctx->encode_lavc_ctx);
encode_lavc_free(mpctx->encode_lavc_ctx);
#endif
mpctx->encode_lavc_ctx = NULL;
#ifdef CONFIG_LUA
#if HAVE_LUA
mp_lua_uninit(mpctx);
#endif
@ -124,7 +124,7 @@ static MP_NORETURN void exit_player(struct MPContext *mpctx,
timeEndPeriod(1);
#endif
#ifdef CONFIG_COCOA
#if HAVE_COCOA
cocoa_set_input_context(NULL);
#endif
@ -134,7 +134,7 @@ static MP_NORETURN void exit_player(struct MPContext *mpctx,
osd_free(mpctx->osd);
#ifdef CONFIG_ASS
#if HAVE_LIBASS
ass_library_done(mpctx->ass_library);
mpctx->ass_library = NULL;
#endif
@ -179,7 +179,7 @@ static MP_NORETURN void exit_player(struct MPContext *mpctx,
mp_msg_uninit(mpctx->global);
talloc_free(mpctx);
#ifdef CONFIG_COCOA
#if HAVE_COCOA
terminate_cocoa_application();
// never reach here:
// terminate calls exit itself, just silence compiler warning
@ -205,7 +205,7 @@ static bool handle_help_options(struct MPContext *mpctx)
talloc_free(list);
opt_exit = 1;
}
#ifdef CONFIG_X11
#if HAVE_X11
if (opts->vo.fstype_list && strcmp(opts->vo.fstype_list[0], "help") == 0) {
fstype_help();
mp_msg(MSGT_FIXME, MSGL_FIXME, "\n");
@ -223,7 +223,7 @@ static bool handle_help_options(struct MPContext *mpctx)
property_print_help();
opt_exit = 1;
}
#ifdef CONFIG_ENCODING
#if HAVE_ENCODING
if (encode_lavc_showhelp(mpctx->opts))
opt_exit = 1;
#endif
@ -284,7 +284,7 @@ static void init_input(struct MPContext *mpctx)
// Set the libstream interrupt callback
stream_set_interrupt_callback(mp_input_check_interrupt, mpctx->input);
#ifdef CONFIG_COCOA
#if HAVE_COCOA
cocoa_set_input_context(mpctx->input);
#endif
}
@ -366,13 +366,13 @@ static int mpv_main(int argc, char *argv[])
exit_player(mpctx, EXIT_NONE);
}
#ifdef CONFIG_PRIORITY
#if HAVE_PRIORITY
set_priority();
#endif
init_input(mpctx);
#ifdef CONFIG_ENCODING
#if HAVE_ENCODING
if (opts->encode_output.file && *opts->encode_output.file) {
mpctx->encode_lavc_ctx = encode_lavc_init(&opts->encode_output);
if(!mpctx->encode_lavc_ctx) {
@ -388,7 +388,7 @@ static int mpv_main(int argc, char *argv[])
}
#endif
#ifdef CONFIG_ASS
#if HAVE_LIBASS
mpctx->ass_library = mp_ass_init(opts);
#else
MP_WARN(mpctx, "Compiled without libass.\n");
@ -410,7 +410,7 @@ static int mpv_main(int argc, char *argv[])
mpctx->initialized_flags |= INITIALIZED_VO;
}
#ifdef CONFIG_LUA
#if HAVE_LUA
// Lua user scripts can call arbitrary functions. Load them at a point
// where this is safe.
mp_lua_init(mpctx);
@ -432,7 +432,7 @@ static int mpv_main(int argc, char *argv[])
int main(int argc, char *argv[])
{
#ifdef CONFIG_COCOA
#if HAVE_COCOA
return cocoa_main(mpv_main, argc, argv);
#else
return mpv_main(argc, argv);

View File

@ -24,13 +24,13 @@
// All these are generated from mpvcore/lua/*.lua
static const char *builtin_lua_scripts[][2] = {
{"mp.defaults",
# include "lua/defaults.inc"
# include "mpvcore/player/lua/defaults.inc"
},
{"mp.assdraw",
# include "lua/assdraw.inc"
# include "mpvcore/player/lua/assdraw.inc"
},
{"@osc",
# include "lua/osc.inc"
# include "mpvcore/player/lua/osc.inc"
},
{0}
};

View File

@ -140,7 +140,7 @@ void print_status(struct MPContext *mpctx)
saddf(&line, " ct:%7.3f", mpctx->total_avsync_change);
}
#ifdef CONFIG_ENCODING
#if HAVE_ENCODING
double position = get_current_pos_ratio(mpctx, true);
char lavcbuf[80];
if (encode_lavc_getstatus(mpctx->encode_lavc_ctx, lavcbuf, sizeof(lavcbuf),

View File

@ -200,7 +200,7 @@ static void seek_reset(struct MPContext *mpctx, bool reset_ao, bool reset_ac)
mpctx->dropped_frames = 0;
mpctx->playback_pts = MP_NOPTS_VALUE;
#ifdef CONFIG_ENCODING
#if HAVE_ENCODING
encode_lavc_discontinuity(mpctx->encode_lavc_ctx);
#endif
}
@ -942,7 +942,7 @@ void run_playloop(struct MPContext *mpctx)
bool was_restart = mpctx->restart_playback;
bool new_frame_shown = false;
#ifdef CONFIG_ENCODING
#if HAVE_ENCODING
if (encode_lavc_didfail(mpctx->encode_lavc_ctx)) {
mpctx->stop_play = PT_QUIT;
return;

View File

@ -129,7 +129,7 @@ void update_subtitles(struct MPContext *mpctx)
static void set_dvdsub_fake_extradata(struct dec_sub *dec_sub, struct stream *st,
int width, int height)
{
#ifdef CONFIG_DVDREAD
#if HAVE_DVDREAD
if (!st)
return;

View File

@ -44,7 +44,7 @@
void update_fps(struct MPContext *mpctx)
{
#ifdef CONFIG_ENCODING
#if HAVE_ENCODING
struct sh_video *sh_video = mpctx->sh_video;
if (mpctx->encode_lavc_ctx && sh_video)
encode_lavc_set_video_fps(mpctx->encode_lavc_ctx, sh_video->fps);

View File

@ -30,11 +30,11 @@
#include <errno.h>
#include <sys/ioctl.h>
#ifdef HAVE_TERMIOS
#ifdef HAVE_TERMIOS_H
#if HAVE_TERMIOS
#if HAVE_TERMIOS_H
#include <termios.h>
#endif
#ifdef HAVE_SYS_TERMIOS_H
#if HAVE_SYS_TERMIOS_H
#include <sys/termios.h>
#endif
#endif
@ -47,7 +47,7 @@
#include "mpvcore/input/keycodes.h"
#include "getch2.h"
#ifdef HAVE_TERMIOS
#if HAVE_TERMIOS
static volatile struct termios tio_orig;
static volatile int tio_orig_set;
#endif
@ -71,12 +71,13 @@ typedef struct {
static keycode_map getch2_keys;
#ifdef HAVE_TERMCAP
#if HAVE_TERMINFO || HAVE_TERMCAP
static char *term_rmkx = NULL;
static char *term_smkx = NULL;
#ifdef HAVE_TERMINFO
#if HAVE_TERMINFO
#include <curses.h>
#endif
#include <term.h>
@ -138,7 +139,7 @@ static keycode_st* keys_push_once(char *p, int code) {
return st;
}
#ifdef HAVE_TERMCAP
#if HAVE_TERMINFO || HAVE_TERMCAP
typedef struct {
char *buf;
@ -228,9 +229,9 @@ static void termcap_add_extra_f_keys(void) {
#endif
int load_termcap(char *termtype){
#ifdef HAVE_TERMCAP
#if HAVE_TERMINFO || HAVE_TERMCAP
#ifdef HAVE_TERMINFO
#if HAVE_TERMINFO
use_env(TRUE);
int ret;
if (setupterm(termtype, 1, &ret) != OK) {
@ -445,12 +446,12 @@ static void do_activate_getch2(void)
if (getch2_active)
return;
#ifdef HAVE_TERMCAP
#if HAVE_TERMINFO || HAVE_TERMCAP
if (term_smkx)
tputs(term_smkx, 1, putchar);
#endif
#ifdef HAVE_TERMIOS
#if HAVE_TERMIOS
struct termios tio_new;
tcgetattr(0,&tio_new);
@ -473,12 +474,12 @@ static void do_deactivate_getch2(void)
if (!getch2_active)
return;
#ifdef HAVE_TERMCAP
#if HAVE_TERMINFO || HAVE_TERMCAP
if (term_rmkx)
tputs(term_rmkx, 1, putchar);
#endif
#ifdef HAVE_TERMIOS
#if HAVE_TERMIOS
if (tio_orig_set) {
// once set, it will never be set again
// so we can cast away volatile here

View File

@ -58,7 +58,7 @@ char *mp_to_utf8(void *talloc_ctx, const wchar_t *s)
#include <io.h>
#include <fcntl.h>
#ifdef HAVE_PTHREADS
#if HAVE_PTHREADS
#include <pthread.h>
#endif
@ -298,7 +298,7 @@ static void init_getenv(void)
char *mp_getenv(const char *name)
{
#ifdef HAVE_PTHREADS
#if HAVE_PTHREADS
static pthread_once_t once_init_getenv = PTHREAD_ONCE_INIT;
pthread_once(&once_init_getenv, init_getenv);
#else

View File

@ -30,7 +30,7 @@ void mp_sleep_us(int64_t us)
{
if (us < 0)
return;
#ifdef HAVE_NANOSLEEP
#if HAVE_NANOSLEEP
struct timespec ts;
ts.tv_sec = us / 1000000;
ts.tv_nsec = (us % 1000000) * 1000;

View File

@ -26,10 +26,10 @@
#include <errno.h>
#include <sys/ioctl.h>
#ifdef HAVE_SYS_SOUNDCARD_H
#if HAVE_SYS_SOUNDCARD_H
#include <sys/soundcard.h>
#else
#ifdef HAVE_SOUNDCARD_H
#if HAVE_SOUNDCARD_H
#include <soundcard.h>
#else
#include <linux/soundcard.h>

View File

@ -40,20 +40,20 @@ int audio_in_init(audio_in_t *ai, int type)
ai->samplesize = -1;
switch (ai->type) {
#ifdef CONFIG_ALSA
#if HAVE_ALSA
case AUDIO_IN_ALSA:
ai->alsa.handle = NULL;
ai->alsa.log = NULL;
ai->alsa.device = strdup("default");
return 0;
#endif
#ifdef CONFIG_OSS_AUDIO
#if HAVE_OSS_AUDIO
case AUDIO_IN_OSS:
ai->oss.audio_fd = -1;
ai->oss.device = strdup("/dev/dsp");
return 0;
#endif
#ifdef CONFIG_SNDIO
#if HAVE_SNDIO
case AUDIO_IN_SNDIO:
ai->sndio.hdl = NULL;
ai->sndio.device = strdup("default");
@ -68,19 +68,19 @@ int audio_in_setup(audio_in_t *ai)
{
switch (ai->type) {
#ifdef CONFIG_ALSA
#if HAVE_ALSA
case AUDIO_IN_ALSA:
if (ai_alsa_init(ai) < 0) return -1;
ai->setup = 1;
return 0;
#endif
#ifdef CONFIG_OSS_AUDIO
#if HAVE_OSS_AUDIO
case AUDIO_IN_OSS:
if (ai_oss_init(ai) < 0) return -1;
ai->setup = 1;
return 0;
#endif
#ifdef CONFIG_SNDIO
#if HAVE_SNDIO
case AUDIO_IN_SNDIO:
if (ai_sndio_init(ai) < 0) return -1;
ai->setup = 1;
@ -94,21 +94,21 @@ int audio_in_setup(audio_in_t *ai)
int audio_in_set_samplerate(audio_in_t *ai, int rate)
{
switch (ai->type) {
#ifdef CONFIG_ALSA
#if HAVE_ALSA
case AUDIO_IN_ALSA:
ai->req_samplerate = rate;
if (!ai->setup) return 0;
if (ai_alsa_setup(ai) < 0) return -1;
return ai->samplerate;
#endif
#ifdef CONFIG_OSS_AUDIO
#if HAVE_OSS_AUDIO
case AUDIO_IN_OSS:
ai->req_samplerate = rate;
if (!ai->setup) return 0;
if (ai_oss_set_samplerate(ai) < 0) return -1;
return ai->samplerate;
#endif
#ifdef CONFIG_SNDIO
#if HAVE_SNDIO
case AUDIO_IN_SNDIO:
ai->req_samplerate = rate;
if (!ai->setup) return 0;
@ -123,21 +123,21 @@ int audio_in_set_samplerate(audio_in_t *ai, int rate)
int audio_in_set_channels(audio_in_t *ai, int channels)
{
switch (ai->type) {
#ifdef CONFIG_ALSA
#if HAVE_ALSA
case AUDIO_IN_ALSA:
ai->req_channels = channels;
if (!ai->setup) return 0;
if (ai_alsa_setup(ai) < 0) return -1;
return ai->channels;
#endif
#ifdef CONFIG_OSS_AUDIO
#if HAVE_OSS_AUDIO
case AUDIO_IN_OSS:
ai->req_channels = channels;
if (!ai->setup) return 0;
if (ai_oss_set_channels(ai) < 0) return -1;
return ai->channels;
#endif
#ifdef CONFIG_SNDIO
#if HAVE_SNDIO
case AUDIO_IN_SNDIO:
ai->req_channels = channels;
if (!ai->setup) return 0;
@ -151,12 +151,12 @@ int audio_in_set_channels(audio_in_t *ai, int channels)
int audio_in_set_device(audio_in_t *ai, char *device)
{
#ifdef CONFIG_ALSA
#if HAVE_ALSA
int i;
#endif
if (ai->setup) return -1;
switch (ai->type) {
#ifdef CONFIG_ALSA
#if HAVE_ALSA
case AUDIO_IN_ALSA:
free(ai->alsa.device);
ai->alsa.device = strdup(device);
@ -166,13 +166,13 @@ int audio_in_set_device(audio_in_t *ai, char *device)
}
return 0;
#endif
#ifdef CONFIG_OSS_AUDIO
#if HAVE_OSS_AUDIO
case AUDIO_IN_OSS:
free(ai->oss.device);
ai->oss.device = strdup(device);
return 0;
#endif
#ifdef CONFIG_SNDIO
#if HAVE_SNDIO
case AUDIO_IN_SNDIO:
if (ai->sndio.device) free(ai->sndio.device);
ai->sndio.device = strdup(device);
@ -187,7 +187,7 @@ int audio_in_uninit(audio_in_t *ai)
{
if (ai->setup) {
switch (ai->type) {
#ifdef CONFIG_ALSA
#if HAVE_ALSA
case AUDIO_IN_ALSA:
if (ai->alsa.log)
snd_output_close(ai->alsa.log);
@ -197,13 +197,13 @@ int audio_in_uninit(audio_in_t *ai)
ai->setup = 0;
return 0;
#endif
#ifdef CONFIG_OSS_AUDIO
#if HAVE_OSS_AUDIO
case AUDIO_IN_OSS:
close(ai->oss.audio_fd);
ai->setup = 0;
return 0;
#endif
#ifdef CONFIG_SNDIO
#if HAVE_SNDIO
case AUDIO_IN_SNDIO:
if (ai->sndio.hdl)
sio_close(ai->sndio.hdl);
@ -218,15 +218,15 @@ int audio_in_uninit(audio_in_t *ai)
int audio_in_start_capture(audio_in_t *ai)
{
switch (ai->type) {
#ifdef CONFIG_ALSA
#if HAVE_ALSA
case AUDIO_IN_ALSA:
return snd_pcm_start(ai->alsa.handle);
#endif
#ifdef CONFIG_OSS_AUDIO
#if HAVE_OSS_AUDIO
case AUDIO_IN_OSS:
return 0;
#endif
#ifdef CONFIG_SNDIO
#if HAVE_SNDIO
case AUDIO_IN_SNDIO:
if (!sio_start(ai->sndio.hdl))
return -1;
@ -242,7 +242,7 @@ int audio_in_read_chunk(audio_in_t *ai, unsigned char *buffer)
int ret;
switch (ai->type) {
#ifdef CONFIG_ALSA
#if HAVE_ALSA
case AUDIO_IN_ALSA:
ret = snd_pcm_readi(ai->alsa.handle, buffer, ai->alsa.chunk_size);
if (ret != ai->alsa.chunk_size) {
@ -262,7 +262,7 @@ int audio_in_read_chunk(audio_in_t *ai, unsigned char *buffer)
}
return ret;
#endif
#ifdef CONFIG_OSS_AUDIO
#if HAVE_OSS_AUDIO
case AUDIO_IN_OSS:
ret = read(ai->oss.audio_fd, buffer, ai->blocksize);
if (ret != ai->blocksize) {
@ -276,7 +276,7 @@ int audio_in_read_chunk(audio_in_t *ai, unsigned char *buffer)
}
return ret;
#endif
#ifdef CONFIG_SNDIO
#if HAVE_SNDIO
case AUDIO_IN_SNDIO:
ret = sio_read(ai->sndio.hdl, buffer, ai->blocksize);
if (ret != ai->blocksize) {

View File

@ -25,7 +25,7 @@
#include "config.h"
#ifdef CONFIG_ALSA
#if HAVE_ALSA
#include <alsa/asoundlib.h>
typedef struct {
@ -38,7 +38,7 @@ typedef struct {
} ai_alsa_t;
#endif
#ifdef CONFIG_OSS_AUDIO
#if HAVE_OSS_AUDIO
typedef struct {
char *device;
@ -46,7 +46,7 @@ typedef struct {
} ai_oss_t;
#endif
#ifdef CONFIG_SNDIO
#if HAVE_SNDIO
#include <sndio.h>
typedef struct {
@ -72,13 +72,13 @@ typedef struct
int bytes_per_sample;
int samplesize;
#ifdef CONFIG_ALSA
#if HAVE_ALSA
ai_alsa_t alsa;
#endif
#ifdef CONFIG_OSS_AUDIO
#if HAVE_OSS_AUDIO
ai_oss_t oss;
#endif
#ifdef CONFIG_SNDIO
#if HAVE_SNDIO
ai_sndio_t sndio;
#endif
} audio_in_t;
@ -92,19 +92,19 @@ int audio_in_uninit(audio_in_t *ai);
int audio_in_start_capture(audio_in_t *ai);
int audio_in_read_chunk(audio_in_t *ai, unsigned char *buffer);
#ifdef CONFIG_ALSA
#if HAVE_ALSA
int ai_alsa_setup(audio_in_t *ai);
int ai_alsa_init(audio_in_t *ai);
int ai_alsa_xrun(audio_in_t *ai);
#endif
#ifdef CONFIG_OSS_AUDIO
#if HAVE_OSS_AUDIO
int ai_oss_set_samplerate(audio_in_t *ai);
int ai_oss_set_channels(audio_in_t *ai);
int ai_oss_init(audio_in_t *ai);
#endif
#ifdef CONFIG_SNDIO
#if HAVE_SNDIO
int ai_sndio_setup(audio_in_t *ai);
int ai_sndio_init(audio_in_t *ai);
#endif

View File

@ -80,34 +80,34 @@ extern const stream_info_t stream_info_rar_filter;
extern const stream_info_t stream_info_rar_entry;
static const stream_info_t *const stream_list[] = {
#ifdef CONFIG_VCD
#if HAVE_VCD
&stream_info_vcd,
#endif
#ifdef CONFIG_CDDA
#if HAVE_CDDA
&stream_info_cdda,
#endif
&stream_info_ffmpeg,
&stream_info_avdevice,
#ifdef CONFIG_DVBIN
#if HAVE_DVBIN
&stream_info_dvb,
#endif
#ifdef CONFIG_TV
#if HAVE_TV
&stream_info_tv,
#endif
#ifdef CONFIG_RADIO
#if HAVE_RADIO
&stream_info_radio,
#endif
#ifdef CONFIG_PVR
#if HAVE_PVR
&stream_info_pvr,
#endif
#ifdef CONFIG_LIBSMBCLIENT
#if HAVE_LIBSMBCLIENT
&stream_info_smb,
#endif
#ifdef CONFIG_DVDREAD
#if HAVE_DVDREAD
&stream_info_ifo,
&stream_info_dvd,
#endif
#ifdef CONFIG_LIBBLURAY
#if HAVE_LIBBLURAY
&stream_info_bluray,
#endif
@ -804,7 +804,7 @@ static int stream_enable_cache(stream_t **stream, int64_t size, int64_t min,
int res = -1;
#ifdef CONFIG_STREAM_CACHE
#if HAVE_STREAM_CACHE
res = stream_cache_init(cache, orig, size, min, seek_limit);
#endif

View File

@ -37,7 +37,7 @@
#include <linux/types.h>
#ifdef CONFIG_RADIO_V4L2
#if HAVE_RADIO_V4L2
#include <linux/videodev2.h>
#endif
@ -48,13 +48,13 @@
#include "stream_radio.h"
#include "libavutil/avstring.h"
#ifdef CONFIG_RADIO_CAPTURE
#if HAVE_RADIO_CAPTURE
#include "audio_in.h"
#ifdef HAVE_SYS_SOUNDCARD_H
#if HAVE_SYS_SOUNDCARD_H
#include <sys/soundcard.h>
#else
#ifdef HAVE_SOUNDCARD_H
#if HAVE_SOUNDCARD_H
#include <soundcard.h>
#else
#include <linux/soundcard.h>
@ -93,7 +93,7 @@ typedef struct radio_priv_s {
float rangehigh; ///< highest tunable frequency in MHz
const struct radio_driver_s* driver;
int old_snd_volume;
#ifdef CONFIG_RADIO_CAPTURE
#if HAVE_RADIO_CAPTURE
volatile int do_capture; ///< is capture enabled
audio_in_t audio_in;
unsigned char* audio_ringbuffer;
@ -125,7 +125,7 @@ static const m_option_t stream_opts_fields[] = {
};
static void close_s(struct stream *stream);
#ifdef CONFIG_RADIO_CAPTURE
#if HAVE_RADIO_CAPTURE
static int clear_buffer(radio_priv_t* priv);
#endif
@ -221,7 +221,7 @@ static int parse_channels(radio_priv_t* priv,float freq_channel,float* pfreq){
return STREAM_OK;
}
#ifdef CONFIG_RADIO_V4L2
#if HAVE_RADIO_V4L2
/*****************************************************************
* \brief get fraction value for using in set_frequency and get_frequency
* \return STREAM_OK if success, STREAM_ERROR otherwise
@ -378,7 +378,7 @@ static const radio_driver_t radio_driver_v4l2={
set_frequency_v4l2,
get_frequency_v4l2
};
#endif /* CONFIG_RADIO_V4L2 */
#endif /* HAVE_RADIO_V4L2 */
static inline int init_frac(radio_priv_t* priv){
return priv->driver->init_frac(priv);
@ -391,7 +391,7 @@ static inline int set_frequency(radio_priv_t* priv,float frequency){
if(priv->driver->set_frequency(priv,frequency)!=STREAM_OK)
return STREAM_ERROR;
#ifdef CONFIG_RADIO_CAPTURE
#if HAVE_RADIO_CAPTURE
if(clear_buffer(priv)!=STREAM_OK){
mp_tmsg(MSGT_RADIO,MSGL_ERR,"[radio] Clearing buffer failed: %s\n",strerror(errno));
return STREAM_ERROR;
@ -410,7 +410,7 @@ static inline int get_volume(radio_priv_t* priv,int* volume){
}
#ifndef CONFIG_RADIO_CAPTURE
#if !HAVE_RADIO_CAPTURE
/*****************************************************************
* \brief stub, if capture disabled at compile-time
* \return STREAM_OK
@ -441,7 +441,7 @@ static int read_chunk(audio_in_t *ai, unsigned char *buffer)
int ret;
switch (ai->type) {
#ifdef CONFIG_ALSA
#if HAVE_ALSA
case AUDIO_IN_ALSA:
//device opened in non-blocking mode
ret = snd_pcm_readi(ai->alsa.handle, buffer, ai->alsa.chunk_size);
@ -463,7 +463,7 @@ static int read_chunk(audio_in_t *ai, unsigned char *buffer)
}
return ret;
#endif
#ifdef CONFIG_OSS_AUDIO
#if HAVE_OSS_AUDIO
case AUDIO_IN_OSS:
{
int bt=0;
@ -562,7 +562,7 @@ static int init_audio(radio_priv_t *priv)
priv->do_capture=1;
mp_tmsg(MSGT_RADIO,MSGL_V,"[radio] Starting capture stuff.\n");
#ifdef CONFIG_ALSA
#if HAVE_ALSA
while ((tmp = strrchr(priv->radio_param->adevice, '='))){
tmp[0] = ':';
//adevice option looks like ALSA device name. Switching to ALSA
@ -584,11 +584,11 @@ static int init_audio(radio_priv_t *priv)
mp_tmsg(MSGT_RADIO, MSGL_ERR, "[radio] audio_in_setup call failed: %s\n", strerror(errno));
return STREAM_ERROR;
}
#ifdef CONFIG_OSS_AUDIO
#if HAVE_OSS_AUDIO
if(is_oss)
ioctl(priv->audio_in.oss.audio_fd, SNDCTL_DSP_NONBLOCK, 0);
#endif
#ifdef CONFIG_ALSA
#if HAVE_ALSA
if(!is_oss)
snd_pcm_nonblock(priv->audio_in.alsa.handle,1);
#endif
@ -616,7 +616,7 @@ static int init_audio(radio_priv_t *priv)
return STREAM_OK;
}
#endif /* CONFIG_RADIO_CAPTURE */
#endif /* HAVE_RADIO_CAPTURE */
/*-------------------------------------------------------------------------
for call from mplayer.c
@ -788,7 +788,7 @@ char* radio_get_channel_name(struct stream *stream){
static int fill_buffer_s(struct stream *s, char *buffer, int max_len){
int len=max_len;
#ifdef CONFIG_RADIO_CAPTURE
#if HAVE_RADIO_CAPTURE
radio_priv_t* priv=(radio_priv_t*)s->priv;
if (priv->do_capture){
@ -806,7 +806,7 @@ static int fill_buffer_s(struct stream *s, char *buffer, int max_len){
when no driver explicitly specified first available will be used
*/
static const radio_driver_t* radio_drivers[]={
#ifdef CONFIG_RADIO_V4L2
#if HAVE_RADIO_V4L2
&radio_driver_v4l2,
#endif
0
@ -837,7 +837,7 @@ static int open_s(stream_t *stream,int mode)
priv->radio_param=stream->priv;
stream->priv=NULL;
#ifdef CONFIG_RADIO_CAPTURE
#if HAVE_RADIO_CAPTURE
if (priv->radio_param->capture && strncmp("capture",priv->radio_param->capture,7)==0)
priv->do_capture=1;
else
@ -934,7 +934,7 @@ static void close_s(struct stream *stream){
radio_channels_t * tmp;
if (!priv) return;
#ifdef CONFIG_RADIO_CAPTURE
#if HAVE_RADIO_CAPTURE
free(priv->audio_ringbuffer);
priv->audio_ringbuffer = NULL;

View File

@ -60,7 +60,7 @@ extern const tvi_info_t tvi_info_v4l2;
/** List of drivers in autodetection order */
static const tvi_info_t* tvi_driver_list[]={
#ifdef CONFIG_TV_V4L2
#if HAVE_TV_V4L2
&tvi_info_v4l2,
#endif
&tvi_info_dummy,
@ -474,7 +474,7 @@ static int open_tv(tvi_handle_t *tvh)
funcs->control(tvh->priv, TVI_CONTROL_SPC_SET_INPUT, &tvh->tv_param->input);
if ((!strcmp(tvh->tv_param->driver, "v4l2") && tvh->tv_param->normid >= 0))
tv_set_norm_i(tvh, tvh->tv_param->normid);
tv_set_norm_i(tvh, tvh->tv_param->normid);
else
tv_set_norm(tvh,tvh->tv_param->norm);

View File

@ -46,10 +46,10 @@ known issues:
#include <sys/types.h>
#include <unistd.h>
#include <math.h>
#ifdef HAVE_SYS_SYSINFO_H
#if HAVE_SYS_SYSINFO_H
#include <sys/sysinfo.h>
#endif
#ifdef HAVE_SYS_VIDEOIO_H
#if HAVE_SYS_VIDEOIO_H
#include <sys/videoio.h>
#else
#include <linux/types.h>
@ -400,7 +400,7 @@ static void init_audio(priv_t *priv)
if (priv->audio_initialized) return;
if (!priv->tv_param->noaudio) {
#ifdef CONFIG_ALSA
#if HAVE_ALSA
if (priv->tv_param->alsa)
audio_in_init(&priv->audio_in, AUDIO_IN_ALSA);
else
@ -1321,7 +1321,7 @@ static int get_capture_buffer_size(priv_t *priv)
if (priv->tv_param->buffer_size >= 0) {
bufsize = priv->tv_param->buffer_size*1024*1024;
} else {
#ifdef HAVE_SYS_SYSINFO_H
#if HAVE_SYS_SYSINFO_H
struct sysinfo si;
sysinfo(&si);

View File

@ -36,7 +36,7 @@
// m_color argument
#define MP_ASS_COLOR(c) MP_ASS_RGBA((c).r, (c).g, (c).b, (c).a)
#ifdef CONFIG_ASS
#if HAVE_LIBASS
#include <ass/ass.h>
#include <ass/ass_types.h>
@ -62,5 +62,5 @@ struct sub_bitmaps;
void mp_ass_render_frame(ASS_Renderer *renderer, ASS_Track *track, double time,
struct sub_bitmap **parts, struct sub_bitmaps *res);
#endif /* CONFIG_ASS */
#endif /* HAVE_LIBASS */
#endif /* MPLAYER_ASS_MP_H */

View File

@ -41,7 +41,7 @@ extern const struct sd_functions sd_lavf_srt;
extern const struct sd_functions sd_lavc_conv;
static const struct sd_functions *sd_list[] = {
#ifdef CONFIG_ASS
#if HAVE_LIBASS
&sd_ass,
#endif
&sd_lavc,

View File

@ -103,18 +103,17 @@ static const struct vd_lavc_hwdec mp_vd_lavc_crystalhd = {
};
static const struct vd_lavc_hwdec *hwdec_list[] = {
#if CONFIG_VDPAU
#if HAVE_AV_CODEC_NEW_VDPAU_API
#if HAVE_VDPAU_HWACCEL
&mp_vd_lavc_vdpau,
#else
#endif
#if HAVE_VDPAU_DECODER
&mp_vd_lavc_vdpau_old,
#endif
#endif // CONFIG_VDPAU
#if CONFIG_VDA
#if HAVE_VDA_HWACCEL
&mp_vd_lavc_vda,
#endif
&mp_vd_lavc_crystalhd,
#if CONFIG_VAAPI
#if HAVE_VAAPI_HWACCEL
&mp_vd_lavc_vaapi,
&mp_vd_lavc_vaapi_copy,
#endif

View File

@ -84,10 +84,10 @@ static const vf_info_t *const filter_list[] = {
&vf_info_rotate,
&vf_info_mirror,
#ifdef CONFIG_LIBPOSTPROC
#if HAVE_LIBPOSTPROC
&vf_info_pp,
#endif
#ifdef CONFIG_VF_LAVFI
#if HAVE_VF_LAVFI
&vf_info_lavfi,
#endif
@ -110,10 +110,10 @@ static const vf_info_t *const filter_list[] = {
&vf_info_sub,
&vf_info_yadif,
&vf_info_stereo3d,
#ifdef CONFIG_DLOPEN
#if HAVE_DLOPEN
&vf_info_dlopen,
#endif
#if CONFIG_VAAPI_VPP
#if HAVE_VAAPI_VPP
&vf_info_vaapi,
#endif
NULL

View File

@ -171,7 +171,7 @@ static const struct {
{IMGFMT_BGRA64_LE, PIX_FMT_BGRA64LE},
#endif
#if HAVE_AV_CODEC_NEW_VDPAU_API
#if HAVE_AVCODEC_NEW_VDPAU_API
{IMGFMT_VDPAU, AV_PIX_FMT_VDPAU},
#else
{IMGFMT_VDPAU_MPEG1, PIX_FMT_VDPAU_MPEG1},

View File

@ -27,7 +27,7 @@
#include "config.h"
#ifdef CONFIG_JPEG
#if HAVE_JPEG
#include <jpeglib.h>
#endif
@ -142,7 +142,7 @@ error_exit:
return success;
}
#ifdef CONFIG_JPEG
#if HAVE_JPEG
static void write_jpeg_error_exit(j_common_ptr cinfo)
{
@ -226,7 +226,7 @@ static const struct img_writer img_writers[] = {
.pixfmts = (int[]) { IMGFMT_BGR24, IMGFMT_BGRA, IMGFMT_BGR15_LE,
IMGFMT_Y8, 0},
},
#ifdef CONFIG_JPEG
#if HAVE_JPEG
{ "jpg", write_jpeg },
{ "jpeg", write_jpeg },
#endif

View File

@ -142,14 +142,14 @@ static bool is_software_gl(GL *gl)
strcmp(renderer, "Mesa X11") == 0;
}
#ifdef HAVE_LIBDL
#if HAVE_LIBDL
#include <dlfcn.h>
#endif
void *mp_getdladdr(const char *s)
{
void *ret = NULL;
#ifdef HAVE_LIBDL
#if HAVE_LIBDL
void *handle = dlopen(NULL, RTLD_LAZY);
if (!handle)
return NULL;
@ -852,18 +852,18 @@ struct backend {
};
static struct backend backends[] = {
#ifdef CONFIG_GL_COCOA
#if HAVE_GL_COCOA
{"cocoa", mpgl_set_backend_cocoa},
#endif
#ifdef CONFIG_GL_WIN32
#if HAVE_GL_WIN32
{"win", mpgl_set_backend_w32},
#endif
//Add the wayland backend before x11, in order to probe for a wayland-server before a x11-server and avoid using xwayland
#ifdef CONFIG_GL_WAYLAND
#if HAVE_GL_WAYLAND
{"wayland", mpgl_set_backend_wayland},
#endif
#ifdef CONFIG_GL_X11
#if HAVE_GL_X11
{"x11", mpgl_set_backend_x11},
#endif
{0}

View File

@ -37,7 +37,7 @@
#include "video/mp_image.h"
#if defined(CONFIG_GL_COCOA)
#if HAVE_GL_COCOA
#ifdef GL_VERSION_3_0
#include <OpenGL/gl3.h>
#else

View File

@ -27,7 +27,7 @@
#ifndef GLAPIENTRY
#ifdef APIENTRY
#define GLAPIENTRY APIENTRY
#elif defined(CONFIG_GL_WIN32)
#elif HAVE_GL_WIN32
#define GLAPIENTRY __stdcall
#else
#define GLAPIENTRY
@ -222,7 +222,7 @@
/** \} */ // end of glextdefines group
#if defined(CONFIG_GL_WIN32) && !defined(WGL_CONTEXT_MAJOR_VERSION_ARB)
#if HAVE_GL_WIN32 && !defined(WGL_CONTEXT_MAJOR_VERSION_ARB)
/* these are supposed to be defined in wingdi.h but mingw's is too old */
/* only the bits actually used by mplayer are defined */
/* reference: http://www.opengl.org/registry/specs/ARB/wgl_create_context.txt */

View File

@ -35,7 +35,7 @@
#include "gl_video.h"
#include "gl_lcms.h"
#ifdef CONFIG_LCMS2
#if HAVE_LCMS2
#include <lcms2.h>
@ -212,7 +212,7 @@ error_exit:
return NULL;
}
#else /* CONFIG_LCMS2 */
#else /* HAVE_LCMS2 */
const struct m_sub_options mp_icc_conf = {
.opts = (m_option_t[]) { {0} },

View File

@ -41,7 +41,7 @@
static const char vo_opengl_shaders[] =
// Generated from gl_video_shaders.glsl
#include "gl_video_shaders.h"
#include "video/out/gl_video_shaders.h"
;
// Pixel width of 1D lookup textures.

View File

@ -66,47 +66,47 @@ extern struct vo_driver video_out_wayland;
const struct vo_driver *video_out_drivers[] =
{
#if CONFIG_VDPAU
#if HAVE_VDPAU
&video_out_vdpau,
#endif
#ifdef CONFIG_GL
#if HAVE_GL
&video_out_opengl,
#endif
#ifdef CONFIG_DIRECT3D
#if HAVE_DIRECT3D
&video_out_direct3d_shaders,
&video_out_direct3d,
#endif
#ifdef CONFIG_COREVIDEO
#if HAVE_COREVIDEO
&video_out_corevideo,
#endif
#ifdef CONFIG_XV
#if HAVE_XV
&video_out_xv,
#endif
#ifdef CONFIG_SDL2
#if HAVE_SDL2
&video_out_sdl,
#endif
#ifdef CONFIG_GL
#if HAVE_GL
&video_out_opengl_old,
#endif
#if CONFIG_VAAPI
#if HAVE_VAAPI
&video_out_vaapi,
#endif
#ifdef CONFIG_X11
#if HAVE_X11
&video_out_x11,
#endif
&video_out_null,
// should not be auto-selected
&video_out_image,
#ifdef CONFIG_CACA
#if HAVE_CACA
&video_out_caca,
#endif
#ifdef CONFIG_ENCODING
#if HAVE_ENCODING
&video_out_lavc,
#endif
#ifdef CONFIG_GL
#if HAVE_GL
&video_out_opengl_hq,
#endif
#ifdef CONFIG_WAYLAND
#if HAVE_WAYLAND
&video_out_wayland,
#endif
NULL

View File

@ -23,7 +23,7 @@
#include "config.h"
#include <QuartzCore/QuartzCore.h>
#if CONFIG_VDA
#if HAVE_VDA_HWACCEL
#include <IOSurface/IOSurface.h>
#endif
@ -446,7 +446,7 @@ static struct cv_functions cv_functions = {
.set_yuv_colorspace = cv_set_yuv_colorspace,
};
#if CONFIG_VDA
#if HAVE_VDA_HWACCEL
static void iosurface_init(struct vo *vo)
{
struct priv *p = vo->priv;
@ -546,7 +546,7 @@ static struct cv_functions iosurface_functions = {
.get_yuv_colorspace = get_yuv_colorspace,
.set_yuv_colorspace = iosurface_set_yuv_csp,
};
#endif /* CONFIG_VDA */
#endif /* HAVE_VDA_HWACCEL */
static int query_format(struct vo *vo, uint32_t format)
{
@ -554,7 +554,7 @@ static int query_format(struct vo *vo, uint32_t format)
const int flags = VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW;
switch (format) {
#if CONFIG_VDA
#if HAVE_VDA_HWACCEL
case IMGFMT_VDA:
p->fns = iosurface_functions;
return flags;

View File

@ -658,7 +658,7 @@ const struct vo_driver video_out_vaapi = {
.priv_defaults = &(const struct priv) {
.scaling = VA_FILTER_SCALING_DEFAULT,
.deint = 0,
#if !CONFIG_VAAPI_VPP
#if !HAVE_VAAPI_VPP
.deint_type = 2,
#endif
},

View File

@ -570,7 +570,7 @@ static int win_x11_init_vdpau_flip_queue(struct vo *vo)
MP_INFO(vo, "Assuming user-specified display refresh rate of %.3f Hz.\n",
vc->user_fps);
} else if (vc->user_fps == 0) {
#ifdef CONFIG_XF86VM
#if HAVE_XF86VM
double fps = vo_x11_vm_get_fps(vo);
if (!fps)
MP_WARN(vo, "Failed to get display FPS\n");

View File

@ -177,7 +177,7 @@ static int create_tmpfile_cloexec(char *tmpname)
{
int fd;
#ifdef HAVE_MKOSTEMP
#if HAVE_MKOSTEMP
fd = mkostemp(tmpname, O_CLOEXEC);
if (fd >= 0)
unlink(tmpname);

View File

@ -40,7 +40,7 @@
#include "x11_common.h"
#ifdef HAVE_SHM
#if HAVE_SHM
#include <sys/ipc.h>
#include <sys/shm.h>
#include <X11/extensions/XShm.h>
@ -94,7 +94,7 @@ struct priv {
int num_buffers;
int Shmem_Flag;
#ifdef HAVE_SHM
#if HAVE_SHM
int Shm_Warned_Slow;
XShmSegmentInfo Shminfo[2];
@ -157,7 +157,7 @@ static int find_depth_from_visuals(struct vo *vo, Visual ** visual_return)
static void getMyXImage(struct priv *p, int foo)
{
struct vo *vo = p->vo;
#ifdef HAVE_SHM
#if HAVE_SHM
if (vo->x11->display_is_local && XShmQueryExtension(vo->x11->display)) {
p->Shmem_Flag = 1;
vo->x11->ShmCompletionEvent = XShmGetEventBase(vo->x11->display)
@ -221,7 +221,7 @@ shmemerror:
memset(p->myximage[foo]->data, 0, p->myximage[foo]->bytes_per_line
* p->image_height);
p->ImageData[foo] = p->myximage[foo]->data;
#ifdef HAVE_SHM
#if HAVE_SHM
}
#endif
}
@ -229,7 +229,7 @@ shmemerror:
static void freeMyXImage(struct priv *p, int foo)
{
struct vo *vo = p->vo;
#ifdef HAVE_SHM
#if HAVE_SHM
if (p->Shmem_Flag) {
XShmDetach(vo->x11->display, &p->Shminfo[foo]);
XDestroyImage(p->myximage[foo]);
@ -397,7 +397,7 @@ static void Display_Image(struct priv *p, XImage *myximage)
XImage *x_image = p->myximage[p->current_buf];
#ifdef HAVE_SHM
#if HAVE_SHM
if (p->Shmem_Flag) {
XShmPutImage(vo->x11->display, vo->x11->window, vo->x11->vo_gc, x_image,
0, 0, p->dst.x0, p->dst.y0, p->dst_w, p->dst_h,
@ -443,7 +443,7 @@ static mp_image_t *get_screenshot(struct vo *vo)
static void wait_for_completion(struct vo *vo, int max_outstanding)
{
#ifdef HAVE_SHM
#if HAVE_SHM
struct priv *ctx = vo->priv;
struct vo_x11_state *x11 = vo->x11;
if (ctx->Shmem_Flag) {

View File

@ -33,7 +33,7 @@
#include "config.h"
#ifdef HAVE_SHM
#if HAVE_SHM
#include <sys/ipc.h>
#include <sys/shm.h>
#include <X11/extensions/XShm.h>
@ -91,7 +91,7 @@ struct xvctx {
struct mp_rect dst_rect;
uint32_t max_width, max_height; // zero means: not set
int Shmem_Flag;
#ifdef HAVE_SHM
#if HAVE_SHM
XShmSegmentInfo Shminfo[2];
int Shm_Warned_Slow;
#endif
@ -490,7 +490,7 @@ static bool allocate_xvimage(struct vo *vo, int foo)
struct vo_x11_state *x11 = vo->x11;
// align it for faster OSD rendering (draw_bmp.c swscale usage)
int aligned_w = FFALIGN(ctx->image_width, 32);
#ifdef HAVE_SHM
#if HAVE_SHM
if (x11->display_is_local && XShmQueryExtension(x11->display)) {
ctx->Shmem_Flag = 1;
x11->ShmCompletionEvent = XShmGetEventBase(x11->display)
@ -544,7 +544,7 @@ static bool allocate_xvimage(struct vo *vo, int foo)
static void deallocate_xvimage(struct vo *vo, int foo)
{
struct xvctx *ctx = vo->priv;
#ifdef HAVE_SHM
#if HAVE_SHM
if (ctx->Shmem_Flag) {
XShmDetach(vo->x11->display, &ctx->Shminfo[foo]);
shmdt(ctx->Shminfo[foo].shmaddr);
@ -573,7 +573,7 @@ static inline void put_xvimage(struct vo *vo, XvImage *xvi)
struct mp_rect *dst = &ctx->dst_rect;
int dw = dst->x1 - dst->x0, dh = dst->y1 - dst->y0;
int sw = src->x1 - src->x0, sh = src->y1 - src->y0;
#ifdef HAVE_SHM
#if HAVE_SHM
if (ctx->Shmem_Flag) {
XvShmPutImage(x11->display, ctx->xv_port, x11->window, x11->vo_gc, xvi,
src->x0, src->y0, sw, sh,
@ -628,7 +628,7 @@ static void draw_osd(struct vo *vo, struct osd_state *osd)
static void wait_for_completion(struct vo *vo, int max_outstanding)
{
#ifdef HAVE_SHM
#if HAVE_SHM
struct xvctx *ctx = vo->priv;
struct vo_x11_state *x11 = vo->x11;
if (ctx->Shmem_Flag) {

View File

@ -46,27 +46,27 @@
#include <X11/keysym.h>
#include <X11/XKBlib.h>
#ifdef CONFIG_XSS
#if HAVE_XSS
#include <X11/extensions/scrnsaver.h>
#endif
#ifdef CONFIG_XDPMS
#if HAVE_XEXT
#include <X11/extensions/dpms.h>
#endif
#ifdef CONFIG_XINERAMA
#if HAVE_XINERAMA
#include <X11/extensions/Xinerama.h>
#endif
#ifdef CONFIG_XF86VM
#if HAVE_XF86VM
#include <X11/extensions/xf86vmode.h>
#endif
#ifdef CONFIG_XF86XK
#if HAVE_XF86XK
#include <X11/XF86keysym.h>
#endif
#if CONFIG_ZLIB
#if HAVE_ZLIB
#include <zlib.h>
#endif
@ -424,7 +424,7 @@ static void vo_x11_update_screeninfo(struct vo *vo)
opts->screenwidth = x11->ws_width;
opts->screenheight = x11->ws_height;
}
#ifdef CONFIG_XINERAMA
#if HAVE_XINERAMA
if (opts->screen_id >= -1 && XineramaIsActive(x11->display) && !all_screens)
{
int screen = opts->fullscreen ? opts->fsscreen_id : opts->screen_id;
@ -974,7 +974,7 @@ static void vo_x11_update_window_title(struct vo *vo)
vo_x11_set_property_utf8(vo, x11->XA_NET_WM_ICON_NAME, title);
}
#if CONFIG_ZLIB
#if HAVE_ZLIB
static bstr decompress_gz(bstr in)
{
bstr res = {0};
@ -1530,7 +1530,7 @@ static void xscreensaver_heartbeat(struct vo_x11_state *x11)
static int xss_suspend(Display *mDisplay, Bool suspend)
{
#ifndef CONFIG_XSS
#if !HAVE_XSS
return 0;
#else
int event, error, major, minor;
@ -1552,7 +1552,7 @@ static void saver_on(struct vo_x11_state *x11)
x11->screensaver_off = 0;
if (xss_suspend(mDisplay, False))
return;
#ifdef CONFIG_XDPMS
#if HAVE_XEXT
if (x11->dpms_disabled) {
int nothing;
if (DPMSQueryExtension(mDisplay, &nothing, &nothing)) {
@ -1587,7 +1587,7 @@ static void saver_off(struct vo_x11_state *x11)
x11->screensaver_off = 1;
if (xss_suspend(mDisplay, True))
return;
#ifdef CONFIG_XDPMS
#if HAVE_XEXT
if (DPMSQueryExtension(mDisplay, &nothing, &nothing)) {
BOOL onoff;
CARD16 state;
@ -1636,7 +1636,7 @@ static void vo_x11_selectinput_witherr(struct vo *vo,
}
}
#ifdef CONFIG_XF86VM
#if HAVE_XF86VM
double vo_x11_vm_get_fps(struct vo *vo)
{
struct vo_x11_state *x11 = vo->x11;
@ -1648,7 +1648,7 @@ double vo_x11_vm_get_fps(struct vo *vo)
XFree(modeline.private);
return 1e3 * clock / modeline.htotal / modeline.vtotal;
}
#else /* CONFIG_XF86VM */
#else /* HAVE_XF86VM */
double vo_x11_vm_get_fps(struct vo *vo)
{
return 0;