mirror of https://git.ffmpeg.org/ffmpeg.git
fftools/ffmpeg: inline check_output_constraints() into its only caller
Which is subtitle encoding. Also, check for AVSubtitle.pts rather than InputStream.pts, since that is the more authoritative value and is guaranteed to be valid.
This commit is contained in:
parent
ceb0275e45
commit
fdf29dcebb
|
@ -941,22 +941,6 @@ int ifilter_parameters_from_codecpar(InputFilter *ifilter, AVCodecParameters *pa
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check whether a packet from ist should be written into ost at this time
|
||||
*/
|
||||
static int check_output_constraints(InputStream *ist, OutputStream *ost)
|
||||
{
|
||||
OutputFile *of = output_files[ost->file_index];
|
||||
|
||||
if (ost->finished & MUXER_FINISHED)
|
||||
return 0;
|
||||
|
||||
if (of->start_time != AV_NOPTS_VALUE && ist->pts < of->start_time)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *pkt)
|
||||
{
|
||||
OutputFile *of = output_files[ost->file_index];
|
||||
|
@ -1471,8 +1455,7 @@ static int process_subtitle(InputStream *ist, AVSubtitle *subtitle, int *got_out
|
|||
|
||||
for (int oidx = 0; oidx < ist->nb_outputs; oidx++) {
|
||||
OutputStream *ost = ist->outputs[oidx];
|
||||
if (!check_output_constraints(ist, ost) || !ost->enc_ctx
|
||||
|| ost->enc_ctx->codec_type != AVMEDIA_TYPE_SUBTITLE)
|
||||
if (!ost->enc_ctx || ost->enc_ctx->codec_type != AVMEDIA_TYPE_SUBTITLE)
|
||||
continue;
|
||||
|
||||
enc_subtitle(output_files[ost->file_index], ost, subtitle);
|
||||
|
|
|
@ -440,6 +440,9 @@ void enc_subtitle(OutputFile *of, OutputStream *ost, AVSubtitle *sub)
|
|||
exit_program(1);
|
||||
return;
|
||||
}
|
||||
if (ost->finished ||
|
||||
(of->start_time != AV_NOPTS_VALUE && sub->pts < of->start_time))
|
||||
return;
|
||||
|
||||
enc = ost->enc_ctx;
|
||||
|
||||
|
|
Loading…
Reference in New Issue