From 36cc9f13ec89f2ec2ff63f29f1a7f22e893f0306 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Tue, 29 Apr 2014 21:29:54 +0200 Subject: [PATCH] tools: Handle times as doubles + concider duration=0 as TIME_NONE https://bugzilla.gnome.org/show_bug.cgi?id=729382 --- tools/ges-launch.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/tools/ges-launch.c b/tools/ges-launch.c index 237768c..9d433f3 100644 --- a/tools/ges-launch.c +++ b/tools/ges-launch.c @@ -189,11 +189,13 @@ check_time (char *time) static guint64 str_to_time (char *time) { - if (check_time (time)) { - return (guint64) (atof (time) * GST_SECOND); - } - GST_ERROR ("%s not a valid time", time); - return 0; + gdouble nsecs; + + g_return_val_if_fail (check_time (time), 0); + + nsecs = g_ascii_strtod (time, NULL); + + return nsecs * GST_SECOND; } static GESTimeline * @@ -251,6 +253,9 @@ create_timeline (int nbargs, gchar ** argv, const gchar * proj_uri) char *arg0 = argv[(i * 3) + 1]; guint64 duration = str_to_time (argv[(i * 3) + 2]); + if (duration == 0) + duration = GST_CLOCK_TIME_NONE; + if (!g_strcmp0 ("+pattern", source)) { clip = GES_CLIP (ges_test_clip_new_for_nick (arg0)); if (!clip) { @@ -321,6 +326,10 @@ create_timeline (int nbargs, gchar ** argv, const gchar * proj_uri) return NULL; } + if (!GST_CLOCK_TIME_IS_VALID (duration)) + duration = + GES_TIMELINE_ELEMENT_DURATION (clip) - (GstClockTime) inpoint; + g_object_set (clip, "in-point", (guint64) inpoint, "duration", (guint64) duration, NULL); -- 2.7.4