ccextractor: Push a GAP event if we have a caption pad but a video buffer did not contain any captions

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1371>
This commit is contained in:
Sebastian Dröge 2020-06-24 16:34:20 +03:00 committed by GStreamer Merge Bot
parent f694956511
commit ed3417219a

View file

@ -423,6 +423,7 @@ gst_cc_extractor_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
GstFlowReturn flow = GST_FLOW_OK;
GstVideoCaptionMeta *cc_meta;
GstVideoTimeCodeMeta *tc_meta;
gboolean had_cc_meta = FALSE;
gpointer iter = NULL;
tc_meta = gst_buffer_get_video_time_code_meta (buf);
@ -430,6 +431,7 @@ gst_cc_extractor_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
while ((cc_meta =
(GstVideoCaptionMeta *) gst_buffer_iterate_meta_filtered (buf, &iter,
GST_VIDEO_CAPTION_META_API_TYPE)) && flow == GST_FLOW_OK) {
had_cc_meta = TRUE;
flow = gst_cc_extractor_handle_meta (filter, buf, cc_meta, tc_meta);
}
@ -444,6 +446,11 @@ gst_cc_extractor_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
gst_buffer_foreach_meta (buf, remove_caption_meta, NULL);
}
if (!had_cc_meta && filter->captionpad && GST_BUFFER_PTS_IS_VALID (buf)) {
gst_pad_push_event (filter->captionpad,
gst_event_new_gap (GST_BUFFER_PTS (buf), GST_BUFFER_DURATION (buf)));
}
/* Push the buffer downstream and return the combined flow return */
return gst_flow_combiner_update_pad_flow (filter->combiner, filter->srcpad,
gst_pad_push (filter->srcpad, buf));