summaryrefslogtreecommitdiff
path: root/ffmpeg.c
diff options
context:
space:
mode:
authorRodger Combs <rodger.combs@gmail.com>2015-11-01 20:04:25 -0600
committerMichael Niedermayer <michael@niedermayer.cc>2015-11-20 19:20:30 +0100
commitbf2590aed3e64d44a5e2430fdbe89f91f5e55bfe (patch)
treeb36787971b1e91f8233317b1829260e598875026 /ffmpeg.c
parentacb430e4d3a704f97762d29bd54e3fb8ca1c0682 (diff)
ffmpeg: fix -copy_prior_start 0 with -copyts and input -ss
Also rearranged the relevant check to reduce code duplication Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'ffmpeg.c')
-rw-r--r--ffmpeg.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index a976f61a44..bf5e983439 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1804,7 +1804,6 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p
InputFile *f = input_files [ist->file_index];
int64_t start_time = (of->start_time == AV_NOPTS_VALUE) ? 0 : of->start_time;
int64_t ost_tb_start_time = av_rescale_q(start_time, AV_TIME_BASE_Q, ost->st->time_base);
- int64_t ist_tb_start_time = av_rescale_q(start_time, AV_TIME_BASE_Q, ist->st->time_base);
AVPicture pict;
AVPacket opkt;
@@ -1814,13 +1813,13 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p
!ost->copy_initial_nonkeyframes)
return;
- if (pkt->pts == AV_NOPTS_VALUE) {
- if (!ost->frame_number && ist->pts < start_time &&
- !ost->copy_prior_start)
- return;
- } else {
- if (!ost->frame_number && pkt->pts < ist_tb_start_time &&
- !ost->copy_prior_start)
+ if (!ost->frame_number && !ost->copy_prior_start) {
+ int64_t comp_start = start_time;
+ if (copy_ts && f->start_time != AV_NOPTS_VALUE)
+ comp_start = FFMAX(start_time, f->start_time + f->ts_offset);
+ if (pkt->pts == AV_NOPTS_VALUE ?
+ ist->pts < comp_start :
+ pkt->pts < av_rescale_q(comp_start, AV_TIME_BASE_Q, ist->st->time_base))
return;
}