summaryrefslogtreecommitdiff
path: root/ffmpeg.c
diff options
context:
space:
mode:
authorAlex Converse <alex.converse@gmail.com>2011-08-30 13:42:27 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-08-30 17:57:59 +0200
commita6d0340ca1820df121042c5dbf9821fb8cdd6902 (patch)
treedba28d3ff0593031bd7dd878489e18c83fec9afb /ffmpeg.c
parentebf94f439e8c0b7d61b7b6c71b80193baef76531 (diff)
ffmpeg: Factorize combining auto vsync with format.
Diffstat (limited to 'ffmpeg.c')
-rw-r--r--ffmpeg.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index 43528f926f..70bc04b5d7 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1136,7 +1136,7 @@ static void do_video_out(AVFormatContext *s,
AVFrame *in_picture,
int *frame_size, float quality)
{
- int nb_frames, i, ret;
+ int nb_frames, i, ret, format_video_sync;
AVFrame *final_picture;
AVCodecContext *enc, *dec;
double sync_ipts;
@@ -1151,12 +1151,16 @@ static void do_video_out(AVFormatContext *s,
*frame_size = 0;
- if(video_sync_method){
+ format_video_sync = video_sync_method;
+ if (format_video_sync < 0)
+ format_video_sync = (s->oformat->flags & AVFMT_VARIABLE_FPS) ? 2 : 1;
+
+ if (format_video_sync) {
double vdelta = sync_ipts - ost->sync_opts;
//FIXME set to 0.5 after we fix some dts/pts bugs like in avidec.c
if (vdelta < -1.1)
nb_frames = 0;
- else if (video_sync_method == 2 || (video_sync_method<0 && (s->oformat->flags & AVFMT_VARIABLE_FPS))){
+ else if (format_video_sync == 2) {
if(vdelta<=-0.6){
nb_frames=0;
}else if(vdelta>0.6)