summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>2024-01-14 21:20:08 +0300
committersfan5 <sfan5@live.de>2024-02-13 10:44:41 +0100
commita1bda5b34df857e6e5ba5bbe228e8fbcb452a155 (patch)
treee510fb567f0686207754ffc8d9044563014131f6
parent09606b9db9e228ac80cadb5fd7875ad60c9bd178 (diff)
downloadmpv-a1bda5b34df857e6e5ba5bbe228e8fbcb452a155.tar.bz2
mpv-a1bda5b34df857e6e5ba5bbe228e8fbcb452a155.tar.xz
sub: allow setting lavc txt_page special values via teletext_page
* Range of accepted values for teletext_page now include 0 and -1. * 0 means "subtitle" and -1 means "*". * Make 0 the default. Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>
-rw-r--r--DOCS/interface-changes.rst1
-rw-r--r--DOCS/man/options.rst7
-rw-r--r--options/options.c4
-rw-r--r--sub/sd_lavc.c12
4 files changed, 17 insertions, 7 deletions
diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst
index 2a53cf1e20..d71f14910c 100644
--- a/DOCS/interface-changes.rst
+++ b/DOCS/interface-changes.rst
@@ -46,6 +46,7 @@ Interface changes
- add the command `load-input-conf`
- remove `--vo=rpi`, `--gpu-context=rpi`, and `--hwdec=mmal`
- add `auto` choice to `--deinterlace`
+ - change `--teletext-page` default from 100 to 0 ("subtitle" in lavc)
--- mpv 0.37.0 ---
- `--save-position-on-quit` and its associated commands now store state files
in %LOCALAPPDATA% instead of %APPDATA% directory by default on Windows.
diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst
index ebe99cb189..cb700e92c4 100644
--- a/DOCS/man/options.rst
+++ b/DOCS/man/options.rst
@@ -2763,9 +2763,12 @@ Subtitles
of subtitles across seeks, so after a seek libass can't eliminate subtitle
packets with the same ReadOrder as earlier packets.
-``--teletext-page=<1-999>``
+``--teletext-page=<-1-999>``
This works for ``dvb_teletext`` subtitle streams, and if FFmpeg has been
- compiled with support for it.
+ compiled with support for it. `-1` matches all pages. `0` (default) matches
+ all subtitle pages.
+
+ Default: 0
``--sub-past-video-end``
After the last frame of video, if this option is enabled, subtitles will
diff --git a/options/options.c b/options/options.c
index b25b4ac72c..c229ce4320 100644
--- a/options/options.c
+++ b/options/options.c
@@ -318,7 +318,7 @@ const struct m_sub_options mp_subtitle_sub_opts = {
{"sub-ass-scale-with-window", OPT_BOOL(ass_scale_with_window)},
{"sub", OPT_SUBSTRUCT(sub_style, sub_style_conf)},
{"sub-clear-on-seek", OPT_BOOL(sub_clear_on_seek)},
- {"teletext-page", OPT_INT(teletext_page), M_RANGE(1, 999)},
+ {"teletext-page", OPT_INT(teletext_page), M_RANGE(-1, 999)},
{"sub-past-video-end", OPT_BOOL(sub_past_video_end)},
{"sub-ass-force-style", OPT_REPLACED("sub-ass-style-overrides")},
{"sub-lavc-o", OPT_KEYVALUELIST(sub_avopts)},
@@ -331,7 +331,7 @@ const struct m_sub_options mp_subtitle_sub_opts = {
.sub_scale_by_window = true,
.sub_use_margins = true,
.sub_scale_with_window = true,
- .teletext_page = 100,
+ .teletext_page = 0,
.sub_scale = 1,
.ass_vsfilter_aspect_compat = true,
.ass_vsfilter_color_compat = 1,
diff --git a/sub/sd_lavc.c b/sub/sd_lavc.c
index 988f6e088d..1bb1c96c2b 100644
--- a/sub/sd_lavc.c
+++ b/sub/sd_lavc.c
@@ -311,9 +311,15 @@ static void decode(struct sd *sd, struct demux_packet *packet)
mp_set_av_packet(priv->avpkt, packet, &priv->pkt_timebase);
if (ctx->codec_id == AV_CODEC_ID_DVB_TELETEXT) {
- char page[4];
- snprintf(page, sizeof(page), "%d", opts->teletext_page);
- av_opt_set(ctx, "txt_page", page, AV_OPT_SEARCH_CHILDREN);
+ if (!opts->teletext_page) {
+ av_opt_set(ctx, "txt_page", "subtitle", AV_OPT_SEARCH_CHILDREN);
+ } else if (opts->teletext_page == -1) {
+ av_opt_set(ctx, "txt_page", "*", AV_OPT_SEARCH_CHILDREN);
+ } else {
+ char page[4];
+ snprintf(page, sizeof(page), "%d", opts->teletext_page);
+ av_opt_set(ctx, "txt_page", page, AV_OPT_SEARCH_CHILDREN);
+ }
}
int got_sub;