Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
db9ea591
Commit
db9ea591
authored
Sep 10, 2008
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for alignment in subsdec (subrip).
parent
432e45db
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
modules/codec/subtitles/subsdec.c
modules/codec/subtitles/subsdec.c
+16
-3
No files found.
modules/codec/subtitles/subsdec.c
View file @
db9ea591
...
...
@@ -43,7 +43,7 @@ static void CloseDecoder ( vlc_object_t * );
static
subpicture_t
*
DecodeBlock
(
decoder_t
*
,
block_t
**
);
static
subpicture_t
*
ParseText
(
decoder_t
*
,
block_t
*
);
static
char
*
StripTags
(
char
*
);
static
char
*
CreateHtmlSubtitle
(
char
*
);
static
char
*
CreateHtmlSubtitle
(
int
*
pi_align
,
char
*
);
/*****************************************************************************
...
...
@@ -437,7 +437,7 @@ static subpicture_t *ParseText( decoder_t *p_dec, block_t *p_block )
p_spu
->
p_region
->
psz_text
=
StripTags
(
psz_subtitle
);
if
(
var_CreateGetBool
(
p_dec
,
"subsdec-formatted"
)
)
{
p_spu
->
p_region
->
psz_html
=
CreateHtmlSubtitle
(
psz_subtitle
);
p_spu
->
p_region
->
psz_html
=
CreateHtmlSubtitle
(
&
p_spu
->
p_region
->
i_align
,
psz_subtitle
);
}
p_spu
->
i_start
=
p_block
->
i_pts
;
...
...
@@ -595,7 +595,7 @@ static void HtmlCopy( char **ppsz_html, char **ppsz_subtitle, const char *psz_te
*
ppsz_subtitle
+=
strlen
(
psz_text
);
}
static
char
*
CreateHtmlSubtitle
(
char
*
psz_subtitle
)
static
char
*
CreateHtmlSubtitle
(
int
*
pi_align
,
char
*
psz_subtitle
)
{
char
*
psz_tag
=
malloc
(
(
strlen
(
psz_subtitle
)
/
3
)
+
1
);
if
(
!
psz_tag
)
return
NULL
;
...
...
@@ -615,6 +615,19 @@ static char *CreateHtmlSubtitle( char *psz_subtitle )
strcpy
(
psz_html
,
"<text>"
);
psz_html
+=
6
;
/* Check for forced alignment */
if
(
!
strncmp
(
psz_subtitle
,
"{
\\
an"
,
4
)
&&
psz_subtitle
[
4
]
>=
'1'
&&
psz_subtitle
[
4
]
<=
'9'
&&
psz_subtitle
[
5
]
==
'}'
)
{
static
const
pi_vertical
[
3
]
=
{
SUBPICTURE_ALIGN_BOTTOM
,
0
,
SUBPICTURE_ALIGN_TOP
};
static
const
pi_horizontal
[
3
]
=
{
SUBPICTURE_ALIGN_LEFT
,
0
,
SUBPICTURE_ALIGN_RIGHT
};
const
int
i_id
=
psz_subtitle
[
4
]
-
'1'
;
*
pi_align
=
pi_vertical
[
i_id
/
3
]
|
pi_horizontal
[
i_id
%
3
];
psz_subtitle
+=
6
;
}
/* */
while
(
*
psz_subtitle
)
{
if
(
*
psz_subtitle
==
'\n'
)
...
...
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