Commit ad7d0985 authored by Sebastian Dröge's avatar Sebastian Dröge 🍵 Committed by Tim-Philipp Müller

videotimecode: Fix handling of timecodes without daily jam in gst_video_time_code_to_date_time()

So that it behaves according to documentation.
parent eae44e51
...@@ -170,17 +170,13 @@ gst_video_time_code_to_date_time (const GstVideoTimeCode * tc) ...@@ -170,17 +170,13 @@ gst_video_time_code_to_date_time (const GstVideoTimeCode * tc)
gdouble add_us; gdouble add_us;
g_return_val_if_fail (gst_video_time_code_is_valid (tc), NULL); 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 (tc->config.latest_daily_jam == NULL) {
if (ret == NULL) {
gchar *tc_str = gst_video_time_code_to_string (tc); gchar *tc_str = gst_video_time_code_to_string (tc);
GST_WARNING GST_WARNING
("Asked to convert time code %s to GDateTime, but its latest daily jam is NULL", ("Asked to convert time code %s to GDateTime, but its latest daily jam is NULL",
tc_str); tc_str);
g_free (tc_str); g_free (tc_str);
g_date_time_unref (ret);
return NULL; return NULL;
} }
...@@ -190,10 +186,11 @@ gst_video_time_code_to_date_time (const GstVideoTimeCode * tc) ...@@ -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", ("Asked to convert time code %s to GDateTime, but its framerate is unknown",
tc_str); tc_str);
g_free (tc_str); g_free (tc_str);
g_date_time_unref (ret);
return NULL; 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, gst_util_fraction_to_double (tc->frames * tc->config.fps_d, tc->config.fps_n,
&add_us); &add_us);
if ((tc->config.flags & GST_VIDEO_TIME_CODE_FLAGS_INTERLACED) if ((tc->config.flags & GST_VIDEO_TIME_CODE_FLAGS_INTERLACED)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment