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
dbbaad32
Commit
dbbaad32
authored
May 04, 2016
by
Martin Storsjö
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
movenc: Provide output bytestream markers for fragmented content
Signed-off-by:
Martin Storsjö
<
martin@martin.st
>
parent
371df9ba
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
0 deletions
+16
-0
movenc.c
libavformat/movenc.c
+16
-0
No files found.
libavformat/movenc.c
View file @
dbbaad32
...
...
@@ -3183,6 +3183,7 @@ static int mov_flush_fragment(AVFormatContext *s, int force)
MOVMuxContext
*
mov
=
s
->
priv_data
;
int
i
,
first_track
=
-
1
;
int64_t
mdat_size
=
0
;
int
has_video
=
0
,
starts_with_key
=
0
,
first_video_track
=
1
;
if
(
!
(
mov
->
flags
&
FF_MOV_FLAG_FRAGMENT
))
return
0
;
...
...
@@ -3235,6 +3236,7 @@ static int mov_flush_fragment(AVFormatContext *s, int force)
for
(
i
=
0
;
i
<
mov
->
nb_streams
;
i
++
)
mov
->
tracks
[
i
].
data_offset
=
pos
+
buf_size
+
8
;
avio_write_marker
(
s
->
pb
,
AV_NOPTS_VALUE
,
AVIO_DATA_MARKER_HEADER
);
if
(
mov
->
flags
&
FF_MOV_FLAG_DELAY_MOOV
)
mov_write_identification
(
s
->
pb
,
s
);
mov_write_moov_tag
(
s
->
pb
,
mov
,
s
);
...
...
@@ -3289,6 +3291,14 @@ static int mov_flush_fragment(AVFormatContext *s, int force)
track
->
data_offset
=
0
;
else
track
->
data_offset
=
mdat_size
;
if
(
track
->
par
->
codec_type
==
AVMEDIA_TYPE_VIDEO
)
{
has_video
=
1
;
if
(
first_video_track
)
{
if
(
track
->
entry
)
starts_with_key
=
track
->
cluster
[
0
].
flags
&
MOV_SYNC_SAMPLE
;
first_video_track
=
0
;
}
}
if
(
!
track
->
entry
)
continue
;
if
(
track
->
mdat_buf
)
...
...
@@ -3300,6 +3310,10 @@ static int mov_flush_fragment(AVFormatContext *s, int force)
if
(
!
mdat_size
)
return
0
;
avio_write_marker
(
s
->
pb
,
av_rescale
(
mov
->
tracks
[
first_track
].
cluster
[
0
].
dts
,
AV_TIME_BASE
,
mov
->
tracks
[
first_track
].
timescale
),
(
has_video
?
starts_with_key
:
mov
->
tracks
[
first_track
].
cluster
[
0
].
flags
&
MOV_SYNC_SAMPLE
)
?
AVIO_DATA_MARKER_SYNC_POINT
:
AVIO_DATA_MARKER_BOUNDARY_POINT
);
for
(
i
=
0
;
i
<
mov
->
nb_streams
;
i
++
)
{
MOVTrack
*
track
=
&
mov
->
tracks
[
i
];
int
buf_size
,
write_moof
=
1
,
moof_tracks
=
-
1
;
...
...
@@ -4284,9 +4298,11 @@ static int mov_write_trailer(AVFormatContext *s)
avio_seek
(
pb
,
mov
->
reserved_header_pos
,
SEEK_SET
);
mov_write_sidx_tags
(
pb
,
mov
,
-
1
,
0
);
avio_seek
(
pb
,
end
,
SEEK_SET
);
avio_write_marker
(
s
->
pb
,
AV_NOPTS_VALUE
,
AVIO_DATA_MARKER_TRAILER
);
mov_write_mfra_tag
(
pb
,
mov
);
}
}
else
{
avio_write_marker
(
s
->
pb
,
AV_NOPTS_VALUE
,
AVIO_DATA_MARKER_TRAILER
);
mov_write_mfra_tag
(
pb
,
mov
);
}
}
...
...
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