mirror of
https://git.videolan.org/git/ffmpeg.git
synced 2024-09-03 06:53:23 +02:00
Merge commit 'b4a5a292274f904f404f40f826c51e6fc9cfb8fe'
* commit 'b4a5a292274f904f404f40f826c51e6fc9cfb8fe': avconv: improve -re implementation Conflicts: ffmpeg.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
22dc25cb29
28
ffmpeg.c
28
ffmpeg.c
@ -1450,16 +1450,6 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p
|
||||
ost->st->codec->frame_number++;
|
||||
}
|
||||
|
||||
static void rate_emu_sleep(InputStream *ist)
|
||||
{
|
||||
if (input_files[ist->file_index]->rate_emu) {
|
||||
int64_t pts = av_rescale(ist->dts, 1000000, AV_TIME_BASE);
|
||||
int64_t now = av_gettime() - ist->start;
|
||||
if (pts > now)
|
||||
av_usleep(pts - now);
|
||||
}
|
||||
}
|
||||
|
||||
int guess_input_channel_layout(InputStream *ist)
|
||||
{
|
||||
AVCodecContext *dec = ist->st->codec;
|
||||
@ -1526,8 +1516,6 @@ static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output)
|
||||
avctx->sample_rate;
|
||||
#endif
|
||||
|
||||
rate_emu_sleep(ist);
|
||||
|
||||
resample_changed = ist->resample_sample_fmt != decoded_frame->format ||
|
||||
ist->resample_channels != avctx->channels ||
|
||||
ist->resample_channel_layout != decoded_frame->channel_layout ||
|
||||
@ -1674,8 +1662,6 @@ static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output)
|
||||
|
||||
pkt->size = 0;
|
||||
|
||||
rate_emu_sleep(ist);
|
||||
|
||||
if (ist->st->sample_aspect_ratio.num)
|
||||
decoded_frame->sample_aspect_ratio = ist->st->sample_aspect_ratio;
|
||||
|
||||
@ -1764,8 +1750,6 @@ static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output)
|
||||
if (!*got_output || !subtitle.num_rects)
|
||||
return ret;
|
||||
|
||||
rate_emu_sleep(ist);
|
||||
|
||||
for (i = 0; i < nb_output_streams; i++) {
|
||||
OutputStream *ost = output_streams[i];
|
||||
|
||||
@ -1882,7 +1866,6 @@ static int output_packet(InputStream *ist, const AVPacket *pkt)
|
||||
|
||||
/* handle stream copy */
|
||||
if (!ist->decoding_needed) {
|
||||
rate_emu_sleep(ist);
|
||||
ist->dts = ist->next_dts;
|
||||
switch (ist->st->codec->codec_type) {
|
||||
case AVMEDIA_TYPE_AUDIO:
|
||||
@ -2817,6 +2800,17 @@ static int get_input_packet_mt(InputFile *f, AVPacket *pkt)
|
||||
|
||||
static int get_input_packet(InputFile *f, AVPacket *pkt)
|
||||
{
|
||||
if (f->rate_emu) {
|
||||
int i;
|
||||
for (i = 0; i < f->nb_streams; i++) {
|
||||
InputStream *ist = input_streams[f->ist_index + i];
|
||||
int64_t pts = av_rescale(ist->dts, 1000000, AV_TIME_BASE);
|
||||
int64_t now = av_gettime() - ist->start;
|
||||
if (pts > now)
|
||||
return AVERROR(EAGAIN);
|
||||
}
|
||||
}
|
||||
|
||||
#if HAVE_PTHREADS
|
||||
if (nb_input_files > 1)
|
||||
return get_input_packet_mt(f, pkt);
|
||||
|
Loading…
Reference in New Issue
Block a user