summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrcombs <rcombs@rcombs.me>2024-04-17 13:00:07 -0700
committerKacper Michajłow <kasper93@gmail.com>2024-04-27 01:19:56 +0200
commit437fff9f2169f677045a5263e0cdf1586871f047 (patch)
treeb8af693b963c89f99310560cbc9c625bb2a0ade2
parentaa0a9ce2ec15af780eb8f02636aad4cf4e357d0c (diff)
downloadmpv-437fff9f2169f677045a5263e0cdf1586871f047.tar.bz2
mpv-437fff9f2169f677045a5263e0cdf1586871f047.tar.xz
player/command: move sub-text-ass to a sub-property
-rw-r--r--DOCS/interface-changes/sub-text-ass.txt1
-rw-r--r--DOCS/man/input.rst25
-rw-r--r--player/command.c12
3 files changed, 28 insertions, 10 deletions
diff --git a/DOCS/interface-changes/sub-text-ass.txt b/DOCS/interface-changes/sub-text-ass.txt
new file mode 100644
index 0000000000..58db3f7f0c
--- /dev/null
+++ b/DOCS/interface-changes/sub-text-ass.txt
@@ -0,0 +1 @@
+deprecate `sub-text-ass` property; add `sub-text/ass` sub-property
diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst
index 67e545fbd1..d1a090c24a 100644
--- a/DOCS/man/input.rst
+++ b/DOCS/man/input.rst
@@ -2823,19 +2823,24 @@ Property list
stripped. If the subtitle is not text-based (i.e. DVD/BD subtitles), an
empty string is returned.
-``sub-text-ass``
- Like ``sub-text``, but return the text in ASS format. Text subtitles in
- other formats are converted. For native ASS subtitles, events that do
- not contain any text (but vector drawings etc.) are not filtered out. If
- multiple events match with the current playback time, they are concatenated
- with line breaks. Contains only the "Text" part of the events.
+ This has sub-properties for different formats:
- This property is not enough to render ASS subtitles correctly, because ASS
- header and per-event metadata are not returned. You likely need to do
- further filtering on the returned string to make it useful.
+ ``sub-text/ass``
+ Like ``sub-text``, but return the text in ASS format. Text subtitles in
+ other formats are converted. For native ASS subtitles, events that do
+ not contain any text (but vector drawings etc.) are not filtered out. If
+ multiple events match with the current playback time, they are concatenated
+ with line breaks. Contains only the "Text" part of the events.
+
+ This property is not enough to render ASS subtitles correctly, because ASS
+ header and per-event metadata are not returned. You likely need to do
+ further filtering on the returned string to make it useful.
+
+``sub-text-ass`` (deprecated)
+ Deprecated alias for ``sub-text/ass``.
``secondary-sub-text``
- Same as ``sub-text``, but for the secondary subtitles.
+ Same as ``sub-text`` (with the same sub-properties), but for the secondary subtitles.
``sub-start``
The current subtitle start time (in seconds). If there's multiple current
diff --git a/player/command.c b/player/command.c
index b7130814d8..39cb9d8720 100644
--- a/player/command.c
+++ b/player/command.c
@@ -3021,6 +3021,18 @@ static int mp_property_sub_text(void *ctx, struct m_property *prop,
int sub_index = def[0];
int type = def[1];
+ if (action == M_PROPERTY_KEY_ACTION) {
+ struct m_property_action_arg *ka = arg;
+
+ if (!strcmp(ka->key, "ass"))
+ type = SD_TEXT_TYPE_ASS;
+ else
+ return M_PROPERTY_UNKNOWN;
+
+ action = ka->action;
+ arg = ka->arg;
+ }
+
struct track *track = mpctx->current_track[sub_index][STREAM_SUB];
struct dec_sub *sub = track ? track->d_sub : NULL;
double pts = mpctx->playback_pts;