mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-16 03:50:05 +01:00
-t + capture bugfix
Originally committed as revision 3266 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
36
ffmpeg.c
36
ffmpeg.c
@@ -1692,8 +1692,9 @@ static int av_encode(AVFormatContext **output_files,
|
|||||||
for(; received_sigterm == 0;) {
|
for(; received_sigterm == 0;) {
|
||||||
int file_index, ist_index;
|
int file_index, ist_index;
|
||||||
AVPacket pkt;
|
AVPacket pkt;
|
||||||
double pts_min;
|
double ipts_min= 1e100;
|
||||||
|
double opts_min= 1e100;
|
||||||
|
|
||||||
redo:
|
redo:
|
||||||
/* if 'q' pressed, exits */
|
/* if 'q' pressed, exits */
|
||||||
if (!using_stdin) {
|
if (!using_stdin) {
|
||||||
@@ -1708,24 +1709,25 @@ static int av_encode(AVFormatContext **output_files,
|
|||||||
/* select the stream that we must read now by looking at the
|
/* select the stream that we must read now by looking at the
|
||||||
smallest output pts */
|
smallest output pts */
|
||||||
file_index = -1;
|
file_index = -1;
|
||||||
pts_min = 1e100;
|
|
||||||
for(i=0;i<nb_ostreams;i++) {
|
for(i=0;i<nb_ostreams;i++) {
|
||||||
double pts;
|
double ipts, opts;
|
||||||
ost = ost_table[i];
|
ost = ost_table[i];
|
||||||
os = output_files[ost->file_index];
|
os = output_files[ost->file_index];
|
||||||
ist = ist_table[ost->source_index];
|
ist = ist_table[ost->source_index];
|
||||||
if (input_sync == 0) {
|
if(ost->st->codec.codec_type == CODEC_TYPE_VIDEO)
|
||||||
if(ost->st->codec.codec_type == CODEC_TYPE_VIDEO)
|
opts = (double)ost->sync_opts * ost->st->codec.frame_rate_base / ost->st->codec.frame_rate;
|
||||||
pts = (double)ost->sync_opts * ost->st->codec.frame_rate_base / ost->st->codec.frame_rate;
|
else
|
||||||
else
|
opts = (double)ost->st->pts.val * ost->st->time_base.num / ost->st->time_base.den;
|
||||||
pts = (double)ost->st->pts.val * ost->st->time_base.num / ost->st->time_base.den;
|
ipts = (double)ist->pts;
|
||||||
} else {
|
if (!file_table[ist->file_index].eof_reached){
|
||||||
pts = (double)ist->pts;
|
if(ipts < ipts_min) {
|
||||||
}
|
ipts_min = ipts;
|
||||||
if (!file_table[ist->file_index].eof_reached &&
|
if(input_sync ) file_index = ist->file_index;
|
||||||
pts < pts_min) {
|
}
|
||||||
pts_min = pts;
|
if(opts < opts_min) {
|
||||||
file_index = ist->file_index;
|
opts_min = opts;
|
||||||
|
if(!input_sync) file_index = ist->file_index;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* if none, if is finished */
|
/* if none, if is finished */
|
||||||
@@ -1734,7 +1736,7 @@ static int av_encode(AVFormatContext **output_files,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* finish if recording time exhausted */
|
/* finish if recording time exhausted */
|
||||||
if (recording_time > 0 && pts_min >= (recording_time / 1000000.0))
|
if (recording_time > 0 && opts_min >= (recording_time / 1000000.0))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* read a frame from it and output it in the fifo */
|
/* read a frame from it and output it in the fifo */
|
||||||
|
|||||||
Reference in New Issue
Block a user