diff options
author | Vivia Nikolaidou <vivia@ahiru.eu> | 2017-11-14 18:13:54 +0200 |
---|---|---|
committer | Vivia Nikolaidou <vivia@ahiru.eu> | 2017-11-14 18:29:49 +0200 |
commit | f3b539e0ff88f8b7b49dee49929d5b3d94bda1a4 (patch) | |
tree | 34c0e6c797744d80b9d935541bc5a4b9c7cb8912 /gst | |
parent | d364c7b44359941d6afb2022c764af771b807846 (diff) |
avwait: Deserialised timecodes set after caps event now get correct framerate
A deserialised timecode has a framerate of 0/1 by default. That breaks
it when comparing the frames field with another timecode (incoming from
the frame). We were setting the framerate when receiving the caps event,
but not when setting the timecode in set_property, so it was broken for
timecodes set after the caps event.
Also checking if the fps_n we got from the caps event is != 0 before
setting it - also at the caps event.
https://bugzilla.gnome.org/show_bug.cgi?id=790334
Diffstat (limited to 'gst')
-rw-r--r-- | gst/timecode/gstavwait.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/gst/timecode/gstavwait.c b/gst/timecode/gstavwait.c index 841d3d28d..e550afdd7 100644 --- a/gst/timecode/gstavwait.c +++ b/gst/timecode/gstavwait.c @@ -387,10 +387,6 @@ gst_avwait_set_property (GObject * object, guint prop_id, frames = g_ascii_strtoll (parts[3], NULL, 10); gst_video_time_code_init (self->tc, 0, 1, NULL, 0, hours, minutes, seconds, frames, 0); - if (self->vinfo.finfo != NULL) { - self->tc->config.fps_n = self->vinfo.fps_n; - self->tc->config.fps_d = self->vinfo.fps_d; - } if (self->end_tc && gst_video_time_code_compare (self->tc, self->end_tc) != -1) { gchar *end_tc; @@ -402,6 +398,12 @@ gst_avwait_set_property (GObject * object, guint prop_id, gst_video_time_code_free (self->tc); g_free (end_tc); self->tc = gst_video_time_code_new_empty (); + } else { + if (GST_VIDEO_INFO_FORMAT (&self->vinfo) != GST_VIDEO_FORMAT_UNKNOWN + && self->vinfo.fps_n != 0) { + self->tc->config.fps_n = self->vinfo.fps_n; + self->tc->config.fps_d = self->vinfo.fps_d; + } } g_strfreev (parts); break; @@ -423,6 +425,13 @@ gst_avwait_set_property (GObject * object, guint prop_id, g_free (start_tc); g_free (end_tc); self->tc = gst_video_time_code_new_empty (); + } else { + if (self->tc->config.fps_n == 0 + && GST_VIDEO_INFO_FORMAT (&self->vinfo) != + GST_VIDEO_FORMAT_UNKNOWN && self->vinfo.fps_n != 0) { + self->tc->config.fps_n = self->vinfo.fps_n; + self->tc->config.fps_d = self->vinfo.fps_d; + } } break; } @@ -443,6 +452,13 @@ gst_avwait_set_property (GObject * object, guint prop_id, self->end_tc = NULL; g_free (start_tc); g_free (end_tc); + } else { + if (self->end_tc->config.fps_n == 0 + && GST_VIDEO_INFO_FORMAT (&self->vinfo) != + GST_VIDEO_FORMAT_UNKNOWN && self->vinfo.fps_n != 0) { + self->end_tc->config.fps_n = self->vinfo.fps_n; + self->end_tc->config.fps_d = self->vinfo.fps_d; + } } break; } @@ -523,11 +539,12 @@ gst_avwait_vsink_event (GstPad * pad, GstObject * parent, GstEvent * event) return FALSE; } g_mutex_lock (&self->mutex); - if (self->tc && self->tc->config.fps_n == 0) { + if (self->tc && self->tc->config.fps_n == 0 && self->vinfo.fps_n != 0) { self->tc->config.fps_n = self->vinfo.fps_n; self->tc->config.fps_d = self->vinfo.fps_d; } - if (self->end_tc && self->end_tc->config.fps_n == 0) { + if (self->end_tc && self->end_tc->config.fps_n == 0 + && self->vinfo.fps_n != 0) { self->end_tc->config.fps_n = self->vinfo.fps_n; self->end_tc->config.fps_d = self->vinfo.fps_d; } |