Commit bdf6d25e authored by François Cartegnie's avatar François Cartegnie 🤞

demux: subtitle: remove WEBVTT

parent b838534c
...@@ -49,7 +49,7 @@ AbstractDemuxer * DASHStream::createDemux(const StreamFormat &format) ...@@ -49,7 +49,7 @@ AbstractDemuxer * DASHStream::createDemux(const StreamFormat &format)
break; break;
case StreamFormat::WEBVTT: case StreamFormat::WEBVTT:
ret = new SlaveDemuxer(p_realdemux, "subtitle", fakeesout->getEsOut(), demuxersource); ret = new SlaveDemuxer(p_realdemux, "webvtt", fakeesout->getEsOut(), demuxersource);
break; break;
case StreamFormat::TTML: case StreamFormat::TTML:
......
...@@ -64,7 +64,7 @@ static const char *const ppsz_sub_type[] = ...@@ -64,7 +64,7 @@ static const char *const ppsz_sub_type[] =
"auto", "microdvd", "subrip", "subviewer", "ssa1", "auto", "microdvd", "subrip", "subviewer", "ssa1",
"ssa2-4", "ass", "vplayer", "sami", "dvdsubtitle", "mpl2", "ssa2-4", "ass", "vplayer", "sami", "dvdsubtitle", "mpl2",
"aqt", "pjs", "mpsub", "jacosub", "psb", "realtext", "dks", "aqt", "pjs", "mpsub", "jacosub", "psb", "realtext", "dks",
"subviewer1", "vtt", "sbv" "subviewer1", "sbv"
}; };
vlc_module_begin () vlc_module_begin ()
...@@ -114,7 +114,6 @@ enum subtitle_type_e ...@@ -114,7 +114,6 @@ enum subtitle_type_e
SUB_TYPE_DKS, SUB_TYPE_DKS,
SUB_TYPE_SUBVIEW1, /* SUBVIEWER 1 - mplayer calls it subrip09, SUB_TYPE_SUBVIEW1, /* SUBVIEWER 1 - mplayer calls it subrip09,
and Gnome subtitles SubViewer 1.0 */ and Gnome subtitles SubViewer 1.0 */
SUB_TYPE_VTT,
SUB_TYPE_SBV, SUB_TYPE_SBV,
SUB_TYPE_SCC, /* Scenarist Closed Caption */ SUB_TYPE_SCC, /* Scenarist Closed Caption */
}; };
...@@ -207,7 +206,7 @@ static int ParsePSB ( vlc_object_t *, subs_properties_t *, text_t *, sub ...@@ -207,7 +206,7 @@ static int ParsePSB ( vlc_object_t *, subs_properties_t *, text_t *, sub
static int ParseRealText ( vlc_object_t *, subs_properties_t *, text_t *, subtitle_t *, size_t ); static int ParseRealText ( vlc_object_t *, subs_properties_t *, text_t *, subtitle_t *, size_t );
static int ParseDKS ( vlc_object_t *, subs_properties_t *, text_t *, subtitle_t *, size_t ); static int ParseDKS ( vlc_object_t *, subs_properties_t *, text_t *, subtitle_t *, size_t );
static int ParseSubViewer1 ( vlc_object_t *, subs_properties_t *, text_t *, subtitle_t *, size_t ); static int ParseSubViewer1 ( vlc_object_t *, subs_properties_t *, text_t *, subtitle_t *, size_t );
static int ParseCommonVTTSBV( vlc_object_t *, subs_properties_t *, text_t *, subtitle_t *, size_t ); static int ParseCommonSBV ( vlc_object_t *, subs_properties_t *, text_t *, subtitle_t *, size_t );
static int ParseSCC ( vlc_object_t *, subs_properties_t *, text_t *, subtitle_t *, size_t ); static int ParseSCC ( vlc_object_t *, subs_properties_t *, text_t *, subtitle_t *, size_t );
static const struct static const struct
...@@ -236,8 +235,7 @@ static const struct ...@@ -236,8 +235,7 @@ static const struct
{ "realtext", SUB_TYPE_RT, "RealText", ParseRealText }, { "realtext", SUB_TYPE_RT, "RealText", ParseRealText },
{ "dks", SUB_TYPE_DKS, "DKS", ParseDKS }, { "dks", SUB_TYPE_DKS, "DKS", ParseDKS },
{ "subviewer1", SUB_TYPE_SUBVIEW1, "Subviewer 1", ParseSubViewer1 }, { "subviewer1", SUB_TYPE_SUBVIEW1, "Subviewer 1", ParseSubViewer1 },
{ "text/vtt", SUB_TYPE_VTT, "WebVTT", ParseCommonVTTSBV }, { "sbv", SUB_TYPE_SBV, "SBV", ParseCommonSBV },
{ "sbv", SUB_TYPE_SBV, "SBV", ParseCommonVTTSBV },
{ "scc", SUB_TYPE_SCC, "SCC", ParseSCC }, { "scc", SUB_TYPE_SCC, "SCC", ParseSCC },
{ NULL, SUB_TYPE_UNKNOWN, "Unknown", NULL } { NULL, SUB_TYPE_UNKNOWN, "Unknown", NULL }
}; };
...@@ -621,7 +619,7 @@ static int Open ( vlc_object_t *p_this ) ...@@ -621,7 +619,7 @@ static int Open ( vlc_object_t *p_this )
} }
else if( !strncasecmp( s, "WEBVTT",6 ) ) else if( !strncasecmp( s, "WEBVTT",6 ) )
{ {
p_sys->props.i_type = SUB_TYPE_VTT; /* FAIL */
break; break;
} }
else if( !strncasecmp( s, "Scenarist_SCC V1.0", 18 ) ) else if( !strncasecmp( s, "Scenarist_SCC V1.0", 18 ) )
...@@ -2330,12 +2328,12 @@ static int ParseSubViewer1( vlc_object_t *p_obj, subs_properties_t *p_props, ...@@ -2330,12 +2328,12 @@ static int ParseSubViewer1( vlc_object_t *p_obj, subs_properties_t *p_props,
return VLC_SUCCESS; return VLC_SUCCESS;
} }
/* Common code for VTT/SBV since they just differ in timestamps */ static int ParseCommonSBV( vlc_object_t *p_obj, subs_properties_t *p_props,
static int ParseCommonVTTSBV( vlc_object_t *p_obj, subs_properties_t *p_props, text_t *txt, subtitle_t *p_subtitle, size_t i_idx )
text_t *txt, subtitle_t *p_subtitle, size_t i_idx )
{ {
VLC_UNUSED(p_obj); VLC_UNUSED(p_obj);
VLC_UNUSED( i_idx ); VLC_UNUSED( i_idx );
VLC_UNUSED( p_props );
char *psz_text; char *psz_text;
for( ;; ) for( ;; )
...@@ -2347,33 +2345,9 @@ static int ParseCommonVTTSBV( vlc_object_t *p_obj, subs_properties_t *p_props, ...@@ -2347,33 +2345,9 @@ static int ParseCommonVTTSBV( vlc_object_t *p_obj, subs_properties_t *p_props,
if( !s ) if( !s )
return VLC_EGENERIC; return VLC_EGENERIC;
bool b_matched = false; if( sscanf( s,"%d:%d:%d.%d,%d:%d:%d.%d",
&h1, &m1, &s1, &d1,
if( p_props->i_type == SUB_TYPE_VTT ) &h2, &m2, &s2, &d2 ) == 8 )
{
b_matched =
( sscanf( s,"%d:%d.%d --> %d:%d.%d",
&m1, &s1, &d1,
&m2, &s2, &d2 ) == 6 ||
sscanf( s,"%d:%d.%d --> %d:%d:%d.%d",
&m1, &s1, &d1,
&h2, &m2, &s2, &d2 ) == 7 ||
sscanf( s,"%d:%d:%d.%d --> %d:%d.%d",
&h1, &m1, &s1, &d1,
&m2, &s2, &d2 ) == 7 ||
sscanf( s,"%d:%d:%d.%d --> %d:%d:%d.%d",
&h1, &m1, &s1, &d1,
&h2, &m2, &s2, &d2 ) == 8 );
}
else if( p_props->i_type == SUB_TYPE_SBV )
{
b_matched =
( sscanf( s,"%d:%d:%d.%d,%d:%d:%d.%d",
&h1, &m1, &s1, &d1,
&h2, &m2, &s2, &d2 ) == 8 );
}
if( b_matched )
{ {
p_subtitle->i_start = ( (int64_t)h1 * 3600 * 1000 + p_subtitle->i_start = ( (int64_t)h1 * 3600 * 1000 +
(int64_t)m1 * 60 * 1000 + (int64_t)m1 * 60 * 1000 +
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment