Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Rodger Combs authored on 2014/11/24 14:31:20... | ... |
@@ -637,6 +637,7 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter, |
637 | 637 |
AVBPrint args; |
638 | 638 |
char name[255]; |
639 | 639 |
int ret, pad_idx = 0; |
640 |
+ int64_t tsoffset = 0; |
|
640 | 641 |
|
641 | 642 |
if (ist->dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) { |
642 | 643 |
av_log(NULL, AV_LOG_ERROR, "Cannot connect video filter to audio input\n"); |
... | ... |
@@ -711,8 +712,14 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter, |
711 | 711 |
|
712 | 712 |
snprintf(name, sizeof(name), "trim for input stream %d:%d", |
713 | 713 |
ist->file_index, ist->st->index); |
714 |
+ if (copy_ts) { |
|
715 |
+ tsoffset = f->start_time == AV_NOPTS_VALUE ? 0 : f->start_time; |
|
716 |
+ if (!start_at_zero && f->ctx->start_time != AV_NOPTS_VALUE) |
|
717 |
+ tsoffset += f->ctx->start_time; |
|
718 |
+ } |
|
714 | 719 |
ret = insert_trim(((f->start_time == AV_NOPTS_VALUE) || !f->accurate_seek) ? |
715 |
- AV_NOPTS_VALUE : 0, f->recording_time, &last_filter, &pad_idx, name); |
|
720 |
+ AV_NOPTS_VALUE : tsoffset, f->recording_time, |
|
721 |
+ &last_filter, &pad_idx, name); |
|
716 | 722 |
if (ret < 0) |
717 | 723 |
return ret; |
718 | 724 |
|
... | ... |
@@ -731,6 +738,7 @@ static int configure_input_audio_filter(FilterGraph *fg, InputFilter *ifilter, |
731 | 731 |
AVBPrint args; |
732 | 732 |
char name[255]; |
733 | 733 |
int ret, pad_idx = 0; |
734 |
+ int64_t tsoffset = 0; |
|
734 | 735 |
|
735 | 736 |
if (ist->dec_ctx->codec_type != AVMEDIA_TYPE_AUDIO) { |
736 | 737 |
av_log(NULL, AV_LOG_ERROR, "Cannot connect audio filter to non audio input\n"); |
... | ... |
@@ -813,8 +821,14 @@ static int configure_input_audio_filter(FilterGraph *fg, InputFilter *ifilter, |
813 | 813 |
|
814 | 814 |
snprintf(name, sizeof(name), "trim for input stream %d:%d", |
815 | 815 |
ist->file_index, ist->st->index); |
816 |
+ if (copy_ts) { |
|
817 |
+ tsoffset = f->start_time == AV_NOPTS_VALUE ? 0 : f->start_time; |
|
818 |
+ if (!start_at_zero && f->ctx->start_time != AV_NOPTS_VALUE) |
|
819 |
+ tsoffset += f->ctx->start_time; |
|
820 |
+ } |
|
816 | 821 |
ret = insert_trim(((f->start_time == AV_NOPTS_VALUE) || !f->accurate_seek) ? |
817 |
- AV_NOPTS_VALUE : 0, f->recording_time, &last_filter, &pad_idx, name); |
|
822 |
+ AV_NOPTS_VALUE : tsoffset, f->recording_time, |
|
823 |
+ &last_filter, &pad_idx, name); |
|
818 | 824 |
if (ret < 0) |
819 | 825 |
return ret; |
820 | 826 |
|