summaryrefslogtreecommitdiff
path: root/ffmpeg.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-08-06 10:25:32 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-08-06 10:25:32 +0200
commit3fa72de82f04802e307085d3fce9eafea1d3dc46 (patch)
tree075119600cac0d5d61b710c51a1c669306cc291b /ffmpeg.c
parent84bc317019ba5c35355592df64d152f2cff76339 (diff)
parent56ee3f9de7b9f6090d599a27d33a392890a2f7b8 (diff)
Merge commit '56ee3f9de7b9f6090d599a27d33a392890a2f7b8'
* commit '56ee3f9de7b9f6090d599a27d33a392890a2f7b8': avconv: distinguish between -ss 0 and -ss not being used Conflicts: ffmpeg.c ffmpeg_opt.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'ffmpeg.c')
-rw-r--r--ffmpeg.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index cc709ab10c..dffe724751 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -751,7 +751,9 @@ static void do_subtitle_out(AVFormatContext *s,
nb = 1;
/* shift timestamp to honor -ss and make check_recording_time() work with -t */
- pts = sub->pts - output_files[ost->file_index]->start_time;
+ pts = sub->pts;
+ if (output_files[ost->file_index]->start_time != AV_NOPTS_VALUE)
+ pts -= output_files[ost->file_index]->start_time;
for (i = 0; i < nb; i++) {
ost->sync_opts = av_rescale_q(pts, AV_TIME_BASE_Q, enc->time_base);
if (!check_recording_time(ost))
@@ -1070,10 +1072,11 @@ static int reap_filters(void)
}
frame_pts = AV_NOPTS_VALUE;
if (filtered_frame->pts != AV_NOPTS_VALUE) {
+ int64_t start_time = (of->start_time == AV_NOPTS_VALUE) ? 0 : of->start_time;
filtered_frame->pts = frame_pts = av_rescale_q(filtered_frame->pts,
ost->filter->filter->inputs[0]->time_base,
ost->st->codec->time_base) -
- av_rescale_q(of->start_time,
+ av_rescale_q(start_time,
AV_TIME_BASE_Q,
ost->st->codec->time_base);
}
@@ -1377,7 +1380,7 @@ static int check_output_constraints(InputStream *ist, OutputStream *ost)
if (ost->source_index != ist_index)
return 0;
- if (of->start_time && ist->pts < of->start_time)
+ if (of->start_time != AV_NOPTS_VALUE && ist->pts < of->start_time)
return 0;
return 1;
@@ -1386,8 +1389,9 @@ static int check_output_constraints(InputStream *ist, OutputStream *ost)
static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *pkt)
{
OutputFile *of = output_files[ost->file_index];
- int64_t ost_tb_start_time = av_rescale_q(of->start_time, AV_TIME_BASE_Q, ost->st->time_base);
- int64_t ist_tb_start_time = av_rescale_q(of->start_time, AV_TIME_BASE_Q, ist->st->time_base);
+ 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;
@@ -1398,7 +1402,7 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p
return;
if (pkt->pts == AV_NOPTS_VALUE) {
- if (!ost->frame_number && ist->pts < of->start_time &&
+ if (!ost->frame_number && ist->pts < start_time &&
!ost->copy_prior_start)
return;
} else {
@@ -1408,7 +1412,7 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p
}
if (of->recording_time != INT64_MAX &&
- ist->pts >= of->recording_time + of->start_time) {
+ ist->pts >= of->recording_time + start_time) {
close_output_stream(ost);
return;
}