summaryrefslogtreecommitdiff
path: root/ffmpeg_filter.c
diff options
context:
space:
mode:
authorwm4 <nfxjfg@googlemail.com>2017-03-02 16:01:01 +0100
committerwm4 <nfxjfg@googlemail.com>2017-03-03 08:45:43 +0100
commit7dd44cde2abb156710f26a08b6cd6c8dd9a9793d (patch)
treed9339c09ab2b06216cd14127ee82d63cfe5014d5 /ffmpeg_filter.c
parent736f4af4fea44d15c5d08558d3fe6f1a0fc98173 (diff)
ffmpeg: delay processing of subtitles before filters are initialized
If a subtitle packet came before the first video frame could be fully decoded, the subtitle packet would get discarded. This puts the subtitle into a queue instead, and processes it once the attached filter graph is initialized.
Diffstat (limited to 'ffmpeg_filter.c')
-rw-r--r--ffmpeg_filter.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/ffmpeg_filter.c b/ffmpeg_filter.c
index 816c906c7e..da2a46d3b7 100644
--- a/ffmpeg_filter.c
+++ b/ffmpeg_filter.c
@@ -1137,6 +1137,19 @@ int configure_filtergraph(FilterGraph *fg)
}
}
+ /* process queued up subtitle packets */
+ for (i = 0; i < fg->nb_inputs; i++) {
+ InputStream *ist = fg->inputs[i]->ist;
+ if (ist->sub2video.sub_queue && ist->sub2video.frame) {
+ while (av_fifo_size(ist->sub2video.sub_queue)) {
+ AVSubtitle tmp;
+ av_fifo_generic_read(ist->sub2video.sub_queue, &tmp, sizeof(tmp), NULL);
+ sub2video_update(ist, &tmp);
+ avsubtitle_free(&tmp);
+ }
+ }
+ }
+
return 0;
}