Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
36f89cb8
Commit
36f89cb8
authored
May 02, 2008
by
Jean-Baptiste Kempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support for MPSub.
Only TIME based, not Frame based, yet.
parent
c637ea54
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
1 deletion
+61
-1
modules/demux/subtitle.c
modules/demux/subtitle.c
+61
-1
No files found.
modules/demux/subtitle.c
View file @
36f89cb8
...
...
@@ -102,7 +102,8 @@ enum
SUB_TYPE_DVDSUBTITLE
,
SUB_TYPE_MPL2
,
SUB_TYPE_AQT
,
SUB_TYPE_PJS
SUB_TYPE_PJS
,
SUB_TYPE_MPSUB
};
typedef
struct
...
...
@@ -150,6 +151,7 @@ static int ParseDVDSubtitle( demux_t *, subtitle_t *, int );
static
int
ParseMPL2
(
demux_t
*
,
subtitle_t
*
,
int
);
static
int
ParseAQT
(
demux_t
*
,
subtitle_t
*
,
int
);
static
int
ParsePJS
(
demux_t
*
,
subtitle_t
*
,
int
);
static
int
ParseMPSub
(
demux_t
*
,
subtitle_t
*
,
int
);
static
struct
{
...
...
@@ -171,6 +173,7 @@ static struct
{
"mpl2"
,
SUB_TYPE_MPL2
,
"MPL2"
,
ParseMPL2
},
{
"aqt"
,
SUB_TYPE_AQT
,
"AQTitle"
,
ParseAQT
},
{
"pjs"
,
SUB_TYPE_PJS
,
"PhoenixSub"
,
ParsePJS
},
{
"mpsub"
,
SUB_TYPE_MPSUB
,
"MPSub"
,
ParseMPSub
},
{
NULL
,
SUB_TYPE_UNKNOWN
,
"Unknown"
,
NULL
}
};
...
...
@@ -254,6 +257,7 @@ static int Open ( vlc_object_t *p_this )
for
(
i_try
=
0
;
i_try
<
256
;
i_try
++
)
{
int
i_dummy
;
float
f_dummy
;
if
(
(
s
=
stream_ReadLine
(
p_demux
->
s
)
)
==
NULL
)
break
;
...
...
@@ -325,6 +329,10 @@ static int Open ( vlc_object_t *p_this )
p_sys
->
i_type
=
SUB_TYPE_MPL2
;
break
;
}
else
if
(
sscanf
(
s
,
"%f %f"
,
&
f_dummy
,
&
f_dummy
)
==
2
)
{
p_sys
->
i_type
=
SUB_TYPE_MPSUB
;
}
else
if
(
sscanf
(
s
,
"-->> %d"
,
&
i_dummy
)
==
1
)
{
p_sys
->
i_type
=
SUB_TYPE_AQT
;
...
...
@@ -1327,3 +1335,55 @@ static int ParsePJS( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx )
return
VLC_SUCCESS
;
}
static
float
mpsub_total
=
0
;
static
int
ParseMPSub
(
demux_t
*
p_demux
,
subtitle_t
*
p_subtitle
,
int
i_idx
)
{
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
text_t
*
txt
=
&
p_sys
->
txt
;
char
*
psz_text
=
strdup
(
""
);
for
(
;;
)
{
const
char
*
s
=
TextGetLine
(
txt
);
float
f1
,
f2
;
if
(
!
s
)
return
VLC_EGENERIC
;
/* Data Lines */
if
(
sscanf
(
s
,
"%f %f"
,
&
f1
,
&
f2
)
==
2
)
{
mpsub_total
+=
f1
;
p_subtitle
->
i_start
=
(
int64_t
)(
1000000
.
0
*
mpsub_total
);
mpsub_total
+=
f2
;
p_subtitle
->
i_stop
=
(
int64_t
)(
1000000
.
0
*
mpsub_total
);
break
;
}
}
for
(
;;
)
{
const
char
*
s
=
TextGetLine
(
txt
);
if
(
!
s
)
return
VLC_EGENERIC
;
int
i_len
=
strlen
(
s
);
if
(
i_len
==
0
)
break
;
int
i_old
=
strlen
(
psz_text
);
psz_text
=
realloc
(
psz_text
,
i_old
+
i_len
+
1
+
1
);
if
(
!
psz_text
)
return
VLC_ENOMEM
;
strcat
(
psz_text
,
s
);
strcat
(
psz_text
,
"
\n
"
);
}
p_subtitle
->
psz_text
=
psz_text
;
return
VLC_SUCCESS
;
}
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