Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
0ea77dfd
Commit
0ea77dfd
authored
Apr 13, 2009
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for buggy SubRip files that use dot instead of comma.
parent
832ce82d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
+23
-0
modules/demux/subtitle.c
modules/demux/subtitle.c
+23
-0
No files found.
modules/demux/subtitle.c
View file @
0ea77dfd
...
@@ -98,6 +98,7 @@ enum
...
@@ -98,6 +98,7 @@ enum
SUB_TYPE_UNKNOWN
=
-
1
,
SUB_TYPE_UNKNOWN
=
-
1
,
SUB_TYPE_MICRODVD
,
SUB_TYPE_MICRODVD
,
SUB_TYPE_SUBRIP
,
SUB_TYPE_SUBRIP
,
SUB_TYPE_SUBRIP_DOT
,
/* Invalid SubRip file (dot instead of comma) */
SUB_TYPE_SSA1
,
SUB_TYPE_SSA1
,
SUB_TYPE_SSA2_4
,
SUB_TYPE_SSA2_4
,
SUB_TYPE_ASS
,
SUB_TYPE_ASS
,
...
@@ -172,6 +173,7 @@ struct demux_sys_t
...
@@ -172,6 +173,7 @@ struct demux_sys_t
static
int
ParseMicroDvd
(
demux_t
*
,
subtitle_t
*
,
int
);
static
int
ParseMicroDvd
(
demux_t
*
,
subtitle_t
*
,
int
);
static
int
ParseSubRip
(
demux_t
*
,
subtitle_t
*
,
int
);
static
int
ParseSubRip
(
demux_t
*
,
subtitle_t
*
,
int
);
static
int
ParseSubRipDot
(
demux_t
*
,
subtitle_t
*
,
int
);
static
int
ParseSubViewer
(
demux_t
*
,
subtitle_t
*
,
int
);
static
int
ParseSubViewer
(
demux_t
*
,
subtitle_t
*
,
int
);
static
int
ParseSSA
(
demux_t
*
,
subtitle_t
*
,
int
);
static
int
ParseSSA
(
demux_t
*
,
subtitle_t
*
,
int
);
static
int
ParseVplayer
(
demux_t
*
,
subtitle_t
*
,
int
);
static
int
ParseVplayer
(
demux_t
*
,
subtitle_t
*
,
int
);
...
@@ -197,6 +199,7 @@ static const struct
...
@@ -197,6 +199,7 @@ static const struct
{
{
{
"microdvd"
,
SUB_TYPE_MICRODVD
,
"MicroDVD"
,
ParseMicroDvd
},
{
"microdvd"
,
SUB_TYPE_MICRODVD
,
"MicroDVD"
,
ParseMicroDvd
},
{
"subrip"
,
SUB_TYPE_SUBRIP
,
"SubRIP"
,
ParseSubRip
},
{
"subrip"
,
SUB_TYPE_SUBRIP
,
"SubRIP"
,
ParseSubRip
},
{
"subrip-dot"
,
SUB_TYPE_SUBRIP_DOT
,
"SubRIP(Dot)"
,
ParseSubRipDot
},
{
"subviewer"
,
SUB_TYPE_SUBVIEWER
,
"SubViewer"
,
ParseSubViewer
},
{
"subviewer"
,
SUB_TYPE_SUBVIEWER
,
"SubViewer"
,
ParseSubViewer
},
{
"ssa1"
,
SUB_TYPE_SSA1
,
"SSA-1"
,
ParseSSA
},
{
"ssa1"
,
SUB_TYPE_SSA1
,
"SSA-1"
,
ParseSSA
},
{
"ssa2-4"
,
SUB_TYPE_SSA2_4
,
"SSA-2/3/4"
,
ParseSSA
},
{
"ssa2-4"
,
SUB_TYPE_SSA2_4
,
"SSA-2/3/4"
,
ParseSSA
},
...
@@ -329,6 +332,15 @@ static int Open ( vlc_object_t *p_this )
...
@@ -329,6 +332,15 @@ static int Open ( vlc_object_t *p_this )
p_sys
->
i_type
=
SUB_TYPE_SUBRIP
;
p_sys
->
i_type
=
SUB_TYPE_SUBRIP
;
break
;
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
)
{
msg_Err
(
p_demux
,
"Detected invalid SubRip file, playing anyway"
);
p_sys
->
i_type
=
SUB_TYPE_SUBRIP_DOT
;
break
;
}
else
if
(
!
strncasecmp
(
s
,
"!: This is a Sub Station Alpha v1"
,
33
)
)
else
if
(
!
strncasecmp
(
s
,
"!: This is a Sub Station Alpha v1"
,
33
)
)
{
{
p_sys
->
i_type
=
SUB_TYPE_SSA1
;
p_sys
->
i_type
=
SUB_TYPE_SSA1
;
...
@@ -947,6 +959,17 @@ static int ParseSubRip( demux_t *p_demux, subtitle_t *p_subtitle,
...
@@ -947,6 +959,17 @@ static int ParseSubRip( demux_t *p_demux, subtitle_t *p_subtitle,
"%d:%d:%d,%d --> %d:%d:%d,%d"
,
"%d:%d:%d,%d --> %d:%d:%d,%d"
,
false
);
false
);
}
}
/* ParseSubRipDot
* Special version for buggy file using '.' instead of ','
*/
static
int
ParseSubRipDot
(
demux_t
*
p_demux
,
subtitle_t
*
p_subtitle
,
int
i_idx
)
{
VLC_UNUSED
(
i_idx
);
return
ParseSubRipSubViewer
(
p_demux
,
p_subtitle
,
"%d:%d:%d.%d --> %d:%d:%d.%d"
,
false
);
}
/* ParseSubViewer
/* ParseSubViewer
*/
*/
static
int
ParseSubViewer
(
demux_t
*
p_demux
,
subtitle_t
*
p_subtitle
,
static
int
ParseSubViewer
(
demux_t
*
p_demux
,
subtitle_t
*
p_subtitle
,
...
...
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