Skip to content

Commit

Permalink
Add srv3 support
Browse files Browse the repository at this point in the history
  • Loading branch information
afishhh committed Mar 29, 2024
1 parent 92cb473 commit 01d407e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion demux/demux_lavf.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ static const struct format_hack format_hacks[] = {
TEXTSUB("aqtitle"), TEXTSUB("jacosub"), TEXTSUB("microdvd"),
TEXTSUB("mpl2"), TEXTSUB("mpsub"), TEXTSUB("pjs"), TEXTSUB("realtext"),
TEXTSUB("sami"), TEXTSUB("srt"), TEXTSUB("stl"), TEXTSUB("subviewer"),
TEXTSUB("subviewer1"), TEXTSUB("vplayer"), TEXTSUB("ass"),
TEXTSUB("subviewer1"), TEXTSUB("vplayer"), TEXTSUB("ass"), TEXTSUB("srv3"),

TEXTSUB_UTF8("webvtt"),

Expand Down
1 change: 1 addition & 0 deletions options/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -1061,6 +1061,7 @@ static const struct MPOpts mp_default_opts = {
"scc",
"smi",
"srt",
"srv3",
"ssa",
"sub",
"sup",
Expand Down
3 changes: 2 additions & 1 deletion player/lua/ytdl_hook.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ local ext_map = {

local codec_map = {
-- src pattern = mpv codec
["srv3"] = "srv3",
["vtt"] = "webvtt",
["opus"] = "opus",
["vp9"] = "vp9",
Expand Down Expand Up @@ -895,7 +896,7 @@ function run_ytdl_hook(url)

local command = {
ytdl.path, "--no-warnings", "-J", "--flat-playlist",
"--sub-format", "ass/srt/best"
"--sub-format", "ass/srv3/srt/best"
}

-- Checks if video option is "no", change format accordingly,
Expand Down
4 changes: 3 additions & 1 deletion sub/lavc_conv.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ struct lavc_conv *lavc_conv_create(struct mp_log *log,
priv->avctx = avctx;
priv->extradata = talloc_strndup(priv, avctx->subtitle_header,
avctx->subtitle_header_size);
disable_styles(bstr0(priv->extradata));
// The SRV3 decoder actually tries to replicate YouTube's styling
if(strcmp(codec->name, "srv3"))
disable_styles(bstr0(priv->extradata));
return priv;

error:
Expand Down

0 comments on commit 01d407e

Please sign in to comment.