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
bf700a99
Commit
bf700a99
authored
Oct 11, 2014
by
Clément Bœsch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avformat/assenc: support remuxing old V4 ASS form (SSA)
parent
b243393e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
assenc.c
libavformat/assenc.c
+9
-2
No files found.
libavformat/assenc.c
View file @
bf700a99
...
...
@@ -35,6 +35,7 @@ typedef struct ASSContext{
DialogueLine
*
dialogue_cache
;
DialogueLine
*
last_added_dialogue
;
int
cache_size
;
int
ssa_mode
;
}
ASSContext
;
static
int
write_header
(
AVFormatContext
*
s
)
...
...
@@ -53,8 +54,10 @@ static int write_header(AVFormatContext *s)
avio_write
(
s
->
pb
,
avctx
->
extradata
,
avctx
->
extradata_size
);
if
(
avctx
->
extradata
[
avctx
->
extradata_size
-
1
]
!=
'\n'
)
avio_write
(
s
->
pb
,
"
\r\n
"
,
2
);
ass
->
ssa_mode
=
!
strstr
(
avctx
->
extradata
,
"
\n
[V4+ Styles]"
);
if
(
!
strstr
(
avctx
->
extradata
,
"
\n
[Events]"
))
avio_printf
(
s
->
pb
,
"[Events]
\r\n
Format: Layer, Start, End, Style, Actor, MarginL, MarginR, MarginV, Effect, Text
\r\n
"
);
avio_printf
(
s
->
pb
,
"[Events]
\r\n
Format: %s, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
\r\n
"
,
ass
->
ssa_mode
?
"Marked"
:
"Layer"
);
}
avio_flush
(
s
->
pb
);
...
...
@@ -154,6 +157,9 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
if
(
*
p
==
','
)
p
++
;
if
(
ass
->
ssa_mode
&&
!
strncmp
(
p
,
"Marked="
,
7
))
p
+=
7
;
layer
=
strtol
(
p
,
&
p
,
10
);
if
(
*
p
==
','
)
p
++
;
...
...
@@ -164,7 +170,8 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
if
(
hh1
>
9
)
hh1
=
9
,
mm1
=
59
,
ss1
=
59
,
ms1
=
99
;
if
(
hh2
>
9
)
hh2
=
9
,
mm2
=
59
,
ss2
=
59
,
ms2
=
99
;
dialogue
->
line
=
av_asprintf
(
"%ld,%d:%02d:%02d.%02d,%d:%02d:%02d.%02d,%s"
,
dialogue
->
line
=
av_asprintf
(
"%s%ld,%d:%02d:%02d.%02d,%d:%02d:%02d.%02d,%s"
,
ass
->
ssa_mode
?
"Marked="
:
""
,
layer
,
hh1
,
mm1
,
ss1
,
ms1
,
hh2
,
mm2
,
ss2
,
ms2
,
p
);
if
(
!
dialogue
->
line
)
{
av_free
(
dialogue
);
...
...
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