mirror of
https://github.com/nyanmisaka/ffmpeg-rockchip.git
synced 2025-11-03 09:41:17 +08:00
ffmpeg: move setting video sync method to new_video_stream()
do_video_out() is the wrong place for it, since the necessary information is already known when creating the stream and its value should never change.
This commit is contained in:
@@ -1144,7 +1144,6 @@ static void do_video_out(OutputFile *of,
|
||||
AVFrame *next_picture)
|
||||
{
|
||||
int ret;
|
||||
enum VideoSyncMethod format_video_sync;
|
||||
AVPacket *pkt = ost->pkt;
|
||||
AVCodecContext *enc = ost->enc_ctx;
|
||||
AVRational frame_rate;
|
||||
@@ -1191,28 +1190,10 @@ static void do_video_out(OutputFile *of,
|
||||
nb0_frames = 0; // tracks the number of times the PREVIOUS frame should be duplicated, mostly for variable framerate (VFR)
|
||||
nb_frames = 1;
|
||||
|
||||
format_video_sync = video_sync_method;
|
||||
if (format_video_sync == VSYNC_AUTO) {
|
||||
if(!strcmp(of->ctx->oformat->name, "avi")) {
|
||||
format_video_sync = VSYNC_VFR;
|
||||
} else
|
||||
format_video_sync = (of->ctx->oformat->flags & AVFMT_VARIABLE_FPS) ? ((of->ctx->oformat->flags & AVFMT_NOTIMESTAMPS) ? VSYNC_PASSTHROUGH : VSYNC_VFR) : VSYNC_CFR;
|
||||
if ( ist
|
||||
&& format_video_sync == VSYNC_CFR
|
||||
&& input_files[ist->file_index]->ctx->nb_streams == 1
|
||||
&& input_files[ist->file_index]->input_ts_offset == 0) {
|
||||
format_video_sync = VSYNC_VSCFR;
|
||||
}
|
||||
if (format_video_sync == VSYNC_CFR && copy_ts) {
|
||||
format_video_sync = VSYNC_VSCFR;
|
||||
}
|
||||
}
|
||||
ost->is_cfr = (format_video_sync == VSYNC_CFR || format_video_sync == VSYNC_VSCFR);
|
||||
|
||||
if (delta0 < 0 &&
|
||||
delta > 0 &&
|
||||
format_video_sync != VSYNC_PASSTHROUGH &&
|
||||
format_video_sync != VSYNC_DROP) {
|
||||
ost->vsync_method != VSYNC_PASSTHROUGH &&
|
||||
ost->vsync_method != VSYNC_DROP) {
|
||||
if (delta0 < -0.6) {
|
||||
av_log(NULL, AV_LOG_VERBOSE, "Past duration %f too large\n", -delta0);
|
||||
} else
|
||||
@@ -1222,7 +1203,7 @@ static void do_video_out(OutputFile *of,
|
||||
delta0 = 0;
|
||||
}
|
||||
|
||||
switch (format_video_sync) {
|
||||
switch (ost->vsync_method) {
|
||||
case VSYNC_VSCFR:
|
||||
if (ost->frame_number == 0 && delta0 >= 0.5) {
|
||||
av_log(NULL, AV_LOG_DEBUG, "Not duplicating %d initial frames\n", (int)lrintf(delta0));
|
||||
|
||||
Reference in New Issue
Block a user