mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-10 17:35:59 +00:00
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
This commit is contained in:
parent
d364c7b443
commit
f3b539e0ff
1 changed files with 23 additions and 6 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue