Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
d43040e2
Commit
d43040e2
authored
Feb 06, 2012
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avconv: refactor vsync code.
No functional changes, just make it more readable.
parent
493a86e2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
20 deletions
+26
-20
avconv.c
avconv.c
+26
-20
No files found.
avconv.c
View file @
d43040e2
...
@@ -1356,11 +1356,12 @@ static void do_video_out(AVFormatContext *s,
...
@@ -1356,11 +1356,12 @@ static void do_video_out(AVFormatContext *s,
int
nb_frames
,
i
,
ret
,
format_video_sync
;
int
nb_frames
,
i
,
ret
,
format_video_sync
;
AVFrame
*
final_picture
;
AVFrame
*
final_picture
;
AVCodecContext
*
enc
;
AVCodecContext
*
enc
;
double
sync_ipts
;
double
sync_ipts
,
delta
;
enc
=
ost
->
st
->
codec
;
enc
=
ost
->
st
->
codec
;
sync_ipts
=
get_sync_ipts
(
ost
,
in_picture
->
pts
)
/
av_q2d
(
enc
->
time_base
);
sync_ipts
=
get_sync_ipts
(
ost
,
in_picture
->
pts
)
/
av_q2d
(
enc
->
time_base
);
delta
=
sync_ipts
-
ost
->
sync_opts
;
/* by default, we output a single frame */
/* by default, we output a single frame */
nb_frames
=
1
;
nb_frames
=
1
;
...
@@ -1372,31 +1373,36 @@ static void do_video_out(AVFormatContext *s,
...
@@ -1372,31 +1373,36 @@ static void do_video_out(AVFormatContext *s,
format_video_sync
=
(
s
->
oformat
->
flags
&
AVFMT_NOTIMESTAMPS
)
?
VSYNC_PASSTHROUGH
:
format_video_sync
=
(
s
->
oformat
->
flags
&
AVFMT_NOTIMESTAMPS
)
?
VSYNC_PASSTHROUGH
:
(
s
->
oformat
->
flags
&
AVFMT_VARIABLE_FPS
)
?
VSYNC_VFR
:
VSYNC_CFR
;
(
s
->
oformat
->
flags
&
AVFMT_VARIABLE_FPS
)
?
VSYNC_VFR
:
VSYNC_CFR
;
if
(
format_video_sync
!=
VSYNC_PASSTHROUGH
)
{
switch
(
format_video_sync
)
{
double
vdelta
=
sync_ipts
-
ost
->
sync_opts
;
case
VSYNC_CFR
:
// FIXME set to 0.5 after we fix some dts/pts bugs like in avidec.c
// FIXME set to 0.5 after we fix some dts/pts bugs like in avidec.c
if
(
v
delta
<
-
1
.
1
)
if
(
delta
<
-
1
.
1
)
nb_frames
=
0
;
nb_frames
=
0
;
else
if
(
format_video_sync
==
VSYNC_VFR
)
{
else
if
(
delta
>
1
.
1
)
if
(
vdelta
<=
-
0
.
6
)
{
nb_frames
=
lrintf
(
delta
);
nb_frames
=
0
;
break
;
}
else
if
(
vdelta
>
0
.
6
)
case
VSYNC_VFR
:
ost
->
sync_opts
=
lrintf
(
sync_ipts
);
if
(
delta
<=
-
0
.
6
)
}
else
if
(
vdelta
>
1
.
1
)
nb_frames
=
0
;
nb_frames
=
lrintf
(
vdelta
);
else
if
(
delta
>
0
.
6
)
if
(
nb_frames
==
0
)
{
ost
->
sync_opts
=
lrintf
(
sync_ipts
);
++
nb_frames_drop
;
break
;
av_log
(
NULL
,
AV_LOG_VERBOSE
,
"*** drop!
\n
"
);
case
VSYNC_PASSTHROUGH
:
}
else
if
(
nb_frames
>
1
)
{
nb_frames_dup
+=
nb_frames
-
1
;
av_log
(
NULL
,
AV_LOG_VERBOSE
,
"*** %d dup!
\n
"
,
nb_frames
-
1
);
}
}
else
ost
->
sync_opts
=
lrintf
(
sync_ipts
);
ost
->
sync_opts
=
lrintf
(
sync_ipts
);
break
;
default:
av_assert0
(
0
);
}
nb_frames
=
FFMIN
(
nb_frames
,
ost
->
max_frames
-
ost
->
frame_number
);
nb_frames
=
FFMIN
(
nb_frames
,
ost
->
max_frames
-
ost
->
frame_number
);
if
(
nb_frames
<=
0
)
if
(
nb_frames
==
0
)
{
nb_frames_drop
++
;
av_log
(
NULL
,
AV_LOG_VERBOSE
,
"*** drop!
\n
"
);
return
;
return
;
}
else
if
(
nb_frames
>
1
)
{
nb_frames_dup
+=
nb_frames
-
1
;
av_log
(
NULL
,
AV_LOG_VERBOSE
,
"*** %d dup!
\n
"
,
nb_frames
-
1
);
}
#if !CONFIG_AVFILTER
#if !CONFIG_AVFILTER
do_video_resample
(
ost
,
ist
,
in_picture
,
&
final_picture
);
do_video_resample
(
ost
,
ist
,
in_picture
,
&
final_picture
);
...
...
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