Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
e17a2aba
Commit
e17a2aba
authored
12 years ago
by
Clément Bœsch
Committed by
Clément Bœsch
12 years ago
Browse files
Options
Downloads
Patches
Plain Diff
lavf/movenc: add get_moov_size and use it in fragment code.
This function will be re-used in the following commits.
parent
65f7aee6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libavformat/movenc.c
+18
-9
18 additions, 9 deletions
libavformat/movenc.c
with
18 additions
and
9 deletions
libavformat/movenc.c
+
18
−
9
View file @
e17a2aba
...
@@ -2876,6 +2876,21 @@ static void mov_parse_vc1_frame(AVPacket *pkt, MOVTrack *trk, int fragment)
...
@@ -2876,6 +2876,21 @@ static void mov_parse_vc1_frame(AVPacket *pkt, MOVTrack *trk, int fragment)
}
}
}
}
static
int
get_moov_size
(
AVFormatContext
*
s
)
{
int
ret
;
uint8_t
*
buf
;
AVIOContext
*
moov_buf
;
MOVMuxContext
*
mov
=
s
->
priv_data
;
if
((
ret
=
avio_open_dyn_buf
(
&
moov_buf
))
<
0
)
return
ret
;
mov_write_moov_tag
(
moov_buf
,
mov
,
s
);
ret
=
avio_close_dyn_buf
(
moov_buf
,
&
buf
);
av_free
(
buf
);
return
ret
;
}
static
int
mov_flush_fragment
(
AVFormatContext
*
s
)
static
int
mov_flush_fragment
(
AVFormatContext
*
s
)
{
{
MOVMuxContext
*
mov
=
s
->
priv_data
;
MOVMuxContext
*
mov
=
s
->
priv_data
;
...
@@ -2887,10 +2902,8 @@ static int mov_flush_fragment(AVFormatContext *s)
...
@@ -2887,10 +2902,8 @@ static int mov_flush_fragment(AVFormatContext *s)
if
(
!
(
mov
->
flags
&
FF_MOV_FLAG_EMPTY_MOOV
)
&&
mov
->
fragments
==
0
)
{
if
(
!
(
mov
->
flags
&
FF_MOV_FLAG_EMPTY_MOOV
)
&&
mov
->
fragments
==
0
)
{
int64_t
pos
=
avio_tell
(
s
->
pb
);
int64_t
pos
=
avio_tell
(
s
->
pb
);
int
ret
;
AVIOContext
*
moov_buf
;
uint8_t
*
buf
;
uint8_t
*
buf
;
int
buf_size
;
int
buf_size
,
moov_size
;
for
(
i
=
0
;
i
<
mov
->
nb_streams
;
i
++
)
for
(
i
=
0
;
i
<
mov
->
nb_streams
;
i
++
)
if
(
!
mov
->
tracks
[
i
].
entry
)
if
(
!
mov
->
tracks
[
i
].
entry
)
...
@@ -2899,13 +2912,9 @@ static int mov_flush_fragment(AVFormatContext *s)
...
@@ -2899,13 +2912,9 @@ static int mov_flush_fragment(AVFormatContext *s)
if
(
i
<
mov
->
nb_streams
)
if
(
i
<
mov
->
nb_streams
)
return
0
;
return
0
;
if
((
ret
=
avio_open_dyn_buf
(
&
moov_buf
))
<
0
)
moov_size
=
get_moov_size
(
s
);
return
ret
;
mov_write_moov_tag
(
moov_buf
,
mov
,
s
);
buf_size
=
avio_close_dyn_buf
(
moov_buf
,
&
buf
);
av_free
(
buf
);
for
(
i
=
0
;
i
<
mov
->
nb_streams
;
i
++
)
for
(
i
=
0
;
i
<
mov
->
nb_streams
;
i
++
)
mov
->
tracks
[
i
].
data_offset
=
pos
+
buf
_size
+
8
;
mov
->
tracks
[
i
].
data_offset
=
pos
+
moov
_size
+
8
;
mov_write_moov_tag
(
s
->
pb
,
mov
,
s
);
mov_write_moov_tag
(
s
->
pb
,
mov
,
s
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment