mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-18 15:51:11 +00:00
assrender: Drop text buffers before the segment start and clip running time end to the segment stop
This commit is contained in:
parent
659776f1b1
commit
852be755dd
1 changed files with 17 additions and 0 deletions
|
@ -1066,6 +1066,8 @@ gst_ass_render_chain_text (GstPad * pad, GstBuffer * buffer)
|
||||||
GstClockTime timestamp, duration;
|
GstClockTime timestamp, duration;
|
||||||
GstClockTime sub_running_time, vid_running_time;
|
GstClockTime sub_running_time, vid_running_time;
|
||||||
GstClockTime sub_running_time_end;
|
GstClockTime sub_running_time_end;
|
||||||
|
gint64 cstart, cstop;
|
||||||
|
gboolean in_seg;
|
||||||
|
|
||||||
if (render->subtitle_flushing) {
|
if (render->subtitle_flushing) {
|
||||||
gst_buffer_unref (buffer);
|
gst_buffer_unref (buffer);
|
||||||
|
@ -1083,6 +1085,21 @@ gst_ass_render_chain_text (GstPad * pad, GstBuffer * buffer)
|
||||||
return GST_FLOW_OK;
|
return GST_FLOW_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
in_seg =
|
||||||
|
gst_segment_clip (&render->subtitle_segment, GST_FORMAT_TIME, timestamp,
|
||||||
|
timestamp + duration, &cstart, &cstop);
|
||||||
|
if (!in_seg) {
|
||||||
|
GST_DEBUG_OBJECT (render,
|
||||||
|
"Text buffer before segment start (%" GST_TIME_FORMAT " < %"
|
||||||
|
GST_TIME_FORMAT ")", GST_TIME_ARGS (timestamp),
|
||||||
|
GST_TIME_ARGS (render->subtitle_segment.start));
|
||||||
|
gst_buffer_unref (buffer);
|
||||||
|
return GST_FLOW_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_BUFFER_TIMESTAMP (buffer) = timestamp = cstart;
|
||||||
|
GST_BUFFER_DURATION (buffer) = duration = cstop - cstart;
|
||||||
|
|
||||||
gst_segment_set_last_stop (&render->subtitle_segment, GST_FORMAT_TIME,
|
gst_segment_set_last_stop (&render->subtitle_segment, GST_FORMAT_TIME,
|
||||||
GST_BUFFER_TIMESTAMP (buffer));
|
GST_BUFFER_TIMESTAMP (buffer));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue