summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorllyyr <llyyr.public@gmail.com>2023-08-26 18:47:01 +0530
committerDudemanguy <random342@airmail.cc>2023-08-27 16:14:18 +0000
commitf9918b53901db2fbc3cfc1be509a32d3ed89556a (patch)
treec9459a0e1efbd897364a9a2ece901316ab48d8c7 /player
parent902bbdad35413436ff024c17d0ead774747f026f (diff)
downloadmpv-f9918b53901db2fbc3cfc1be509a32d3ed89556a.tar.bz2
mpv-f9918b53901db2fbc3cfc1be509a32d3ed89556a.tar.xz
command: add `sub-ass-extradata` property
Diffstat (limited to 'player')
-rw-r--r--player/command.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/player/command.c b/player/command.c
index 0a45469308..71363e832d 100644
--- a/player/command.c
+++ b/player/command.c
@@ -2916,6 +2916,29 @@ static int mp_property_sub_pos(void *ctx, struct m_property *prop,
return mp_property_generic_option(mpctx, prop, action, arg);
}
+static int mp_property_sub_ass_extradata(void *ctx, struct m_property *prop,
+ int action, void *arg)
+{
+ MPContext *mpctx = ctx;
+ struct track *track = mpctx->current_track[0][STREAM_SUB];
+ struct dec_sub *sub = track ? track->d_sub : NULL;
+ if (!sub)
+ return M_PROPERTY_UNAVAILABLE;
+ switch (action) {
+ case M_PROPERTY_GET: {
+ char *data = sub_ass_get_extradata(sub);
+ if (!data)
+ return M_PROPERTY_UNAVAILABLE;
+ *(char **)arg = data;
+ return M_PROPERTY_OK;
+ }
+ case M_PROPERTY_GET_TYPE:
+ *(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_STRING};
+ return M_PROPERTY_OK;
+ }
+ return M_PROPERTY_NOT_IMPLEMENTED;
+}
+
static int get_sub_text(void *ctx, struct m_property *prop,
int action, void *arg, int sub_index)
{
@@ -3954,6 +3977,7 @@ static const struct m_property mp_properties_base[] = {
{"sub-delay", mp_property_sub_delay},
{"sub-speed", mp_property_sub_speed},
{"sub-pos", mp_property_sub_pos},
+ {"sub-ass-extradata", mp_property_sub_ass_extradata},
{"sub-text", mp_property_sub_text,
.priv = (void *)&(const int){SD_TEXT_TYPE_PLAIN}},
{"secondary-sub-text", mp_property_secondary_sub_text,