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
|
|
|
/*
|
2015-04-13 07:36:54 +00:00
|
|
|
* This file is part of mpv.
|
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
|
|
|
*
|
2015-04-13 07:36:54 +00:00
|
|
|
* mpv is free software; you can redistribute it and/or modify
|
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
|
|
|
* 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.
|
|
|
|
*
|
2015-04-13 07:36:54 +00:00
|
|
|
* mpv is distributed in the hope that it will be useful,
|
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
|
|
|
* 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
|
2015-04-13 07:36:54 +00:00
|
|
|
* with mpv. If not, see <http://www.gnu.org/licenses/>.
|
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
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <assert.h>
|
|
|
|
|
2013-02-16 21:51:10 +00:00
|
|
|
#include <libavutil/common.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
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include "talloc.h"
|
2014-08-29 10:09:04 +00:00
|
|
|
#include "misc/bstr.h"
|
2013-12-17 01:39:45 +00:00
|
|
|
#include "common/common.h"
|
|
|
|
#include "common/msg.h"
|
2013-11-24 11:58:06 +00:00
|
|
|
#include "osd.h"
|
2014-01-18 00:19:20 +00:00
|
|
|
#include "osd_state.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
|
|
|
|
2012-07-28 21:03:19 +00:00
|
|
|
static const char osd_font_pfb[] =
|
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
|
|
|
#include "sub/osd_font.h"
|
2012-07-28 21:03:19 +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
|
|
|
|
|
|
|
#include "sub/ass_mp.h"
|
2013-12-17 01:02:25 +00:00
|
|
|
#include "options/options.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
|
|
|
|
|
|
|
|
2013-05-14 17:14:09 +00:00
|
|
|
#define ASS_USE_OSD_FONT "{\\fnmpv-osd-symbols}"
|
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_init_backend(struct osd_state *osd)
|
|
|
|
{
|
2013-12-15 14:04:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void create_ass_renderer(struct osd_state *osd, struct osd_object *obj)
|
|
|
|
{
|
|
|
|
if (obj->osd_render)
|
|
|
|
return;
|
|
|
|
|
2013-12-21 18:06:37 +00:00
|
|
|
struct mp_log *ass_log = mp_log_new(obj, osd->log, "libass");
|
|
|
|
obj->osd_ass_library = mp_ass_init(osd->global, ass_log);
|
2013-12-15 14:04:49 +00:00
|
|
|
ass_add_font(obj->osd_ass_library, "mpv-osd-symbols", (void *)osd_font_pfb,
|
2012-07-28 21:03:19 +00:00
|
|
|
sizeof(osd_font_pfb) - 1);
|
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
|
|
|
|
2013-12-15 14:04:49 +00:00
|
|
|
obj->osd_render = ass_renderer_init(obj->osd_ass_library);
|
|
|
|
if (!obj->osd_render)
|
|
|
|
abort();
|
|
|
|
|
2013-12-21 18:06:37 +00:00
|
|
|
mp_ass_configure_fonts(obj->osd_render, osd->opts->osd_style,
|
|
|
|
osd->global, ass_log);
|
2013-12-15 14:04:49 +00:00
|
|
|
ass_set_aspect_ratio(obj->osd_render, 1.0, 1.0);
|
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_destroy_backend(struct osd_state *osd)
|
|
|
|
{
|
2013-04-12 17:02:58 +00:00
|
|
|
for (int n = 0; n < MAX_OSD_PARTS; n++) {
|
|
|
|
struct osd_object *obj = osd->objs[n];
|
|
|
|
if (obj->osd_track)
|
|
|
|
ass_free_track(obj->osd_track);
|
|
|
|
obj->osd_track = NULL;
|
2013-12-15 14:04:49 +00:00
|
|
|
if (obj->osd_render)
|
|
|
|
ass_renderer_done(obj->osd_render);
|
|
|
|
obj->osd_render = NULL;
|
|
|
|
if (obj->osd_ass_library)
|
|
|
|
ass_library_done(obj->osd_ass_library);
|
|
|
|
obj->osd_ass_library = NULL;
|
2013-04-12 17:02:58 +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
|
|
|
}
|
|
|
|
|
2013-12-15 14:04:49 +00:00
|
|
|
static void create_ass_track(struct osd_state *osd, struct osd_object *obj,
|
|
|
|
int res_x, int res_y)
|
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
|
|
|
{
|
2013-12-15 14:04:49 +00:00
|
|
|
create_ass_renderer(osd, obj);
|
|
|
|
|
2013-03-30 19:08:56 +00:00
|
|
|
ASS_Track *track = obj->osd_track;
|
|
|
|
if (!track)
|
2013-12-15 14:04:49 +00:00
|
|
|
track = ass_new_track(obj->osd_ass_library);
|
|
|
|
|
|
|
|
int old_res_x = track->PlayResX;
|
|
|
|
int old_res_y = track->PlayResY;
|
2013-03-30 19:08:56 +00:00
|
|
|
|
|
|
|
double aspect = 1.0 * obj->vo_res.w / FFMAX(obj->vo_res.h, 1) /
|
|
|
|
obj->vo_res.display_par;
|
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-11-17 19:56:45 +00:00
|
|
|
track->track_type = TRACK_TYPE_ASS;
|
|
|
|
track->Timer = 100.;
|
2013-12-15 14:04:49 +00:00
|
|
|
track->PlayResY = res_y ? res_y : MP_ASS_FONT_PLAYRESY;
|
|
|
|
track->PlayResX = res_x ? res_x : track->PlayResY * aspect;
|
2012-11-17 19:56:45 +00:00
|
|
|
track->WrapStyle = 1; // end-of-line wrapping instead of smart wrapping
|
2013-12-15 16:38:48 +00:00
|
|
|
track->Kerning = true;
|
2012-11-17 19:56:45 +00:00
|
|
|
|
2013-12-15 14:04:49 +00:00
|
|
|
// Force libass to clear its internal cache - it doesn't check for
|
|
|
|
// PlayRes changes itself.
|
|
|
|
if (old_res_x != track->PlayResX || old_res_y != track->PlayResY)
|
|
|
|
ass_set_frame_size(obj->osd_render, 1, 1);
|
|
|
|
|
2013-12-15 16:38:48 +00:00
|
|
|
if (track->n_styles < 2) {
|
2012-11-17 19:56:45 +00:00
|
|
|
int sid = ass_alloc_style(track);
|
|
|
|
track->default_style = sid;
|
|
|
|
ASS_Style *style = track->styles + sid;
|
|
|
|
style->Name = strdup("OSD");
|
|
|
|
// Set to neutral base direction, as opposed to VSFilter LTR default
|
|
|
|
style->Encoding = -1;
|
2013-09-26 15:49:54 +00:00
|
|
|
|
|
|
|
sid = ass_alloc_style(track);
|
2013-12-15 16:38:48 +00:00
|
|
|
assert(sid == track->default_style + 1);
|
2013-09-26 15:49:54 +00:00
|
|
|
style = track->styles + sid;
|
|
|
|
style->Name = strdup("Default");
|
|
|
|
style->Encoding = -1;
|
2012-11-17 19:56:45 +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
|
|
|
|
2013-12-15 16:38:48 +00:00
|
|
|
ASS_Style *s_osd = track->styles + track->default_style;
|
|
|
|
mp_ass_set_style(s_osd, track->PlayResY, osd->opts->osd_style);
|
|
|
|
|
|
|
|
ASS_Style *s_def = track->styles + track->default_style + 1;
|
|
|
|
const struct osd_style_opts *def = osd_style_conf.defaults;
|
|
|
|
mp_ass_set_style(s_def, track->PlayResY, def);
|
|
|
|
|
2013-03-30 19:08:56 +00:00
|
|
|
obj->osd_track = track;
|
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
|
|
|
}
|
|
|
|
|
2013-03-30 19:08:56 +00:00
|
|
|
static ASS_Event *add_osd_ass_event(ASS_Track *track, const char *text)
|
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
|
|
|
{
|
2013-03-30 19:08:56 +00:00
|
|
|
int n = ass_alloc_event(track);
|
|
|
|
ASS_Event *event = track->events + n;
|
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
|
|
|
event->Start = 0;
|
|
|
|
event->Duration = 100;
|
|
|
|
event->Style = track->default_style;
|
2013-05-10 17:45:38 +00:00
|
|
|
event->ReadOrder = n;
|
2012-09-28 19:38:52 +00:00
|
|
|
assert(event->Text == NULL);
|
2013-03-30 19:08:56 +00:00
|
|
|
if (text)
|
|
|
|
event->Text = strdup(text);
|
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
|
|
|
return event;
|
|
|
|
}
|
|
|
|
|
2012-09-28 19:38:52 +00:00
|
|
|
static void clear_obj(struct osd_object *obj)
|
|
|
|
{
|
|
|
|
if (obj->osd_track)
|
|
|
|
ass_flush_events(obj->osd_track);
|
|
|
|
}
|
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
// 0xFF is never valid UTF-8, so we can use it to escape OSD symbols.
|
|
|
|
snprintf(buffer, buffer_size, "\xFF%c", osd_function);
|
|
|
|
}
|
|
|
|
|
2014-09-17 22:49:55 +00:00
|
|
|
// Same trick as above: never valid UTF-8, so we expect it's free for use.
|
2014-10-10 11:44:08 +00:00
|
|
|
const char *const osd_ass_0 = "\xFD";
|
|
|
|
const char *const osd_ass_1 = "\xFE";
|
2014-09-17 22:49:55 +00:00
|
|
|
|
2013-12-30 21:44:25 +00:00
|
|
|
static void mangle_ass(bstr *dst, const char *in)
|
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
|
|
|
{
|
2014-09-17 22:49:55 +00:00
|
|
|
bool escape_ass = true;
|
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
|
|
|
while (*in) {
|
|
|
|
// As used by osd_get_function_sym().
|
2012-10-20 18:58:46 +00:00
|
|
|
if (in[0] == '\xFF' && in[1]) {
|
2013-12-30 21:44:25 +00:00
|
|
|
bstr_xappend(NULL, dst, bstr0(ASS_USE_OSD_FONT));
|
|
|
|
mp_append_utf8_bstr(NULL, dst, OSD_CODEPOINTS + in[1]);
|
|
|
|
bstr_xappend(NULL, dst, bstr0("{\\r}"));
|
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
|
|
|
in += 2;
|
|
|
|
continue;
|
|
|
|
}
|
2014-09-17 22:49:55 +00:00
|
|
|
if (*in == '\xFD' || *in == '\xFE') {
|
|
|
|
escape_ass = *in == '\xFE';
|
|
|
|
in += 1;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (escape_ass && *in == '{')
|
2013-12-30 21:44:25 +00:00
|
|
|
bstr_xappend(NULL, dst, bstr0("\\"));
|
|
|
|
bstr_xappend(NULL, dst, (bstr){(char *)in, 1});
|
2012-10-13 19:09:34 +00:00
|
|
|
// Break ASS escapes with U+2060 WORD JOINER
|
2014-09-17 22:49:55 +00:00
|
|
|
if (escape_ass && *in == '\\')
|
2013-12-30 21:44:25 +00:00
|
|
|
mp_append_utf8_bstr(NULL, dst, 0x2060);
|
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
|
|
|
in++;
|
|
|
|
}
|
2013-12-30 21:44:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void add_osd_ass_event_escaped(ASS_Track *track, const char *text)
|
|
|
|
{
|
|
|
|
bstr buf = {0};
|
|
|
|
mangle_ass(&buf, text);
|
|
|
|
add_osd_ass_event(track, buf.start);
|
|
|
|
talloc_free(buf.start);
|
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
|
|
|
static void update_osd(struct osd_state *osd, struct osd_object *obj)
|
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
|
|
|
{
|
2013-05-14 12:10:27 +00:00
|
|
|
struct MPOpts *opts = osd->opts;
|
|
|
|
|
2013-03-30 19:08:56 +00:00
|
|
|
clear_obj(obj);
|
2014-01-18 00:19:20 +00:00
|
|
|
if (!obj->text[0])
|
2012-09-28 19:38:52 +00:00
|
|
|
return;
|
|
|
|
|
2015-09-07 12:26:01 +00:00
|
|
|
create_ass_track(osd, obj, 0, 0);
|
|
|
|
|
2013-05-14 12:10:27 +00:00
|
|
|
struct osd_style_opts font = *opts->osd_style;
|
|
|
|
font.font_size *= opts->osd_scale;
|
|
|
|
|
2013-12-10 18:58:57 +00:00
|
|
|
double playresy = obj->osd_track->PlayResY;
|
|
|
|
// Compensate for libass and mp_ass_set_style scaling the font etc.
|
|
|
|
if (!opts->osd_scale_by_window)
|
|
|
|
playresy *= 720.0 / obj->vo_res.h;
|
|
|
|
|
2013-05-14 12:10:27 +00:00
|
|
|
ASS_Style *style = obj->osd_track->styles + obj->osd_track->default_style;
|
2013-12-10 18:58:57 +00:00
|
|
|
mp_ass_set_style(style, playresy, &font);
|
2013-05-14 12:10:27 +00:00
|
|
|
|
2014-01-18 00:19:20 +00:00
|
|
|
add_osd_ass_event_escaped(obj->osd_track, obj->text);
|
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
|
|
|
}
|
|
|
|
|
2013-03-30 19:08:56 +00:00
|
|
|
// align: -1 .. +1
|
|
|
|
// frame: size of the containing area
|
|
|
|
// obj: size of the object that should be positioned inside the area
|
|
|
|
// margin: min. distance from object to frame (as long as -1 <= align <= +1)
|
|
|
|
static float get_align(float align, float frame, float obj, float margin)
|
2013-02-14 19:43:00 +00:00
|
|
|
{
|
2013-03-30 19:08:56 +00:00
|
|
|
frame -= margin * 2;
|
|
|
|
return margin + frame / 2 - obj / 2 + (frame - obj) / 2 * align;
|
2013-02-14 19:43:00 +00:00
|
|
|
}
|
|
|
|
|
2013-03-30 19:08:56 +00:00
|
|
|
struct ass_draw {
|
|
|
|
int scale;
|
|
|
|
char *text;
|
|
|
|
};
|
2013-02-14 19:43:00 +00:00
|
|
|
|
2013-03-30 19:08:56 +00:00
|
|
|
static void ass_draw_start(struct ass_draw *d)
|
|
|
|
{
|
|
|
|
d->scale = FFMAX(d->scale, 1);
|
|
|
|
d->text = talloc_asprintf_append(d->text, "{\\p%d}", d->scale);
|
|
|
|
}
|
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
|
|
|
|
2013-03-30 19:08:56 +00:00
|
|
|
static void ass_draw_stop(struct ass_draw *d)
|
|
|
|
{
|
|
|
|
d->text = talloc_strdup_append(d->text, "{\\p0}");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ass_draw_c(struct ass_draw *d, float x, float y)
|
|
|
|
{
|
|
|
|
int ix = round(x * (1 << (d->scale - 1)));
|
|
|
|
int iy = round(y * (1 << (d->scale - 1)));
|
|
|
|
d->text = talloc_asprintf_append(d->text, " %d %d", ix, iy);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ass_draw_append(struct ass_draw *d, const char *t)
|
|
|
|
{
|
|
|
|
d->text = talloc_strdup_append(d->text, t);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ass_draw_move_to(struct ass_draw *d, float x, float y)
|
|
|
|
{
|
|
|
|
ass_draw_append(d, " m");
|
|
|
|
ass_draw_c(d, x, y);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ass_draw_line_to(struct ass_draw *d, float x, float y)
|
|
|
|
{
|
|
|
|
ass_draw_append(d, " l");
|
|
|
|
ass_draw_c(d, x, y);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ass_draw_rect_ccw(struct ass_draw *d, float x0, float y0,
|
|
|
|
float x1, float y1)
|
|
|
|
{
|
|
|
|
ass_draw_move_to(d, x0, y0);
|
|
|
|
ass_draw_line_to(d, x0, y1);
|
|
|
|
ass_draw_line_to(d, x1, y1);
|
|
|
|
ass_draw_line_to(d, x1, y0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ass_draw_rect_cw(struct ass_draw *d, float x0, float y0,
|
|
|
|
float x1, float y1)
|
|
|
|
{
|
|
|
|
ass_draw_move_to(d, x0, y0);
|
|
|
|
ass_draw_line_to(d, x1, y0);
|
|
|
|
ass_draw_line_to(d, x1, y1);
|
|
|
|
ass_draw_line_to(d, x0, y1);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ass_draw_reset(struct ass_draw *d)
|
|
|
|
{
|
|
|
|
talloc_free(d->text);
|
|
|
|
d->text = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void get_osd_bar_box(struct osd_state *osd, struct osd_object *obj,
|
|
|
|
float *o_x, float *o_y, float *o_w, float *o_h,
|
|
|
|
float *o_border)
|
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
|
|
|
{
|
2013-02-14 19:43:00 +00:00
|
|
|
struct MPOpts *opts = osd->opts;
|
|
|
|
|
2013-12-15 14:04:49 +00:00
|
|
|
create_ass_track(osd, obj, 0, 0);
|
2013-03-30 19:08:56 +00:00
|
|
|
ASS_Track *track = obj->osd_track;
|
|
|
|
ASS_Style *style = track->styles + track->default_style;
|
|
|
|
|
|
|
|
*o_w = track->PlayResX * (opts->osd_bar_w / 100.0);
|
|
|
|
*o_h = track->PlayResY * (opts->osd_bar_h / 100.0);
|
|
|
|
|
2015-02-24 13:36:14 +00:00
|
|
|
float base_size = 0.03125;
|
|
|
|
style->Outline *= *o_h / track->PlayResY / base_size;
|
|
|
|
// So that the chapter marks have space between them
|
|
|
|
style->Outline = FFMIN(style->Outline, *o_h / 5.2);
|
|
|
|
// So that the border is not 0
|
|
|
|
style->Outline = FFMAX(style->Outline, *o_h / 32.0);
|
|
|
|
// Rendering with shadow is broken (because there's more than one shape)
|
|
|
|
style->Shadow = 0;
|
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
|
|
|
|
2015-02-24 13:40:06 +00:00
|
|
|
style->Alignment = 5;
|
|
|
|
|
2013-03-30 19:08:56 +00:00
|
|
|
*o_border = style->Outline;
|
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
|
|
|
|
2013-03-30 19:08:56 +00:00
|
|
|
*o_x = get_align(opts->osd_bar_align_x, track->PlayResX, *o_w, *o_border);
|
|
|
|
*o_y = get_align(opts->osd_bar_align_y, track->PlayResY, *o_h, *o_border);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void update_progbar(struct osd_state *osd, struct osd_object *obj)
|
|
|
|
{
|
|
|
|
clear_obj(obj);
|
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
|
|
|
|
2014-01-18 00:19:20 +00:00
|
|
|
if (obj->progbar_state.type < 0)
|
2013-03-30 19:08:56 +00:00
|
|
|
return;
|
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
|
|
|
|
2015-09-07 12:26:01 +00:00
|
|
|
float px, py, width, height, border;
|
|
|
|
get_osd_bar_box(osd, obj, &px, &py, &width, &height, &border);
|
|
|
|
|
2013-03-30 19:08:56 +00:00
|
|
|
float sx = px - border * 2 - height / 4; // includes additional spacing
|
|
|
|
float sy = py + height / 2;
|
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
|
|
|
|
2013-12-30 21:44:25 +00:00
|
|
|
bstr buf = bstr0(talloc_asprintf(NULL, "{\\an6\\pos(%f,%f)}", sx, sy));
|
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
|
|
|
|
2014-01-18 00:19:20 +00:00
|
|
|
if (obj->progbar_state.type == 0 || obj->progbar_state.type >= 256) {
|
2013-02-16 19:50:05 +00:00
|
|
|
// no sym
|
2014-01-18 00:19:20 +00:00
|
|
|
} else if (obj->progbar_state.type >= 32) {
|
|
|
|
mp_append_utf8_bstr(NULL, &buf, obj->progbar_state.type);
|
2013-02-16 19:50:05 +00:00
|
|
|
} else {
|
2013-12-30 21:44:25 +00:00
|
|
|
bstr_xappend(NULL, &buf, bstr0(ASS_USE_OSD_FONT));
|
2014-01-18 00:19:20 +00:00
|
|
|
mp_append_utf8_bstr(NULL, &buf, OSD_CODEPOINTS + obj->progbar_state.type);
|
2013-12-30 21:44:25 +00:00
|
|
|
bstr_xappend(NULL, &buf, bstr0("{\\r}"));
|
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
|
|
|
}
|
|
|
|
|
2013-12-30 21:44:25 +00:00
|
|
|
add_osd_ass_event(obj->osd_track, buf.start);
|
|
|
|
talloc_free(buf.start);
|
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
|
|
|
|
2013-03-30 19:08:56 +00:00
|
|
|
struct ass_draw *d = &(struct ass_draw) { .scale = 4 };
|
|
|
|
// filled area
|
2013-03-31 19:12:53 +00:00
|
|
|
d->text = talloc_asprintf_append(d->text, "{\\bord0\\pos(%f,%f)}", px, py);
|
2013-03-30 19:08:56 +00:00
|
|
|
ass_draw_start(d);
|
2014-01-18 00:19:20 +00:00
|
|
|
float pos = obj->progbar_state.value * width - border / 2;
|
2013-03-30 19:08:56 +00:00
|
|
|
ass_draw_rect_cw(d, 0, 0, pos, height);
|
|
|
|
ass_draw_stop(d);
|
|
|
|
add_osd_ass_event(obj->osd_track, d->text);
|
|
|
|
ass_draw_reset(d);
|
|
|
|
|
2013-04-01 23:53:33 +00:00
|
|
|
// position marker
|
|
|
|
d->text = talloc_asprintf_append(d->text, "{\\bord%f\\pos(%f,%f)}",
|
|
|
|
border / 2, px, py);
|
|
|
|
ass_draw_start(d);
|
|
|
|
ass_draw_move_to(d, pos + border / 2, 0);
|
|
|
|
ass_draw_line_to(d, pos + border / 2, height);
|
|
|
|
ass_draw_stop(d);
|
|
|
|
add_osd_ass_event(obj->osd_track, d->text);
|
|
|
|
ass_draw_reset(d);
|
|
|
|
|
2013-03-30 19:08:56 +00:00
|
|
|
d->text = talloc_asprintf_append(d->text, "{\\pos(%f,%f)}", px, py);
|
|
|
|
ass_draw_start(d);
|
|
|
|
|
|
|
|
// the box
|
|
|
|
ass_draw_rect_cw(d, -border, -border, width + border, height + border);
|
|
|
|
|
|
|
|
// the "hole"
|
|
|
|
ass_draw_rect_ccw(d, 0, 0, width, height);
|
|
|
|
|
|
|
|
// chapter marks
|
2014-01-18 00:19:20 +00:00
|
|
|
for (int n = 0; n < obj->progbar_state.num_stops; n++) {
|
|
|
|
float s = obj->progbar_state.stops[n] * width;
|
2013-03-30 19:08:56 +00:00
|
|
|
float dent = border * 1.3;
|
|
|
|
|
|
|
|
if (s > dent && s < width - dent) {
|
|
|
|
ass_draw_move_to(d, s + dent, 0);
|
|
|
|
ass_draw_line_to(d, s, dent);
|
|
|
|
ass_draw_line_to(d, s - dent, 0);
|
|
|
|
|
|
|
|
ass_draw_move_to(d, s - dent, height);
|
|
|
|
ass_draw_line_to(d, s, height - dent);
|
|
|
|
ass_draw_line_to(d, s + dent, height);
|
|
|
|
}
|
|
|
|
}
|
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
|
|
|
|
2013-03-30 19:08:56 +00:00
|
|
|
ass_draw_stop(d);
|
|
|
|
add_osd_ass_event(obj->osd_track, d->text);
|
|
|
|
ass_draw_reset(d);
|
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
|
|
|
}
|
|
|
|
|
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
|
|
|
static void update_external(struct osd_state *osd, struct osd_object *obj)
|
|
|
|
{
|
|
|
|
clear_obj(obj);
|
|
|
|
|
2014-01-18 00:19:20 +00:00
|
|
|
bstr t = bstr0(obj->text);
|
2015-09-07 12:26:01 +00:00
|
|
|
if (!t.len)
|
|
|
|
return;
|
|
|
|
create_ass_track(osd, obj, obj->external_res_x, obj->external_res_y);
|
|
|
|
|
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
|
|
|
while (t.len) {
|
|
|
|
bstr line;
|
|
|
|
bstr_split_tok(t, "\n", &line, &t);
|
|
|
|
if (line.len) {
|
|
|
|
char *tmp = bstrdup0(NULL, line);
|
|
|
|
add_osd_ass_event(obj->osd_track, tmp);
|
|
|
|
talloc_free(tmp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-28 19:38:52 +00:00
|
|
|
static void update_sub(struct osd_state *osd, struct osd_object *obj)
|
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-08-25 18:22:39 +00:00
|
|
|
struct MPOpts *opts = osd->opts;
|
|
|
|
|
2013-03-30 19:08:56 +00:00
|
|
|
clear_obj(obj);
|
|
|
|
|
2014-01-18 00:19:20 +00:00
|
|
|
if (!obj->text || !obj->text[0] || obj->sub_state.render_bitmap_subs)
|
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
|
|
|
return;
|
|
|
|
|
2013-12-15 14:04:49 +00:00
|
|
|
create_ass_renderer(osd, obj);
|
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
|
|
|
if (!obj->osd_track)
|
2013-12-15 14:04:49 +00:00
|
|
|
obj->osd_track = mp_ass_default_track(obj->osd_ass_library, osd->opts);
|
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
|
|
|
|
2013-01-04 15:10:17 +00:00
|
|
|
struct osd_style_opts font = *opts->sub_text_style;
|
2012-11-17 19:56:45 +00:00
|
|
|
font.font_size *= opts->sub_scale;
|
|
|
|
|
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
|
|
|
ASS_Style *style = obj->osd_track->styles + obj->osd_track->default_style;
|
2013-06-03 20:14:56 +00:00
|
|
|
mp_ass_set_style(style, obj->osd_track->PlayResY, &font);
|
2013-12-24 16:46:14 +00:00
|
|
|
if (obj->type == OSDTYPE_SUB2)
|
|
|
|
style->Alignment = 6;
|
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
|
|
|
|
2013-12-15 14:04:49 +00:00
|
|
|
ass_set_line_position(obj->osd_render, 100 - opts->sub_pos);
|
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
|
|
|
|
2014-01-18 00:19:20 +00:00
|
|
|
add_osd_ass_event_escaped(obj->osd_track, obj->text);
|
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
|
|
|
static void update_object(struct osd_state *osd, struct osd_object *obj)
|
|
|
|
{
|
|
|
|
switch (obj->type) {
|
|
|
|
case OSDTYPE_OSD:
|
|
|
|
update_osd(osd, obj);
|
|
|
|
break;
|
2013-12-24 16:46:14 +00:00
|
|
|
case OSDTYPE_SUB:
|
|
|
|
case OSDTYPE_SUB2:
|
2012-09-28 19:38:52 +00:00
|
|
|
update_sub(osd, obj);
|
|
|
|
break;
|
|
|
|
case OSDTYPE_PROGBAR:
|
|
|
|
update_progbar(osd, obj);
|
|
|
|
break;
|
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
|
|
|
case OSDTYPE_EXTERNAL:
|
|
|
|
update_external(osd, obj);
|
|
|
|
break;
|
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)
|
|
|
|
{
|
2014-11-25 10:08:25 +00:00
|
|
|
if (!osd->opts->use_text_osd)
|
|
|
|
return;
|
|
|
|
|
2012-09-28 19:38:52 +00:00
|
|
|
if (obj->force_redraw)
|
|
|
|
update_object(osd, obj);
|
|
|
|
|
|
|
|
*out_imgs = (struct sub_bitmaps) {0};
|
|
|
|
if (!obj->osd_track)
|
|
|
|
return;
|
|
|
|
|
2013-12-15 14:04:49 +00:00
|
|
|
ass_set_frame_size(obj->osd_render, obj->vo_res.w, obj->vo_res.h);
|
|
|
|
ass_set_aspect_ratio(obj->osd_render, obj->vo_res.display_par, 1.0);
|
|
|
|
mp_ass_render_frame(obj->osd_render, obj->osd_track, 0,
|
2012-09-28 19:38:52 +00:00
|
|
|
&obj->parts_cache, out_imgs);
|
|
|
|
talloc_steal(obj, obj->parts_cache);
|
|
|
|
}
|
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
|
|
|
|
2014-01-18 00:19:20 +00:00
|
|
|
void osd_object_get_resolution(struct osd_state *osd, int obj,
|
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
|
|
|
int *out_w, int *out_h)
|
|
|
|
{
|
2014-01-18 00:19:20 +00:00
|
|
|
pthread_mutex_lock(&osd->lock);
|
|
|
|
struct osd_object *osd_obj = osd->objs[obj];
|
|
|
|
*out_w = osd_obj->osd_track ? osd_obj->osd_track->PlayResX : 0;
|
|
|
|
*out_h = osd_obj->osd_track ? osd_obj->osd_track->PlayResY : 0;
|
|
|
|
pthread_mutex_unlock(&osd->lock);
|
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
|
|
|
}
|