2009-02-08 03:27:30 +00:00
|
|
|
/*
|
|
|
|
* libvo common functions, variables used by many/all drivers.
|
|
|
|
*
|
|
|
|
* This file is part of MPlayer.
|
|
|
|
*
|
|
|
|
* MPlayer is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* MPlayer is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with MPlayer; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2001-02-24 20:28:24 +00:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2009-09-17 14:47:43 +00:00
|
|
|
#include <assert.h>
|
2009-09-18 13:27:55 +00:00
|
|
|
#include <stdbool.h>
|
2001-02-24 20:28:24 +00:00
|
|
|
|
|
|
|
#include <unistd.h>
|
2013-03-02 21:50:09 +00:00
|
|
|
|
2013-06-15 17:23:53 +00:00
|
|
|
#include <libavutil/common.h>
|
|
|
|
|
2013-03-02 21:50:09 +00:00
|
|
|
#include "talloc.h"
|
2001-02-24 20:28:24 +00:00
|
|
|
|
|
|
|
#include "config.h"
|
2013-03-02 21:50:09 +00:00
|
|
|
#include "osdep/timer.h"
|
2013-08-06 20:41:30 +00:00
|
|
|
#include "mpvcore/options.h"
|
|
|
|
#include "mpvcore/bstr.h"
|
2012-11-09 00:06:43 +00:00
|
|
|
#include "vo.h"
|
2007-02-17 20:58:55 +00:00
|
|
|
#include "aspect.h"
|
2013-08-06 20:41:30 +00:00
|
|
|
#include "mpvcore/input/input.h"
|
|
|
|
#include "mpvcore/m_config.h"
|
|
|
|
#include "mpvcore/mp_msg.h"
|
|
|
|
#include "mpvcore/mpv_global.h"
|
video/filter: change filter API, use refcounting, remove filter DR
Change the entire filter API to use reference counted images instead
of vf_get_image().
Remove filter "direct rendering". This was useful for vf_expand and (in
rare cases) vf_sub: DR allowed these filters to pass a cropped image to
the filters before them. Then, on filtering, the image was "uncropped",
so that black bars could be added around the image without copying. This
means that in some cases, vf_expand will be slower (-vf gradfun,expand
for example).
Note that another form of DR used for in-place filters has been replaced
by simpler logic. Instead of trying to do DR, filters can check if the
image is writeable (with mp_image_is_writeable()), and do true in-place
if that's the case. This affects filters like vf_gradfun and vf_sub.
Everything has to support strides now. If something doesn't, making a
copy of the image data is required.
2012-11-05 13:25:04 +00:00
|
|
|
#include "video/mp_image.h"
|
2012-11-09 00:06:43 +00:00
|
|
|
#include "video/vfcap.h"
|
2012-10-27 20:10:32 +00:00
|
|
|
#include "sub/sub.h"
|
2002-09-29 21:53:05 +00:00
|
|
|
|
2001-02-24 20:28:24 +00:00
|
|
|
//
|
|
|
|
// Externally visible list of all vo drivers
|
|
|
|
//
|
2008-04-03 03:25:41 +00:00
|
|
|
extern struct vo_driver video_out_x11;
|
2009-02-17 23:07:37 +00:00
|
|
|
extern struct vo_driver video_out_vdpau;
|
2008-04-03 03:25:41 +00:00
|
|
|
extern struct vo_driver video_out_xv;
|
2012-09-23 14:10:00 +00:00
|
|
|
extern struct vo_driver video_out_opengl;
|
2012-09-29 16:36:05 +00:00
|
|
|
extern struct vo_driver video_out_opengl_hq;
|
2012-09-23 14:10:00 +00:00
|
|
|
extern struct vo_driver video_out_opengl_old;
|
2008-04-03 03:25:41 +00:00
|
|
|
extern struct vo_driver video_out_null;
|
2012-08-06 15:52:17 +00:00
|
|
|
extern struct vo_driver video_out_image;
|
2012-09-14 15:51:26 +00:00
|
|
|
extern struct vo_driver video_out_lavc;
|
2008-04-03 03:25:41 +00:00
|
|
|
extern struct vo_driver video_out_caca;
|
2008-11-22 17:16:43 +00:00
|
|
|
extern struct vo_driver video_out_direct3d;
|
2011-11-04 07:39:20 +00:00
|
|
|
extern struct vo_driver video_out_direct3d_shaders;
|
2012-12-28 07:07:14 +00:00
|
|
|
extern struct vo_driver video_out_sdl;
|
2009-05-08 20:50:26 +00:00
|
|
|
extern struct vo_driver video_out_corevideo;
|
video: add vaapi decode and output support
This is based on the MPlayer VA API patches. To be exact it's based on
a very stripped down version of commit f1ad459a263f8537f6c from
git://gitorious.org/vaapi/mplayer.git.
This doesn't contain useless things like benchmarking hacks and the
demo code for GLX interop. Also, unlike in the original patch, decoding
and video output are split into separate source files (the separation
between decoding and display also makes pixel format hacks unnecessary).
On the other hand, some features not present in the original patch were
added, like screenshot support.
VA API is rather bad for actual video output. Dealing with older libva
versions or the completely broken vdpau backend doesn't help. OSD is
low quality and should be rather slow. In some cases, only either OSD
or subtitles can be shown at the same time (because OSD is drawn first,
OSD is prefered).
Also, libva can't decide whether it accepts straight or premultiplied
alpha for OSD sub-pictures: the vdpau backend seems to assume
premultiplied, while a native vaapi driver uses straight. So I picked
straight alpha. It doesn't matter much, because the blending code for
straight alpha I added to img_convert.c is probably buggy, and ASS
subtitles might be blended incorrectly.
Really good video output with VA API would probably use OpenGL and the
GL interop features, but at this point you might just use vo_opengl.
(Patches for making HW decoding with vo_opengl have a chance of being
accepted.)
Despite these issues, decoding seems to work ok. I still got tearing
on the Intel system I tested (Intel(R) Core(TM) i3-2350M). It was also
tested with the vdpau vaapi wrapper on a nvidia system; however this
was rather broken. (Fortunately, there is no reason to use mpv's VAAPI
support over native VDPAU.)
2013-08-09 12:01:30 +00:00
|
|
|
extern struct vo_driver video_out_vaapi;
|
2013-04-15 20:37:02 +00:00
|
|
|
extern struct vo_driver video_out_wayland;
|
2008-04-03 03:25:41 +00:00
|
|
|
|
|
|
|
const struct vo_driver *video_out_drivers[] =
|
2001-02-24 20:28:24 +00:00
|
|
|
{
|
2013-02-06 21:29:21 +00:00
|
|
|
#if CONFIG_VDPAU
|
|
|
|
&video_out_vdpau,
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_GL
|
|
|
|
&video_out_opengl,
|
|
|
|
#endif
|
2008-11-18 13:18:55 +00:00
|
|
|
#ifdef CONFIG_DIRECT3D
|
2011-11-04 07:39:20 +00:00
|
|
|
&video_out_direct3d_shaders,
|
2012-02-27 23:25:17 +00:00
|
|
|
&video_out_direct3d,
|
2008-11-18 13:18:55 +00:00
|
|
|
#endif
|
2008-08-06 07:42:26 +00:00
|
|
|
#ifdef CONFIG_COREVIDEO
|
2009-05-04 16:55:05 +00:00
|
|
|
&video_out_corevideo,
|
2005-05-05 00:17:27 +00:00
|
|
|
#endif
|
2009-09-18 21:25:36 +00:00
|
|
|
#ifdef CONFIG_XV
|
|
|
|
&video_out_xv,
|
|
|
|
#endif
|
2012-12-28 07:07:14 +00:00
|
|
|
#ifdef CONFIG_SDL2
|
|
|
|
&video_out_sdl,
|
|
|
|
#endif
|
2013-02-06 21:29:21 +00:00
|
|
|
#ifdef CONFIG_GL
|
|
|
|
&video_out_opengl_old,
|
|
|
|
#endif
|
2013-08-11 23:38:38 +00:00
|
|
|
#if CONFIG_VAAPI
|
video: add vaapi decode and output support
This is based on the MPlayer VA API patches. To be exact it's based on
a very stripped down version of commit f1ad459a263f8537f6c from
git://gitorious.org/vaapi/mplayer.git.
This doesn't contain useless things like benchmarking hacks and the
demo code for GLX interop. Also, unlike in the original patch, decoding
and video output are split into separate source files (the separation
between decoding and display also makes pixel format hacks unnecessary).
On the other hand, some features not present in the original patch were
added, like screenshot support.
VA API is rather bad for actual video output. Dealing with older libva
versions or the completely broken vdpau backend doesn't help. OSD is
low quality and should be rather slow. In some cases, only either OSD
or subtitles can be shown at the same time (because OSD is drawn first,
OSD is prefered).
Also, libva can't decide whether it accepts straight or premultiplied
alpha for OSD sub-pictures: the vdpau backend seems to assume
premultiplied, while a native vaapi driver uses straight. So I picked
straight alpha. It doesn't matter much, because the blending code for
straight alpha I added to img_convert.c is probably buggy, and ASS
subtitles might be blended incorrectly.
Really good video output with VA API would probably use OpenGL and the
GL interop features, but at this point you might just use vo_opengl.
(Patches for making HW decoding with vo_opengl have a chance of being
accepted.)
Despite these issues, decoding seems to work ok. I still got tearing
on the Intel system I tested (Intel(R) Core(TM) i3-2350M). It was also
tested with the vdpau vaapi wrapper on a nvidia system; however this
was rather broken. (Fortunately, there is no reason to use mpv's VAAPI
support over native VDPAU.)
2013-08-09 12:01:30 +00:00
|
|
|
&video_out_vaapi,
|
|
|
|
#endif
|
2012-04-23 22:48:14 +00:00
|
|
|
#ifdef CONFIG_X11
|
2001-02-24 20:28:24 +00:00
|
|
|
&video_out_x11,
|
2004-10-04 19:36:12 +00:00
|
|
|
#endif
|
|
|
|
&video_out_null,
|
2008-12-20 11:49:00 +00:00
|
|
|
// should not be auto-selected
|
2012-08-06 15:52:17 +00:00
|
|
|
&video_out_image,
|
2013-02-06 21:29:21 +00:00
|
|
|
#ifdef CONFIG_CACA
|
|
|
|
&video_out_caca,
|
|
|
|
#endif
|
2012-09-14 15:51:26 +00:00
|
|
|
#ifdef CONFIG_ENCODING
|
|
|
|
&video_out_lavc,
|
2012-09-29 16:36:05 +00:00
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_GL
|
|
|
|
&video_out_opengl_hq,
|
2013-04-15 20:37:02 +00:00
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_WAYLAND
|
|
|
|
&video_out_wayland,
|
2004-10-23 22:43:19 +00:00
|
|
|
#endif
|
2001-02-24 20:28:24 +00:00
|
|
|
NULL
|
|
|
|
};
|
2002-05-13 13:15:40 +00:00
|
|
|
|
2013-07-21 19:17:48 +00:00
|
|
|
static bool get_desc(struct m_obj_desc *dst, int index)
|
|
|
|
{
|
|
|
|
if (index >= MP_ARRAY_SIZE(video_out_drivers) - 1)
|
|
|
|
return false;
|
|
|
|
const struct vo_driver *vo = video_out_drivers[index];
|
|
|
|
*dst = (struct m_obj_desc) {
|
|
|
|
.name = vo->info->short_name,
|
|
|
|
.description = vo->info->name,
|
|
|
|
.priv_size = vo->priv_size,
|
|
|
|
.priv_defaults = vo->priv_defaults,
|
|
|
|
.options = vo->options,
|
|
|
|
.init_options = vo->init_option_string,
|
2013-07-21 20:03:53 +00:00
|
|
|
.hidden = vo->encode,
|
2013-07-21 19:17:48 +00:00
|
|
|
.p = vo,
|
|
|
|
};
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// For the vo option
|
|
|
|
const struct m_obj_list vo_obj_list = {
|
|
|
|
.get_desc = get_desc,
|
|
|
|
.description = "video outputs",
|
|
|
|
.aliases = {
|
|
|
|
{"gl", "opengl"},
|
|
|
|
{"gl3", "opengl-hq"},
|
|
|
|
{0}
|
|
|
|
},
|
|
|
|
.allow_unknown_entries = true,
|
|
|
|
.allow_trailer = true,
|
|
|
|
};
|
2008-04-03 03:25:41 +00:00
|
|
|
|
2013-07-31 19:44:21 +00:00
|
|
|
static struct vo *vo_create(struct mpv_global *global,
|
2013-07-21 19:17:48 +00:00
|
|
|
struct input_ctx *input_ctx,
|
|
|
|
struct encode_lavc_context *encode_lavc_ctx,
|
|
|
|
char *name, char **args)
|
2008-04-03 03:25:41 +00:00
|
|
|
{
|
2013-07-31 19:44:21 +00:00
|
|
|
struct mp_log *log = mp_log_new(NULL, global->log, "vo");
|
2013-07-21 19:17:48 +00:00
|
|
|
struct m_obj_desc desc;
|
|
|
|
if (!m_obj_list_find(&desc, &vo_obj_list, bstr0(name))) {
|
2013-07-31 19:44:21 +00:00
|
|
|
mp_tmsg_log(log, MSGL_ERR, "Video output %s not found!\n", name);
|
|
|
|
talloc_free(log);
|
2013-07-21 19:17:48 +00:00
|
|
|
return NULL;
|
|
|
|
};
|
|
|
|
struct vo *vo = talloc_ptrtype(NULL, vo);
|
|
|
|
*vo = (struct vo) {
|
2013-07-31 19:44:21 +00:00
|
|
|
.vo_log = { .log = talloc_steal(vo, log) },
|
|
|
|
.log = mp_log_new(vo, log, name),
|
2013-07-21 19:17:48 +00:00
|
|
|
.driver = desc.p,
|
2013-07-31 19:44:21 +00:00
|
|
|
.opts = &global->opts->vo,
|
2013-07-21 19:17:48 +00:00
|
|
|
.encode_lavc_ctx = encode_lavc_ctx,
|
|
|
|
.input_ctx = input_ctx,
|
|
|
|
.event_fd = -1,
|
|
|
|
.registered_fd = -1,
|
|
|
|
.aspdat = { .monitor_par = 1 },
|
|
|
|
};
|
2013-02-06 21:54:03 +00:00
|
|
|
if (vo->driver->encode != !!vo->encode_lavc_ctx)
|
2013-07-21 19:17:48 +00:00
|
|
|
goto error;
|
|
|
|
struct m_config *config = m_config_from_obj_desc(vo, &desc);
|
2013-07-22 20:52:42 +00:00
|
|
|
if (m_config_set_obj_params(config, args) < 0)
|
2013-07-21 19:17:48 +00:00
|
|
|
goto error;
|
2013-07-22 20:52:42 +00:00
|
|
|
vo->priv = config->optstruct;
|
|
|
|
if (vo->driver->preinit(vo))
|
2013-07-21 19:17:48 +00:00
|
|
|
goto error;
|
|
|
|
return vo;
|
|
|
|
error:
|
|
|
|
talloc_free(vo);
|
|
|
|
return NULL;
|
2008-04-03 03:25:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int vo_control(struct vo *vo, uint32_t request, void *data)
|
|
|
|
{
|
|
|
|
return vo->driver->control(vo, request, data);
|
|
|
|
}
|
|
|
|
|
2013-03-28 20:39:10 +00:00
|
|
|
void vo_queue_image(struct vo *vo, struct mp_image *mpi)
|
2009-09-18 13:27:55 +00:00
|
|
|
{
|
|
|
|
if (!vo->config_ok)
|
2013-03-28 20:39:10 +00:00
|
|
|
return;
|
2009-09-18 13:27:55 +00:00
|
|
|
if (vo->driver->buffer_frames) {
|
video/filter: change filter API, use refcounting, remove filter DR
Change the entire filter API to use reference counted images instead
of vf_get_image().
Remove filter "direct rendering". This was useful for vf_expand and (in
rare cases) vf_sub: DR allowed these filters to pass a cropped image to
the filters before them. Then, on filtering, the image was "uncropped",
so that black bars could be added around the image without copying. This
means that in some cases, vf_expand will be slower (-vf gradfun,expand
for example).
Note that another form of DR used for in-place filters has been replaced
by simpler logic. Instead of trying to do DR, filters can check if the
image is writeable (with mp_image_is_writeable()), and do true in-place
if that's the case. This affects filters like vf_gradfun and vf_sub.
Everything has to support strides now. If something doesn't, making a
copy of the image data is required.
2012-11-05 13:25:04 +00:00
|
|
|
vo->driver->draw_image(vo, mpi);
|
2013-03-28 20:39:10 +00:00
|
|
|
return;
|
2009-09-18 13:27:55 +00:00
|
|
|
}
|
|
|
|
vo->frame_loaded = true;
|
video/filter: change filter API, use refcounting, remove filter DR
Change the entire filter API to use reference counted images instead
of vf_get_image().
Remove filter "direct rendering". This was useful for vf_expand and (in
rare cases) vf_sub: DR allowed these filters to pass a cropped image to
the filters before them. Then, on filtering, the image was "uncropped",
so that black bars could be added around the image without copying. This
means that in some cases, vf_expand will be slower (-vf gradfun,expand
for example).
Note that another form of DR used for in-place filters has been replaced
by simpler logic. Instead of trying to do DR, filters can check if the
image is writeable (with mp_image_is_writeable()), and do true in-place
if that's the case. This affects filters like vf_gradfun and vf_sub.
Everything has to support strides now. If something doesn't, making a
copy of the image data is required.
2012-11-05 13:25:04 +00:00
|
|
|
vo->next_pts = mpi->pts;
|
|
|
|
assert(!vo->waiting_mpi);
|
|
|
|
vo->waiting_mpi = mp_image_new_ref(mpi);
|
2009-09-18 13:27:55 +00:00
|
|
|
}
|
|
|
|
|
2011-12-05 03:24:18 +00:00
|
|
|
int vo_redraw_frame(struct vo *vo)
|
|
|
|
{
|
2012-02-28 01:17:25 +00:00
|
|
|
if (!vo->config_ok || !vo->hasframe)
|
2011-12-05 03:24:18 +00:00
|
|
|
return -1;
|
|
|
|
if (vo_control(vo, VOCTRL_REDRAW_FRAME, NULL) == true) {
|
2013-03-01 10:16:01 +00:00
|
|
|
vo->want_redraw = false;
|
2011-12-05 03:24:18 +00:00
|
|
|
vo->redrawing = true;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2013-03-01 10:16:01 +00:00
|
|
|
bool vo_get_want_redraw(struct vo *vo)
|
|
|
|
{
|
|
|
|
if (!vo->config_ok || !vo->hasframe)
|
|
|
|
return false;
|
|
|
|
return vo->want_redraw;
|
|
|
|
}
|
|
|
|
|
2009-09-18 13:27:55 +00:00
|
|
|
int vo_get_buffered_frame(struct vo *vo, bool eof)
|
|
|
|
{
|
|
|
|
if (!vo->config_ok)
|
|
|
|
return -1;
|
|
|
|
if (vo->frame_loaded)
|
|
|
|
return 0;
|
|
|
|
if (!vo->driver->buffer_frames)
|
|
|
|
return -1;
|
|
|
|
vo->driver->get_buffered_frame(vo, eof);
|
|
|
|
return vo->frame_loaded ? 0 : -1;
|
|
|
|
}
|
|
|
|
|
2011-03-03 10:54:36 +00:00
|
|
|
void vo_skip_frame(struct vo *vo)
|
|
|
|
{
|
2011-12-04 16:10:17 +00:00
|
|
|
vo_control(vo, VOCTRL_SKIPFRAME, NULL);
|
2011-03-03 10:54:36 +00:00
|
|
|
vo->frame_loaded = false;
|
video/filter: change filter API, use refcounting, remove filter DR
Change the entire filter API to use reference counted images instead
of vf_get_image().
Remove filter "direct rendering". This was useful for vf_expand and (in
rare cases) vf_sub: DR allowed these filters to pass a cropped image to
the filters before them. Then, on filtering, the image was "uncropped",
so that black bars could be added around the image without copying. This
means that in some cases, vf_expand will be slower (-vf gradfun,expand
for example).
Note that another form of DR used for in-place filters has been replaced
by simpler logic. Instead of trying to do DR, filters can check if the
image is writeable (with mp_image_is_writeable()), and do true in-place
if that's the case. This affects filters like vf_gradfun and vf_sub.
Everything has to support strides now. If something doesn't, making a
copy of the image data is required.
2012-11-05 13:25:04 +00:00
|
|
|
mp_image_unrefp(&vo->waiting_mpi);
|
2011-03-03 10:54:36 +00:00
|
|
|
}
|
|
|
|
|
2011-12-04 16:10:17 +00:00
|
|
|
void vo_new_frame_imminent(struct vo *vo)
|
|
|
|
{
|
|
|
|
if (vo->driver->buffer_frames)
|
|
|
|
vo_control(vo, VOCTRL_NEWFRAME, NULL);
|
|
|
|
else {
|
video/filter: change filter API, use refcounting, remove filter DR
Change the entire filter API to use reference counted images instead
of vf_get_image().
Remove filter "direct rendering". This was useful for vf_expand and (in
rare cases) vf_sub: DR allowed these filters to pass a cropped image to
the filters before them. Then, on filtering, the image was "uncropped",
so that black bars could be added around the image without copying. This
means that in some cases, vf_expand will be slower (-vf gradfun,expand
for example).
Note that another form of DR used for in-place filters has been replaced
by simpler logic. Instead of trying to do DR, filters can check if the
image is writeable (with mp_image_is_writeable()), and do true in-place
if that's the case. This affects filters like vf_gradfun and vf_sub.
Everything has to support strides now. If something doesn't, making a
copy of the image data is required.
2012-11-05 13:25:04 +00:00
|
|
|
assert(vo->frame_loaded);
|
|
|
|
assert(vo->waiting_mpi);
|
|
|
|
assert(vo->waiting_mpi->pts == vo->next_pts);
|
|
|
|
vo->driver->draw_image(vo, vo->waiting_mpi);
|
|
|
|
mp_image_unrefp(&vo->waiting_mpi);
|
2011-12-04 16:10:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-06-23 22:53:58 +00:00
|
|
|
void vo_draw_osd(struct vo *vo, struct osd_state *osd)
|
2008-04-03 03:25:41 +00:00
|
|
|
{
|
2013-03-01 10:16:01 +00:00
|
|
|
if (vo->config_ok && vo->driver->draw_osd)
|
2012-10-21 13:54:22 +00:00
|
|
|
vo->driver->draw_osd(vo, osd);
|
2008-04-03 03:25:41 +00:00
|
|
|
}
|
|
|
|
|
2009-11-15 02:39:22 +00:00
|
|
|
void vo_flip_page(struct vo *vo, unsigned int pts_us, int duration)
|
2008-04-03 03:25:41 +00:00
|
|
|
{
|
2008-04-18 03:28:47 +00:00
|
|
|
if (!vo->config_ok)
|
|
|
|
return;
|
2011-12-05 03:24:18 +00:00
|
|
|
if (!vo->redrawing) {
|
|
|
|
vo->frame_loaded = false;
|
|
|
|
vo->next_pts = MP_NOPTS_VALUE;
|
|
|
|
}
|
2011-12-05 04:36:20 +00:00
|
|
|
vo->want_redraw = false;
|
2011-12-05 03:24:18 +00:00
|
|
|
vo->redrawing = false;
|
2009-11-15 02:39:22 +00:00
|
|
|
if (vo->driver->flip_page_timed)
|
|
|
|
vo->driver->flip_page_timed(vo, pts_us, duration);
|
|
|
|
else
|
|
|
|
vo->driver->flip_page(vo);
|
2012-02-28 01:17:25 +00:00
|
|
|
vo->hasframe = true;
|
2008-04-03 03:25:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void vo_check_events(struct vo *vo)
|
|
|
|
{
|
2010-12-14 19:58:47 +00:00
|
|
|
if (!vo->config_ok) {
|
|
|
|
if (vo->registered_fd != -1)
|
|
|
|
mp_input_rm_key_fd(vo->input_ctx, vo->registered_fd);
|
|
|
|
vo->registered_fd = -1;
|
2008-04-18 03:28:47 +00:00
|
|
|
return;
|
2010-12-14 19:58:47 +00:00
|
|
|
}
|
2013-05-15 16:17:18 +00:00
|
|
|
vo_control(vo, VOCTRL_CHECK_EVENTS, NULL);
|
2008-04-03 03:25:41 +00:00
|
|
|
}
|
|
|
|
|
2009-09-18 13:27:55 +00:00
|
|
|
void vo_seek_reset(struct vo *vo)
|
|
|
|
{
|
|
|
|
vo_control(vo, VOCTRL_RESET, NULL);
|
|
|
|
vo->frame_loaded = false;
|
2012-03-14 23:24:52 +00:00
|
|
|
vo->hasframe = false;
|
video/filter: change filter API, use refcounting, remove filter DR
Change the entire filter API to use reference counted images instead
of vf_get_image().
Remove filter "direct rendering". This was useful for vf_expand and (in
rare cases) vf_sub: DR allowed these filters to pass a cropped image to
the filters before them. Then, on filtering, the image was "uncropped",
so that black bars could be added around the image without copying. This
means that in some cases, vf_expand will be slower (-vf gradfun,expand
for example).
Note that another form of DR used for in-place filters has been replaced
by simpler logic. Instead of trying to do DR, filters can check if the
image is writeable (with mp_image_is_writeable()), and do true in-place
if that's the case. This affects filters like vf_gradfun and vf_sub.
Everything has to support strides now. If something doesn't, making a
copy of the image data is required.
2012-11-05 13:25:04 +00:00
|
|
|
mp_image_unrefp(&vo->waiting_mpi);
|
2009-09-18 13:27:55 +00:00
|
|
|
}
|
|
|
|
|
2008-04-03 03:25:41 +00:00
|
|
|
void vo_destroy(struct vo *vo)
|
|
|
|
{
|
2010-12-14 19:58:47 +00:00
|
|
|
if (vo->registered_fd != -1)
|
|
|
|
mp_input_rm_key_fd(vo->input_ctx, vo->registered_fd);
|
2013-08-11 18:09:06 +00:00
|
|
|
mp_image_unrefp(&vo->waiting_mpi);
|
2008-04-03 03:25:41 +00:00
|
|
|
vo->driver->uninit(vo);
|
2008-04-20 03:04:10 +00:00
|
|
|
talloc_free(vo);
|
2008-04-03 03:25:41 +00:00
|
|
|
}
|
|
|
|
|
2013-07-31 19:44:21 +00:00
|
|
|
struct vo *init_best_video_out(struct mpv_global *global,
|
2012-09-14 15:51:26 +00:00
|
|
|
struct input_ctx *input_ctx,
|
|
|
|
struct encode_lavc_context *encode_lavc_ctx)
|
2008-04-03 01:58:32 +00:00
|
|
|
{
|
2013-07-31 19:44:21 +00:00
|
|
|
struct m_obj_settings *vo_list = global->opts->vo.video_driver_list;
|
2002-09-29 21:53:05 +00:00
|
|
|
// first try the preferred drivers, with their optional subdevice param:
|
2013-07-21 19:17:48 +00:00
|
|
|
if (vo_list && vo_list[0].name) {
|
|
|
|
for (int n = 0; vo_list[n].name; n++) {
|
|
|
|
// Something like "-vo name," allows fallback to autoprobing.
|
|
|
|
if (strlen(vo_list[n].name) == 0)
|
|
|
|
goto autoprobe;
|
2013-07-31 19:44:21 +00:00
|
|
|
struct vo *vo = vo_create(global, input_ctx, encode_lavc_ctx,
|
2013-07-21 19:17:48 +00:00
|
|
|
vo_list[n].name, vo_list[n].attribs);
|
|
|
|
if (vo)
|
|
|
|
return vo;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
autoprobe:
|
2002-09-29 21:53:05 +00:00
|
|
|
// now try the rest...
|
2013-07-21 19:17:48 +00:00
|
|
|
for (int i = 0; video_out_drivers[i]; i++) {
|
2013-07-31 19:44:21 +00:00
|
|
|
struct vo *vo = vo_create(global, input_ctx, encode_lavc_ctx,
|
2013-07-21 19:17:48 +00:00
|
|
|
(char *)video_out_drivers[i]->info->short_name, NULL);
|
|
|
|
if (vo)
|
|
|
|
return vo;
|
2002-09-29 21:53:05 +00:00
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-01-23 09:56:36 +00:00
|
|
|
// Fit *w/*h into the size specified by geo.
|
|
|
|
static void apply_autofit(int *w, int *h, int scr_w, int scr_h,
|
|
|
|
struct m_geometry *geo, bool allow_upscale)
|
|
|
|
{
|
|
|
|
if (!geo->wh_valid)
|
|
|
|
return;
|
|
|
|
|
|
|
|
int dummy;
|
|
|
|
int n_w = *w, n_h = *h;
|
|
|
|
m_geometry_apply(&dummy, &dummy, &n_w, &n_h, scr_w, scr_h, geo);
|
|
|
|
|
|
|
|
if (!allow_upscale && *w <= n_w && *h <= n_h)
|
|
|
|
return;
|
|
|
|
|
|
|
|
// If aspect mismatches, always make the window smaller than the fit box
|
|
|
|
double asp = (double)*w / *h;
|
|
|
|
double n_asp = (double)n_w / n_h;
|
|
|
|
if (n_asp <= asp) {
|
|
|
|
*w = n_w;
|
|
|
|
*h = n_w / asp;
|
|
|
|
} else {
|
|
|
|
*w = n_h * asp;
|
|
|
|
*h = n_h;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-01-22 12:28:31 +00:00
|
|
|
// Set window size (vo->dwidth/dheight) and position (vo->dx/dy) according to
|
|
|
|
// the video display size d_w/d_h.
|
|
|
|
// NOTE: currently, all GUI backends do their own handling of window geometry
|
|
|
|
// additional to this code. This is to deal with initial window placement,
|
|
|
|
// fullscreen handling, avoiding resize on config() with no size change,
|
|
|
|
// multi-monitor stuff, and possibly more.
|
|
|
|
static void determine_window_geometry(struct vo *vo, int d_w, int d_h)
|
|
|
|
{
|
2013-03-04 21:41:27 +00:00
|
|
|
struct mp_vo_opts *opts = vo->opts;
|
2013-01-22 12:28:31 +00:00
|
|
|
|
2013-03-04 21:41:27 +00:00
|
|
|
int scr_w = opts->screenwidth;
|
|
|
|
int scr_h = opts->screenheight;
|
2013-01-23 09:56:36 +00:00
|
|
|
|
2013-03-14 15:21:37 +00:00
|
|
|
aspect_calc_monitor(vo, &d_w, &d_h);
|
2013-01-22 12:28:31 +00:00
|
|
|
|
2013-03-04 21:41:27 +00:00
|
|
|
apply_autofit(&d_w, &d_h, scr_w, scr_h, &opts->autofit, true);
|
|
|
|
apply_autofit(&d_w, &d_h, scr_w, scr_h, &opts->autofit_larger, false);
|
2013-01-23 09:56:36 +00:00
|
|
|
|
2013-03-04 21:41:27 +00:00
|
|
|
vo->dx = (int)(opts->screenwidth - d_w) / 2;
|
|
|
|
vo->dy = (int)(opts->screenheight - d_h) / 2;
|
2013-01-23 09:56:36 +00:00
|
|
|
m_geometry_apply(&vo->dx, &vo->dy, &d_w, &d_h, scr_w, scr_h,
|
2013-03-04 21:41:27 +00:00
|
|
|
&opts->geometry);
|
2013-01-22 12:28:31 +00:00
|
|
|
|
2013-03-04 16:40:21 +00:00
|
|
|
vo->dx += vo->xinerama_x;
|
|
|
|
vo->dy += vo->xinerama_y;
|
2013-01-22 12:28:31 +00:00
|
|
|
vo->dwidth = d_w;
|
|
|
|
vo->dheight = d_h;
|
|
|
|
}
|
|
|
|
|
2010-12-14 19:58:47 +00:00
|
|
|
static int event_fd_callback(void *ctx, int fd)
|
|
|
|
{
|
|
|
|
struct vo *vo = ctx;
|
|
|
|
vo_check_events(vo);
|
2011-07-17 01:47:50 +00:00
|
|
|
return MP_INPUT_NOTHING;
|
2010-12-14 19:58:47 +00:00
|
|
|
}
|
|
|
|
|
2013-06-07 23:35:44 +00:00
|
|
|
int vo_reconfig(struct vo *vo, struct mp_image_params *params, int flags)
|
2008-04-03 01:58:32 +00:00
|
|
|
{
|
2013-06-07 23:35:44 +00:00
|
|
|
int d_width = params->d_w;
|
|
|
|
int d_height = params->d_h;
|
|
|
|
aspect_save_videores(vo, params->w, params->h, d_width, d_height);
|
2007-02-17 20:58:55 +00:00
|
|
|
|
2008-04-03 03:25:41 +00:00
|
|
|
if (vo_control(vo, VOCTRL_UPDATE_SCREENINFO, NULL) == VO_TRUE) {
|
2013-06-07 23:35:44 +00:00
|
|
|
determine_window_geometry(vo, params->d_w, params->d_h);
|
2013-01-22 12:28:31 +00:00
|
|
|
d_width = vo->dwidth;
|
|
|
|
d_height = vo->dheight;
|
2008-04-03 01:58:32 +00:00
|
|
|
}
|
2013-06-07 23:35:44 +00:00
|
|
|
vo->dwidth = d_width;
|
|
|
|
vo->dheight = d_height;
|
2007-02-17 20:58:55 +00:00
|
|
|
|
2013-06-07 23:35:44 +00:00
|
|
|
struct mp_image_params p2 = *params;
|
|
|
|
|
|
|
|
int ret;
|
|
|
|
if (vo->driver->reconfig) {
|
|
|
|
ret = vo->driver->reconfig(vo, &p2, flags);
|
|
|
|
} else {
|
|
|
|
// Old config() takes window size, while reconfig() takes aspect (!)
|
|
|
|
ret = vo->driver->config(vo, p2.w, p2.h, d_width, d_height, flags,
|
|
|
|
p2.imgfmt);
|
|
|
|
ret = ret ? -1 : 0;
|
|
|
|
}
|
|
|
|
vo->config_ok = (ret >= 0);
|
2008-04-18 03:28:47 +00:00
|
|
|
vo->config_count += vo->config_ok;
|
2010-12-14 19:58:47 +00:00
|
|
|
if (vo->registered_fd == -1 && vo->event_fd != -1 && vo->config_ok) {
|
|
|
|
mp_input_add_key_fd(vo->input_ctx, vo->event_fd, 1, event_fd_callback,
|
|
|
|
NULL, vo);
|
|
|
|
vo->registered_fd = vo->event_fd;
|
|
|
|
}
|
2011-12-04 16:10:17 +00:00
|
|
|
vo->frame_loaded = false;
|
|
|
|
vo->waiting_mpi = NULL;
|
2011-12-05 03:24:18 +00:00
|
|
|
vo->redrawing = false;
|
2012-02-28 01:17:25 +00:00
|
|
|
vo->hasframe = false;
|
2013-07-16 21:22:55 +00:00
|
|
|
if (vo->config_ok) {
|
|
|
|
// Legacy
|
|
|
|
struct mp_csp_details csp;
|
|
|
|
if (vo_control(vo, VOCTRL_GET_YUV_COLORSPACE, &csp) > 0) {
|
|
|
|
csp.levels_in = params->colorlevels;
|
2013-08-24 17:37:34 +00:00
|
|
|
csp.levels_out = params->outputlevels;
|
2013-07-16 21:22:55 +00:00
|
|
|
csp.format = params->colorspace;
|
|
|
|
vo_control(vo, VOCTRL_SET_YUV_COLORSPACE, &csp);
|
|
|
|
}
|
|
|
|
}
|
2008-04-18 03:28:47 +00:00
|
|
|
return ret;
|
2007-02-17 20:58:55 +00:00
|
|
|
}
|
2002-09-29 21:53:05 +00:00
|
|
|
|
2008-12-20 11:52:11 +00:00
|
|
|
/**
|
|
|
|
* \brief lookup an integer in a table, table must have 0 as the last key
|
|
|
|
* \param key key to search for
|
|
|
|
* \result translation corresponding to key or "to" value of last mapping
|
|
|
|
* if not found.
|
|
|
|
*/
|
2010-04-23 10:22:44 +00:00
|
|
|
int lookup_keymap_table(const struct mp_keymap *map, int key) {
|
2008-12-20 11:52:11 +00:00
|
|
|
while (map->from && map->from != key) map++;
|
|
|
|
return map->to;
|
|
|
|
}
|
|
|
|
|
2012-10-27 20:10:32 +00:00
|
|
|
static void print_video_rect(struct vo *vo, struct mp_rect src,
|
|
|
|
struct mp_rect dst, struct mp_osd_res osd)
|
|
|
|
{
|
|
|
|
int sw = src.x1 - src.x0, sh = src.y1 - src.y0;
|
|
|
|
int dw = dst.x1 - dst.x0, dh = dst.y1 - dst.y0;
|
|
|
|
|
2013-07-31 19:44:21 +00:00
|
|
|
MP_VERBOSE(&vo->vo_log, "Window size: %dx%d\n",
|
|
|
|
vo->dwidth, vo->dheight);
|
|
|
|
MP_VERBOSE(&vo->vo_log, "Video source: %dx%d (%dx%d)\n",
|
|
|
|
vo->aspdat.orgw, vo->aspdat.orgh,
|
|
|
|
vo->aspdat.prew, vo->aspdat.preh);
|
|
|
|
MP_VERBOSE(&vo->vo_log, "Video display: (%d, %d) %dx%d -> (%d, %d) %dx%d\n",
|
|
|
|
src.x0, src.y0, sw, sh, dst.x0, dst.y0, dw, dh);
|
|
|
|
MP_VERBOSE(&vo->vo_log, "Video scale: %f/%f\n",
|
|
|
|
(double)dw / sw, (double)dh / sh);
|
|
|
|
MP_VERBOSE(&vo->vo_log, "OSD borders: l=%d t=%d r=%d b=%d\n",
|
|
|
|
osd.ml, osd.mt, osd.mr, osd.mb);
|
|
|
|
MP_VERBOSE(&vo->vo_log, "Video borders: l=%d t=%d r=%d b=%d\n",
|
|
|
|
dst.x0, dst.y0, vo->dwidth - dst.x1, vo->dheight - dst.y1);
|
2009-02-12 17:40:53 +00:00
|
|
|
}
|
|
|
|
|
2013-06-14 21:59:53 +00:00
|
|
|
// Clamp [start, end) to range [0, size) with various fallbacks.
|
|
|
|
static void clamp_size(int size, int *start, int *end)
|
|
|
|
{
|
|
|
|
*start = FFMAX(0, *start);
|
|
|
|
*end = FFMIN(size, *end);
|
|
|
|
if (*start >= *end) {
|
|
|
|
*start = 0;
|
|
|
|
*end = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Round source to a multiple of 2, this is at least needed for vo_direct3d
|
|
|
|
// and ATI cards.
|
|
|
|
#define VID_SRC_ROUND_UP(x) (((x) + 1) & ~1)
|
|
|
|
|
2012-10-27 20:10:32 +00:00
|
|
|
static void src_dst_split_scaling(int src_size, int dst_size,
|
2013-09-01 01:27:03 +00:00
|
|
|
int scaled_src_size, bool unscaled,
|
2013-06-14 22:15:32 +00:00
|
|
|
float zoom, float align, float pan,
|
2013-06-14 21:59:53 +00:00
|
|
|
int *src_start, int *src_end,
|
|
|
|
int *dst_start, int *dst_end,
|
|
|
|
int *osd_margin_a, int *osd_margin_b)
|
2009-02-17 23:07:37 +00:00
|
|
|
{
|
2013-09-01 01:27:03 +00:00
|
|
|
if (unscaled)
|
|
|
|
scaled_src_size = src_size;
|
|
|
|
|
2013-06-14 22:15:32 +00:00
|
|
|
scaled_src_size += zoom * src_size;
|
|
|
|
align = (align + 1) / 2;
|
|
|
|
|
2013-06-14 21:59:53 +00:00
|
|
|
*src_start = 0;
|
|
|
|
*src_end = src_size;
|
2013-06-14 22:15:32 +00:00
|
|
|
*dst_start = (dst_size - scaled_src_size) * align + pan * scaled_src_size;
|
2013-06-14 21:59:53 +00:00
|
|
|
*dst_end = *dst_start + scaled_src_size;
|
|
|
|
|
|
|
|
// Distance of screen frame to video
|
|
|
|
*osd_margin_a = *dst_start;
|
|
|
|
*osd_margin_b = dst_size - *dst_end;
|
|
|
|
|
|
|
|
// Clip to screen
|
|
|
|
int s_src = *src_end - *src_start;
|
|
|
|
int s_dst = *dst_end - *dst_start;
|
|
|
|
if (*dst_start < 0) {
|
|
|
|
int border = -(*dst_start) * s_src / s_dst;
|
|
|
|
*src_start += VID_SRC_ROUND_UP(border);
|
2012-10-27 20:10:32 +00:00
|
|
|
*dst_start = 0;
|
2009-02-17 11:59:49 +00:00
|
|
|
}
|
2013-06-14 21:59:53 +00:00
|
|
|
if (*dst_end > dst_size) {
|
|
|
|
int border = (*dst_end - dst_size) * s_src / s_dst;
|
|
|
|
*src_end -= VID_SRC_ROUND_UP(border);
|
|
|
|
*dst_end = dst_size;
|
|
|
|
}
|
|
|
|
|
2013-09-01 01:27:03 +00:00
|
|
|
if (unscaled && zoom == 1.0) {
|
|
|
|
// Force unscaled by reducing the range for src or dst
|
|
|
|
int src_s = *src_end - *src_start;
|
|
|
|
int dst_s = *dst_end - *dst_start;
|
|
|
|
if (src_s > dst_s) {
|
|
|
|
*src_end = *src_start + dst_s;
|
|
|
|
} else if (src_s < dst_s) {
|
|
|
|
*dst_end = *dst_start + src_s;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-06-14 21:59:53 +00:00
|
|
|
// For sanity: avoid bothering VOs with corner cases
|
|
|
|
clamp_size(src_size, src_start, src_end);
|
|
|
|
clamp_size(dst_size, dst_start, dst_end);
|
2012-10-27 20:10:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Calculate the appropriate source and destination rectangle to
|
|
|
|
// get a correctly scaled picture, including pan-scan.
|
|
|
|
// out_src: visible part of the video
|
|
|
|
// out_dst: area of screen covered by the video source rectangle
|
|
|
|
// out_osd: OSD size, OSD margins, etc.
|
|
|
|
void vo_get_src_dst_rects(struct vo *vo, struct mp_rect *out_src,
|
|
|
|
struct mp_rect *out_dst, struct mp_osd_res *out_osd)
|
2009-02-17 23:07:37 +00:00
|
|
|
{
|
2013-06-14 21:59:53 +00:00
|
|
|
struct mp_vo_opts *opts = vo->opts;
|
2012-10-27 20:10:32 +00:00
|
|
|
int src_w = vo->aspdat.orgw;
|
|
|
|
int src_h = vo->aspdat.orgh;
|
|
|
|
struct mp_rect dst = {0, 0, vo->dwidth, vo->dheight};
|
|
|
|
struct mp_rect src = {0, 0, src_w, src_h};
|
|
|
|
struct mp_osd_res osd = {
|
|
|
|
.w = vo->dwidth,
|
|
|
|
.h = vo->dheight,
|
2013-03-14 15:21:37 +00:00
|
|
|
.display_par = vo->aspdat.monitor_par,
|
2012-10-27 20:10:32 +00:00
|
|
|
.video_par = vo->aspdat.par,
|
|
|
|
};
|
2013-06-14 21:59:53 +00:00
|
|
|
if (opts->keepaspect) {
|
2013-03-14 15:21:37 +00:00
|
|
|
int scaled_width, scaled_height;
|
|
|
|
aspect_calc_panscan(vo, &scaled_width, &scaled_height);
|
2013-09-01 01:27:03 +00:00
|
|
|
src_dst_split_scaling(src_w, vo->dwidth, scaled_width, opts->unscaled,
|
2013-06-14 22:15:32 +00:00
|
|
|
opts->zoom, opts->align_x, opts->pan_x,
|
2013-06-14 21:59:53 +00:00
|
|
|
&src.x0, &src.x1, &dst.x0, &dst.x1,
|
|
|
|
&osd.ml, &osd.mr);
|
2013-09-01 01:27:03 +00:00
|
|
|
src_dst_split_scaling(src_h, vo->dheight, scaled_height, opts->unscaled,
|
2013-06-14 22:15:32 +00:00
|
|
|
opts->zoom, opts->align_y, opts->pan_y,
|
2013-06-14 21:59:53 +00:00
|
|
|
&src.y0, &src.y1, &dst.y0, &dst.y1,
|
|
|
|
&osd.mt, &osd.mb);
|
2009-02-17 11:59:49 +00:00
|
|
|
}
|
2012-10-27 20:10:32 +00:00
|
|
|
|
|
|
|
*out_src = src;
|
|
|
|
*out_dst = dst;
|
|
|
|
*out_osd = osd;
|
|
|
|
|
|
|
|
print_video_rect(vo, src, dst, osd);
|
2009-02-12 17:40:53 +00:00
|
|
|
}
|
|
|
|
|
2011-12-06 19:23:54 +00:00
|
|
|
// Return the window title the VO should set. Always returns a null terminated
|
|
|
|
// string. The string is valid until frontend code is invoked again. Copy it if
|
|
|
|
// you need to keep the string for an extended period of time.
|
|
|
|
const char *vo_get_window_title(struct vo *vo)
|
|
|
|
{
|
2012-08-16 14:18:51 +00:00
|
|
|
if (!vo->window_title)
|
|
|
|
vo->window_title = talloc_strdup(vo, "");
|
2012-08-02 00:36:26 +00:00
|
|
|
return vo->window_title;
|
2011-12-06 19:23:54 +00:00
|
|
|
}
|
|
|
|
|
2010-04-25 16:13:57 +00:00
|
|
|
/**
|
|
|
|
* Generates a mouse movement message if those are enable and sends it
|
|
|
|
* to the "main" MPlayer.
|
|
|
|
*
|
|
|
|
* \param posx new x position of mouse
|
|
|
|
* \param posy new y position of mouse
|
|
|
|
*/
|
2010-04-26 16:22:56 +00:00
|
|
|
void vo_mouse_movement(struct vo *vo, int posx, int posy)
|
|
|
|
{
|
input: handle mouse movement differently
Before this commit, mouse movement events emitted a special command
("set_mouse_pos"), which was specially handled in command.c. This was
once special-cased to the dvdnav and menu code, and did nothing after
libmenu and dvdnav were removed.
Change it so that mouse movement triggers a pseudo-key ("MOUSE_MOVE"),
which then can be bound to an arbitrary command. The mouse position is
now managed in input.c. A command which actually needs the mouse
position can use either mp_input_get_mouse_pos() or mp_get_osd_mouse_pos()
to query it. The former returns raw window-space coordinates, while the
latter returns coordinates transformed to OSD- space. (Both are the same
for most VOs, except vo_xv and vo_x11, which can't render OSD in
window-space. These require extra code for mapping mouse position.)
As of this commit, there is still nothing that uses mouse movement, so
MOUSE_MOVE is mapped to "ignore" to silence warnings when moving the
mouse (much like MOUSE_BTN0).
Extend the concept of input sections. Allow multiple sections to be
active at once, and organize them as stack. Bindings from the top of
the stack are preferred to lower ones.
Each section has a mouse input section associated, inside which mouse
events are associated with the bindings. If the mouse pointer is
outside of a section's mouse area, mouse events will be dispatched to
an input section lower on the stack of active sections. This is intended
for scripting, which is to be added later. Two scripts could occupy
different areas of the screen without conflicting with each other. (If
it turns out that this mechanism is useless, we'll just remove it
again.)
2013-04-26 00:13:30 +00:00
|
|
|
if (!vo->opts->enable_mouse_movements)
|
|
|
|
return;
|
|
|
|
mp_input_set_mouse_pos(vo->input_ctx, posx, posy);
|
2010-04-25 16:13:57 +00:00
|
|
|
}
|