tests/examples/playlist.c: allow file / pattern durations to be 0 (but not
authorBrandon Lewis <brandon.lewis@collabora.co.uk>
Fri, 4 Jun 2010 10:17:56 +0000 (12:17 +0200)
committerEdward Hervey <edward.hervey@collabora.co.uk>
Wed, 9 Jun 2010 09:28:45 +0000 (11:28 +0200)
transitions)

tests/examples/playlist.c

index 390d477138f7e7eb91abfd7565f90404e583ed43..a8dc8780b76503fb78c97563a49796cf8277ccdc 100644 (file)
@@ -137,19 +137,6 @@ str_to_time (char *time)
   return 0;
 }
 
-guint64
-str_to_duration (char *time)
-{
-  if (check_time (time)) {
-    double t = (double) atof (time);
-    if (t <= 0)
-      g_error ("durations must be greater than 0");
-    return (guint64) (t * GST_SECOND);
-  }
-  g_error ("%s not a valid time", time);
-  return 0;
-}
-
 static GstEncodingProfile *
 make_encoding_profile (gchar * audio, gchar * video, gchar * video_restriction,
     gchar * container)
@@ -204,7 +191,7 @@ create_timeline (int nbargs, gchar ** argv)
 
     char *source = argv[i * 3];
     char *arg0 = argv[(i * 3) + 1];
-    guint64 duration = str_to_duration (argv[(i * 3) + 2]);
+    guint64 duration = str_to_time (argv[(i * 3) + 2]);
 
     if (!g_strcmp0 ("+pattern", source)) {
       pattern = pattern_for_name (arg0);
@@ -224,6 +211,9 @@ create_timeline (int nbargs, gchar ** argv)
       if (!obj)
         g_error ("invalid transition type\n");
 
+      if (duration <= 0)
+        g_error ("durations must be greater than 0");
+
       g_object_set (G_OBJECT (obj), "duration", duration, NULL);
 
       g_print ("Adding <transition:%s> duration %" GST_TIME_FORMAT "\n",