#include "libavutil/fifo.h"
#include "libavutil/pixdesc.h"
#include "libavutil/avstring.h"
+#include "libavutil/libm.h"
#include "libavformat/os_support.h"
#if HAVE_SYS_RESOURCE_H
#elif HAVE_CONIO_H
#include <conio.h>
#endif
-#undef time //needed because HAVE_AV_CONFIG_H is defined on top
#include <time.h>
#include "cmdutils.h"
#undef NDEBUG
#include <assert.h>
-#undef exit
-
const char program_name[] = "FFmpeg";
const int program_birth_year = 2000;
AVFrame *final_picture, *formatted_picture, *resampling_dst, *padding_src;
AVFrame picture_crop_temp, picture_pad_temp;
AVCodecContext *enc, *dec;
+ double sync_ipts;
avcodec_get_frame_defaults(&picture_crop_temp);
avcodec_get_frame_defaults(&picture_pad_temp);
enc = ost->st->codec;
dec = ist->st->codec;
+ sync_ipts = get_sync_ipts(ost) / av_q2d(enc->time_base);
+
/* by default, we output a single frame */
nb_frames = 1;
*frame_size = 0;
if(video_sync_method){
- double vdelta;
- vdelta = get_sync_ipts(ost) / av_q2d(enc->time_base) - ost->sync_opts;
+ 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;
if(vdelta<=-0.6){
nb_frames=0;
}else if(vdelta>0.6)
- ost->sync_opts= lrintf(get_sync_ipts(ost) / av_q2d(enc->time_base));
+ ost->sync_opts= lrintf(sync_ipts);
}else if (vdelta > 1.1)
nb_frames = lrintf(vdelta);
//fprintf(stderr, "vdelta:%f, ost->sync_opts:%"PRId64", ost->sync_ipts:%f nb_frames:%d\n", vdelta, ost->sync_opts, get_sync_ipts(ost), nb_frames);
fprintf(stderr, "*** %d dup!\n", nb_frames-1);
}
}else
- ost->sync_opts= lrintf(get_sync_ipts(ost) / av_q2d(enc->time_base));
+ ost->sync_opts= lrintf(sync_ipts);
nb_frames= FFMIN(nb_frames, max_frames[CODEC_TYPE_VIDEO] - ost->frame_number);
if (nb_frames <= 0)
while ((t = av_metadata_get(ist->st->metadata, "", t, AV_METADATA_IGNORE_SUFFIX))) {
if (lang && !strcmp(t->key, "language"))
continue;
- av_metadata_set2(&ost->st->metadata, t->key, t->value, NULL);
+ av_metadata_set2(&ost->st->metadata, t->key, t->value, 0);
}
ost->st->disposition = ist->st->disposition;
if(*p == video_enc->pix_fmt)
break;
}
- if(*p == -1)
+ if(*p == -1
+ && !( video_enc->codec_id==CODEC_ID_MJPEG
+ && video_enc->strict_std_compliance <= FF_COMPLIANCE_INOFFICIAL
+ && ( video_enc->pix_fmt == PIX_FMT_YUV420P
+ || video_enc->pix_fmt == PIX_FMT_YUV422P)))
video_enc->pix_fmt = codec->pix_fmts[0];
}