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
2d6e5849
Commit
2d6e5849
authored
Oct 08, 2014
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavf: switch to AVCodecContext.framerate for demuxing
parent
7ea1b347
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
8 deletions
+10
-8
internal.h
libavformat/internal.h
+1
-1
mux.c
libavformat/mux.c
+1
-1
utils.c
libavformat/utils.c
+8
-6
No files found.
libavformat/internal.h
View file @
2d6e5849
...
...
@@ -323,7 +323,7 @@ int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out,
/**
* Return the frame duration in seconds. Return 0 if not available.
*/
void
ff_compute_frame_duration
(
int
*
pnum
,
int
*
pden
,
AVStream
*
st
,
void
ff_compute_frame_duration
(
AVFormatContext
*
s
,
int
*
pnum
,
int
*
pden
,
AVStream
*
st
,
AVCodecParserContext
*
pc
,
AVPacket
*
pkt
);
unsigned
int
ff_codec_get_tag
(
const
AVCodecTag
*
tags
,
enum
AVCodecID
id
);
...
...
libavformat/mux.c
View file @
2d6e5849
...
...
@@ -265,7 +265,7 @@ static int compute_pkt_fields2(AVFormatContext *s, AVStream *st, AVPacket *pkt)
/* duration field */
if
(
pkt
->
duration
==
0
)
{
ff_compute_frame_duration
(
&
num
,
&
den
,
st
,
NULL
,
pkt
);
ff_compute_frame_duration
(
s
,
&
num
,
&
den
,
st
,
NULL
,
pkt
);
if
(
den
&&
num
)
{
pkt
->
duration
=
av_rescale
(
1
,
num
*
(
int64_t
)
st
->
time_base
.
den
*
st
->
codec
->
ticks_per_frame
,
den
*
(
int64_t
)
st
->
time_base
.
num
);
}
...
...
libavformat/utils.c
View file @
2d6e5849
...
...
@@ -456,9 +456,11 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
/**
* Return the frame duration in seconds. Return 0 if not available.
*/
void
ff_compute_frame_duration
(
int
*
pnum
,
int
*
pden
,
AVStream
*
st
,
void
ff_compute_frame_duration
(
AVFormatContext
*
s
,
int
*
pnum
,
int
*
pden
,
AVStream
*
st
,
AVCodecParserContext
*
pc
,
AVPacket
*
pkt
)
{
AVRational
codec_framerate
=
s
->
iformat
?
st
->
codec
->
framerate
:
av_inv_q
(
st
->
codec
->
time_base
);
int
frame_size
;
*
pnum
=
0
;
...
...
@@ -471,9 +473,9 @@ void ff_compute_frame_duration(int *pnum, int *pden, AVStream *st,
}
else
if
(
st
->
time_base
.
num
*
1000LL
>
st
->
time_base
.
den
)
{
*
pnum
=
st
->
time_base
.
num
;
*
pden
=
st
->
time_base
.
den
;
}
else
if
(
st
->
codec
->
time_base
.
num
*
1000LL
>
st
->
codec
->
time_base
.
den
)
{
*
pnum
=
st
->
codec
->
time_base
.
num
;
*
pden
=
st
->
codec
->
time_base
.
den
;
}
else
if
(
codec_framerate
.
den
*
1000LL
>
codec_framerate
.
num
)
{
*
pnum
=
codec_framerate
.
den
;
*
pden
=
codec_framerate
.
num
;
if
(
pc
&&
pc
->
repeat_pict
)
{
if
(
*
pnum
>
INT_MAX
/
(
1
+
pc
->
repeat_pict
))
*
pden
/=
1
+
pc
->
repeat_pict
;
...
...
@@ -620,7 +622,7 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
}
if
(
pkt
->
duration
==
0
&&
st
->
codec
->
codec_type
!=
AVMEDIA_TYPE_AUDIO
)
{
ff_compute_frame_duration
(
&
num
,
&
den
,
st
,
pc
,
pkt
);
ff_compute_frame_duration
(
s
,
&
num
,
&
den
,
st
,
pc
,
pkt
);
if
(
den
&&
num
)
{
pkt
->
duration
=
av_rescale_rnd
(
1
,
num
*
(
int64_t
)
st
->
time_base
.
den
,
den
*
(
int64_t
)
st
->
time_base
.
num
,
...
...
@@ -683,7 +685,7 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
st
->
codec
->
codec_type
==
AVMEDIA_TYPE_AUDIO
)
{
int
duration
=
pkt
->
duration
;
if
(
!
duration
&&
st
->
codec
->
codec_type
==
AVMEDIA_TYPE_AUDIO
)
{
ff_compute_frame_duration
(
&
num
,
&
den
,
st
,
pc
,
pkt
);
ff_compute_frame_duration
(
s
,
&
num
,
&
den
,
st
,
pc
,
pkt
);
if
(
den
&&
num
)
{
duration
=
av_rescale_rnd
(
1
,
num
*
(
int64_t
)
st
->
time_base
.
den
,
...
...
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