Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
2e79843e
Commit
2e79843e
authored
Apr 04, 2020
by
John Stebbins
Committed by
Philip Langdale
Apr 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavc/movtextenc: add alpha tag handling
Signed-off-by:
Philip Langdale
<
philipl@overt.org
>
parent
b847bd95
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
1 deletion
+24
-1
movtextenc.c
libavcodec/movtextenc.c
+24
-1
No files found.
libavcodec/movtextenc.c
View file @
2e79843e
...
...
@@ -351,6 +351,26 @@ static void mov_text_color_cb(void *priv, unsigned int color, unsigned int color
*/
}
static
void
mov_text_alpha_set
(
MovTextContext
*
s
,
uint8_t
alpha
)
{
if
(
!
s
->
style_attributes_temp
||
(
s
->
style_attributes_temp
->
style_color
&
0xff
)
==
alpha
)
{
// color hasn't changed
return
;
}
if
(
mov_text_style_start
(
s
))
s
->
style_attributes_temp
->
style_color
=
(
s
->
style_attributes_temp
->
style_color
&
0xffffff00
)
|
alpha
;
}
static
void
mov_text_alpha_cb
(
void
*
priv
,
int
alpha
,
int
alpha_id
)
{
MovTextContext
*
s
=
priv
;
if
(
alpha_id
==
1
)
// primary alpha changes
mov_text_alpha_set
(
s
,
255
-
alpha
);
}
static
void
mov_text_end_cb
(
void
*
priv
)
{
// End of text, close any open style record
...
...
@@ -360,7 +380,7 @@ static void mov_text_end_cb(void *priv)
static
void
mov_text_dialog
(
MovTextContext
*
s
,
ASSDialog
*
dialog
)
{
ASSStyle
*
style
=
ff_ass_style_get
(
s
->
ass_ctx
,
dialog
->
style
);
uint8_t
style_flags
;
uint8_t
style_flags
,
alpha
;
uint32_t
color
;
if
(
style
)
{
...
...
@@ -370,6 +390,8 @@ static void mov_text_dialog(MovTextContext *s, ASSDialog *dialog)
mov_text_style_set
(
s
,
style_flags
);
color
=
BGR_TO_RGB
(
style
->
primary_color
&
0xffffff
)
<<
8
;
mov_text_color_set
(
s
,
color
);
alpha
=
255
-
((
uint32_t
)
style
->
primary_color
>>
24
);
mov_text_alpha_set
(
s
,
alpha
);
}
}
...
...
@@ -416,6 +438,7 @@ static const ASSCodesCallbacks mov_text_callbacks = {
.
new_line
=
mov_text_new_line_cb
,
.
style
=
mov_text_style_cb
,
.
color
=
mov_text_color_cb
,
.
alpha
=
mov_text_alpha_cb
,
.
end
=
mov_text_end_cb
,
};
...
...
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