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
55a1d75b
Commit
55a1d75b
authored
Apr 04, 2015
by
Rodger Combs
Committed by
Michael Niedermayer
Apr 16, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavf/assenc: handle extra sections after Events
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
e224aa41
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
2 deletions
+26
-2
assenc.c
libavformat/assenc.c
+26
-2
No files found.
libavformat/assenc.c
View file @
55a1d75b
...
...
@@ -40,6 +40,8 @@ typedef struct ASSContext {
int
cache_size
;
int
ssa_mode
;
int
ignore_readorder
;
uint8_t
*
trailer
;
size_t
trailer_size
;
}
ASSContext
;
static
int
write_header
(
AVFormatContext
*
s
)
...
...
@@ -55,8 +57,23 @@ static int write_header(AVFormatContext *s)
ass
->
write_ts
=
avctx
->
codec_id
==
AV_CODEC_ID_ASS
;
avpriv_set_pts_info
(
s
->
streams
[
0
],
64
,
1
,
100
);
if
(
avctx
->
extradata_size
>
0
)
{
avio_write
(
s
->
pb
,
avctx
->
extradata
,
avctx
->
extradata_size
);
if
(
avctx
->
extradata
[
avctx
->
extradata_size
-
1
]
!=
'\n'
)
size_t
header_size
=
avctx
->
extradata_size
;
uint8_t
*
trailer
=
strstr
(
avctx
->
extradata
,
"
\n
[Events]"
);
if
(
trailer
)
trailer
=
strstr
(
trailer
,
"Format:"
);
if
(
trailer
)
trailer
=
strstr
(
trailer
,
"
\n
"
);
if
(
trailer
++
)
{
header_size
=
(
trailer
-
avctx
->
extradata
);
ass
->
trailer_size
=
avctx
->
extradata_size
-
header_size
;
if
(
ass
->
trailer_size
)
ass
->
trailer
=
trailer
;
}
avio_write
(
s
->
pb
,
avctx
->
extradata
,
header_size
);
if
(
avctx
->
extradata
[
header_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]"
))
...
...
@@ -192,7 +209,14 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
static
int
write_trailer
(
AVFormatContext
*
s
)
{
ASSContext
*
ass
=
s
->
priv_data
;
purge_dialogues
(
s
,
1
);
if
(
ass
->
trailer
)
{
avio_write
(
s
->
pb
,
ass
->
trailer
,
ass
->
trailer_size
);
}
return
0
;
}
...
...
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