summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-08-23 23:30:09 +0200
committerwm4 <wm4@nowhere>2013-08-23 23:30:09 +0200
commit0d8a62c08da87f6cfb5c45a86ee87c414c33323e (patch)
tree41091ca7dd1e3809f91a377d5f28b6594085df69
parent11a7a8b30b0c7a5ab5468385d3d43c64b24ddc9a (diff)
downloadmpv-0d8a62c08da87f6cfb5c45a86ee87c414c33323e.tar.bz2
mpv-0d8a62c08da87f6cfb5c45a86ee87c414c33323e.tar.xz
Some more mp_msg conversions
Also add a note to mp_msg.h, since it might be not clear which of the two mechanisms is preferred.
-rw-r--r--audio/out/ao_dsound.c72
-rw-r--r--audio/out/ao_oss.c90
-rw-r--r--mpvcore/mp_msg.h2
-rw-r--r--video/out/vo_caca.c12
-rw-r--r--video/out/vo_direct3d.c139
-rw-r--r--video/out/vo_image.c12
-rw-r--r--video/out/vo_sdl.c36
-rw-r--r--video/out/vo_vdpau.c96
-rw-r--r--video/out/vo_xv.c98
9 files changed, 241 insertions, 316 deletions
diff --git a/audio/out/ao_dsound.c b/audio/out/ao_dsound.c
index 039df2a7ed..3002b67dcc 100644
--- a/audio/out/ao_dsound.c
+++ b/audio/out/ao_dsound.c
@@ -152,25 +152,10 @@ static void UninitDirectSound(struct ao *ao)
FreeLibrary(p->hdsound_dll);
p->hdsound_dll = NULL;
}
- mp_msg(MSGT_AO, MSGL_V, "ao_dsound: DirectSound uninitialized\n");
+ MP_VERBOSE(ao, "DirectSound uninitialized\n");
}
/**
-\brief print the commandline help
-*/
-static void print_help(void)
-{
- mp_msg(MSGT_AO, MSGL_FATAL,
- "\n-ao dsound commandline help:\n"
- "Example: mpv -ao dsound:device=1\n"
- " sets 1st device\n"
- "\nOptions:\n"
- " device=<device-number>\n"
- " Sets device number, use -v to get a list\n");
-}
-
-
-/**
\brief enumerate direct sound devices
\return TRUE to continue with the enumeration
*/
@@ -180,13 +165,13 @@ static BOOL CALLBACK DirectSoundEnum(LPGUID guid, LPCSTR desc, LPCSTR module,
struct ao *ao = context;
struct priv *p = ao->priv;
- mp_msg(MSGT_AO, MSGL_V, "%i %s ", p->device_index, desc);
+ MP_VERBOSE(ao, "%i %s ", p->device_index, desc);
if (p->device_num == p->device_index) {
- mp_msg(MSGT_AO, MSGL_V, "<--");
+ MP_VERBOSE(ao, "<--");
if (guid)
memcpy(&p->device, guid, sizeof(GUID));
}
- mp_msg(MSGT_AO, MSGL_V, "\n");
+ MP_VERBOSE(ao, "\n");
p->device_index++;
return TRUE;
}
@@ -210,7 +195,7 @@ static int InitDirectSound(struct ao *ao)
p->hdsound_dll = LoadLibrary("DSOUND.DLL");
if (p->hdsound_dll == NULL) {
- mp_msg(MSGT_AO, MSGL_ERR, "ao_dsound: cannot load DSOUND.DLL\n");
+ MP_ERR(ao, "cannot load DSOUND.DLL\n");
return 0;
}
OurDirectSoundCreate = (void *)GetProcAddress(p->hdsound_dll,
@@ -219,21 +204,20 @@ static int InitDirectSound(struct ao *ao)
"DirectSoundEnumerateA");
if (OurDirectSoundCreate == NULL || OurDirectSoundEnumerate == NULL) {
- mp_msg(MSGT_AO, MSGL_ERR, "ao_dsound: GetProcAddress FAILED\n");
+ MP_ERR(ao, "GetProcAddress FAILED\n");
FreeLibrary(p->hdsound_dll);
return 0;
}
// Enumerate all directsound p->devices
- mp_msg(MSGT_AO, MSGL_V, "ao_dsound: Output Devices:\n");
+ MP_VERBOSE(ao, "Output Devices:\n");
OurDirectSoundEnumerate(DirectSoundEnum, ao);
// Create the direct sound object
if (FAILED(OurDirectSoundCreate((p->device_num) ? &p->device : NULL,
&p->hds, NULL)))
{
- mp_msg(MSGT_AO, MSGL_ERR,
- "ao_dsound: cannot create a DirectSound device\n");
+ MP_ERR(ao, "cannot create a DirectSound device\n");
FreeLibrary(p->hdsound_dll);
return 0;
}
@@ -251,22 +235,20 @@ static int InitDirectSound(struct ao *ao)
if (IDirectSound_SetCooperativeLevel(p->hds, GetDesktopWindow(),
DSSCL_EXCLUSIVE))
{
- mp_msg(MSGT_AO, MSGL_ERR,
- "ao_dsound: cannot set direct sound cooperative level\n");
+ MP_ERR(ao, "cannot set direct sound cooperative level\n");
IDirectSound_Release(p->hds);
FreeLibrary(p->hdsound_dll);
return 0;
}
- mp_msg(MSGT_AO, MSGL_V, "ao_dsound: DirectSound initialized\n");
+ MP_VERBOSE(ao, "DirectSound initialized\n");
memset(&dscaps, 0, sizeof(DSCAPS));
dscaps.dwSize = sizeof(DSCAPS);
if (DS_OK == IDirectSound_GetCaps(p->hds, &dscaps)) {
if (dscaps.dwFlags & DSCAPS_EMULDRIVER)
- mp_msg(MSGT_AO, MSGL_V,
- "ao_dsound: DirectSound is emulated, waveOut may give better performance\n");
+ MP_VERBOSE(ao, "DirectSound is emulated\n");
} else {
- mp_msg(MSGT_AO, MSGL_V, "ao_dsound: cannot get device capabilities\n");
+ MP_VERBOSE(ao, "cannot get device capabilities\n");
}
return 1;
@@ -424,9 +406,8 @@ static int init(struct ao *ao)
case AF_FORMAT_U8:
break;
default:
- mp_msg(MSGT_AO, MSGL_V,
- "ao_dsound: format %s not supported defaulting to Signed 16-bit Little-Endian\n",
- af_fmt2str_short(format));
+ MP_VERBOSE(ao, "format %s not supported defaulting to Signed 16-bit Little-Endian\n",
+ af_fmt2str_short(format));
format = AF_FORMAT_S16_LE;
}
//set our audio parameters
@@ -434,11 +415,10 @@ static int init(struct ao *ao)
ao->format = format;
ao->bps = ao->channels.num * rate * (af_fmt2bits(format) >> 3);
int buffersize = ao->bps; // space for 1 sec
- mp_msg(MSGT_AO, MSGL_V,
- "ao_dsound: Samplerate:%iHz Channels:%i Format:%s\n", rate,
- ao->channels.num, af_fmt2str_short(format));
- mp_msg(MSGT_AO, MSGL_V, "ao_dsound: Buffersize:%d bytes (%d msec)\n",
- buffersize, buffersize / ao->bps * 1000);
+ MP_VERBOSE(ao, "Samplerate:%iHz Channels:%i Format:%s\n", rate,
+ ao->channels.num, af_fmt2str_short(format));
+ MP_VERBOSE(ao, "Buffersize:%d bytes (%d msec)\n",
+ buffersize, buffersize / ao->bps * 1000);
//fill waveformatex
ZeroMemory(&wformat, sizeof(WAVEFORMATEXTENSIBLE));
@@ -494,19 +474,16 @@ static int init(struct ao *ao)
res = IDirectSound_CreateSoundBuffer(p->hds, &dsbpridesc, &p->hdspribuf, NULL);
if (res != DS_OK) {
UninitDirectSound(ao);
- mp_msg(MSGT_AO, MSGL_ERR,
- "ao_dsound: cannot create primary buffer (%s)\n",
- dserr2str(res));
+ MP_ERR(ao, "cannot create primary buffer (%s)\n", dserr2str(res));
return -1;
}
res = IDirectSoundBuffer_SetFormat(p->hdspribuf, (WAVEFORMATEX *)&wformat);
if (res != DS_OK) {
- mp_msg(MSGT_AO, MSGL_WARN,
- "ao_dsound: cannot set primary buffer format (%s), using "
- "standard setting (bad quality)", dserr2str(res));
+ MP_WARN(ao, "cannot set primary buffer format (%s), using "
+ "standard setting (bad quality)", dserr2str(res));
}
- mp_msg(MSGT_AO, MSGL_V, "ao_dsound: primary buffer created\n");
+ MP_VERBOSE(ao, "primary buffer created\n");
// now create the stream buffer
@@ -519,13 +496,12 @@ static int init(struct ao *ao)
}
if (res != DS_OK) {
UninitDirectSound(ao);
- mp_msg(MSGT_AO, MSGL_ERR,
- "ao_dsound: cannot create secondary (stream)buffer (%s)\n",
+ MP_ERR(ao, "cannot create secondary (stream)buffer (%s)\n",
dserr2str(res));
return -1;
}
}
- mp_msg(MSGT_AO, MSGL_V, "ao_dsound: secondary (stream)buffer created\n");
+ MP_VERBOSE(ao, "secondary (stream)buffer created\n");
return 0;
}
diff --git a/audio/out/ao_oss.c b/audio/out/ao_oss.c
index 0e17bcb632..79b96c7bc1 100644
--- a/audio/out/ao_oss.c
+++ b/audio/out/ao_oss.c
@@ -107,8 +107,6 @@ static int format2oss(int format)
if (format_table[n][1] == format)
return format_table[n][0];
}
- mp_msg(MSGT_AO, MSGL_V, "OSS: Unknown/not supported internal format: %s\n",
- af_fmt2str_short(format));
return -1;
}
@@ -118,8 +116,6 @@ static int oss2format(int format)
if (format_table[n][0] == format)
return format_table[n][1];
}
- mp_tmsg(MSGT_GLOBAL, MSGL_ERR, "[AO OSS] Unknown/Unsupported OSS format: %x.\n",
- format);
return -1;
}
@@ -204,16 +200,15 @@ static int init(struct ao *ao)
if (p->cfg_oss_mixer_channel && p->cfg_oss_mixer_channel[0])
mchan = p->cfg_oss_mixer_channel;
- mp_msg(MSGT_AO, MSGL_V, "ao2: %d Hz %d chans %s\n", ao->samplerate,
- ao->channels.num, af_fmt2str_short(ao->format));
+ MP_VERBOSE(ao, "%d Hz %d chans %s\n", ao->samplerate,
+ ao->channels.num, af_fmt2str_short(ao->format));
if (mchan) {
int fd, devs, i;
if ((fd = open(p->oss_mixer_device, O_RDONLY)) == -1) {
- mp_tmsg(MSGT_AO, MSGL_ERR,
- "[AO OSS] audio_setup: Can't open mixer device %s: %s\n",
- p->oss_mixer_device, strerror(errno));
+ MP_ERR(ao, "Can't open mixer device %s: %s\n",
+ p->oss_mixer_device, strerror(errno));
} else {
ioctl(fd, SOUND_MIXER_READ_DEVMASK, &devs);
close(fd);
@@ -221,9 +216,8 @@ static int init(struct ao *ao)
for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) {
if (!strcasecmp(mixer_channels[i], mchan)) {
if (!(devs & (1 << i))) {
- mp_tmsg(MSGT_AO, MSGL_ERR, "[AO OSS] audio_setup: "
- "Audio card mixer does not have channel '%s', "
- "using default.\n", mchan);
+ MP_ERR(ao, "Audio card mixer does not have "
+ "channel '%s', using default.\n", mchan);
i = SOUND_MIXER_NRDEVICES + 1;
break;
}
@@ -232,20 +226,17 @@ static int init(struct ao *ao)
}
}
if (i == SOUND_MIXER_NRDEVICES) {
- mp_tmsg(MSGT_AO, MSGL_ERR, "[AO OSS] audio_setup: Audio card "
- "mixer does not have channel '%s', using default.\n",
- mchan);
+ MP_ERR(ao, "Audio card mixer does not have "
+ "channel '%s', using default.\n", mchan);
}
}
} else {
p->oss_mixer_channel = SOUND_MIXER_PCM;
}
- mp_msg(MSGT_AO, MSGL_V, "audio_setup: using '%s' dsp device\n", p->dsp);
- mp_msg(MSGT_AO, MSGL_V, "audio_setup: using '%s' mixer device\n",
- p->oss_mixer_device);
- mp_msg(MSGT_AO, MSGL_V, "audio_setup: using '%s' mixer device\n",
- mixer_channels[p->oss_mixer_channel]);
+ MP_VERBOSE(ao, "using '%s' dsp device\n", p->dsp);
+ MP_VERBOSE(ao, "using '%s' mixer device\n", p->oss_mixer_device);
+ MP_VERBOSE(ao, "using '%s' mixer device\n", mixer_channels[p->oss_mixer_channel]);
#ifdef __linux__
p->audio_fd = open(p->dsp, O_WRONLY | O_NONBLOCK);
@@ -253,17 +244,14 @@ static int init(struct ao *ao)
p->audio_fd = open(p->dsp, O_WRONLY);
#endif
if (p->audio_fd < 0) {
- mp_tmsg(MSGT_AO, MSGL_ERR,
- "[AO OSS] audio_setup: Can't open audio device %s: %s\n",
- p->dsp, strerror(errno));
+ MP_ERR(ao, "Can't open audio device %s: %s\n", p->dsp, strerror(errno));
return -1;
}
#ifdef __linux__
/* Remove the non-blocking flag */
if (fcntl(p->audio_fd, F_SETFL, 0) < 0) {
- mp_tmsg(MSGT_AO, MSGL_ERR, "[AO OSS] audio_setup: Can't make file "
- "descriptor blocking: %s\n", strerror(errno));
+ MP_ERR(ao, "Can't make file descriptor blocking: %s\n", strerror(errno));
return -1;
}
#endif
@@ -281,6 +269,8 @@ ac3_retry:
ao->format = AF_FORMAT_AC3_NE;
oss_format = format2oss(ao->format);
if (oss_format == -1) {
+ MP_VERBOSE(ao, "Unknown/not supported internal format: %s\n",
+ af_fmt2str_short(ao->format));
#if BYTE_ORDER == BIG_ENDIAN
oss_format = AFMT_S16_BE;
#else
@@ -291,19 +281,20 @@ ac3_retry:
if (ioctl(p->audio_fd, SNDCTL_DSP_SETFMT, &oss_format) < 0 ||
oss_format != format2oss(ao->format))
{
- mp_tmsg(MSGT_AO, MSGL_WARN, "[AO OSS] Can't set audio device %s to %s "
- "output, trying %s...\n", p->dsp, af_fmt2str_short(ao->format),
+ MP_WARN(ao, "Can't set audio device %s to %s output, trying %s...\n",
+ p->dsp, af_fmt2str_short(ao->format),
af_fmt2str_short(AF_FORMAT_S16_NE));
ao->format = AF_FORMAT_S16_NE;
goto ac3_retry;
}
ao->format = oss2format(oss_format);
- if (ao->format == -1)
+ if (ao->format == -1) {
+ MP_ERR(ao, "Unknown/Unsupported OSS format: %x.\n", oss_format);
return -1;
+ }
- mp_msg(MSGT_AO, MSGL_V, "audio_setup: sample format: %s\n",
- af_fmt2str_short(ao->format));
+ MP_VERBOSE(ao, "sample format: %s\n", af_fmt2str_short(ao->format));
if (!AF_FORMAT_IS_AC3(ao->format)) {
struct mp_chmap_sel sel = {0};
@@ -317,45 +308,39 @@ ac3_retry:
if (ioctl(p->audio_fd, SNDCTL_DSP_CHANNELS, &nchannels) == -1 ||
nchannels != reqchannels)
{
- mp_tmsg(MSGT_AO, MSGL_ERR, "[AO OSS] audio_setup: Failed to "
- "set audio device to %d channels.\n", reqchannels);
+ MP_ERR(ao, "Failed to set audio device to %d channels.\n",
+ reqchannels);
return -1;
}
} else {
int c = reqchannels - 1;
if (ioctl(p->audio_fd, SNDCTL_DSP_STEREO, &c) == -1) {
- mp_tmsg(MSGT_AO, MSGL_ERR, "[AO OSS] audio_setup: Failed to "
- "set audio device to %d channels.\n", reqchannels);
+ MP_ERR(ao, "Failed to set audio device to %d channels.\n",
+ reqchannels);
return -1;
}
if (!ao_chmap_sel_get_def(ao, &sel, &ao->channels, c + 1))
return -1;
}
- mp_msg(MSGT_AO, MSGL_V,
- "audio_setup: using %d channels (requested: %d)\n",
- ao->channels.num, reqchannels);
+ MP_VERBOSE(ao, "using %d channels (requested: %d)\n",
+ ao->channels.num, reqchannels);
// set rate
ioctl(p->audio_fd, SNDCTL_DSP_SPEED, &ao->samplerate);
- mp_msg(MSGT_AO, MSGL_V, "audio_setup: using %d Hz samplerate\n",
- ao->samplerate);
+ MP_VERBOSE(ao, "using %d Hz samplerate\n", ao->samplerate);
}
if (ioctl(p->audio_fd, SNDCTL_DSP_GETOSPACE, &p->zz) == -1) {
int r = 0;
- mp_tmsg(MSGT_AO, MSGL_WARN, "[AO OSS] audio_setup: driver doesn't "
- "support SNDCTL_DSP_GETOSPACE\n");
+ MP_WARN(ao, "driver doesn't support SNDCTL_DSP_GETOSPACE\n");
if (ioctl(p->audio_fd, SNDCTL_DSP_GETBLKSIZE, &r) == -1)
- mp_msg(MSGT_AO, MSGL_V, "audio_setup: %d bytes/frag (config.h)\n",
- p->outburst);
+ MP_VERBOSE(ao, "%d bytes/frag (config.h)\n", p->outburst);
else {
p->outburst = r;
- mp_msg(MSGT_AO, MSGL_V, "audio_setup: %d bytes/frag (GETBLKSIZE)\n",
- p->outburst);
+ MP_VERBOSE(ao, "%d bytes/frag (GETBLKSIZE)\n", p->outburst);
}
} else {
- mp_msg(MSGT_AO, MSGL_V,
- "audio_setup: frags: %3d/%d (%d bytes/frag) free: %6d\n",
- p->zz.fragments, p->zz.fragstotal, p->zz.fragsize, p->zz.bytes);
+ MP_VERBOSE(ao, "frags: %3d/%d (%d bytes/frag) free: %6d\n",
+ p->zz.fragments, p->zz.fragstotal, p->zz.fragsize, p->zz.bytes);
p->buffersize = p->zz.bytes;
p->outburst = p->zz.fragsize;
}
@@ -381,9 +366,8 @@ ac3_retry:
}
free(data);
if (p->buffersize == 0) {
- mp_tmsg(MSGT_AO, MSGL_ERR, "[AO OSS]\n *** Your audio driver "
- "DOES NOT support select() ***\n Recompile mpv with "
- "#undef HAVE_AUDIO_SELECT in config.h !\n\n");
+ 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");
return -1;
}
#endif
@@ -433,8 +417,8 @@ static void reset(struct ao *ao)
close_device(ao);
p->audio_fd = open(p->dsp, O_WRONLY);
if (p->audio_fd < 0) {
- mp_tmsg(MSGT_AO, MSGL_ERR, "[AO OSS]\nFatal error: *** CANNOT "
- "RE-OPEN / RESET AUDIO DEVICE *** %s\n", strerror(errno));
+ MP_ERR(ao, "Fatal error: *** CANNOT "
+ "RE-OPEN / RESET AUDIO DEVICE *** %s\n", strerror(errno));
return;
}
diff --git a/mpvcore/mp_msg.h b/mpvcore/mp_msg.h
index 77ae9124c8..7868d9c89d 100644
--- a/mpvcore/mp_msg.h
+++ b/mpvcore/mp_msg.h
@@ -139,8 +139,8 @@ bool mp_msg_test_log(struct mp_log *log, int lev);
char *mp_gtext(const char *string);
+// Note: using mp_msg_log or the MP_ERR/... macros is preferred.
void mp_msg_va(int mod, int lev, const char *format, va_list va);
-
void mp_msg(int mod, int lev, const char *format, ... ) PRINTF_ATTRIBUTE(3, 4);
void mp_tmsg(int mod, int lev, const char *format, ... ) PRINTF_ATTRIBUTE(3, 4);
#define mp_dbg mp_msg
diff --git a/video/out/vo_caca.c b/video/out/vo_caca.c
index b217eb8f29..4d457eb57b 100644
--- a/video/out/vo_caca.c
+++ b/video/out/vo_caca.c
@@ -70,7 +70,7 @@ static unsigned int gmask = 0x00ff00;
static unsigned int bmask = 0x0000ff;
static unsigned int amask = 0;
-static int resize(void)
+static int resize(struct vo *vo)
{
screen_w = caca_get_canvas_width(canvas);
screen_h = caca_get_canvas_height(canvas);
@@ -82,7 +82,7 @@ static int resize(void)
depth * image_width,
rmask, gmask, bmask, amask);
if (dither == NULL) {
- mp_msg(MSGT_VO, MSGL_FATAL, "vo_caca: caca_create_dither failed!\n");
+ MP_FATAL(vo, "caca_create_dither failed!\n");
return ENOSYS;
}
dither_buffer =
@@ -105,7 +105,7 @@ static int config(struct vo *vo, uint32_t width, uint32_t height,
image_width = width;
image_format = format;
- return resize();
+ return resize(vo);
}
static void draw_image(struct vo *vo, mp_image_t *mpi)
@@ -166,7 +166,7 @@ static void check_events(struct vo *vo)
switch (cev.type) {
case CACA_EVENT_RESIZE:
caca_refresh_display(display);
- resize();
+ resize(vo);
break;
case CACA_EVENT_QUIT:
mp_input_put_key(vo->input_ctx, MP_KEY_CLOSE_WIN);
@@ -250,14 +250,14 @@ static int preinit(struct vo *vo)
{
canvas = caca_create_canvas(0, 0);
if (canvas == NULL) {
- mp_msg(MSGT_VO, MSGL_ERR, "vo_caca: failed to create canvas\n");
+ MP_ERR(vo, "failed to create canvas\n");
return ENOSYS;
}
display = caca_create_display(canvas);
if (display == NULL) {
- mp_msg(MSGT_VO, MSGL_ERR, "vo_caca: failed to create display\n");
+ MP_ERR(vo, "failed to create display\n");
caca_free_canvas(canvas);
return ENOSYS;
}
diff --git a/video/out/vo_direct3d.c b/video/out/vo_direct3d.c
index 9a3e70b1cd..e265b0b38f 100644
--- a/video/out/vo_direct3d.c
+++ b/video/out/vo_direct3d.c
@@ -114,6 +114,8 @@ struct osdpart {
/* Global variables "priv" structure. I try to keep their count low.
*/
typedef struct d3d_priv {
+ struct mp_log *log;
+
int opt_prefer_stretchrect;
int opt_disable_textures;
int opt_disable_stretchrect;
@@ -264,7 +266,7 @@ static bool d3d_begin_scene(d3d_priv *priv)
{
if (!priv->d3d_in_scene) {
if (FAILED(IDirect3DDevice9_BeginScene(priv->d3d_device))) {
- mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>BeginScene failed.\n");
+ MP_ERR(priv, "BeginScene failed.\n");
return false;
}
priv->d3d_in_scene = true;
@@ -354,9 +356,7 @@ static bool d3dtex_allocate(d3d_priv *priv, struct d3dtex *tex, D3DFORMAT fmt,
if (FAILED(IDirect3DDevice9_CreateTexture(priv->d3d_device, tw, th, 1,
D3DUSAGE_DYNAMIC, fmt, memtype, &tex->system, NULL)))
{
- mp_msg(MSGT_VO, MSGL_ERR,
- "<vo_direct3d>Allocating %dx%d texture in system RAM failed.\n",
- w, h);
+ MP_ERR(priv, "Allocating %dx%d texture in system RAM failed.\n", w, h);
goto error_exit;
}
@@ -364,9 +364,7 @@ static bool d3dtex_allocate(d3d_priv *priv, struct d3dtex *tex, D3DFORMAT fmt,
if (FAILED(IDirect3DDevice9_CreateTexture(priv->d3d_device, tw, th, 1,
D3DUSAGE_DYNAMIC, fmt, D3DPOOL_DEFAULT, &tex->device, NULL)))
{
- mp_msg(MSGT_VO, MSGL_ERR,
- "<vo_direct3d>Allocating %dx%d texture in video RAM failed.\n",
- w, h);
+ MP_ERR(priv, "Allocating %dx%d texture in video RAM failed.\n", w, h);
goto error_exit;
}
}
@@ -417,8 +415,7 @@ static void d3d_unlock_video_objects(d3d_priv *priv)
}
if (any_failed) {
- mp_msg(MSGT_VO, MSGL_V,
- "<vo_direct3d>Unlocking video objects failed.\n");
+ MP_VERBOSE(priv, "Unlocking video objects failed.\n");
}
}
@@ -444,7 +441,7 @@ static void d3d_destroy_video_objects(d3d_priv *priv)
*/
static void destroy_d3d_surfaces(d3d_priv *priv)
{
- mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>destroy_d3d_surfaces called.\n");
+ MP_VERBOSE(priv, "destroy_d3d_surfaces called.\n");
d3d_destroy_video_objects(priv);
@@ -480,12 +477,12 @@ static bool d3d_configure_video_objects(d3d_priv *priv)
priv->src_width >> plane->shift_x,
priv->src_height >> plane->shift_y))
{
- mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>Allocating plane %d"
+ MP_ERR(priv, "Allocating plane %d"
" failed.\n", n);
return false;
}
- mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>Allocated plane %d:"
+ MP_VERBOSE(priv, "Allocated plane %d:"
" %d bit, shift=%d/%d size=%d/%d (%d/%d).\n", n,
plane->bits_per_pixel,
plane->shift_x, plane->shift_y,
@@ -504,7 +501,7 @@ static bool d3d_configure_video_objects(d3d_priv *priv)
FAILED(IDirect3DDevice9_CreatePixelShader(priv->d3d_device,
(DWORD *)priv->pixel_shader_data, &priv->pixel_shader)))
{
- mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>Failed to create "
+ MP_ERR(priv, "Failed to create "
"YUV conversion pixel shader.\n");
return false;
}
@@ -517,8 +514,7 @@ static bool d3d_configure_video_objects(d3d_priv *priv)
priv->d3d_device, priv->src_width, priv->src_height,
priv->movie_src_fmt, D3DPOOL_DEFAULT, &priv->d3d_surface, NULL)))
{
- mp_msg(MSGT_VO, MSGL_ERR,
- "<vo_direct3d>Allocating offscreen surface failed.\n");
+ MP_ERR(priv, "Allocating offscreen surface failed.\n");
return false;
}
}
@@ -535,7 +531,7 @@ static bool d3d_lock_video_textures(d3d_priv *priv)
if (FAILED(IDirect3DTexture9_LockRect(plane->texture.system, 0,
&plane->locked_rect, NULL, 0)))
{
- mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>Texture lock failure.\n");
+ MP_VERBOSE(priv, "Texture lock failure.\n");
d3d_unlock_video_objects(priv);
return false;
}
@@ -565,13 +561,13 @@ static void d3d_clear_video_textures(d3d_priv *priv)
// done.
static bool create_d3d_surfaces(d3d_priv *priv)
{
- mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>create_d3d_surfaces called.\n");
+ MP_VERBOSE(priv, "create_d3d_surfaces called.\n");
if (!priv->d3d_backbuf &&
FAILED(IDirect3DDevice9_GetBackBuffer(priv->d3d_device, 0, 0,
D3DBACKBUFFER_TYPE_MONO,
&priv->d3d_backbuf))) {
- mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>Allocating backbuffer failed.\n");
+ MP_ERR(priv, "Allocating backbuffer failed.\n");
return 0;
}
@@ -614,16 +610,14 @@ static bool init_d3d(d3d_priv *priv)
priv->d3d_handle = priv->pDirect3DCreate9(D3D_SDK_VERSION);
if (!priv->d3d_handle) {
- mp_msg(MSGT_VO, MSGL_ERR,
- "<vo_direct3d>Initializing Direct3D failed.\n");
+ MP_ERR(priv, "Initializing Direct3D failed.\n");
return false;
}
if (FAILED(IDirect3D9_GetAdapterDisplayMode(priv->d3d_handle,
D3DADAPTER_DEFAULT,
&disp_mode))) {
- mp_msg(MSGT_VO, MSGL_ERR,
- "<vo_direct3d>Reading display mode failed.\n");
+ MP_ERR(priv, "Reading display mode failed.\n");
return false;
}
@@ -631,17 +625,15 @@ static bool init_d3d(d3d_priv *priv)
priv->cur_backbuf_width = disp_mode.Width;
priv->cur_backbuf_height = disp_mode.Height;
- mp_msg(MSGT_VO, MSGL_V,
- "<vo_direct3d>Setting backbuffer dimensions to (%dx%d).\n",
- disp_mode.Width, disp_mode.Height);
+ MP_VERBOSE(priv, "Setting backbuffer dimensions to (%dx%d).\n",
+ disp_mode.Width, disp_mode.Height);
if (FAILED(IDirect3D9_GetDeviceCaps(priv->d3d_handle,
D3DADAPTER_DEFAULT,
DEVTYPE,
&disp_caps)))
{
- mp_msg(MSGT_VO, MSGL_ERR,
- "<vo_direct3d>Reading display capabilities failed.\n");
+ MP_ERR(priv, "Reading display capabilities failed.\n");
return false;
}
@@ -658,13 +650,12 @@ static bool init_d3d(d3d_priv *priv)
if (priv->opt_force_power_of_2)
priv->device_caps_power2_only = 1;
- mp_msg(MSGT_VO, MSGL_V,
- "<vo_direct3d>device_caps_power2_only %d, device_caps_square_only %d\n"
- "<vo_direct3d>device_texture_sys %d\n"
- "<vo_direct3d>max_texture_width %d, max_texture_height %d\n",
- priv->device_caps_power2_only, priv->device_caps_square_only,
- priv->device_texture_sys, priv->max_texture_width,
- priv->max_texture_height);
+ MP_VERBOSE(priv, "device_caps_power2_only %d, device_caps_square_only %d\n"
+ "device_texture_sys %d\n"
+ "max_texture_width %d, max_texture_height %d\n",
+ priv->device_caps_power2_only, priv->device_caps_square_only,
+ priv->device_texture_sys, priv->max_texture_width,
+ priv->max_texture_height);
return true;
}
@@ -724,22 +715,19 @@ static bool change_d3d_backbuffer(d3d_priv *priv)
| D3DCREATE_FPU_PRESERVE,
&present_params, &priv->d3d_device)))
{
- mp_msg(MSGT_VO, MSGL_V,
- "<vo_direct3d>Creating Direct3D device failed.\n");
+ MP_VERBOSE(priv, "Creating Direct3D device failed.\n");
return 0;
}
} else {
if (FAILED(IDirect3DDevice9_Reset(priv->d3d_device, &present_params))) {
- mp_msg(MSGT_VO, MSGL_ERR,
- "<vo_direct3d>Reseting Direct3D device failed.\n");
+ MP_ERR(priv, "Reseting Direct3D device failed.\n");
return 0;
}
}
- mp_msg(MSGT_VO, MSGL_V,
- "<vo_direct3d>New backbuffer (%dx%d), VO (%dx%d)\n",
- present_params.BackBufferWidth, present_params.BackBufferHeight,
- window_w, window_h);
+ MP_VERBOSE(priv, "New backbuffer (%dx%d), VO (%dx%d)\n",
+ present_params.BackBufferWidth, present_params.BackBufferHeight,
+ window_w, window_h);
return 1;
}
@@ -750,7 +738,7 @@ static bool change_d3d_backbuffer(d3d_priv *priv)
*/
static int reconfigure_d3d(d3d_priv *priv)
{
- mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>reconfigure_d3d called.\n");
+ MP_VERBOSE(priv, "reconfigure_d3d called.\n");
destroy_d3d_surfaces(priv);
@@ -781,7 +769,7 @@ static bool resize_d3d(d3d_priv *priv)
{
D3DVIEWPORT9 vp = {0, 0, priv->vo->dwidth, priv->vo->dheight, 0, 1};
- mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>resize_d3d called.\n");
+ MP_VERBOSE(priv, "resize_d3d called.\n");
/* Make sure that backbuffer is large enough to accomodate the new
viewport dimensions. Grow it if necessary. */
@@ -808,7 +796,7 @@ static bool resize_d3d(d3d_priv *priv)
return 0;
if (FAILED(IDirect3DDevice9_SetViewport(priv->d3d_device, &vp))) {
- mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>Setting viewport failed.\n");
+ MP_ERR(priv, "Setting viewport failed.\n");
return 0;
}
@@ -827,7 +815,7 @@ static bool resize_d3d(d3d_priv *priv)
*/
static void uninit_d3d(d3d_priv *priv)
{
- mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>uninit_d3d called.\n");
+ MP_VERBOSE(priv, "uninit_d3d called.\n");
destroy_d3d_surfaces(priv);
@@ -836,7 +824,7 @@ static void uninit_d3d(d3d_priv *priv)
priv->d3d_device = NULL;
if (priv->d3d_handle) {
- mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>Stopping Direct3D.\n");
+ MP_VERBOSE(priv, "Stopping Direct3D.\n");
IDirect3D9_Release(priv->d3d_handle);
}
priv->d3d_handle = NULL;
@@ -913,8 +901,7 @@ static uint32_t d3d_draw_frame(d3d_priv *priv)
priv->d3d_backbuf,
&priv->fs_movie_rect,
D3DTEXF_LINEAR))) {
- mp_msg(MSGT_VO, MSGL_ERR,
- "<vo_direct3d>Copying frame to the backbuffer failed.\n");
+ MP_ERR(priv, "Copying frame to the backbuffer failed.\n");
return VO_ERROR;
}
}
@@ -979,13 +966,13 @@ static D3DFORMAT check_format(d3d_priv *priv, uint32_t movie_fmt,
priv->desktop_fmt);
}
if (FAILED(res)) {
- mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>Rejected image format "
+ MP_VERBOSE(priv, "Rejected image format "
"(%s): %s\n", type, vo_format_name(cur->mplayer_fmt));
return 0;
}
- mp_msg(MSGT_VO, MSGL_DBG2, "<vo_direct3d>Accepted image format "
- "(%s): %s\n", type, vo_format_name(cur->mplayer_fmt));
+ MP_DBG(priv, "Accepted image format (%s): %s\n",
+ type, vo_format_name(cur->mplayer_fmt));
return cur->fourcc;
}
@@ -1037,7 +1024,7 @@ static bool init_rendering_mode(d3d_priv *priv, uint32_t fmt, bool initialize)
if (!(blit_d3dfmt || shader_d3dfmt || texture_d3dfmt))
return false;
- mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>Accepted rendering methods for "
+ MP_VERBOSE(priv, "Accepted rendering methods for "
"format='%s': StretchRect=%#x, Texture=%#x, Texture+Shader=%#x.\n",
vo_format_name(fmt), blit_d3dfmt, texture_d3dfmt, shader_d3dfmt);
@@ -1066,7 +1053,7 @@ static bool init_rendering_mode(d3d_priv *priv, uint32_t fmt, bool initialize)
}
if (priv->use_textures) {
- mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>Using 3D rendering.\n");
+ MP_VERBOSE(priv, "Using 3D rendering.\n");
struct texplane *planes = &priv->planes[0];
planes[0].shift_x = planes[0].shift_y = 0;
@@ -1078,7 +1065,7 @@ static bool init_rendering_mode(d3d_priv *priv, uint32_t fmt, bool initialize)
planes[0].bits_per_pixel = imgfmt_any_rnd_depth(priv->image_format);
planes[0].d3d_format = texture_d3dfmt;
} else {
- mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>Using YUV shaders.\n");
+ MP_VERBOSE(priv, "Using YUV shaders.\n");
struct mp_imgfmt_desc desc = mp_imgfmt_get_desc(priv->image_format);
priv->plane_count = 3;
@@ -1098,7 +1085,7 @@ static bool init_rendering_mode(d3d_priv *priv, uint32_t fmt, bool initialize)
}
} else {
- mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>Using StretchRect.\n");
+ MP_VERBOSE(priv, "Using StretchRect.\n");
priv->movie_src_fmt = blit_d3dfmt;
}
@@ -1161,6 +1148,7 @@ static int preinit(struct vo *vo)
{
d3d_priv *priv = vo->priv;
priv->vo = vo;
+ priv->log = vo->log;
for (int n = 0; n < MAX_OSD_PARTS; n++) {
struct osdpart *osd = talloc_ptrtype(priv, osd);
@@ -1172,16 +1160,14 @@ static int preinit(struct vo *vo)
priv->d3d9_dll = LoadLibraryA("d3d9.dll");
if (!priv->d3d9_dll) {
- mp_msg(MSGT_VO, MSGL_ERR,
- "<vo_direct3d>Unable to dynamically load d3d9.dll\n");
+ MP_ERR(priv, "Unable to dynamically load d3d9.dll\n");
goto err_out;
}
priv->pDirect3DCreate9 = (void *)GetProcAddress(priv->d3d9_dll,
"Direct3DCreate9");
if (!priv->pDirect3DCreate9) {
- mp_msg(MSGT_VO, MSGL_ERR,
- "<vo_direct3d>Unable to find entry point of Direct3DCreate9\n");
+ MP_ERR(priv, "Unable to find entry point of Direct3DCreate9\n");
goto err_out;
}
@@ -1192,8 +1178,7 @@ static int preinit(struct vo *vo)
* fullscreen dimensions and does other useful stuff.
*/
if (!vo_w32_init(vo)) {
- mp_msg(MSGT_VO, MSGL_V,
- "<vo_direct3d>Configuring onscreen window failed.\n");
+ MP_VERBOSE(priv, "Configuring onscreen window failed.\n");
goto err_out;
}
@@ -1290,7 +1275,7 @@ static int config(struct vo *vo, uint32_t width, uint32_t height,
* the given coordinates.
*/
if (!vo_w32_config(vo, d_width, d_height, options)) {
- mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>Creating window failed.\n");
+ MP_VERBOSE(priv, "Creating window failed.\n");
return VO_ERROR;
}
@@ -1320,7 +1305,7 @@ static void flip_page(struct vo *vo)
if (priv->d3d_device && priv->d3d_in_scene) {
if (FAILED(IDirect3DDevice9_EndScene(priv->d3d_device))) {
- mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>EndScene failed.\n");
+ MP_ERR(priv, "EndScene failed.\n");
}
}
priv->d3d_in_scene = false;
@@ -1328,14 +1313,12 @@ static void flip_page(struct vo *vo)
RECT rect = {0, 0, vo->dwidth, vo->dheight};
if (!priv->d3d_device ||
FAILED(IDirect3DDevice9_Present(priv->d3d_device, &rect, 0, 0, 0))) {
- mp_msg(MSGT_VO, MSGL_V,
- "<vo_direct3d>Trying to reinitialize uncooperative video adapter.\n");
+ MP_VERBOSE(priv, "Trying to reinitialize uncooperative video adapter.\n");
if (!reconfigure_d3d(priv)) {
- mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>Reinitialization failed.\n");
+ MP_VERBOSE(priv, "Reinitialization failed.\n");
return;
} else {
- mp_msg(MSGT_VO, MSGL_V,
- "<vo_direct3d>Video adapter reinitialized.\n");
+ MP_VERBOSE(priv, "Video adapter reinitialized.\n");
}
}
}
@@ -1347,7 +1330,7 @@ static void uninit(struct vo *vo)
{
d3d_priv *priv = vo->priv;
- mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>uninit called.\n");
+ MP_VERBOSE(priv, "uninit called.\n");
uninit_d3d(priv);
vo_w32_uninit(vo);
@@ -1381,7 +1364,7 @@ static bool get_video_buffer(d3d_priv *priv, struct mp_image *out)
if (FAILED(IDirect3DSurface9_LockRect(priv->d3d_surface,
&priv->locked_rect, NULL, 0)))
{
- mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>Surface lock failed.\n");
+ MP_ERR(priv, "Surface lock failed.\n");
return false;
}
}
@@ -1463,7 +1446,7 @@ static mp_image_t *get_window_screenshot(d3d_priv *priv)
int width, height;
if (FAILED(IDirect3DDevice9_GetDisplayMode(priv->d3d_device, 0, &mode))) {
- mp_msg(MSGT_VO,MSGL_ERR, "<vo_direct3d>GetDisplayMode failed.\n");
+ MP_ERR(priv, "GetDisplayMode failed.\n");
goto error_exit;
}
@@ -1472,14 +1455,14 @@ static mp_image_t *get_window_screenshot(d3d_priv *priv)
mode.Width, mode.Height, D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM, &surface,
NULL)))
{
- mp_msg(MSGT_VO,MSGL_ERR, "<vo_direct3d>Couldn't create surface.\n");
+ MP_ERR(priv, "Couldn't create surface.\n");
goto error_exit;
}
if (FAILED(IDirect3DDevice9_GetFrontBufferData(priv->d3d_device, 0,
surface)))
{
- mp_msg(MSGT_VO,MSGL_ERR, "<vo_direct3d>Couldn't copy frontbuffer.\n");
+ MP_ERR(priv, "Couldn't copy frontbuffer.\n");
goto error_exit;
}
@@ -1532,7 +1515,7 @@ static bool upload_osd(d3d_priv *priv, struct osdpart *osd,
osd->packer->padding = imgs->scaled; // assume 2x2 filter on scaling
int r = packer_pack_from_subbitmaps(osd->packer, imgs);
if (r < 0) {
- mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>OSD bitmaps do not fit on "
+ MP_ERR(priv, "OSD bitmaps do not fit on "
"a surface with the maximum supported size %dx%d.\n",
osd->packer->w_max, osd->packer->h_max);
return false;
@@ -1548,7 +1531,7 @@ static bool upload_osd(d3d_priv *priv, struct osdpart *osd,
int new_h = osd->packer->h;
d3d_fix_texture_size(priv, &new_w, &new_h);
- mp_msg(MSGT_VO, MSGL_DBG2, "<vo_direct3d>reallocate OSD surface.\n");
+ MP_DBG(priv, "reallocate OSD surface.\n");
d3dtex_release(priv, &osd->texture);
d3dtex_allocate(priv, &osd->texture, fmt, new_w, new_h);
@@ -1566,7 +1549,7 @@ static bool upload_osd(d3d_priv *priv, struct osdpart *osd,
if (FAILED(IDirect3DTexture9_LockRect(osd->texture.system, 0, &locked_rect,
&dirty_rc, 0)))
{
- mp_msg(MSGT_VO,MSGL_ERR, "<vo_direct3d>OSD texture lock failed.\n");
+ MP_ERR(priv, "OSD texture lock failed.\n");
return false;
}
@@ -1575,7 +1558,7 @@ static bool upload_osd(d3d_priv *priv, struct osdpart *osd,
locked_rect.Pitch);
if (FAILED(IDirect3DTexture9_UnlockRect(osd->texture.system, 0))) {
- mp_msg(MSGT_VO,MSGL_ERR, "<vo_direct3d>OSD texture unlock failed.\n");
+ MP_ERR(priv, "OSD texture unlock failed.\n");
return false;
}
diff --git a/video/out/vo_image.c b/video/out/vo_image.c
index 248cddc78a..b2557459de 100644
--- a/video/out/vo_image.c
+++ b/video/out/vo_image.c
@@ -54,10 +54,9 @@ struct priv {
struct mp_csp_details colorspace;
};
-static bool checked_mkdir(const char *buf)
+static bool checked_mkdir(struct vo *vo, const char *buf)
{
- mp_msg(MSGT_VO, MSGL_INFO, "[vo_image] Creating output directory '%s'...\n",
- buf);
+ MP_INFO(vo, "Creating output directory '%s'...\n", buf);
if (mkdir(buf, 0755) < 0) {
char *errstr = strerror(errno);
if (errno == EEXIST) {
@@ -65,8 +64,7 @@ static bool checked_mkdir(const char *buf)
if (mp_stat(buf, &stat_p ) == 0 && S_ISDIR(stat_p.st_mode))
return true;
}
- mp_msg(MSGT_VO, MSGL_ERR, "[vo_image] Error creating output directory"
- ": %s\n", errstr);
+ MP_ERR(vo, "Error creating output directory: %s\n", errstr);
return false;
}
return true;
@@ -84,7 +82,7 @@ static int config(struct vo *vo, uint32_t width, uint32_t height,
p->d_height = d_height;
if (p->outdir && vo->config_count < 1)
- if (!checked_mkdir(p->outdir))
+ if (!checked_mkdir(vo, p->outdir))
return -1;
return 0;
@@ -131,7 +129,7 @@ static void flip_page(struct vo *vo)
if (p->outdir && strlen(p->outdir))
filename = mp_path_join(t, bstr0(p->outdir), bstr0(filename));
- mp_msg(MSGT_VO, MSGL_STATUS, "\nSaving %s\n", filename);
+ MP_INFO(vo, "Saving %s\n", filename);
write_image(p->current, p->opts, filename);
talloc_free(t);
diff --git a/video/out/vo_sdl.c b/video/out/vo_sdl.c
index 64f1a856b9..c9e81c450d 100644
--- a/video/out/vo_sdl.c
+++ b/video/out/vo_sdl.c
@@ -280,27 +280,27 @@ static bool try_create_renderer(struct vo *vo, int i, const char *driver,
w, h,
SDL_WINDOW_RESIZABLE | SDL_WINDOW_HIDDEN);
if (!vc->window) {
- mp_msg(MSGT_VO, MSGL_ERR, "[sdl] SDL_CreateWindow failedd\n");
+ MP_ERR(vo, "SDL_CreateWindow failedd\n");
destroy_renderer(vo);
return false;
}
vc->renderer = SDL_CreateRenderer(vc->window, i, 0);
if (!vc->renderer) {
- mp_msg(MSGT_VO, MSGL_ERR, "[sdl] SDL_CreateRenderer failed\n");
+ MP_ERR(vo, "SDL_CreateRenderer failed\n");
destroy_renderer(vo);
return false;
}
if (SDL_GetRendererInfo(vc->renderer, &vc->renderer_info)) {
- mp_msg(MSGT_VO, MSGL_ERR, "[sdl] SDL_GetRendererInfo failed\n");
+ MP_ERR(vo, "SDL_GetRendererInfo failed\n");
destroy_renderer(vo);
return false;
}
if (!is_good_renderer(&vc->renderer_info, NULL, vc->allow_sw,
&vc->osd_format)) {
- mp_msg(MSGT_VO, MSGL_ERR, "[sdl] Renderer '%s' does not fulfill "
+ MP_ERR(vo, "Renderer '%s' does not fulfill "
"requirements on this system\n",
vc->renderer_info.name);
destroy_renderer(vo);
@@ -308,7 +308,7 @@ static bool try_create_renderer(struct vo *vo, int i, const char *driver,
}
if (vc->renderer_index != i) {
- mp_msg(MSGT_VO, MSGL_INFO, "[sdl] Using %s\n", vc->renderer_info.name);
+ MP_INFO(vo, "Using %s\n", vc->renderer_info.name);
vc->renderer_index = i;
}
@@ -335,7 +335,7 @@ static int init_renderer(struct vo *vo, int w, int h)
if (try_create_renderer(vo, i, NULL, w, h))
return 0;
- mp_msg(MSGT_VO, MSGL_ERR, "[sdl] No supported renderer\n");
+ MP_ERR(vo, "No supported renderer\n");
return -1;
}
@@ -388,7 +388,7 @@ static void set_fullscreen(struct vo *vo)
flags |= fs_flag;
if (SDL_SetWindowFullscreen(vc->window, flags)) {
- mp_msg(MSGT_VO, MSGL_ERR, "[sdl] SDL_SetWindowFullscreen failed\n");
+ MP_ERR(vo, "SDL_SetWindowFullscreen failed\n");
return;
}
@@ -426,7 +426,7 @@ static int config(struct vo *vo, uint32_t width, uint32_t height,
if (format == formats[j].mpv)
texfmt = formats[j].sdl;
if (texfmt == SDL_PIXELFORMAT_UNKNOWN) {
- mp_msg(MSGT_VO, MSGL_ERR, "[sdl] Invalid pixel format\n");
+ MP_ERR(vo, "Invalid pixel format\n");
return -1;
}
@@ -434,7 +434,7 @@ static int config(struct vo *vo, uint32_t width, uint32_t height,
vc->tex = SDL_CreateTexture(vc->renderer, texfmt,
SDL_TEXTUREACCESS_STREAMING, width, height);
if (!vc->tex) {
- mp_msg(MSGT_VO, MSGL_ERR, "[sdl] Could not create a texture\n");
+ MP_ERR(vo, "Could not create a texture\n");
return -1;
}
@@ -446,7 +446,7 @@ static int config(struct vo *vo, uint32_t width, uint32_t height,
case 3:
break;
default:
- mp_msg(MSGT_VO, MSGL_ERR, "[sdl] Invalid plane count\n");
+ MP_ERR(vo, "Invalid plane count\n");
SDL_DestroyTexture(vc->tex);
vc->tex = NULL;
return -1;
@@ -580,7 +580,7 @@ static inline void upload_to_texture(struct vo *vo, SDL_Texture *tex,
void *pixels;
int pitch;
if (SDL_LockTexture(tex, NULL, &pixels, &pitch)) {
- mp_msg(MSGT_VO, MSGL_ERR, "[sdl] Could not lock texture\n");
+ MP_ERR(vo, "Could not lock texture\n");
} else {
SDL_ConvertPixels(w, h, SDL_PIXELFORMAT_ARGB8888,
bitmap, stride,
@@ -659,7 +659,7 @@ static void generate_osd_part(struct vo *vo, struct sub_bitmaps *imgs)
vc->osd_format.sdl, SDL_TEXTUREACCESS_STREAMING,
bmp->w, bmp->h);
if (!target->tex) {
- mp_msg(MSGT_VO, MSGL_ERR, "[sdl] Could not create texture\n");
+ MP_ERR(vo, "Could not create texture\n");
}
if (target->tex) {
SDL_SetTextureBlendMode(target->tex,
@@ -678,7 +678,7 @@ static void generate_osd_part(struct vo *vo, struct sub_bitmaps *imgs)
vc->osd_format.sdl, SDL_TEXTUREACCESS_STREAMING,
bmp->w, bmp->h);
if (!target->tex2) {
- mp_msg(MSGT_VO, MSGL_ERR, "[sdl] Could not create texture\n");
+ MP_ERR(vo, "Could not create texture\n");
}
if (target->tex2) {
SDL_SetTextureBlendMode(target->tex2,
@@ -733,7 +733,7 @@ static int preinit(struct vo *vo)
struct priv *vc = vo->priv;
if (SDL_WasInit(SDL_INIT_VIDEO)) {
- mp_msg(MSGT_VO, MSGL_ERR, "[sdl] already initialized\n");
+ MP_ERR(vo, "already initialized\n");
return -1;
}
@@ -748,7 +748,7 @@ static int preinit(struct vo *vo)
SDL_HINT_OVERRIDE);
if (SDL_InitSubSystem(SDL_INIT_VIDEO)) {
- mp_msg(MSGT_VO, MSGL_ERR, "[sdl] SDL_Init failed\n");
+ MP_ERR(vo, "SDL_Init failed\n");
return -1;
}
@@ -826,7 +826,7 @@ static void draw_image(struct vo *vo, mp_image_t *mpi)
if (mpi) {
if (SDL_LockTexture(vc->tex, NULL, &pixels, &pitch)) {
- mp_msg(MSGT_VO, MSGL_ERR, "[sdl] SDL_LockTexture failed\n");
+ MP_ERR(vo, "SDL_LockTexture failed\n");
return;
}
@@ -884,7 +884,7 @@ static void update_screeninfo(struct vo *vo)
SDL_DisplayMode mode;
if (SDL_GetCurrentDisplayMode(SDL_GetWindowDisplayIndex(vc->window),
&mode)) {
- mp_msg(MSGT_VO, MSGL_ERR, "[sdl] SDL_GetCurrentDisplayMode failed\n");
+ MP_ERR(vo, "SDL_GetCurrentDisplayMode failed\n");
return;
}
struct mp_vo_opts *opts = vo->opts;
@@ -906,7 +906,7 @@ static struct mp_image *get_window_screenshot(struct vo *vo)
vo->dheight);
if (SDL_RenderReadPixels(vc->renderer, NULL, vc->osd_format.sdl,
image->planes[0], image->stride[0])) {
- mp_msg(MSGT_VO, MSGL_ERR, "[sdl] SDL_RenderReadPixels failed\n");
+ MP_ERR(vo, "SDL_RenderReadPixels failed\n");
talloc_free(image);
return NULL;
}
diff --git a/video/out/vo_vdpau.c b/video/out/vo_vdpau.c
index 2b4198ebfb..5045ecce1f 100644
--- a/video/out/vo_vdpau.c
+++ b/video/out/vo_vdpau.c
@@ -169,8 +169,9 @@ struct vdpctx {
static bool status_ok(struct vo *vo);
-static int change_vdptime_sync(struct vdpctx *vc, int64_t *t)
+static int change_vdptime_sync(struct vo *vo, int64_t *t)
{
+ struct vdpctx *vc = vo->priv;
struct vdp_functions *vdp = vc->vdp;
VdpStatus vdp_st;
VdpTime vdp_time;
@@ -185,7 +186,7 @@ static int change_vdptime_sync(struct vdpctx *vc, int64_t *t)
else
vdp_time = old;
}
- mp_msg(MSGT_VO, MSGL_DBG2, "[vdpau] adjusting VdpTime offset by %f µs\n",
+ MP_DBG(vo, "adjusting VdpTime offset by %f µs\n",
(int64_t)(vdp_time - old) / 1000.);
vc->last_vdp_time = vdp_time;
vc->last_sync_update = t1;
@@ -199,7 +200,7 @@ static uint64_t sync_vdptime(struct vo *vo)
uint64_t t = mp_time_us();
if (t - vc->last_sync_update > 5000000)
- change_vdptime_sync(vc, &t);
+ change_vdptime_sync(vo, &t);
uint64_t now = (t - vc->last_sync_update) * 1000ULL + vc->last_vdp_time;
// Make sure nanosecond inaccuracies don't make things inconsistent
now = FFMAX(now, vc->recent_vsync_time);
@@ -419,7 +420,7 @@ static void resize(struct vo *vo)
vc->output_surface_height,
&vc->output_surfaces[i]);
CHECK_ST_WARNING("Error when calling vdp_output_surface_create");
- mp_msg(MSGT_VO, MSGL_DBG2, "vdpau out create: %u\n",
+ MP_DBG(vo, "vdpau out create: %u\n",
vc->output_surfaces[i]);
}
}
@@ -463,11 +464,10 @@ static int win_x11_init_vdpau_procs(struct vo *vo)
vc->mpvdp.vdp_device = vc->vdp_device;
if (vdp_st != VDP_STATUS_OK) {
if (vc->is_preempted)
- mp_msg(MSGT_VO, MSGL_DBG2, "[vdpau] Error calling "
- "vdp_device_create_x11 while preempted: %d\n", vdp_st);
+ MP_DBG(vo, "Error calling vdp_device_create_x11 while preempted: %d\n",
+ vdp_st);
else
- mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Error when calling "
- "vdp_device_create_x11: %d\n", vdp_st);
+ MP_ERR(vo, "Error when calling vdp_device_create_x11: %d\n", vdp_st);
return -1;
}
@@ -476,8 +476,8 @@ static int win_x11_init_vdpau_procs(struct vo *vo)
vdp_st = get_proc_address(vc->vdp_device, dsc->id,
(void **)((char *)vdp + dsc->offset));
if (vdp_st != VDP_STATUS_OK) {
- mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Error when calling "
- "vdp_get_proc_address(function id %d): %s\n", dsc->id,
+ MP_ERR(vo, "Error when calling vdp_get_proc_address(function "
+ "id %d): %s\n", dsc->id,
vdp->get_error_string ? vdp->get_error_string(vdp_st) : "?");
return -1;
}
@@ -513,8 +513,8 @@ static int win_x11_init_vdpau_flip_queue(struct vo *vo)
vdp_st = vdp->presentation_queue_create(vc->vdp_device, vc->flip_target,
&vc->flip_queue);
if (vc->is_preempted && vdp_st != VDP_STATUS_OK) {
- mp_msg(MSGT_VO, MSGL_DBG2, "[vdpau] Failed to create flip queue "
- "while preempted: %s\n", vdp->get_error_string(vdp_st));
+ MP_DBG(vo, "Failed to create flip queue while preempted: %s\n",
+ vdp->get_error_string(vdp_st));
return -1;
} else
CHECK_ST_ERROR("Error when calling vdp_presentation_queue_create");
@@ -540,41 +540,39 @@ static int win_x11_init_vdpau_flip_queue(struct vo *vo)
vc->vsync_interval = 1;
if (vc->composite_detect && vo_x11_screen_is_composited(vo)) {
- mp_msg(MSGT_VO, MSGL_INFO, "[vdpau] Compositing window manager "
- "detected. Assuming timing info is inaccurate.\n");
+ MP_INFO(vo, "Compositing window manager detected. Assuming timing info "
+ "is inaccurate.\n");
} else if (vc->user_fps > 0) {
vc->vsync_interval = 1e9 / vc->user_fps;
- mp_msg(MSGT_VO, MSGL_INFO, "[vdpau] Assuming user-specified display "
- "refresh rate of %.3f Hz.\n", vc->user_fps);
+ 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
double fps = vo_x11_vm_get_fps(vo);
if (!fps)
- mp_msg(MSGT_VO, MSGL_WARN, "[vdpau] Failed to get display FPS\n");
+ MP_WARN(vo, "Failed to get display FPS\n");
else {
vc->vsync_interval = 1e9 / fps;
// This is verbose, but I'm not yet sure how common wrong values are
- mp_msg(MSGT_VO, MSGL_INFO,
- "[vdpau] Got display refresh rate %.3f Hz.\n"
- "[vdpau] If that value looks wrong give the "
- "-vo vdpau:fps=X suboption manually.\n", fps);
+ MP_INFO(vo, "Got display refresh rate %.3f Hz.\n", fps);
+ MP_INFO(vo, "If that value looks wrong give the "
+ "-vo vdpau:fps=X suboption manually.\n");
}
#else
- mp_msg(MSGT_VO, MSGL_INFO, "[vdpau] This binary has been compiled "
- "without XF86VidMode support.\n");
- mp_msg(MSGT_VO, MSGL_INFO, "[vdpau] Can't use vsync-aware timing "
- "without manually provided -vo vdpau:fps=X suboption.\n");
+ MP_INFO(vo, "This binary has been compiled without XF86VidMode support.\n");
+ MP_INFO(vo, "Can't use vsync-aware timing without manually provided "
+ "-vo vdpau:fps=X suboption.\n");
#endif
} else
- mp_msg(MSGT_VO, MSGL_V, "[vdpau] framedrop/timing logic disabled by "
- "user.\n");
+ MP_VERBOSE(vo, "framedrop/timing logic disabled by user.\n");
return 0;
}
-static int set_video_attribute(struct vdpctx *vc, VdpVideoMixerAttribute attr,
+static int set_video_attribute(struct vo *vo, VdpVideoMixerAttribute attr,
const void *value, char *attr_name)
{
+ struct vdpctx *vc = vo->priv;
struct vdp_functions *vdp = vc->vdp;
VdpStatus vdp_st;
@@ -584,8 +582,8 @@ static int set_video_attribute(struct vdpctx *vc, VdpVideoMixerAttribute attr,
vdp_st = vdp->video_mixer_set_attribute_values(vc->video_mixer, 1, &attr,
&value);
if (vdp_st != VDP_STATUS_OK) {
- mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Error setting video mixer "
- "attribute %s: %s\n", attr_name, vdp->get_error_string(vdp_st));
+ MP_ERR(vo, "Error setting video mixer attribute %s: %s\n", attr_name,
+ vdp->get_error_string(vdp_st));
return -1;
}
return 0;
@@ -595,7 +593,7 @@ static void update_csc_matrix(struct vo *vo)
{
struct vdpctx *vc = vo->priv;
- mp_msg(MSGT_VO, MSGL_V, "[vdpau] Updating CSC matrix\n");
+ MP_VERBOSE(vo, "Updating CSC matrix\n");
// VdpCSCMatrix happens to be compatible with mplayer's CSC matrix type
// both are float[3][4]
@@ -606,11 +604,11 @@ static void update_csc_matrix(struct vo *vo)
mp_csp_copy_equalizer_values(&cparams, &vc->video_eq);
mp_get_yuv2rgb_coeffs(&cparams, matrix);
- set_video_attribute(vc, VDP_VIDEO_MIXER_ATTRIBUTE_CSC_MATRIX,
+ set_video_attribute(vo, VDP_VIDEO_MIXER_ATTRIBUTE_CSC_MATRIX,
&matrix, "CSC matrix");
}
-#define SET_VIDEO_ATTR(attr_name, attr_type, value) set_video_attribute(vc, \
+#define SET_VIDEO_ATTR(attr_name, attr_type, value) set_video_attribute(vo, \
VDP_VIDEO_MIXER_ATTRIBUTE_ ## attr_name, &(attr_type){value},\
# attr_name)
static int create_vdp_mixer(struct vo *vo, VdpChromaType vdp_chroma_type)
@@ -659,8 +657,8 @@ static int create_vdp_mixer(struct vo *vo, VdpChromaType vdp_chroma_type)
if (hqscaling_available)
features[feature_count++] = hqscaling_feature;
else
- mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Your hardware or VDPAU "
- "library does not support requested hqscaling.\n");
+ MP_ERR(vo, "Your hardware or VDPAU library does not support "
+ "requested hqscaling.\n");
}
vdp_st = vdp->video_mixer_create(vc->vdp_device, feature_count, features,
@@ -814,8 +812,7 @@ static int handle_preemption(struct vo *vo)
mark_vdpau_objects_uninitialized(vo);
vc->preemption_acked = true;
if (!vc->preemption_user_notified) {
- mp_tmsg(MSGT_VO, MSGL_ERR, "[vdpau] Got display preemption notice! "
- "Will attempt to recover.\n");
+ MP_ERR(vo, "Got display preemption notice! Will attempt to recover.\n");
vc->preemption_user_notified = true;
}
/* Trying to initialize seems to be quite slow, so only try once a
@@ -832,7 +829,7 @@ static int handle_preemption(struct vo *vo)
vc->mpvdp.is_preempted = false;
vc->mpvdp.preemption_counter++;
vc->preemption_user_notified = false;
- mp_tmsg(MSGT_VO, MSGL_INFO, "[vdpau] Recovered from display preemption.\n");
+ MP_INFO(vo, "Recovered from display preemption.\n");
return 1;
}
@@ -983,16 +980,16 @@ static void generate_osd_part(struct vo *vo, struct sub_bitmaps *imgs)
sfc->packer->padding = imgs->scaled; // assume 2x2 filter on scaling
int r = packer_pack_from_subbitmaps(sfc->packer, imgs);
if (r < 0) {
- mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] OSD bitmaps do not fit on "
- "a surface with the maximum supported size\n");
+ MP_ERR(vo, "OSD bitmaps do not fit on a surface with the maximum "
+ "supported size\n");
return;
} else if (r == 1) {
if (sfc->surface != VDP_INVALID_HANDLE) {
vdp_st = vdp->bitmap_surface_destroy(sfc->surface);
CHECK_ST_WARNING("Error when calling vdp_bitmap_surface_destroy");
}
- mp_msg(MSGT_VO, MSGL_V, "[vdpau] Allocating a %dx%d surface for "
- "OSD bitmaps.\n", sfc->packer->w, sfc->packer->h);
+ MP_VERBOSE(vo, "Allocating a %dx%d surface for OSD bitmaps.\n",
+ sfc->packer->w, sfc->packer->h);
vdp_st = vdp->bitmap_surface_create(vc->vdp_device, format,
sfc->packer->w, sfc->packer->h,
true, &sfc->surface);
@@ -1091,9 +1088,9 @@ static int update_presentation_queue_status(struct vo *vo)
if (vc->vsync_interval > 1) {
uint64_t qtime = vc->queue_time[vc->query_surface_num];
if (vtime < qtime + vc->vsync_interval / 2)
- mp_msg(MSGT_VO, MSGL_V, "[vdpau] Frame shown too early\n");
+ MP_VERBOSE(vo, "Frame shown too early\n");
if (vtime > qtime + vc->vsync_interval)
- mp_msg(MSGT_VO, MSGL_V, "[vdpau] Frame shown late\n");
+ MP_VERBOSE(vo, "Frame shown late\n");
}
vc->query_surface_num = WRAP_ADD(vc->query_surface_num, 1,
vc->num_output_surfaces);
@@ -1101,8 +1098,7 @@ static int update_presentation_queue_status(struct vo *vo)
}
int num_queued = WRAP_ADD(vc->surface_num, -vc->query_surface_num,
vc->num_output_surfaces);
- mp_msg(MSGT_VO, MSGL_DBG3, "[vdpau] Queued surface count (before add): "
- "%d\n", num_queued);
+ MP_DBG(vo, "Queued surface count (before add): %d\n", num_queued);
return num_queued;
}
@@ -1266,7 +1262,7 @@ static struct mp_image *get_video_surface(struct mp_vdpau_ctx *ctx, int fmt,
e->w = w;
e->h = h;
if (vc->is_preempted) {
- mp_msg(MSGT_VO, MSGL_WARN, "[vdpau] Preempted, no surface.\n");
+ MP_WARN(vo, "Preempted, no surface.\n");
} else {
vdp_st = vdp->video_surface_create(vc->vdp_device, chroma,
w, h, &e->surface);
@@ -1276,8 +1272,7 @@ static struct mp_image *get_video_surface(struct mp_vdpau_ctx *ctx, int fmt,
}
}
- mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] no surfaces available in "
- "get_video_surface\n");
+ MP_ERR(vo, "no surfaces available in get_video_surface\n");
// TODO: this probably breaks things forever, provide a dummy buffer?
return NULL;
}
@@ -1302,8 +1297,7 @@ static VdpOutputSurface get_rgb_surface(struct vo *vo)
in_use:;
}
- mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] no surfaces available in "
- "get_rgb_surface\n");
+ MP_ERR(vo, "no surfaces available in get_rgb_surface\n");
return VDP_INVALID_HANDLE;
}
diff --git a/video/out/vo_xv.c b/video/out/vo_xv.c
index 7cc7b8420d..8f652d991b 100644
--- a/video/out/vo_xv.c
+++ b/video/out/vo_xv.c
@@ -180,7 +180,7 @@ static int xv_find_atom(struct vo *vo, uint32_t xv_port, const char *name,
static int xv_set_eq(struct vo *vo, uint32_t xv_port, const char *name,
int value)
{
- mp_dbg(MSGT_VO, MSGL_V, "xv_set_eq called! (%s, %d)\n", name, value);
+ MP_VERBOSE(vo, "xv_set_eq called! (%s, %d)\n", name, value);
int min, max;
int atom = xv_find_atom(vo, xv_port, name, false, &min, &max);
@@ -205,8 +205,7 @@ static int xv_get_eq(struct vo *vo, uint32_t xv_port, const char *name,
XvGetPortAttribute(vo->x11->display, xv_port, atom, &port_value);
*value = (port_value - min) * 200 / (max - min) - 100;
- mp_dbg(MSGT_VO, MSGL_V, "xv_get_eq called! (%s, %d)\n",
- name, *value);
+ MP_VERBOSE(vo, "xv_get_eq called! (%s, %d)\n", name, *value);
return VO_TRUE;
}
return VO_FALSE;
@@ -266,52 +265,46 @@ static void xv_get_max_img_dim(struct vo *vo, uint32_t *width, uint32_t *height)
}
}
- mp_msg(MSGT_VO, MSGL_V,
- "[xv] Maximum source image dimensions: %ux%u\n",
- *width, *height);
+ MP_VERBOSE(vo, "Maximum source image dimensions: %ux%u\n", *width, *height);
XvFreeEncodingInfo(encodings);
}
-static void xv_print_ck_info(struct xvctx *xv)
+static void xv_print_ck_info(struct vo *vo)
{
- mp_msg(MSGT_VO, MSGL_V, "[xv] ");
+ struct xvctx *xv = vo->priv;
switch (xv->xv_ck_info.method) {
case CK_METHOD_NONE:
- mp_msg(MSGT_VO, MSGL_V, "Drawing no colorkey.\n");
+ MP_VERBOSE(vo, "Drawing no colorkey.\n");
return;
case CK_METHOD_AUTOPAINT:
- mp_msg(MSGT_VO, MSGL_V, "Colorkey is drawn by Xv.");
+ MP_VERBOSE(vo, "Colorkey is drawn by Xv.\n");
break;
case CK_METHOD_MANUALFILL:
- mp_msg(MSGT_VO, MSGL_V, "Drawing colorkey manually.");
+ MP_VERBOSE(vo, "Drawing colorkey manually.\n");
break;
case CK_METHOD_BACKGROUND:
- mp_msg(MSGT_VO, MSGL_V, "Colorkey is drawn as window background.");
+ MP_VERBOSE(vo, "Colorkey is drawn as window background.\n");
break;
}
- mp_msg(MSGT_VO, MSGL_V, "\n[xv] ");
-
switch (xv->xv_ck_info.source) {
case CK_SRC_CUR:
- mp_msg(MSGT_VO, MSGL_V, "Using colorkey from Xv (0x%06lx).\n",
- xv->xv_colorkey);
+ MP_VERBOSE(vo, "Using colorkey from Xv (0x%06lx).\n", xv->xv_colorkey);
break;
case CK_SRC_USE:
if (xv->xv_ck_info.method == CK_METHOD_AUTOPAINT) {
- mp_msg(MSGT_VO, MSGL_V, "Ignoring colorkey from mpv (0x%06lx).\n",
- xv->xv_colorkey);
+ MP_VERBOSE(vo, "Ignoring colorkey from mpv (0x%06lx).\n",
+ xv->xv_colorkey);
} else {
- mp_msg(MSGT_VO, MSGL_V,
- "Using colorkey from mpv (0x%06lx). Use -colorkey to change.\n",
- xv->xv_colorkey);
+ MP_VERBOSE(vo, "Using colorkey from mpv (0x%06lx). Use -colorkey to change.\n",
+ xv->xv_colorkey);
}
break;
case CK_SRC_SET:
- mp_msg(MSGT_VO, MSGL_V, "Setting and using colorkey from mpv (0x%06lx)."
- " Use -colorkey to change.\n", xv->xv_colorkey);
+ MP_VERBOSE(vo, "Setting and using colorkey from mpv (0x%06lx)."
+ " Use -colorkey to change.\n", xv->xv_colorkey);
break;
}
}
@@ -336,8 +329,8 @@ static int xv_init_colorkey(struct vo *vo)
if (rez == Success)
ctx->xv_colorkey = colorkey_ret;
else {
- mp_msg(MSGT_VO, MSGL_FATAL, "[xv] Couldn't get colorkey!"
- "Maybe the selected Xv port has no overlay.\n");
+ MP_FATAL(vo, "Couldn't get colorkey! "
+ "Maybe the selected Xv port has no overlay.\n");
return 0; // error getting colorkey
}
} else {
@@ -350,7 +343,7 @@ static int xv_init_colorkey(struct vo *vo)
rez = XvSetPortAttribute(display, ctx->xv_port, xv_atom,
ctx->colorkey);
if (rez != Success) {
- mp_msg(MSGT_VO, MSGL_FATAL, "[xv] Couldn't set colorkey!\n");
+ MP_FATAL(vo, "Couldn't set colorkey!\n");
return 0; // error setting colorkey
}
}
@@ -375,7 +368,7 @@ static int xv_init_colorkey(struct vo *vo)
} else // do no colorkey drawing at all
ctx->xv_ck_info.method = CK_METHOD_NONE;
- xv_print_ck_info(ctx);
+ xv_print_ck_info(vo);
return 1;
}
@@ -448,7 +441,7 @@ static int config(struct vo *vo, uint32_t width, uint32_t height,
if ((ctx->max_width != 0 && ctx->max_height != 0)
&& (ctx->image_width > ctx->max_width
|| ctx->image_height > ctx->max_height)) {
- mp_tmsg(MSGT_VO, MSGL_ERR, "Source image dimensions are too high: %ux%u (maximum is %ux%u)\n",
+ MP_ERR(vo, "Source image dimensions are too high: %ux%u (maximum is %ux%u)\n",
ctx->image_width, ctx->image_height, ctx->max_width,
ctx->max_height);
return -1;
@@ -457,9 +450,9 @@ static int config(struct vo *vo, uint32_t width, uint32_t height,
/* check image formats */
ctx->xv_format = 0;
for (i = 0; i < ctx->formats; i++) {
- mp_msg(MSGT_VO, MSGL_V, "Xvideo image format: 0x%x (%4.4s) %s\n",
- ctx->fo[i].id, (char *) &ctx->fo[i].id,
- (ctx->fo[i].format == XvPacked) ? "packed" : "planar");
+ MP_VERBOSE(vo, "Xvideo image format: 0x%x (%4.4s) %s\n",
+ ctx->fo[i].id, (char *) &ctx->fo[i].id,
+ (ctx->fo[i].format == XvPacked) ? "packed" : "planar");
if (ctx->fo[i].id == find_xv_format(format))
ctx->xv_format = ctx->fo[i].id;
}
@@ -472,8 +465,7 @@ static int config(struct vo *vo, uint32_t width, uint32_t height,
if (ctx->xv_ck_info.method == CK_METHOD_BACKGROUND)
XSetWindowBackground(x11->display, x11->window, ctx->xv_colorkey);
- mp_msg(MSGT_VO, MSGL_V, "using Xvideo port %d for hw scaling\n",
- ctx->xv_port);
+ MP_VERBOSE(vo, "using Xvideo port %d for hw scaling\n", ctx->xv_port);
// In case config has been called before
for (i = 0; i < ctx->num_buffers; i++)
@@ -506,7 +498,7 @@ static void allocate_xvimage(struct vo *vo, int foo)
+ ShmCompletion;
} else {
ctx->Shmem_Flag = 0;
- mp_tmsg(MSGT_VO, MSGL_INFO, "[VO_XV] Shared memory not supported\nReverting to normal Xv.\n");
+ MP_INFO(vo, "Shared memory not supported\nReverting to normal Xv.\n");
}
if (ctx->Shmem_Flag) {
ctx->xvimage[foo] =
@@ -629,8 +621,8 @@ static void wait_for_completion(struct vo *vo, int max_outstanding)
if (ctx->Shmem_Flag) {
while (x11->ShmCompletionWaitCount > max_outstanding) {
if (!ctx->Shm_Warned_Slow) {
- mp_msg(MSGT_VO, MSGL_WARN, "[VO_XV] X11 can't keep up! Waiting"
- " for XShm completion events...\n");
+ MP_WARN(vo, "X11 can't keep up! Waiting"
+ " for XShm completion events...\n");
ctx->Shm_Warned_Slow = 1;
}
mp_sleep_us(1000);
@@ -738,7 +730,7 @@ static int preinit(struct vo *vo)
/* check for Xvideo extension */
unsigned int ver, rel, req, ev, err;
if (Success != XvQueryExtension(x11->display, &ver, &rel, &req, &ev, &err)) {
- mp_tmsg(MSGT_VO, MSGL_ERR, "[VO_XV] Sorry, Xv not supported by this X11 version/driver\n[VO_XV] ******** Try with -vo x11 *********\n");
+ MP_ERR(vo, "Xv not supported by this X11 version/driver\n");
goto error;
}
@@ -746,7 +738,7 @@ static int preinit(struct vo *vo)
if (Success !=
XvQueryAdaptors(x11->display, DefaultRootWindow(x11->display),
&ctx->adaptors, &ctx->ai)) {
- mp_tmsg(MSGT_VO, MSGL_ERR, "[VO_XV] XvQueryAdaptors failed.\n");
+ MP_ERR(vo, "XvQueryAdaptors failed.\n");
goto error;
}
@@ -771,7 +763,7 @@ static int preinit(struct vo *vo)
if (XvGrabPort(x11->display, ctx->xv_port, CurrentTime))
ctx->xv_port = 0;
} else {
- mp_tmsg(MSGT_VO, MSGL_WARN, "[VO_XV] Invalid port parameter, overriding with port 0.\n");
+ MP_WARN(vo, "Invalid port parameter, overriding with port 0.\n");
ctx->xv_port = 0;
}
}
@@ -786,30 +778,28 @@ static int preinit(struct vo *vo)
xv_p < ctx->ai[i].base_id + ctx->ai[i].num_ports; ++xv_p)
if (!XvGrabPort(x11->display, xv_p, CurrentTime)) {
ctx->xv_port = xv_p;
- mp_msg(MSGT_VO, MSGL_V,
- "[VO_XV] Using Xv Adapter #%d (%s)\n",
- i, ctx->ai[i].name);
+ MP_VERBOSE(vo, "Using Xv Adapter #%d (%s)\n",
+ i, ctx->ai[i].name);
break;
} else {
- mp_tmsg(MSGT_VO, MSGL_WARN, "[VO_XV] Could not grab port %i.\n",
- (int) xv_p);
+ MP_WARN(vo, "Could not grab port %i.\n", (int) xv_p);
++busy_ports;
}
}
}
if (!ctx->xv_port) {
if (busy_ports)
- mp_tmsg(MSGT_VO, MSGL_ERR,
- "[VO_XV] Could not find free Xvideo port - maybe another process is already\n"\
- "[VO_XV] using it. Close all video applications, and try again. If that does\n"\
- "[VO_XV] not help, see 'mpv -vo help' for other (non-xv) video out drivers.\n");
+ MP_ERR(vo,
+ "Could not find free Xvideo port - maybe another process is already\n"\
+ "using it. Close all video applications, and try again. If that does\n"\
+ "not help, see 'mpv -vo help' for other (non-xv) video out drivers.\n");
else
- mp_tmsg(MSGT_VO, MSGL_ERR,
- "[VO_XV] It seems there is no Xvideo support for your video card available.\n"\
- "[VO_XV] Run 'xvinfo' to verify its Xv support and read\n"\
- "[VO_XV] DOCS/HTML/en/video.html#xv!\n"\
- "[VO_XV] See 'mpv -vo help' for other (non-xv) video out drivers.\n"\
- "[VO_XV] Try -vo x11.\n");
+ MP_ERR(vo,
+ "It seems there is no Xvideo support for your video card available.\n"\
+ "Run 'xvinfo' to verify its Xv support and read\n"\
+ "DOCS/HTML/en/video.html#xv!\n"\
+ "See 'mpv -vo help' for other (non-xv) video out drivers.\n"\
+ "Try -vo x11.\n");
goto error;
}