2009-02-08 03:27:30 +00:00
|
|
|
/*
|
|
|
|
* 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-03-27 00:32:24 +00:00
|
|
|
|
2007-07-02 22:34:45 +00:00
|
|
|
#ifndef MPLAYER_SUB_H
|
|
|
|
#define MPLAYER_SUB_H
|
2001-04-24 11:42:04 +00:00
|
|
|
|
2012-10-22 14:15:52 +00:00
|
|
|
#include <stddef.h>
|
2011-01-19 18:13:48 +00:00
|
|
|
#include <stdbool.h>
|
2012-10-04 15:16:40 +00:00
|
|
|
#include <stdint.h>
|
2011-01-19 18:13:48 +00:00
|
|
|
|
2013-08-06 20:41:30 +00:00
|
|
|
#include "mpvcore/m_option.h"
|
2012-11-17 19:56:45 +00:00
|
|
|
|
2013-08-12 00:40:20 +00:00
|
|
|
// NOTE: VOs must support at least SUBBITMAP_RGBA.
|
2012-10-04 15:16:40 +00:00
|
|
|
enum sub_bitmap_format {
|
|
|
|
SUBBITMAP_EMPTY = 0,// no bitmaps; always has num_parts==0
|
|
|
|
SUBBITMAP_LIBASS, // A8, with a per-surface blend color (libass.color)
|
2012-10-05 18:37:16 +00:00
|
|
|
SUBBITMAP_RGBA, // B8G8R8A8 (MSB=A, LSB=B), scaled, premultiplied alpha
|
2012-10-04 15:16:47 +00:00
|
|
|
SUBBITMAP_INDEXED, // scaled, bitmap points to osd_bmp_indexed
|
2012-10-04 15:16:40 +00:00
|
|
|
|
|
|
|
SUBBITMAP_COUNT
|
|
|
|
};
|
|
|
|
|
2012-10-04 15:16:47 +00:00
|
|
|
// For SUBBITMAP_INDEXED
|
|
|
|
struct osd_bmp_indexed {
|
|
|
|
uint8_t *bitmap;
|
2013-08-12 00:40:20 +00:00
|
|
|
// Each entry is like a pixel in SUBBITMAP_RGBA format, but using straight
|
|
|
|
// alpha.
|
2012-10-04 15:16:47 +00:00
|
|
|
uint32_t palette[256];
|
|
|
|
};
|
|
|
|
|
2012-10-04 15:16:40 +00:00
|
|
|
struct sub_bitmap {
|
|
|
|
void *bitmap;
|
|
|
|
int stride;
|
2012-10-04 15:16:47 +00:00
|
|
|
// Note: not clipped, going outside the screen area is allowed
|
|
|
|
// (except for SUBBITMAP_LIBASS, which is always clipped)
|
2012-10-04 15:16:40 +00:00
|
|
|
int w, h;
|
|
|
|
int x, y;
|
|
|
|
int dw, dh;
|
|
|
|
|
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
uint32_t color;
|
|
|
|
} libass;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
struct sub_bitmaps {
|
2012-10-04 15:16:47 +00:00
|
|
|
// For VO cache state (limited by MAX_OSD_PARTS)
|
|
|
|
int render_index;
|
2012-10-04 15:16:40 +00:00
|
|
|
|
|
|
|
enum sub_bitmap_format format;
|
2012-10-04 15:16:47 +00:00
|
|
|
|
|
|
|
// If false, dw==w && dh==h.
|
|
|
|
// SUBBITMAP_LIBASS is never scaled.
|
|
|
|
bool scaled;
|
2012-10-04 15:16:40 +00:00
|
|
|
|
|
|
|
struct sub_bitmap *parts;
|
|
|
|
int num_parts;
|
|
|
|
|
|
|
|
// Incremented on each change
|
|
|
|
int bitmap_id, bitmap_pos_id;
|
|
|
|
};
|
|
|
|
|
VO, sub: refactor
Remove VFCTRL_DRAW_OSD, VFCAP_EOSD_FILTER, VFCAP_EOSD_RGBA, VFCAP_EOSD,
VOCTRL_DRAW_EOSD, VOCTRL_GET_EOSD_RES, VOCTRL_QUERY_EOSD_FORMAT.
Remove draw_osd_with_eosd(), which rendered the OSD by calling
VOCTRL_DRAW_EOSD. Change VOs to call osd_draw() directly, which takes
a callback as argument. (This basically works like the old OSD API,
except multiple OSD bitmap formats are supported and caching is
possible.)
Remove all mentions of "eosd". It's simply "osd" now.
Make OSD size per-OSD-object, as they can be different when using
vf_sub. Include display_par/video_par in resolution change detection.
Fix the issue with margin borders in vo_corevideo.
2012-10-19 17:25:18 +00:00
|
|
|
struct mp_osd_res {
|
2012-10-04 15:16:40 +00:00
|
|
|
int w, h; // screen dimensions, including black borders
|
|
|
|
int mt, mb, ml, mr; // borders (top, bottom, left, right)
|
2012-10-18 15:31:00 +00:00
|
|
|
double display_par;
|
2012-10-04 15:16:40 +00:00
|
|
|
};
|
2012-09-28 19:33:26 +00:00
|
|
|
|
2012-09-29 07:53:28 +00:00
|
|
|
enum mp_osdtype {
|
2012-10-04 15:16:32 +00:00
|
|
|
OSDTYPE_SUB,
|
2013-04-28 19:12:11 +00:00
|
|
|
OSDTYPE_SUBTEXT,
|
2012-09-29 07:53:28 +00:00
|
|
|
|
2012-11-22 12:35:19 +00:00
|
|
|
OSDTYPE_PROGBAR,
|
|
|
|
OSDTYPE_OSD,
|
|
|
|
|
Add initial Lua scripting support
This is preliminary. There are still tons of issues, and any aspect
of scripting may change in the future. I decided to merge this
(preliminary) work now because it makes it easier to develop it, not
because it's done. lua.rst is clear enough about it (plus some
sarcasm).
This requires linking to Lua. Lua has no official pkg-config file, but
there are distribution specific .pc files, all with different names.
Adding a non-pkg-config based configure test was considered, but we'd
rather not.
One major complication is that libquvi links against Lua too, and if
the Lua version is different from mpv's, you will get a crash as soon
as libquvi uses Lua. (libquvi by design always runs when a file is
opened.) I would consider this the problem of distros and whoever
builds mpv, but to make things easier for users, we add a terrible
runtime test to the configure script, which probes whether libquvi
will crash. This is disabled when cross-compiling, but in that case
we hope the user knows what he is doing.
2013-09-25 22:41:14 +00:00
|
|
|
OSDTYPE_EXTERNAL,
|
2013-09-30 20:27:37 +00:00
|
|
|
OSDTYPE_EXTERNAL2,
|
Add initial Lua scripting support
This is preliminary. There are still tons of issues, and any aspect
of scripting may change in the future. I decided to merge this
(preliminary) work now because it makes it easier to develop it, not
because it's done. lua.rst is clear enough about it (plus some
sarcasm).
This requires linking to Lua. Lua has no official pkg-config file, but
there are distribution specific .pc files, all with different names.
Adding a non-pkg-config based configure test was considered, but we'd
rather not.
One major complication is that libquvi links against Lua too, and if
the Lua version is different from mpv's, you will get a crash as soon
as libquvi uses Lua. (libquvi by design always runs when a file is
opened.) I would consider this the problem of distros and whoever
builds mpv, but to make things easier for users, we add a terrible
runtime test to the configure script, which probes whether libquvi
will crash. This is disabled when cross-compiling, but in that case
we hope the user knows what he is doing.
2013-09-25 22:41:14 +00:00
|
|
|
|
2012-09-29 07:53:28 +00:00
|
|
|
MAX_OSD_PARTS
|
|
|
|
};
|
2012-09-28 19:38:52 +00:00
|
|
|
|
2012-12-11 15:24:24 +00:00
|
|
|
#define OSD_CONV_CACHE_MAX 4
|
2012-09-28 19:38:52 +00:00
|
|
|
|
|
|
|
struct osd_object {
|
|
|
|
int type; // OSDTYPE_*
|
2012-10-04 15:16:32 +00:00
|
|
|
bool is_sub;
|
|
|
|
|
2012-09-28 19:38:52 +00:00
|
|
|
bool force_redraw;
|
|
|
|
|
|
|
|
// caches for OSD conversion (internal to render_object())
|
|
|
|
struct osd_conv_cache *cache[OSD_CONV_CACHE_MAX];
|
|
|
|
struct sub_bitmaps cached;
|
osd: use libass for OSD rendering
The OSD will now be rendered with libass. The old rendering code, which
used freetype/fontconfig and did text layout manually, is disabled. To
re-enable the old code, use the --disable-libass-osd configure switch.
Some switches do nothing with the new code enabled, such as -subalign,
-sub-bg-alpha, -sub-bg-color, and many more. (The reason is mostly that
the code for rendering unstyled subtitles with libass doesn't make any
attempts to support them. Some of them could be supported in theory.)
Teletext rendering is not implemented in the new OSD rendering code. I
don't have any teletext sources for testing, and since teletext is
being phased out world-wide, the need for this is questionable.
Note that rendering is extremely inefficient, mostly because the libass
output is blended with the extremely strange mplayer OSD format. This
could be improved at a later point.
Remove most OSD rendering from vo_aa.c, because that was extremely
hacky, can't be made work with osd_libass, and didn't work anyway in
my tests.
Internally, some cleanup is done. Subtitle and OSD related variable
declarations were literally all over the place. Move them to sub.h and
sub.c, which were hoarding most of these declarations already. Make the
player core in mplayer.c free of concerns like bitmap font loading.
The old OSD rendering code has been moved to osd_ft.c. The font_load.c
and font_load_ft.c are only needed and compiled if the old OSD
rendering code is configured.
2012-03-22 05:26:37 +00:00
|
|
|
|
2012-09-28 19:38:52 +00:00
|
|
|
// VO cache state
|
|
|
|
int vo_bitmap_id;
|
|
|
|
int vo_bitmap_pos_id;
|
VO, sub: refactor
Remove VFCTRL_DRAW_OSD, VFCAP_EOSD_FILTER, VFCAP_EOSD_RGBA, VFCAP_EOSD,
VOCTRL_DRAW_EOSD, VOCTRL_GET_EOSD_RES, VOCTRL_QUERY_EOSD_FORMAT.
Remove draw_osd_with_eosd(), which rendered the OSD by calling
VOCTRL_DRAW_EOSD. Change VOs to call osd_draw() directly, which takes
a callback as argument. (This basically works like the old OSD API,
except multiple OSD bitmap formats are supported and caching is
possible.)
Remove all mentions of "eosd". It's simply "osd" now.
Make OSD size per-OSD-object, as they can be different when using
vf_sub. Include display_par/video_par in resolution change detection.
Fix the issue with margin borders in vo_corevideo.
2012-10-19 17:25:18 +00:00
|
|
|
struct mp_osd_res vo_res;
|
2012-09-28 19:38:52 +00:00
|
|
|
|
|
|
|
// Internally used by osd_libass.c
|
osd: use libass for OSD rendering
The OSD will now be rendered with libass. The old rendering code, which
used freetype/fontconfig and did text layout manually, is disabled. To
re-enable the old code, use the --disable-libass-osd configure switch.
Some switches do nothing with the new code enabled, such as -subalign,
-sub-bg-alpha, -sub-bg-color, and many more. (The reason is mostly that
the code for rendering unstyled subtitles with libass doesn't make any
attempts to support them. Some of them could be supported in theory.)
Teletext rendering is not implemented in the new OSD rendering code. I
don't have any teletext sources for testing, and since teletext is
being phased out world-wide, the need for this is questionable.
Note that rendering is extremely inefficient, mostly because the libass
output is blended with the extremely strange mplayer OSD format. This
could be improved at a later point.
Remove most OSD rendering from vo_aa.c, because that was extremely
hacky, can't be made work with osd_libass, and didn't work anyway in
my tests.
Internally, some cleanup is done. Subtitle and OSD related variable
declarations were literally all over the place. Move them to sub.h and
sub.c, which were hoarding most of these declarations already. Make the
player core in mplayer.c free of concerns like bitmap font loading.
The old OSD rendering code has been moved to osd_ft.c. The font_load.c
and font_load_ft.c are only needed and compiled if the old OSD
rendering code is configured.
2012-03-22 05:26:37 +00:00
|
|
|
struct ass_track *osd_track;
|
2012-09-28 19:38:52 +00:00
|
|
|
struct sub_bitmap *parts_cache;
|
|
|
|
};
|
2002-04-15 19:17:12 +00:00
|
|
|
|
2008-06-23 22:53:58 +00:00
|
|
|
struct osd_state {
|
2012-09-28 19:38:52 +00:00
|
|
|
struct osd_object *objs[MAX_OSD_PARTS];
|
|
|
|
|
2011-07-22 22:55:13 +00:00
|
|
|
struct ass_library *ass_library;
|
2012-08-25 14:47:50 +00:00
|
|
|
struct ass_renderer *ass_renderer;
|
2013-06-28 23:31:19 +00:00
|
|
|
double video_offset;
|
VO, sub: refactor
Remove VFCTRL_DRAW_OSD, VFCAP_EOSD_FILTER, VFCAP_EOSD_RGBA, VFCAP_EOSD,
VOCTRL_DRAW_EOSD, VOCTRL_GET_EOSD_RES, VOCTRL_QUERY_EOSD_FORMAT.
Remove draw_osd_with_eosd(), which rendered the OSD by calling
VOCTRL_DRAW_EOSD. Change VOs to call osd_draw() directly, which takes
a callback as argument. (This basically works like the old OSD API,
except multiple OSD bitmap formats are supported and caching is
possible.)
Remove all mentions of "eosd". It's simply "osd" now.
Make OSD size per-OSD-object, as they can be different when using
vf_sub. Include display_par/video_par in resolution change detection.
Fix the issue with margin borders in vo_corevideo.
2012-10-19 17:25:18 +00:00
|
|
|
double vo_pts;
|
2012-10-04 15:16:32 +00:00
|
|
|
|
|
|
|
bool render_subs_in_filter;
|
2013-04-28 19:12:11 +00:00
|
|
|
bool render_bitmap_subs;
|
2012-10-04 15:16:32 +00:00
|
|
|
|
2013-09-30 20:25:34 +00:00
|
|
|
struct mp_osd_res last_vo_res;
|
|
|
|
|
2012-10-21 12:58:46 +00:00
|
|
|
bool want_redraw;
|
|
|
|
|
2013-03-30 19:08:56 +00:00
|
|
|
// OSDTYPE_OSD
|
|
|
|
char *osd_text;
|
2013-04-28 19:12:11 +00:00
|
|
|
// OSDTYPE_SUBTEXT
|
|
|
|
char *sub_text;
|
2013-03-30 19:08:56 +00:00
|
|
|
// OSDTYPE_PROGBAR
|
|
|
|
int progbar_type; // <0: disabled, 1-255: symbol, else: no symbol
|
|
|
|
float progbar_value; // range 0.0-1.0
|
|
|
|
float *progbar_stops; // used for chapter indicators (0.0-1.0 each)
|
|
|
|
int progbar_num_stops;
|
Add initial Lua scripting support
This is preliminary. There are still tons of issues, and any aspect
of scripting may change in the future. I decided to merge this
(preliminary) work now because it makes it easier to develop it, not
because it's done. lua.rst is clear enough about it (plus some
sarcasm).
This requires linking to Lua. Lua has no official pkg-config file, but
there are distribution specific .pc files, all with different names.
Adding a non-pkg-config based configure test was considered, but we'd
rather not.
One major complication is that libquvi links against Lua too, and if
the Lua version is different from mpv's, you will get a crash as soon
as libquvi uses Lua. (libquvi by design always runs when a file is
opened.) I would consider this the problem of distros and whoever
builds mpv, but to make things easier for users, we add a terrible
runtime test to the configure script, which probes whether libquvi
will crash. This is disabled when cross-compiling, but in that case
we hope the user knows what he is doing.
2013-09-25 22:41:14 +00:00
|
|
|
// OSDTYPE_EXTERNAL
|
|
|
|
char *external;
|
|
|
|
int external_res_x, external_res_y;
|
2013-09-30 20:27:37 +00:00
|
|
|
// OSDTYPE_EXTERNAL2
|
|
|
|
struct sub_bitmaps external2;
|
2013-06-01 17:44:12 +00:00
|
|
|
// OSDTYPE_SUB
|
|
|
|
struct dec_sub *dec_sub;
|
2012-09-28 19:33:26 +00:00
|
|
|
|
osd: use libass for OSD rendering
The OSD will now be rendered with libass. The old rendering code, which
used freetype/fontconfig and did text layout manually, is disabled. To
re-enable the old code, use the --disable-libass-osd configure switch.
Some switches do nothing with the new code enabled, such as -subalign,
-sub-bg-alpha, -sub-bg-color, and many more. (The reason is mostly that
the code for rendering unstyled subtitles with libass doesn't make any
attempts to support them. Some of them could be supported in theory.)
Teletext rendering is not implemented in the new OSD rendering code. I
don't have any teletext sources for testing, and since teletext is
being phased out world-wide, the need for this is questionable.
Note that rendering is extremely inefficient, mostly because the libass
output is blended with the extremely strange mplayer OSD format. This
could be improved at a later point.
Remove most OSD rendering from vo_aa.c, because that was extremely
hacky, can't be made work with osd_libass, and didn't work anyway in
my tests.
Internally, some cleanup is done. Subtitle and OSD related variable
declarations were literally all over the place. Move them to sub.h and
sub.c, which were hoarding most of these declarations already. Make the
player core in mplayer.c free of concerns like bitmap font loading.
The old OSD rendering code has been moved to osd_ft.c. The font_load.c
and font_load_ft.c are only needed and compiled if the old OSD
rendering code is configured.
2012-03-22 05:26:37 +00:00
|
|
|
struct MPOpts *opts;
|
2012-09-28 19:38:52 +00:00
|
|
|
|
2012-10-19 15:49:49 +00:00
|
|
|
// Internal to sub.c
|
|
|
|
struct mp_draw_sub_cache *draw_cache;
|
|
|
|
|
2012-09-28 19:38:52 +00:00
|
|
|
// Internally used by osd_libass.c
|
|
|
|
struct ass_renderer *osd_render;
|
|
|
|
struct ass_library *osd_ass_library;
|
2008-06-23 22:53:58 +00:00
|
|
|
};
|
2002-04-15 19:17:12 +00:00
|
|
|
|
2012-09-29 07:53:28 +00:00
|
|
|
// Start of OSD symbols in osd_font.pfb
|
|
|
|
#define OSD_CODEPOINTS 0xE000
|
|
|
|
|
|
|
|
// OSD symbols. osd_font.pfb has them starting from codepoint OSD_CODEPOINTS.
|
|
|
|
// Symbols with a value >= 32 are normal unicode codepoints.
|
|
|
|
enum mp_osd_font_codepoints {
|
|
|
|
OSD_PLAY = 0x01,
|
|
|
|
OSD_PAUSE = 0x02,
|
|
|
|
OSD_STOP = 0x03,
|
|
|
|
OSD_REW = 0x04,
|
|
|
|
OSD_FFW = 0x05,
|
|
|
|
OSD_CLOCK = 0x06,
|
|
|
|
OSD_CONTRAST = 0x07,
|
|
|
|
OSD_SATURATION = 0x08,
|
|
|
|
OSD_VOLUME = 0x09,
|
|
|
|
OSD_BRIGHTNESS = 0x0A,
|
|
|
|
OSD_HUE = 0x0B,
|
|
|
|
OSD_BALANCE = 0x0C,
|
|
|
|
OSD_PANSCAN = 0x50,
|
|
|
|
|
|
|
|
OSD_PB_START = 0x10,
|
|
|
|
OSD_PB_0 = 0x11,
|
|
|
|
OSD_PB_END = 0x12,
|
|
|
|
OSD_PB_1 = 0x13,
|
|
|
|
};
|
2001-03-27 00:32:24 +00:00
|
|
|
|
2012-11-17 19:56:45 +00:00
|
|
|
struct osd_style_opts {
|
|
|
|
char *font;
|
|
|
|
float font_size;
|
|
|
|
struct m_color color;
|
|
|
|
struct m_color border_color;
|
|
|
|
struct m_color shadow_color;
|
|
|
|
struct m_color back_color;
|
|
|
|
float border_size;
|
|
|
|
float shadow_offset;
|
|
|
|
float spacing;
|
|
|
|
int margin_x;
|
|
|
|
int margin_y;
|
2013-04-13 16:53:03 +00:00
|
|
|
float blur;
|
2012-11-17 19:56:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern const struct m_sub_options osd_style_conf;
|
|
|
|
|
2012-08-07 17:21:46 +00:00
|
|
|
struct osd_state *osd_create(struct MPOpts *opts, struct ass_library *asslib);
|
2011-08-08 08:07:17 +00:00
|
|
|
void osd_set_text(struct osd_state *osd, const char *text);
|
2013-04-28 19:12:11 +00:00
|
|
|
void osd_set_sub(struct osd_state *osd, const char *text);
|
2013-04-28 23:49:20 +00:00
|
|
|
void osd_changed(struct osd_state *osd, int new_value);
|
2013-05-14 21:14:23 +00:00
|
|
|
void osd_changed_all(struct osd_state *osd);
|
2008-06-23 22:53:58 +00:00
|
|
|
void osd_free(struct osd_state *osd);
|
2002-02-22 15:25:11 +00:00
|
|
|
|
2012-10-19 17:11:08 +00:00
|
|
|
enum mp_osd_draw_flags {
|
|
|
|
OSD_DRAW_SUB_FILTER = (1 << 0),
|
|
|
|
OSD_DRAW_SUB_ONLY = (1 << 1),
|
|
|
|
};
|
|
|
|
|
VO, sub: refactor
Remove VFCTRL_DRAW_OSD, VFCAP_EOSD_FILTER, VFCAP_EOSD_RGBA, VFCAP_EOSD,
VOCTRL_DRAW_EOSD, VOCTRL_GET_EOSD_RES, VOCTRL_QUERY_EOSD_FORMAT.
Remove draw_osd_with_eosd(), which rendered the OSD by calling
VOCTRL_DRAW_EOSD. Change VOs to call osd_draw() directly, which takes
a callback as argument. (This basically works like the old OSD API,
except multiple OSD bitmap formats are supported and caching is
possible.)
Remove all mentions of "eosd". It's simply "osd" now.
Make OSD size per-OSD-object, as they can be different when using
vf_sub. Include display_par/video_par in resolution change detection.
Fix the issue with margin borders in vo_corevideo.
2012-10-19 17:25:18 +00:00
|
|
|
void osd_draw(struct osd_state *osd, struct mp_osd_res res,
|
|
|
|
double video_pts, int draw_flags,
|
|
|
|
const bool formats[SUBBITMAP_COUNT],
|
2012-10-19 17:11:08 +00:00
|
|
|
void (*cb)(void *ctx, struct sub_bitmaps *imgs), void *cb_ctx);
|
2012-10-04 15:16:32 +00:00
|
|
|
|
2012-10-07 01:26:46 +00:00
|
|
|
struct mp_image;
|
VO, sub: refactor
Remove VFCTRL_DRAW_OSD, VFCAP_EOSD_FILTER, VFCAP_EOSD_RGBA, VFCAP_EOSD,
VOCTRL_DRAW_EOSD, VOCTRL_GET_EOSD_RES, VOCTRL_QUERY_EOSD_FORMAT.
Remove draw_osd_with_eosd(), which rendered the OSD by calling
VOCTRL_DRAW_EOSD. Change VOs to call osd_draw() directly, which takes
a callback as argument. (This basically works like the old OSD API,
except multiple OSD bitmap formats are supported and caching is
possible.)
Remove all mentions of "eosd". It's simply "osd" now.
Make OSD size per-OSD-object, as they can be different when using
vf_sub. Include display_par/video_par in resolution change detection.
Fix the issue with margin borders in vo_corevideo.
2012-10-19 17:25:18 +00:00
|
|
|
bool osd_draw_on_image(struct osd_state *osd, struct mp_osd_res res,
|
2012-10-27 16:06:09 +00:00
|
|
|
double video_pts, int draw_flags, struct mp_image *dest);
|
2012-10-07 01:26:46 +00:00
|
|
|
|
sub: do not copy the target image if there is no OSD/subs
It's not easy to tell whether the OSD/subs are empty, or if something is
drawn. In general you have to use osd_draw() with a custom callback. If
nothing is visible, the callback is never invoked. (The actual reason
why this is so "hard" is the implementation of osd_libass.c, which
doesn't allow separating rendering and drawing of OSD elements, because
all OSD elements share the same ASS_Renderer.)
To simplify avoiding copies, make osd_draw_on_image() instead of the
caller use mp_image_make_writeable(). Introduce osd_draw_on_image_p(),
which works like osd_draw_on_image(), but gets the new image allocation
from an image pool. This is supposed to be an optimization, because it
reduces the frequency of large allocations/deallocations for image data.
The result of this is that the frequency of copies needed in conjunction
with vf_sub, screenshots, and vo_lavc (encoding) should be reduced.
vf_sub now always does true pass-through if no subs are shown.
Drop the pts check from vf_sub. This didn't make much sense.
2012-12-22 16:17:43 +00:00
|
|
|
struct mp_image_pool;
|
|
|
|
void osd_draw_on_image_p(struct osd_state *osd, struct mp_osd_res res,
|
|
|
|
double video_pts, int draw_flags,
|
|
|
|
struct mp_image_pool *pool, struct mp_image *dest);
|
|
|
|
|
Add initial Lua scripting support
This is preliminary. There are still tons of issues, and any aspect
of scripting may change in the future. I decided to merge this
(preliminary) work now because it makes it easier to develop it, not
because it's done. lua.rst is clear enough about it (plus some
sarcasm).
This requires linking to Lua. Lua has no official pkg-config file, but
there are distribution specific .pc files, all with different names.
Adding a non-pkg-config based configure test was considered, but we'd
rather not.
One major complication is that libquvi links against Lua too, and if
the Lua version is different from mpv's, you will get a crash as soon
as libquvi uses Lua. (libquvi by design always runs when a file is
opened.) I would consider this the problem of distros and whoever
builds mpv, but to make things easier for users, we add a terrible
runtime test to the configure script, which probes whether libquvi
will crash. This is disabled when cross-compiling, but in that case
we hope the user knows what he is doing.
2013-09-25 22:41:14 +00:00
|
|
|
void osd_object_get_scale_factor(struct osd_state *osd, struct osd_object *obj,
|
|
|
|
double *sw, double *sh);
|
|
|
|
|
2012-09-28 19:38:52 +00:00
|
|
|
// defined in osd_libass.c and osd_dummy.c
|
osd: use libass for OSD rendering
The OSD will now be rendered with libass. The old rendering code, which
used freetype/fontconfig and did text layout manually, is disabled. To
re-enable the old code, use the --disable-libass-osd configure switch.
Some switches do nothing with the new code enabled, such as -subalign,
-sub-bg-alpha, -sub-bg-color, and many more. (The reason is mostly that
the code for rendering unstyled subtitles with libass doesn't make any
attempts to support them. Some of them could be supported in theory.)
Teletext rendering is not implemented in the new OSD rendering code. I
don't have any teletext sources for testing, and since teletext is
being phased out world-wide, the need for this is questionable.
Note that rendering is extremely inefficient, mostly because the libass
output is blended with the extremely strange mplayer OSD format. This
could be improved at a later point.
Remove most OSD rendering from vo_aa.c, because that was extremely
hacky, can't be made work with osd_libass, and didn't work anyway in
my tests.
Internally, some cleanup is done. Subtitle and OSD related variable
declarations were literally all over the place. Move them to sub.h and
sub.c, which were hoarding most of these declarations already. Make the
player core in mplayer.c free of concerns like bitmap font loading.
The old OSD rendering code has been moved to osd_ft.c. The font_load.c
and font_load_ft.c are only needed and compiled if the old OSD
rendering code is configured.
2012-03-22 05:26:37 +00:00
|
|
|
|
2012-09-28 19:38:52 +00:00
|
|
|
void osd_object_get_bitmaps(struct osd_state *osd, struct osd_object *obj,
|
|
|
|
struct sub_bitmaps *out_imgs);
|
Add initial Lua scripting support
This is preliminary. There are still tons of issues, and any aspect
of scripting may change in the future. I decided to merge this
(preliminary) work now because it makes it easier to develop it, not
because it's done. lua.rst is clear enough about it (plus some
sarcasm).
This requires linking to Lua. Lua has no official pkg-config file, but
there are distribution specific .pc files, all with different names.
Adding a non-pkg-config based configure test was considered, but we'd
rather not.
One major complication is that libquvi links against Lua too, and if
the Lua version is different from mpv's, you will get a crash as soon
as libquvi uses Lua. (libquvi by design always runs when a file is
opened.) I would consider this the problem of distros and whoever
builds mpv, but to make things easier for users, we add a terrible
runtime test to the configure script, which probes whether libquvi
will crash. This is disabled when cross-compiling, but in that case
we hope the user knows what he is doing.
2013-09-25 22:41:14 +00:00
|
|
|
void osd_object_get_resolution(struct osd_state *osd, struct osd_object *obj,
|
|
|
|
int *out_w, int *out_h);
|
osd: use libass for OSD rendering
The OSD will now be rendered with libass. The old rendering code, which
used freetype/fontconfig and did text layout manually, is disabled. To
re-enable the old code, use the --disable-libass-osd configure switch.
Some switches do nothing with the new code enabled, such as -subalign,
-sub-bg-alpha, -sub-bg-color, and many more. (The reason is mostly that
the code for rendering unstyled subtitles with libass doesn't make any
attempts to support them. Some of them could be supported in theory.)
Teletext rendering is not implemented in the new OSD rendering code. I
don't have any teletext sources for testing, and since teletext is
being phased out world-wide, the need for this is questionable.
Note that rendering is extremely inefficient, mostly because the libass
output is blended with the extremely strange mplayer OSD format. This
could be improved at a later point.
Remove most OSD rendering from vo_aa.c, because that was extremely
hacky, can't be made work with osd_libass, and didn't work anyway in
my tests.
Internally, some cleanup is done. Subtitle and OSD related variable
declarations were literally all over the place. Move them to sub.h and
sub.c, which were hoarding most of these declarations already. Make the
player core in mplayer.c free of concerns like bitmap font loading.
The old OSD rendering code has been moved to osd_ft.c. The font_load.c
and font_load_ft.c are only needed and compiled if the old OSD
rendering code is configured.
2012-03-22 05:26:37 +00:00
|
|
|
void osd_get_function_sym(char *buffer, size_t buffer_size, int osd_function);
|
|
|
|
void osd_init_backend(struct osd_state *osd);
|
|
|
|
void osd_destroy_backend(struct osd_state *osd);
|
|
|
|
|
2007-12-31 16:15:50 +00:00
|
|
|
#endif /* MPLAYER_SUB_H */
|