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
68cea1bc
Commit
68cea1bc
authored
May 14, 2014
by
Gaullier Nicolas
Committed by
Michael Niedermayer
May 16, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
estimate_timings_from_pts: Try to get the duration for all streams
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
424599c7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
4 deletions
+15
-4
utils.c
libavformat/utils.c
+15
-4
No files found.
libavformat/utils.c
View file @
68cea1bc
...
...
@@ -2469,7 +2469,7 @@ static void estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset)
AVPacket
pkt1
,
*
pkt
=
&
pkt1
;
AVStream
*
st
;
int
read_size
,
i
,
ret
;
int
64_t
end_time
;
int
all_duration_valid
=
0
;
int64_t
filesize
,
offset
,
duration
;
int
retry
=
0
;
...
...
@@ -2493,7 +2493,6 @@ static void estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset)
/* estimate the end time (duration) */
/* XXX: may need to support wrapping */
filesize
=
ic
->
pb
?
avio_size
(
ic
->
pb
)
:
0
;
end_time
=
AV_NOPTS_VALUE
;
do
{
offset
=
filesize
-
(
DURATION_MAX_READ_SIZE
<<
retry
);
if
(
offset
<
0
)
...
...
@@ -2515,7 +2514,7 @@ static void estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset)
if
(
pkt
->
pts
!=
AV_NOPTS_VALUE
&&
(
st
->
start_time
!=
AV_NOPTS_VALUE
||
st
->
first_dts
!=
AV_NOPTS_VALUE
))
{
duration
=
end_time
=
pkt
->
pts
+
pkt
->
duration
;
duration
=
pkt
->
pts
+
pkt
->
duration
;
if
(
st
->
start_time
!=
AV_NOPTS_VALUE
)
duration
-=
st
->
start_time
;
else
...
...
@@ -2529,7 +2528,19 @@ static void estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset)
}
av_free_packet
(
pkt
);
}
}
while
(
end_time
==
AV_NOPTS_VALUE
&&
/* check if all audio/video streams have valid duration */
all_duration_valid
=
1
;
for
(
i
=
0
;
i
<
ic
->
nb_streams
;
i
++
)
{
st
=
ic
->
streams
[
i
];
switch
(
st
->
codec
->
codec_type
)
{
case
AVMEDIA_TYPE_VIDEO
:
case
AVMEDIA_TYPE_AUDIO
:
if
(
st
->
duration
==
AV_NOPTS_VALUE
)
all_duration_valid
=
0
;
}
}
}
while
(
!
all_duration_valid
&&
offset
&&
++
retry
<=
DURATION_MAX_RETRY
);
...
...
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