2008-05-14 17:22:53 +00:00
|
|
|
/*
|
|
|
|
* based on video_out_null.c from mpeg2dec
|
2001-02-24 20:28:24 +00:00
|
|
|
*
|
2008-05-14 17:22:53 +00:00
|
|
|
* Copyright (C) Aaron Holtzman - June 2000
|
2001-02-24 20:28:24 +00:00
|
|
|
*
|
2015-04-13 07:36:54 +00:00
|
|
|
* This file is part of mpv.
|
2008-05-14 17:22:53 +00:00
|
|
|
*
|
vo.c, vo.h, vo_null.c: change license to LGPL
Most contributors have agreed. vo.c requires a "driver" entry for each
video output - we assume that if someone who didn't agree to LGPL added
a line, it's fine for vo.c to be LGPL anyway. If the affected video
output is not disabled at compilation time, the resulting binary will be
GPL anyway.
One problem are the changes by Nick Kurshev (usually using "nick" as SVN
username). He could not be reached. I believe all changes to his files
are actually gone, but here is a detailed listing:
fa1d5742bc: nick introduces a new VO API. It was removed in 64bedd9683.
Some of this was replaced by VOCTRLs are introduced in 7c51652a1b,
obviously replacing at least some functionality by his API.
b587a3d642: nick adds a vo_tune_info_t struct. Removed in 64bedd9683
too.
9caad2c29a: nick adds some VOCTRLs, which were silently removed in
8cc5ba5ab8 (they became unused probably with the VIDIX removal).
340183b0e9: nick adds VO-based screenshots, which got removed in
2f4b840f62. Strangely the same name was introduced in 01cf896a2f again,
but this is a coincidence and worked differently (also it was removed
yet again in 2858232220).
104c125e6d: nick adds an option for "direct rendering". It was renamed
in 6403904ae9 and fully removed in e48b21dd87.
5ddd8e92a1: nick adds code to check the VO driver preinit arg to every
single VO driver. The argument itself and any possibly remaining code
associated with it was removed in 1f5ffe7d30.
f6878753fb: nick adds header inclusion guards. We assume this is not
relevant for copyright.
Some of nick's code was merely moved to other files, such as the
equalizer stuff added in 555c676683 and moved in 4db72f6a80 and
12579136ff, and don't affect copyright of these files anymore.
Other notes:
fef7b17c34: a patch by someone who wasn't asked for relicensing added a
symbol that was removed again in 1b09f4633.
4a8a46fafd: author probably didn't agree to LGPL, but the function
signature was changed later on anyway, and nothing of this is left.
7b25afd742: the same author adds a symbol to what is vo.h today, which
this relicensing commit removes, as it was unused. (It's not clear
whether the mere symbol is copyrightable, but no need to take a risk.)
3a406e94d7, 9dd8f241ac: slave mode things by someone who couldn't be
reached. This aspect of the old slave mode was completely removed.
bbeb54d80a: patch by someone who was not asked, but the added code was
completely removed again.
2017-05-10 12:32:34 +00:00
|
|
|
* mpv is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2008-05-14 17:22:53 +00:00
|
|
|
*
|
2015-04-13 07:36:54 +00:00
|
|
|
* mpv is distributed in the hope that it will be useful,
|
2008-05-14 17:22:53 +00:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
vo.c, vo.h, vo_null.c: change license to LGPL
Most contributors have agreed. vo.c requires a "driver" entry for each
video output - we assume that if someone who didn't agree to LGPL added
a line, it's fine for vo.c to be LGPL anyway. If the affected video
output is not disabled at compilation time, the resulting binary will be
GPL anyway.
One problem are the changes by Nick Kurshev (usually using "nick" as SVN
username). He could not be reached. I believe all changes to his files
are actually gone, but here is a detailed listing:
fa1d5742bc: nick introduces a new VO API. It was removed in 64bedd9683.
Some of this was replaced by VOCTRLs are introduced in 7c51652a1b,
obviously replacing at least some functionality by his API.
b587a3d642: nick adds a vo_tune_info_t struct. Removed in 64bedd9683
too.
9caad2c29a: nick adds some VOCTRLs, which were silently removed in
8cc5ba5ab8 (they became unused probably with the VIDIX removal).
340183b0e9: nick adds VO-based screenshots, which got removed in
2f4b840f62. Strangely the same name was introduced in 01cf896a2f again,
but this is a coincidence and worked differently (also it was removed
yet again in 2858232220).
104c125e6d: nick adds an option for "direct rendering". It was renamed
in 6403904ae9 and fully removed in e48b21dd87.
5ddd8e92a1: nick adds code to check the VO driver preinit arg to every
single VO driver. The argument itself and any possibly remaining code
associated with it was removed in 1f5ffe7d30.
f6878753fb: nick adds header inclusion guards. We assume this is not
relevant for copyright.
Some of nick's code was merely moved to other files, such as the
equalizer stuff added in 555c676683 and moved in 4db72f6a80 and
12579136ff, and don't affect copyright of these files anymore.
Other notes:
fef7b17c34: a patch by someone who wasn't asked for relicensing added a
symbol that was removed again in 1b09f4633.
4a8a46fafd: author probably didn't agree to LGPL, but the function
signature was changed later on anyway, and nothing of this is left.
7b25afd742: the same author adds a symbol to what is vo.h today, which
this relicensing commit removes, as it was unused. (It's not clear
whether the mere symbol is copyrightable, but no need to take a risk.)
3a406e94d7, 9dd8f241ac: slave mode things by someone who couldn't be
reached. This aspect of the old slave mode was completely removed.
bbeb54d80a: patch by someone who was not asked, but the added code was
completely removed again.
2017-05-10 12:32:34 +00:00
|
|
|
* GNU Lesser General Public License for more details.
|
2008-05-14 17:22:53 +00:00
|
|
|
*
|
vo.c, vo.h, vo_null.c: change license to LGPL
Most contributors have agreed. vo.c requires a "driver" entry for each
video output - we assume that if someone who didn't agree to LGPL added
a line, it's fine for vo.c to be LGPL anyway. If the affected video
output is not disabled at compilation time, the resulting binary will be
GPL anyway.
One problem are the changes by Nick Kurshev (usually using "nick" as SVN
username). He could not be reached. I believe all changes to his files
are actually gone, but here is a detailed listing:
fa1d5742bc: nick introduces a new VO API. It was removed in 64bedd9683.
Some of this was replaced by VOCTRLs are introduced in 7c51652a1b,
obviously replacing at least some functionality by his API.
b587a3d642: nick adds a vo_tune_info_t struct. Removed in 64bedd9683
too.
9caad2c29a: nick adds some VOCTRLs, which were silently removed in
8cc5ba5ab8 (they became unused probably with the VIDIX removal).
340183b0e9: nick adds VO-based screenshots, which got removed in
2f4b840f62. Strangely the same name was introduced in 01cf896a2f again,
but this is a coincidence and worked differently (also it was removed
yet again in 2858232220).
104c125e6d: nick adds an option for "direct rendering". It was renamed
in 6403904ae9 and fully removed in e48b21dd87.
5ddd8e92a1: nick adds code to check the VO driver preinit arg to every
single VO driver. The argument itself and any possibly remaining code
associated with it was removed in 1f5ffe7d30.
f6878753fb: nick adds header inclusion guards. We assume this is not
relevant for copyright.
Some of nick's code was merely moved to other files, such as the
equalizer stuff added in 555c676683 and moved in 4db72f6a80 and
12579136ff, and don't affect copyright of these files anymore.
Other notes:
fef7b17c34: a patch by someone who wasn't asked for relicensing added a
symbol that was removed again in 1b09f4633.
4a8a46fafd: author probably didn't agree to LGPL, but the function
signature was changed later on anyway, and nothing of this is left.
7b25afd742: the same author adds a symbol to what is vo.h today, which
this relicensing commit removes, as it was unused. (It's not clear
whether the mere symbol is copyrightable, but no need to take a risk.)
3a406e94d7, 9dd8f241ac: slave mode things by someone who couldn't be
reached. This aspect of the old slave mode was completely removed.
bbeb54d80a: patch by someone who was not asked, but the added code was
completely removed again.
2017-05-10 12:32:34 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
|
2001-02-24 20:28:24 +00:00
|
|
|
*/
|
|
|
|
|
2002-04-13 19:14:34 +00:00
|
|
|
#include <stdlib.h>
|
2013-12-17 01:39:45 +00:00
|
|
|
#include "common/msg.h"
|
2012-11-09 00:06:43 +00:00
|
|
|
#include "vo.h"
|
|
|
|
#include "video/mp_image.h"
|
2015-05-24 13:48:48 +00:00
|
|
|
#include "osdep/timer.h"
|
|
|
|
#include "options/m_option.h"
|
|
|
|
|
|
|
|
struct priv {
|
|
|
|
int64_t last_vsync;
|
|
|
|
|
|
|
|
double cfg_fps;
|
|
|
|
};
|
2001-02-24 20:28:24 +00:00
|
|
|
|
2012-11-04 14:56:04 +00:00
|
|
|
static void draw_image(struct vo *vo, mp_image_t *mpi)
|
|
|
|
{
|
2014-06-17 21:05:50 +00:00
|
|
|
talloc_free(mpi);
|
2012-11-04 14:56:04 +00:00
|
|
|
}
|
|
|
|
|
2012-08-06 22:24:53 +00:00
|
|
|
static void flip_page(struct vo *vo)
|
2001-02-24 20:28:24 +00:00
|
|
|
{
|
2015-05-24 13:48:48 +00:00
|
|
|
struct priv *p = vo->priv;
|
|
|
|
if (p->cfg_fps) {
|
|
|
|
int64_t ft = 1e6 / p->cfg_fps;
|
|
|
|
int64_t prev_vsync = mp_time_us() / ft;
|
|
|
|
int64_t target_time = (prev_vsync + 1) * ft;
|
|
|
|
for (;;) {
|
|
|
|
int64_t now = mp_time_us();
|
|
|
|
if (now >= target_time)
|
|
|
|
break;
|
|
|
|
mp_sleep_us(target_time - now);
|
|
|
|
}
|
|
|
|
}
|
2001-02-24 20:28:24 +00:00
|
|
|
}
|
|
|
|
|
2015-01-21 21:08:24 +00:00
|
|
|
static int query_format(struct vo *vo, int format)
|
2001-02-24 20:28:24 +00:00
|
|
|
{
|
2015-01-21 21:08:24 +00:00
|
|
|
return 1;
|
2001-02-24 20:28:24 +00:00
|
|
|
}
|
|
|
|
|
2015-10-03 16:20:16 +00:00
|
|
|
static int reconfig(struct vo *vo, struct mp_image_params *params)
|
2001-02-24 20:28:24 +00:00
|
|
|
{
|
2012-08-06 22:24:53 +00:00
|
|
|
return 0;
|
2001-02-24 20:28:24 +00:00
|
|
|
}
|
|
|
|
|
2012-08-06 22:24:53 +00:00
|
|
|
static void uninit(struct vo *vo)
|
2001-02-24 20:28:24 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-07-22 20:52:42 +00:00
|
|
|
static int preinit(struct vo *vo)
|
2002-01-26 16:01:26 +00:00
|
|
|
{
|
2002-02-17 08:24:43 +00:00
|
|
|
return 0;
|
2002-01-26 16:01:26 +00:00
|
|
|
}
|
2001-03-03 21:46:39 +00:00
|
|
|
|
2012-08-06 22:24:53 +00:00
|
|
|
static int control(struct vo *vo, uint32_t request, void *data)
|
2002-01-26 16:01:26 +00:00
|
|
|
{
|
2015-05-24 13:48:48 +00:00
|
|
|
struct priv *p = vo->priv;
|
|
|
|
switch (request) {
|
|
|
|
case VOCTRL_GET_DISPLAY_FPS:
|
|
|
|
if (!p->cfg_fps)
|
|
|
|
break;
|
|
|
|
*(double *)data = p->cfg_fps;
|
|
|
|
return VO_TRUE;
|
|
|
|
}
|
2012-08-06 22:24:53 +00:00
|
|
|
return VO_NOTIMPL;
|
2002-01-26 16:01:26 +00:00
|
|
|
}
|
2012-08-06 22:24:53 +00:00
|
|
|
|
2015-05-24 13:48:48 +00:00
|
|
|
#define OPT_BASE_STRUCT struct priv
|
2012-08-06 22:24:53 +00:00
|
|
|
const struct vo_driver video_out_null = {
|
2013-10-23 17:06:14 +00:00
|
|
|
.description = "Null video output",
|
|
|
|
.name = "null",
|
2012-08-06 22:24:53 +00:00
|
|
|
.preinit = preinit,
|
2012-11-04 15:24:18 +00:00
|
|
|
.query_format = query_format,
|
2014-01-24 20:22:25 +00:00
|
|
|
.reconfig = reconfig,
|
2012-08-06 22:24:53 +00:00
|
|
|
.control = control,
|
2012-11-04 14:56:04 +00:00
|
|
|
.draw_image = draw_image,
|
2012-08-06 22:24:53 +00:00
|
|
|
.flip_page = flip_page,
|
|
|
|
.uninit = uninit,
|
2015-05-24 13:48:48 +00:00
|
|
|
.priv_size = sizeof(struct priv),
|
|
|
|
.options = (const struct m_option[]) {
|
options: change option macros and all option declarations
Change all OPT_* macros such that they don't define the entire m_option
initializer, and instead expand only to a part of it, which sets certain
fields. This requires changing almost every option declaration, because
they all use these macros. A declaration now always starts with
{"name", ...
followed by designated initializers only (possibly wrapped in macros).
The OPT_* macros now initialize the .offset and .type fields only,
sometimes also .priv and others.
I think this change makes the option macros less tricky. The old code
had to stuff everything into macro arguments (and attempted to allow
setting arbitrary fields by letting the user pass designated
initializers in the vararg parts). Some of this was made messy due to
C99 and C11 not allowing 0-sized varargs with ',' removal. It's also
possible that this change is pointless, other than cosmetic preferences.
Not too happy about some things. For example, the OPT_CHOICE()
indentation I applied looks a bit ugly.
Much of this change was done with regex search&replace, but some places
required manual editing. In particular, code in "obscure" areas (which I
didn't include in compilation) might be broken now.
In wayland_common.c the author of some option declarations confused the
flags parameter with the default value (though the default value was
also properly set below). I fixed this with this change.
2020-03-14 20:28:01 +00:00
|
|
|
{"fps", OPT_DOUBLE(cfg_fps), M_RANGE(0, 10000)},
|
2015-05-24 13:48:48 +00:00
|
|
|
{0},
|
|
|
|
},
|
2016-11-25 20:00:39 +00:00
|
|
|
.options_prefix = "vo-null",
|
2012-08-06 22:24:53 +00:00
|
|
|
};
|