mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
basetextoverlay: get framerate from previously parsed video info
This commit is contained in:
parent
267a8c24af
commit
f47c2442fe
1 changed files with 3 additions and 11 deletions
|
@ -2319,22 +2319,14 @@ gst_base_text_overlay_video_chain (GstPad * pad, GstObject * parent,
|
||||||
* duration (we only use those estimated values internally though, we
|
* duration (we only use those estimated values internally though, we
|
||||||
* don't want to set bogus values on the buffer itself) */
|
* don't want to set bogus values on the buffer itself) */
|
||||||
if (stop == -1) {
|
if (stop == -1) {
|
||||||
GstCaps *caps;
|
if (overlay->info.fps_n && overlay->info.fps_d) {
|
||||||
GstStructure *s;
|
|
||||||
gint fps_num, fps_denom;
|
|
||||||
|
|
||||||
/* FIXME, store this in setcaps */
|
|
||||||
caps = gst_pad_get_current_caps (pad);
|
|
||||||
s = gst_caps_get_structure (caps, 0);
|
|
||||||
if (gst_structure_get_fraction (s, "framerate", &fps_num, &fps_denom) &&
|
|
||||||
fps_num && fps_denom) {
|
|
||||||
GST_DEBUG_OBJECT (overlay, "estimating duration based on framerate");
|
GST_DEBUG_OBJECT (overlay, "estimating duration based on framerate");
|
||||||
stop = start + gst_util_uint64_scale_int (GST_SECOND, fps_denom, fps_num);
|
stop = start + gst_util_uint64_scale_int (GST_SECOND,
|
||||||
|
overlay->info.fps_d, overlay->info.fps_n);
|
||||||
} else {
|
} else {
|
||||||
GST_LOG_OBJECT (overlay, "no duration, assuming minimal duration");
|
GST_LOG_OBJECT (overlay, "no duration, assuming minimal duration");
|
||||||
stop = start + 1; /* we need to assume some interval */
|
stop = start + 1; /* we need to assume some interval */
|
||||||
}
|
}
|
||||||
gst_caps_unref (caps);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_object_sync_values (GST_OBJECT (overlay), GST_BUFFER_TIMESTAMP (buffer));
|
gst_object_sync_values (GST_OBJECT (overlay), GST_BUFFER_TIMESTAMP (buffer));
|
||||||
|
|
Loading…
Reference in a new issue