/* do not send the heartbeat frame if the subtitle is already ahead */
if (pts2 <= ist2->sub2video.last_pts)
continue;
- if (pts2 >= ist2->sub2video.end_pts || !ist2->sub2video.frame->data[0])
+ if (pts2 >= ist2->sub2video.end_pts ||
+ (!ist2->sub2video.frame->data[0] && ist2->sub2video.end_pts < INT64_MAX))
sub2video_update(ist2, NULL);
for (j = 0, nb_reqs = 0; j < ist2->nb_filters; j++)
nb_reqs += av_buffersrc_get_nb_failed_requests(ist2->filters[j]->filter);
print_final_stats(total_size);
}
+static void ifilter_parameters_from_codecpar(InputFilter *ifilter, AVCodecParameters *par)
+{
+ // We never got any input. Set a fake format, which will
+ // come from libavformat.
+ ifilter->format = par->format;
+ ifilter->sample_rate = par->sample_rate;
+ ifilter->channels = par->channels;
+ ifilter->channel_layout = par->channel_layout;
+ ifilter->width = par->width;
+ ifilter->height = par->height;
+ ifilter->sample_aspect_ratio = par->sample_aspect_ratio;
+}
+
static void flush_encoders(void)
{
int i, ret;
int x;
for (x = 0; x < fg->nb_inputs; x++) {
InputFilter *ifilter = fg->inputs[x];
- if (ifilter->format < 0) {
- AVCodecParameters *par = ifilter->ist->st->codecpar;
- // We never got any input. Set a fake format, which will
- // come from libavformat.
- ifilter->format = par->format;
- ifilter->sample_rate = par->sample_rate;
- ifilter->channels = par->channels;
- ifilter->channel_layout = par->channel_layout;
- ifilter->width = par->width;
- ifilter->height = par->height;
- ifilter->sample_aspect_ratio = par->sample_aspect_ratio;
- }
+ if (ifilter->format < 0)
+ ifilter_parameters_from_codecpar(ifilter, ifilter->ist->st->codecpar);
}
if (!ifilter_has_all_input_formats(fg))
static int ifilter_send_eof(InputFilter *ifilter, int64_t pts)
{
- int i, j, ret;
+ int ret;
ifilter->eof = 1;
return ret;
} else {
// the filtergraph was never configured
- FilterGraph *fg = ifilter->graph;
- for (i = 0; i < fg->nb_inputs; i++)
- if (!fg->inputs[i]->eof)
- break;
- if (i == fg->nb_inputs) {
- // All the input streams have finished without the filtergraph
- // ever being configured.
- // Mark the output streams as finished.
- for (j = 0; j < fg->nb_outputs; j++)
- finish_output_stream(fg->outputs[j]->ost);
+ if (ifilter->format < 0)
+ ifilter_parameters_from_codecpar(ifilter, ifilter->ist->st->codecpar);
+ if (ifilter->format < 0 && (ifilter->type == AVMEDIA_TYPE_AUDIO || ifilter->type == AVMEDIA_TYPE_VIDEO)) {
+ av_log(NULL, AV_LOG_ERROR, "Cannot determine format of input stream %d:%d after EOF\n", ifilter->ist->file_index, ifilter->ist->st->index);
+ return AVERROR_INVALIDDATA;
}
}