diff options
author | Ripose <ripose@protonmail.com> | 2021-07-12 11:29:59 -0700 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2021-07-12 21:07:37 +0000 |
commit | 34cfe9d89b19b3080bf62168803a8cb239c03c4c (patch) | |
tree | 9746f03fd0300180521c39b75e792bf47ed3c959 /player | |
parent | 383acd41a8d8f0620b0bf20bb2be23d629d67285 (diff) | |
download | mpv-34cfe9d89b19b3080bf62168803a8cb239c03c4c.tar.bz2 mpv-34cfe9d89b19b3080bf62168803a8cb239c03c4c.tar.xz |
command: add secondary-sub-start and secondary-sub-end properties
Adds secondary-sub-start and secondary-sub-end properties by setting
the current_track index in the m_property's priv variable which later
gets accessed in get_times. Also adds a test of the secondary subtitle
time properties in tests/subtimes.js bound to 'T'.
Diffstat (limited to 'player')
-rw-r--r-- | player/command.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/player/command.c b/player/command.c index 051d83b14d..f4dd93c5d0 100644 --- a/player/command.c +++ b/player/command.c @@ -2873,7 +2873,8 @@ static struct sd_times get_times(void *ctx, struct m_property *prop, { struct sd_times res = { .start = MP_NOPTS_VALUE, .end = MP_NOPTS_VALUE }; MPContext *mpctx = ctx; - struct track *track = mpctx->current_track[0][STREAM_SUB]; + int track_ind = *(int *)prop->priv; + struct track *track = mpctx->current_track[track_ind][STREAM_SUB]; struct dec_sub *sub = track ? track->d_sub : NULL; double pts = mpctx->playback_pts; if (!sub || pts == MP_NOPTS_VALUE) @@ -3674,8 +3675,14 @@ static const struct m_property mp_properties_base[] = { .priv = (void *)&(const int){SD_TEXT_TYPE_PLAIN}}, {"sub-text-ass", mp_property_sub_text, .priv = (void *)&(const int){SD_TEXT_TYPE_ASS}}, - {"sub-start", mp_property_sub_start}, - {"sub-end", mp_property_sub_end}, + {"sub-start", mp_property_sub_start, + .priv = (void *)&(const int){0}}, + {"secondary-sub-start", mp_property_sub_start, + .priv = (void *)&(const int){1}}, + {"sub-end", mp_property_sub_end, + .priv = (void *)&(const int){0}}, + {"secondary-sub-end", mp_property_sub_end, + .priv = (void *)&(const int){1}}, {"vf", mp_property_vf}, {"af", mp_property_af}, @@ -3755,7 +3762,7 @@ static const char *const *const mp_event_property_change[] = { "estimated-display-fps", "vsync-jitter", "sub-text", "secondary-sub-text", "audio-bitrate", "video-bitrate", "sub-bitrate", "decoder-frame-drop-count", "frame-drop-count", "video-frame-info", "vf-metadata", "af-metadata", - "sub-start", "sub-end"), + "sub-start", "sub-end", "secondary-sub-start", "secondary-sub-end"), E(MP_EVENT_DURATION_UPDATE, "duration"), E(MPV_EVENT_VIDEO_RECONFIG, "video-out-params", "video-params", "video-format", "video-codec", "video-bitrate", "dwidth", "dheight", |