[Bug 772764] GstVideoTimeCode lacks GstValue functions

GStreamer (GNOME Bugzilla) bugzilla at gnome.org
Mon Jan 9 16:34:04 UTC 2017


https://bugzilla.gnome.org/show_bug.cgi?id=772764

Sebastian Dröge (slomo) <slomo at coaxion.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #342635|none                        |needs-work
             status|                            |

--- Comment #8 from Sebastian Dröge (slomo) <slomo at coaxion.net> ---
Review of attachment 342635:
 --> (https://bugzilla.gnome.org/review?bug=772764&attachment=342635)

::: gst-libs/gst/video/gstvideotimecode.c
@@ +550,3 @@
+  tc = gst_video_time_code_new_from_string (tc_str);
+  g_value_set_boxed (tc_val, tc);
+  gst_video_time_code_free (tc);

g_value_take_boxed(), then you don't have a useless copy here and don't need to
free

@@ +560,3 @@
+
+  tc_str = gst_video_time_code_to_string (tc);
+  g_value_set_string (str_val, tc_str);

g_value_take_string() (see above)

@@ +579,3 @@
+    return FALSE;
+
+  g_value_set_boxed (dest, tc);

g_value_take_boxed()

@@ +601,3 @@
+  gchar **parts;
+
+  parts = g_strsplit (tc_str, ":", 4);

g_strsplit_set(tc_str, ":;,", 4) so that it also works for all the other
variants. But that needs validation that the string is  not e.g. "12;32,23" or
something like that.

You could do
if (sscanf (tc_str, "%02u:%02u:%02u:%02u", &hours, &minutes, &seconds, &frames)
== 4 ||
    sscanf (tc_str, "%02u:%02u:%02u;%02u", &hours, &minutes, &seconds, &frames)
== 4 ||
    sscanf (tc_str, "%02u:%02u:%02u.%02u", &hours, &minutes, &seconds, &frames)
== 4 ||
    sscanf (tc_str, "%02u:%02u:%02u,%02u", &hours, &minutes, &seconds, &frames)
== 4) {
  // good case
} else {
  // error
}

-- 
You are receiving this mail because:
You are the QA Contact for the bug.


More information about the gstreamer-bugs mailing list