Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
3e8235d4
Commit
3e8235d4
authored
Aug 06, 2015
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demux: subtitle: add support for SBV (fix #15180)
parent
8d69d2a3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
20 deletions
+45
-20
NEWS
NEWS
+1
-0
modules/demux/subtitle.c
modules/demux/subtitle.c
+43
-19
src/input/subtitles.c
src/input/subtitles.c
+1
-1
No files found.
NEWS
View file @
3e8235d4
...
...
@@ -57,6 +57,7 @@ Demuxers:
* Support Daala in Ogg
* Important rework of the MP4 demuxer, including fragments
* Support EIA-608 subtitles in MP4/mov
* Support SBV subtitles
* Support WMV and WMAV in MP4/mov, aka Flip4Mac files
* Support bitmap audio channel reordering in MP4/mov
* Support AlbumArtist and DiscNumber metadata
...
...
modules/demux/subtitle.c
View file @
3e8235d4
...
...
@@ -63,7 +63,7 @@ static const char *const ppsz_sub_type[] =
"auto"
,
"microdvd"
,
"subrip"
,
"subviewer"
,
"ssa1"
,
"ssa2-4"
,
"ass"
,
"vplayer"
,
"sami"
,
"dvdsubtitle"
,
"mpl2"
,
"aqt"
,
"pjs"
,
"mpsub"
,
"jacosub"
,
"psb"
,
"realtext"
,
"dks"
,
"subviewer1"
,
"vtt
"
"subviewer1"
,
"vtt"
,
"sbv
"
};
vlc_module_begin
()
...
...
@@ -113,7 +113,8 @@ enum
SUB_TYPE_DKS
,
SUB_TYPE_SUBVIEW1
,
/* SUBVIEWER 1 - mplayer calls it subrip09,
and Gnome subtitles SubViewer 1.0 */
SUB_TYPE_VTT
SUB_TYPE_VTT
,
SUB_TYPE_SBV
};
typedef
struct
...
...
@@ -185,7 +186,7 @@ static int ParsePSB ( demux_t *, subtitle_t *, int );
static
int
ParseRealText
(
demux_t
*
,
subtitle_t
*
,
int
);
static
int
ParseDKS
(
demux_t
*
,
subtitle_t
*
,
int
);
static
int
ParseSubViewer1
(
demux_t
*
,
subtitle_t
*
,
int
);
static
int
Parse
VTT
(
demux_t
*
,
subtitle_t
*
,
int
);
static
int
Parse
CommonVTTSBV
(
demux_t
*
,
subtitle_t
*
,
int
);
static
const
struct
{
...
...
@@ -213,7 +214,8 @@ static const struct
{
"realtext"
,
SUB_TYPE_RT
,
"RealText"
,
ParseRealText
},
{
"dks"
,
SUB_TYPE_DKS
,
"DKS"
,
ParseDKS
},
{
"subviewer1"
,
SUB_TYPE_SUBVIEW1
,
"Subviewer 1"
,
ParseSubViewer1
},
{
"text/vtt"
,
SUB_TYPE_VTT
,
"WebVTT"
,
ParseVTT
},
{
"text/vtt"
,
SUB_TYPE_VTT
,
"WebVTT"
,
ParseCommonVTTSBV
},
{
"sbv"
,
SUB_TYPE_SBV
,
"SBV"
,
ParseCommonVTTSBV
},
{
NULL
,
SUB_TYPE_UNKNOWN
,
"Unknown"
,
NULL
}
};
/* When adding support for more formats, be sure to add their file extension
...
...
@@ -397,6 +399,13 @@ static int Open ( vlc_object_t *p_this )
p_sys
->
i_type
=
SUB_TYPE_JACOSUB
;
break
;
}
else
if
(
sscanf
(
s
,
"%d:%d:%d.%d,%d:%d:%d.%d"
,
&
i_dummy
,
&
i_dummy
,
&
i_dummy
,
&
i_dummy
,
&
i_dummy
,
&
i_dummy
,
&
i_dummy
,
&
i_dummy
)
==
8
)
{
p_sys
->
i_type
=
SUB_TYPE_SBV
;
break
;
}
else
if
(
sscanf
(
s
,
"%d:%d:%d:"
,
&
i_dummy
,
&
i_dummy
,
&
i_dummy
)
==
3
||
sscanf
(
s
,
"%d:%d:%d "
,
&
i_dummy
,
&
i_dummy
,
&
i_dummy
)
==
3
)
{
...
...
@@ -2162,11 +2171,11 @@ static int ParseSubViewer1( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx
return
VLC_SUCCESS
;
}
/*Parsing WebVTT */
static
int
ParseVTT
(
demux_t
*
p_demux
,
subtitle_t
*
p_subtitle
,
int
i_idx
)
/* Common code for VTT/SBV since they just differ in timestamps */
static
int
ParseCommonVTTSBV
(
demux_t
*
p_demux
,
subtitle_t
*
p_subtitle
,
int
i_idx
)
{
VLC_UNUSED
(
i_idx
);
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
text_t
*
txt
=
&
p_sys
->
txt
;
char
*
psz_text
;
...
...
@@ -2180,7 +2189,12 @@ static int ParseVTT( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx )
if
(
!
s
)
return
VLC_EGENERIC
;
if
(
sscanf
(
s
,
"%d:%d:%d.%d --> %d:%d:%d.%d"
,
bool
b_matched
=
false
;
if
(
p_sys
->
i_type
==
SUB_TYPE_VTT
)
{
b_matched
=
(
sscanf
(
s
,
"%d:%d:%d.%d --> %d:%d:%d.%d"
,
&
h1
,
&
m1
,
&
s1
,
&
d1
,
&
h2
,
&
m2
,
&
s2
,
&
d2
)
==
8
||
sscanf
(
s
,
"%d:%d:%d.%d --> %d:%d.%d"
,
...
...
@@ -2191,7 +2205,17 @@ static int ParseVTT( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx )
&
h2
,
&
m2
,
&
s2
,
&
d2
)
==
7
||
sscanf
(
s
,
"%d:%d.%d --> %d:%d.%d"
,
&
m1
,
&
s1
,
&
d1
,
&
m2
,
&
s2
,
&
d2
)
==
6
)
&
m2
,
&
s2
,
&
d2
)
==
6
);
}
else
if
(
p_sys
->
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
+
(
int64_t
)
m1
*
60
*
1000
+
...
...
src/input/subtitles.c
View file @
3e8235d4
...
...
@@ -57,7 +57,7 @@ static const char sub_exts[][6] = {
"usf"
,
"jss"
,
"cdg"
,
"psb"
,
"mpsub"
,
"mpl2"
,
"pjs"
,
"dks"
,
"stl"
,
"vtt"
,
""
"vtt"
,
"sbv"
,
""
};
static
void
strcpy_trim
(
char
*
d
,
const
char
*
s
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment