diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2018-12-14 20:59:11 +0200 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2019-05-01 17:28:16 +0100 |
commit | ad7d098572da9ee2ea17c4bddac6b5a8ad6e234c (patch) | |
tree | f515dead9b9abc5d6f01fbf0c04733840330a5e5 | |
parent | eae44e51b53d46d8a12c51567030885f8a909daa (diff) | |
download | gstreamer-plugins-base-ad7d098572da9ee2ea17c4bddac6b5a8ad6e234c.tar.gz |
videotimecode: Fix handling of timecodes without daily jam in gst_video_time_code_to_date_time()
So that it behaves according to documentation.
-rw-r--r-- | gst-libs/gst/video/gstvideotimecode.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/gst-libs/gst/video/gstvideotimecode.c b/gst-libs/gst/video/gstvideotimecode.c index 2b02e217d..8401d5017 100644 --- a/gst-libs/gst/video/gstvideotimecode.c +++ b/gst-libs/gst/video/gstvideotimecode.c @@ -170,17 +170,13 @@ gst_video_time_code_to_date_time (const GstVideoTimeCode * tc) gdouble add_us; g_return_val_if_fail (gst_video_time_code_is_valid (tc), NULL); - g_return_val_if_fail (tc->config.latest_daily_jam != NULL, NULL); - ret = g_date_time_ref (tc->config.latest_daily_jam); - - if (ret == NULL) { + if (tc->config.latest_daily_jam == NULL) { gchar *tc_str = gst_video_time_code_to_string (tc); GST_WARNING ("Asked to convert time code %s to GDateTime, but its latest daily jam is NULL", tc_str); g_free (tc_str); - g_date_time_unref (ret); return NULL; } @@ -190,10 +186,11 @@ gst_video_time_code_to_date_time (const GstVideoTimeCode * tc) ("Asked to convert time code %s to GDateTime, but its framerate is unknown", tc_str); g_free (tc_str); - g_date_time_unref (ret); return NULL; } + ret = g_date_time_ref (tc->config.latest_daily_jam); + gst_util_fraction_to_double (tc->frames * tc->config.fps_d, tc->config.fps_n, &add_us); if ((tc->config.flags & GST_VIDEO_TIME_CODE_FLAGS_INTERLACED) |