fftools/ffmpeg: simplify handling input -t for streamcopy
Output stream will be closed implicitly after a NULL packet is sent to it, there is no need to explicitly call close_output_stream().
This commit is contained in:
parent
8f2e7e9dcf
commit
b39b6b7456
@ -814,7 +814,6 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo
|
|||||||
int64_t dts_est = AV_NOPTS_VALUE;
|
int64_t dts_est = AV_NOPTS_VALUE;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int eof_reached = 0;
|
int eof_reached = 0;
|
||||||
int duration_exceeded;
|
|
||||||
|
|
||||||
if (ist->decoding_needed) {
|
if (ist->decoding_needed) {
|
||||||
ret = dec_packet(ist, pkt, no_eof);
|
ret = dec_packet(ist, pkt, no_eof);
|
||||||
@ -829,7 +828,6 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo
|
|||||||
dts_est = pd->dts_est;
|
dts_est = pd->dts_est;
|
||||||
}
|
}
|
||||||
|
|
||||||
duration_exceeded = 0;
|
|
||||||
if (f->recording_time != INT64_MAX) {
|
if (f->recording_time != INT64_MAX) {
|
||||||
int64_t start_time = 0;
|
int64_t start_time = 0;
|
||||||
if (copy_ts) {
|
if (copy_ts) {
|
||||||
@ -837,7 +835,7 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo
|
|||||||
start_time += start_at_zero ? 0 : f->start_time_effective;
|
start_time += start_at_zero ? 0 : f->start_time_effective;
|
||||||
}
|
}
|
||||||
if (dts_est >= f->recording_time + start_time)
|
if (dts_est >= f->recording_time + start_time)
|
||||||
duration_exceeded = 1;
|
pkt = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int oidx = 0; oidx < ist->nb_outputs; oidx++) {
|
for (int oidx = 0; oidx < ist->nb_outputs; oidx++) {
|
||||||
@ -845,11 +843,6 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo
|
|||||||
if (ost->enc || (!pkt && no_eof))
|
if (ost->enc || (!pkt && no_eof))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (duration_exceeded) {
|
|
||||||
close_output_stream(ost);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = of_streamcopy(ost, pkt, dts_est);
|
ret = of_streamcopy(ost, pkt, dts_est);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user