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
5442c6cc
Commit
5442c6cc
authored
Oct 23, 2012
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavf: fix duration estimation for multi program TS
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
31cdf600
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
2 deletions
+31
-2
avformat.h
libavformat/avformat.h
+10
-0
utils.c
libavformat/utils.c
+21
-2
No files found.
libavformat/avformat.h
View file @
5442c6cc
...
...
@@ -862,6 +862,16 @@ typedef struct AVProgram {
int
program_num
;
int
pmt_pid
;
int
pcr_pid
;
/*****************************************************************
* All fields below this line are not part of the public API. They
* may not be used outside of libavformat and can be changed and
* removed at will.
* New public fields should be added right above.
*****************************************************************
*/
int64_t
start_time
;
int64_t
end_time
;
}
AVProgram
;
#define AVFMTCTX_NOHEADER 0x0001
/**< signal that no header is present
...
...
libavformat/utils.c
View file @
5442c6cc
...
...
@@ -2045,6 +2045,7 @@ static void update_stream_timings(AVFormatContext *ic)
int64_t
duration
,
duration1
,
filesize
;
int
i
;
AVStream
*
st
;
AVProgram
*
p
;
start_time
=
INT64_MAX
;
start_time_text
=
INT64_MAX
;
...
...
@@ -2059,11 +2060,18 @@ static void update_stream_timings(AVFormatContext *ic)
start_time_text
=
start_time1
;
}
else
start_time
=
FFMIN
(
start_time
,
start_time1
);
end_time1
=
AV_NOPTS_VALUE
;
if
(
st
->
duration
!=
AV_NOPTS_VALUE
)
{
end_time1
=
start_time1
+
av_rescale_q
(
st
->
duration
,
st
->
time_base
,
AV_TIME_BASE_Q
);
end_time
=
FFMAX
(
end_time
,
end_time1
);
}
for
(
p
=
NULL
;
(
p
=
av_find_program_from_stream
(
ic
,
p
,
i
));
){
if
(
p
->
start_time
==
AV_NOPTS_VALUE
||
p
->
start_time
>
start_time1
)
p
->
start_time
=
start_time1
;
if
(
p
->
end_time
<
end_time1
)
p
->
end_time
=
end_time1
;
}
}
if
(
st
->
duration
!=
AV_NOPTS_VALUE
)
{
duration1
=
av_rescale_q
(
st
->
duration
,
st
->
time_base
,
AV_TIME_BASE_Q
);
...
...
@@ -2077,8 +2085,16 @@ static void update_stream_timings(AVFormatContext *ic)
if
(
start_time
!=
INT64_MAX
)
{
ic
->
start_time
=
start_time
;
if
(
end_time
!=
INT64_MIN
)
duration
=
FFMAX
(
duration
,
end_time
-
start_time
);
if
(
end_time
!=
INT64_MIN
)
{
if
(
ic
->
nb_programs
)
{
for
(
i
=
0
;
i
<
ic
->
nb_programs
;
i
++
)
{
p
=
ic
->
programs
[
i
];
if
(
p
->
start_time
!=
AV_NOPTS_VALUE
&&
p
->
end_time
>
p
->
start_time
)
duration
=
FFMAX
(
duration
,
p
->
end_time
-
p
->
start_time
);
}
}
else
duration
=
FFMAX
(
duration
,
end_time
-
start_time
);
}
}
if
(
duration
!=
INT64_MIN
&&
duration
>
0
&&
ic
->
duration
==
AV_NOPTS_VALUE
)
{
ic
->
duration
=
duration
;
...
...
@@ -3162,6 +3178,9 @@ AVProgram *av_new_program(AVFormatContext *ac, int id)
}
program
->
id
=
id
;
program
->
start_time
=
program
->
end_time
=
AV_NOPTS_VALUE
;
return
program
;
}
...
...
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