[MPlayer-dev-eng] [PATCH] mplayer: add the -ass-keep-fonts option.
Nicolas George
george at nsup.org
Fri Feb 27 19:42:15 CET 2015
It is now possible to do:
mplayer -ass -ass-keep-fonts fonts.mkv video.mkv
and use the fonts attached to the first file to render ASS
on the second file.
This allows to distribute the fonts once for a series of similar
files without requiring to install them on the system, which may
be inconvenient for the user.
---
DOCS/man/en/mplayer.1 | 8 ++++++++
cfg-common.h | 2 ++
mplayer.c | 2 +-
sub/ass_mp.c | 1 +
sub/ass_mp.h | 1 +
5 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1
index 19560c9..2717ad1 100644
--- a/DOCS/man/en/mplayer.1
+++ b/DOCS/man/en/mplayer.1
@@ -2484,6 +2484,14 @@ Enables placing toptitles and subtitles in black borders when they
are available.
.
.TP
+.B \-ass\-keep\-fonts
+Keep fonts that were attached to files and loaded when switching to the next
+file.
+It allows to use a single dummy video file as an archive for attached fonts
+instead of attaching them to all files in a series or installing them on the
+system.
+.
+.TP
.B \-dumpjacosub (MPlayer only)
Convert the given subtitle (specified with the \-sub option) to the time-based
JACOsub subtitle format.
diff --git a/cfg-common.h b/cfg-common.h
index 58748ff..ac74cc7 100644
--- a/cfg-common.h
+++ b/cfg-common.h
@@ -628,6 +628,8 @@ const m_option_t common_opts[] = {
{"ass-border-color", &ass_border_color, CONF_TYPE_STRING, 0, 0, 0, NULL},
{"ass-styles", &ass_styles_file, CONF_TYPE_STRING, 0, 0, 0, NULL},
{"ass-hinting", &ass_hinting, CONF_TYPE_INT, CONF_RANGE, 0, 7, NULL},
+ {"ass-keep-fonts", &ass_keep_fonts, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+ {"noass-keep-fonts", &ass_keep_fonts, CONF_TYPE_FLAG, 0, 1, 0, NULL},
#endif
#ifdef CONFIG_FONTCONFIG
{"fontconfig", &font_fontconfig, CONF_TYPE_FLAG, 0, -1, 1, NULL},
diff --git a/mplayer.c b/mplayer.c
index 482bf53..728f47b 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -654,7 +654,7 @@ void uninit_player(unsigned int mask)
subdata = NULL;
#ifdef CONFIG_ASS
ass_track = NULL;
- if (ass_library)
+ if (ass_library && !ass_keep_fonts)
ass_clear_fonts(ass_library);
#endif
}
diff --git a/sub/ass_mp.c b/sub/ass_mp.c
index 60f464f..8efa243 100644
--- a/sub/ass_mp.c
+++ b/sub/ass_mp.c
@@ -49,6 +49,7 @@ int ass_bottom_margin = 0;
int extract_embedded_fonts = 1;
char **ass_force_style_list = NULL;
int ass_use_margins = 0;
+int ass_keep_fonts = 0;
char* ass_color = NULL;
char* ass_border_color = NULL;
char* ass_styles_file = NULL;
diff --git a/sub/ass_mp.h b/sub/ass_mp.h
index bd4f827..ccce635 100644
--- a/sub/ass_mp.h
+++ b/sub/ass_mp.h
@@ -40,6 +40,7 @@ extern int ass_bottom_margin;
extern int extract_embedded_fonts;
extern char **ass_force_style_list;
extern int ass_use_margins;
+extern int ass_keep_fonts;
extern char* ass_color;
extern char* ass_border_color;
extern char* ass_styles_file;
--
2.1.4
More information about the MPlayer-dev-eng
mailing list