|
|
|
@ -389,13 +389,14 @@ fail: |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void of_streamcopy(OutputStream *ost, const AVPacket *pkt, int64_t dts) |
|
|
|
|
int of_streamcopy(OutputStream *ost, const AVPacket *pkt, int64_t dts) |
|
|
|
|
{ |
|
|
|
|
OutputFile *of = output_files[ost->file_index]; |
|
|
|
|
MuxStream *ms = ms_from_ost(ost); |
|
|
|
|
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->mux_timebase); |
|
|
|
|
AVPacket *opkt = ms->pkt; |
|
|
|
|
int ret; |
|
|
|
|
|
|
|
|
|
av_packet_unref(opkt); |
|
|
|
|
|
|
|
|
@ -406,26 +407,27 @@ void of_streamcopy(OutputStream *ost, const AVPacket *pkt, int64_t dts) |
|
|
|
|
// EOF: flush output bitstream filters.
|
|
|
|
|
if (!pkt) { |
|
|
|
|
of_output_packet(of, ost, NULL); |
|
|
|
|
return; |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!ms->streamcopy_started && !(pkt->flags & AV_PKT_FLAG_KEY) && |
|
|
|
|
!ms->copy_initial_nonkeyframes) |
|
|
|
|
return; |
|
|
|
|
return 0; |
|
|
|
|
|
|
|
|
|
if (!ms->streamcopy_started) { |
|
|
|
|
if (!ms->copy_prior_start && |
|
|
|
|
(pkt->pts == AV_NOPTS_VALUE ? |
|
|
|
|
dts < ms->ts_copy_start : |
|
|
|
|
pkt->pts < av_rescale_q(ms->ts_copy_start, AV_TIME_BASE_Q, pkt->time_base))) |
|
|
|
|
return; |
|
|
|
|
return 0; |
|
|
|
|
|
|
|
|
|
if (of->start_time != AV_NOPTS_VALUE && dts < of->start_time) |
|
|
|
|
return; |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (av_packet_ref(opkt, pkt) < 0) |
|
|
|
|
exit_program(1); |
|
|
|
|
ret = av_packet_ref(opkt, pkt); |
|
|
|
|
if (ret < 0) |
|
|
|
|
return ret; |
|
|
|
|
|
|
|
|
|
opkt->time_base = ost->mux_timebase; |
|
|
|
|
|
|
|
|
@ -455,13 +457,15 @@ void of_streamcopy(OutputStream *ost, const AVPacket *pkt, int64_t dts) |
|
|
|
|
av_log(NULL, AV_LOG_ERROR, |
|
|
|
|
"Subtitle heartbeat logic failed in %s! (%s)\n", |
|
|
|
|
__func__, av_err2str(ret)); |
|
|
|
|
exit_program(1); |
|
|
|
|
return ret; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
of_output_packet(of, ost, opkt); |
|
|
|
|
|
|
|
|
|
ms->streamcopy_started = 1; |
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static int thread_stop(Muxer *mux) |
|
|
|
|