summaryrefslogtreecommitdiffstats
path: root/sub/sd_lavc.c
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 /sub/sd_lavc.c
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>
Diffstat (limited to 'sub/sd_lavc.c')
-rw-r--r--sub/sd_lavc.c12
1 files changed, 9 insertions, 3 deletions
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;