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
47b6f761
Commit
47b6f761
authored
May 19, 2008
by
Jean-Baptiste Kempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Multi-line support for JacoSub.
parent
85ca5599
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
114 additions
and
99 deletions
+114
-99
modules/demux/subtitle.c
modules/demux/subtitle.c
+114
-99
No files found.
modules/demux/subtitle.c
View file @
47b6f761
...
...
@@ -1333,7 +1333,7 @@ static int ParseAQT( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx )
/* We have been too far: end of the subtitle, begin of next */
else
{
txt
->
i_line
--
;
TextPreviousLine
(
txt
)
;
break
;
}
}
...
...
@@ -1505,10 +1505,10 @@ static int ParseJSS( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx )
if
(
!
s
)
return
VLC_EGENERIC
;
psz_
text
=
malloc
(
strlen
(
s
)
+
1
);
if
(
!
psz_
text
)
psz_
orig
=
malloc
(
strlen
(
s
)
+
1
);
if
(
!
psz_
orig
)
return
VLC_ENOMEM
;
psz_
orig
=
psz_text
;
psz_
text
=
psz_orig
;
/* Complete time lines */
if
(
sscanf
(
s
,
"%d:%d:%d.%d %d:%d:%d.%d %[^
\n\r
]"
,
...
...
@@ -1520,6 +1520,7 @@ static int ParseJSS( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx )
p_subtitle
->
i_stop
=
(
(
int64_t
)(
h2
*
3600
+
m2
*
60
+
s2
)
+
(
int64_t
)(
(
f2
+
jss_time_shift
)
/
jss_time_resolution
)
)
*
1000000
;
break
;
}
/* Short time lines */
else
if
(
sscanf
(
s
,
"@%d @%d %[^
\n\r
]"
,
&
f1
,
&
f2
,
psz_text
)
==
3
)
...
...
@@ -1528,6 +1529,7 @@ static int ParseJSS( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx )
(
f1
+
jss_time_shift
)
/
jss_time_resolution
*
1000000
.
0
);
p_subtitle
->
i_stop
=
(
int64_t
)(
(
f2
+
jss_time_shift
)
/
jss_time_resolution
*
1000000
.
0
);
break
;
}
/* General Directive lines */
/* Only TIME and SHIFT are supported so far */
...
...
@@ -1584,15 +1586,37 @@ static int ParseJSS( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx )
sscanf
(
&
psz_text
[
shift
],
"%d"
,
&
jss_time_resolution
);
break
;
}
free
(
psz_
text
);
free
(
psz_
orig
);
continue
;
}
else
/* Unkown type line, probably a comment */
{
free
(
psz_
text
);
free
(
psz_
orig
);
continue
;
}
}
while
(
psz_text
[
strlen
(
psz_text
)
-
1
]
==
'\\'
)
{
const
char
*
s2
=
TextGetLine
(
txt
);
if
(
!
s2
)
return
VLC_EGENERIC
;
int
i_len
=
strlen
(
s2
);
if
(
i_len
==
0
)
break
;
int
i_old
=
strlen
(
psz_text
);
psz_text
=
realloc
(
psz_text
,
i_old
+
i_len
+
1
);
if
(
!
psz_text
)
return
VLC_ENOMEM
;
psz_orig
=
psz_text
;
strcat
(
psz_text
,
s2
);
}
/* Skip the blanks */
while
(
*
psz_text
==
' '
||
*
psz_text
==
'\t'
)
psz_text
++
;
...
...
@@ -1612,10 +1636,9 @@ static int ParseJSS( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx )
/* Skip the blanks after directives */
while
(
*
psz_text
==
' '
||
*
psz_text
==
'\t'
)
psz_text
++
;
/* Clean all the lines from inline comments and other stuffs */
psz_text
2
=
calloc
(
strlen
(
psz_text
)
+
1
,
1
);
psz_orig2
=
psz_text
2
;
psz_orig
2
=
calloc
(
strlen
(
psz_text
)
+
1
,
1
);
psz_text2
=
psz_orig
2
;
for
(
;
*
psz_text
!=
'\0'
&&
*
psz_text
!=
'\n'
&&
*
psz_text
!=
'\r'
;
)
{
...
...
@@ -1673,20 +1696,12 @@ static int ParseJSS( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx )
if
(
(
*
(
psz_text
+
1
)
)
==
'~'
||
(
*
(
psz_text
+
1
)
)
==
'{'
||
(
*
(
psz_text
+
1
)
)
==
'\\'
)
psz_text
++
;
else
if
(
*
(
psz_text
+
1
)
==
'\r'
||
*
(
psz_text
+
1
)
==
'\n'
||
*
(
psz_text
+
1
)
==
'\0'
)
else
if
(
*
(
psz_text
+
1
)
==
'\r'
||
*
(
psz_text
+
1
)
==
'\n'
||
*
(
psz_text
+
1
)
==
'\0'
)
{
char
*
s2
=
TextGetLine
(
txt
);
if
(
!
s2
)
return
VLC_EGENERIC
;
while
(
*
s2
==
' '
)
s2
++
;
/* Here to parse the second line, we should add s2 to
psz_text and go on the for( ) line 1556 in order to
parse the next line.
*/
psz_text
++
;
}
break
;
default:
if
(
!
i_comment
)
{
...
...
@@ -1698,9 +1713,9 @@ static int ParseJSS( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx )
}
p_subtitle
->
psz_text
=
psz_orig2
;
msg_Dbg
(
p_demux
,
"%s"
,
p_subtitle
->
psz_text
);
free
(
psz_orig
);
return
VLC_SUCCESS
;
}
}
static
int
ParsePSB
(
demux_t
*
p_demux
,
subtitle_t
*
p_subtitle
,
int
i_idx
)
...
...
@@ -1837,7 +1852,7 @@ static int ParseRealText( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx )
if
(
strcasestr
(
s
,
"<time"
)
||
strcasestr
(
s
,
"<clear/"
)
)
{
txt
->
i_line
--
;
TextPreviousLine
(
txt
)
;
break
;
}
...
...
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