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
093db7f8
Commit
093db7f8
authored
Apr 27, 2011
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Used decoder_NewSubpictureText to render SRT subtitles.
parent
585d5b48
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
32 deletions
+12
-32
modules/codec/Modules.am
modules/codec/Modules.am
+1
-1
modules/codec/subsdec.c
modules/codec/subsdec.c
+11
-31
No files found.
modules/codec/Modules.am
View file @
093db7f8
...
...
@@ -33,7 +33,7 @@ SOURCES_kate = kate.c
SOURCES_schroedinger = schroedinger.c
SOURCES_libass = libass.c
SOURCES_aes3 = aes3.c
SOURCES_subsdec = subsdec.c
SOURCES_subsdec = subsdec.c
substext.h
SOURCES_subsusf = subsusf.c
SOURCES_t140 = t140.c
SOURCES_crystalhd = crystalhd.c
...
...
modules/codec/subsdec.c
View file @
093db7f8
...
...
@@ -36,6 +36,8 @@
#include <vlc_codec.h>
#include <vlc_charset.h>
#include "substext.h"
/*****************************************************************************
* Module descriptor.
*****************************************************************************/
...
...
@@ -370,7 +372,6 @@ static subpicture_t *ParseText( decoder_t *p_dec, block_t *p_block )
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
subpicture_t
*
p_spu
=
NULL
;
char
*
psz_subtitle
=
NULL
;
video_format_t
fmt
;
/* We cannot display a subpicture with no date */
if
(
p_block
->
i_pts
<=
VLC_TS_INVALID
)
...
...
@@ -449,45 +450,24 @@ static subpicture_t *ParseText( decoder_t *p_dec, block_t *p_block )
}
/* Create the subpicture unit */
p_spu
=
decoder_NewSubpicture
(
p_dec
,
NULL
);
p_spu
=
decoder_NewSubpicture
Text
(
p_dec
);
if
(
!
p_spu
)
{
msg_Warn
(
p_dec
,
"can't get spu buffer"
);
free
(
psz_subtitle
);
return
NULL
;
}
/* Create a new subpicture region */
memset
(
&
fmt
,
0
,
sizeof
(
video_format_t
)
);
fmt
.
i_chroma
=
VLC_CODEC_TEXT
;
fmt
.
i_width
=
fmt
.
i_height
=
0
;
fmt
.
i_x_offset
=
fmt
.
i_y_offset
=
0
;
p_spu
->
p_region
=
subpicture_region_New
(
&
fmt
);
if
(
!
p_spu
->
p_region
)
{
msg_Err
(
p_dec
,
"cannot allocate SPU region"
);
free
(
psz_subtitle
);
decoder_DeleteSubpicture
(
p_dec
,
p_spu
);
return
NULL
;
}
/* Normal text subs, easy markup */
p_spu
->
p_region
->
i_align
=
SUBPICTURE_ALIGN_BOTTOM
|
p_sys
->
i_align
;
p_spu
->
p_region
->
i_x
=
p_sys
->
i_align
?
20
:
0
;
p_spu
->
p_region
->
i_y
=
10
;
/* Remove formatting from string */
p_spu
->
p_region
->
psz_text
=
StripTags
(
psz_subtitle
);
if
(
var_InheritBool
(
p_dec
,
"subsdec-formatted"
)
)
{
p_spu
->
p_region
->
psz_html
=
CreateHtmlSubtitle
(
&
p_spu
->
p_region
->
i_align
,
psz_subtitle
);
}
p_spu
->
i_start
=
p_block
->
i_pts
;
p_spu
->
i_stop
=
p_block
->
i_pts
+
p_block
->
i_length
;
p_spu
->
b_ephemer
=
(
p_block
->
i_length
==
0
);
p_spu
->
b_absolute
=
false
;
subpicture_updater_sys_t
*
p_spu_sys
=
p_spu
->
updater
.
p_sys
;
p_spu_sys
->
align
=
SUBPICTURE_ALIGN_BOTTOM
|
p_sys
->
i_align
;
p_spu_sys
->
text
=
StripTags
(
psz_subtitle
);
if
(
var_InheritBool
(
p_dec
,
"subsdec-formatted"
)
)
p_spu_sys
->
html
=
CreateHtmlSubtitle
(
&
p_spu_sys
->
align
,
psz_subtitle
);
free
(
psz_subtitle
);
return
p_spu
;
...
...
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