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
8c0f565e
Commit
8c0f565e
authored
Oct 07, 2013
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avformat/movenc: factor out find_fps()
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
2dce4abe
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
8 deletions
+14
-8
movenc.c
libavformat/movenc.c
+14
-8
No files found.
libavformat/movenc.c
View file @
8c0f565e
...
...
@@ -884,6 +884,19 @@ static int mov_get_dv_codec_tag(AVFormatContext *s, MOVTrack *track)
return
tag
;
}
static
AVRational
find_fps
(
AVFormatContext
*
s
,
AVStream
*
st
)
{
AVRational
rate
=
{
st
->
codec
->
time_base
.
den
,
st
->
codec
->
time_base
.
num
};
/* if the codec time base makes no sense, try to fallback on stream frame rate */
if
(
av_timecode_check_frame_rate
(
rate
)
<
0
)
{
av_log
(
s
,
AV_LOG_DEBUG
,
"timecode: tbc=%d/%d invalid, fallback on %d/%d
\n
"
,
rate
.
num
,
rate
.
den
,
st
->
avg_frame_rate
.
num
,
st
->
avg_frame_rate
.
den
);
rate
=
st
->
avg_frame_rate
;
}
return
rate
;
}
static
const
struct
{
enum
AVPixelFormat
pix_fmt
;
uint32_t
tag
;
...
...
@@ -3490,14 +3503,7 @@ static int mov_create_timecode_track(AVFormatContext *s, int index, int src_inde
AVStream
*
src_st
=
s
->
streams
[
src_index
];
AVTimecode
tc
;
AVPacket
pkt
=
{.
stream_index
=
index
,
.
flags
=
AV_PKT_FLAG_KEY
,
.
size
=
4
};
AVRational
rate
=
{
src_st
->
codec
->
time_base
.
den
,
src_st
->
codec
->
time_base
.
num
};
/* if the codec time base makes no sense, try to fallback on stream frame rate */
if
(
av_timecode_check_frame_rate
(
rate
)
<
0
)
{
av_log
(
s
,
AV_LOG_DEBUG
,
"timecode: tbc=%d/%d invalid, fallback on %d/%d
\n
"
,
rate
.
num
,
rate
.
den
,
src_st
->
avg_frame_rate
.
num
,
src_st
->
avg_frame_rate
.
den
);
rate
=
src_st
->
avg_frame_rate
;
}
AVRational
rate
=
find_fps
(
s
,
src_st
);
/* compute the frame number */
ret
=
av_timecode_init_from_string
(
&
tc
,
rate
,
tcstr
,
s
);
...
...
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