mirror of
https://github.com/mpv-player/mpv
synced 2025-03-19 18:05:21 +00:00
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>
This commit is contained in:
parent
09606b9db9
commit
a1bda5b34d
@ -46,6 +46,7 @@ Interface changes
|
|||||||
- add the command `load-input-conf`
|
- add the command `load-input-conf`
|
||||||
- remove `--vo=rpi`, `--gpu-context=rpi`, and `--hwdec=mmal`
|
- remove `--vo=rpi`, `--gpu-context=rpi`, and `--hwdec=mmal`
|
||||||
- add `auto` choice to `--deinterlace`
|
- add `auto` choice to `--deinterlace`
|
||||||
|
- change `--teletext-page` default from 100 to 0 ("subtitle" in lavc)
|
||||||
--- mpv 0.37.0 ---
|
--- mpv 0.37.0 ---
|
||||||
- `--save-position-on-quit` and its associated commands now store state files
|
- `--save-position-on-quit` and its associated commands now store state files
|
||||||
in %LOCALAPPDATA% instead of %APPDATA% directory by default on Windows.
|
in %LOCALAPPDATA% instead of %APPDATA% directory by default on Windows.
|
||||||
|
@ -2763,9 +2763,12 @@ Subtitles
|
|||||||
of subtitles across seeks, so after a seek libass can't eliminate subtitle
|
of subtitles across seeks, so after a seek libass can't eliminate subtitle
|
||||||
packets with the same ReadOrder as earlier packets.
|
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
|
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``
|
``--sub-past-video-end``
|
||||||
After the last frame of video, if this option is enabled, subtitles will
|
After the last frame of video, if this option is enabled, subtitles will
|
||||||
|
@ -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-ass-scale-with-window", OPT_BOOL(ass_scale_with_window)},
|
||||||
{"sub", OPT_SUBSTRUCT(sub_style, sub_style_conf)},
|
{"sub", OPT_SUBSTRUCT(sub_style, sub_style_conf)},
|
||||||
{"sub-clear-on-seek", OPT_BOOL(sub_clear_on_seek)},
|
{"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-past-video-end", OPT_BOOL(sub_past_video_end)},
|
||||||
{"sub-ass-force-style", OPT_REPLACED("sub-ass-style-overrides")},
|
{"sub-ass-force-style", OPT_REPLACED("sub-ass-style-overrides")},
|
||||||
{"sub-lavc-o", OPT_KEYVALUELIST(sub_avopts)},
|
{"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_scale_by_window = true,
|
||||||
.sub_use_margins = true,
|
.sub_use_margins = true,
|
||||||
.sub_scale_with_window = true,
|
.sub_scale_with_window = true,
|
||||||
.teletext_page = 100,
|
.teletext_page = 0,
|
||||||
.sub_scale = 1,
|
.sub_scale = 1,
|
||||||
.ass_vsfilter_aspect_compat = true,
|
.ass_vsfilter_aspect_compat = true,
|
||||||
.ass_vsfilter_color_compat = 1,
|
.ass_vsfilter_color_compat = 1,
|
||||||
|
@ -311,10 +311,16 @@ static void decode(struct sd *sd, struct demux_packet *packet)
|
|||||||
mp_set_av_packet(priv->avpkt, packet, &priv->pkt_timebase);
|
mp_set_av_packet(priv->avpkt, packet, &priv->pkt_timebase);
|
||||||
|
|
||||||
if (ctx->codec_id == AV_CODEC_ID_DVB_TELETEXT) {
|
if (ctx->codec_id == AV_CODEC_ID_DVB_TELETEXT) {
|
||||||
|
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];
|
char page[4];
|
||||||
snprintf(page, sizeof(page), "%d", opts->teletext_page);
|
snprintf(page, sizeof(page), "%d", opts->teletext_page);
|
||||||
av_opt_set(ctx, "txt_page", page, AV_OPT_SEARCH_CHILDREN);
|
av_opt_set(ctx, "txt_page", page, AV_OPT_SEARCH_CHILDREN);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int got_sub;
|
int got_sub;
|
||||||
int res = avcodec_decode_subtitle2(ctx, &sub, &got_sub, priv->avpkt);
|
int res = avcodec_decode_subtitle2(ctx, &sub, &got_sub, priv->avpkt);
|
||||||
|
Loading…
Reference in New Issue
Block a user