From: Tim-Philipp Müller Date: Thu, 29 Sep 2005 12:05:51 +0000 (+0000) Subject: gst/gstvalue.c: More robust fraction string parsing. X-Git-Tag: RELEASE-0_9_3~21 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fa0afcafb4da2ea5692a846730fd5fac70e0aa97;p=platform%2Fupstream%2Fgstreamer.git gst/gstvalue.c: More robust fraction string parsing. Original commit message from CVS: * gst/gstvalue.c: (gst_value_deserialize_fraction): More robust fraction string parsing. * docs/pwg/appendix-porting.xml: Mention gst_pad_use_explicit_caps() => gst_pad_use_fixed_caps() --- diff --git a/ChangeLog b/ChangeLog index 2e01739..a7c9436 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2005-09-29 Tim-Philipp Müller + * gst/gstvalue.c: (gst_value_deserialize_fraction): + More robust fraction string parsing. + + * docs/pwg/appendix-porting.xml: + Mention gst_pad_use_explicit_caps() => gst_pad_use_fixed_caps() + +2005-09-29 Tim-Philipp Müller + * gst/gstcaps.c: (gst_caps_do_simplify): Thou shalt not free a structure and then continue using it in the next loop iteration. diff --git a/docs/pwg/appendix-porting.xml b/docs/pwg/appendix-porting.xml index 80ec450..0de6bca 100644 --- a/docs/pwg/appendix-porting.xml +++ b/docs/pwg/appendix-porting.xml @@ -176,6 +176,13 @@ then override the set_caps (). + + + gst_pad_use_explicit_caps () has been replaced by + gst_pad_use_fixed_caps (). You can then set the + fixed caps to use on a pad with gst_pad_set_caps (). + + diff --git a/gst/gstvalue.c b/gst/gstvalue.c index 84755d7..813eb3b 100644 --- a/gst/gstvalue.c +++ b/gst/gstvalue.c @@ -2823,20 +2823,13 @@ static gboolean gst_value_deserialize_fraction (GValue * dest, const char *s) { gint num, den; - char *div; - char *tmp; - div = strstr (s, "/"); - if (!div) - return FALSE; - tmp = g_strndup (s, (size_t) (div - s)); - num = atoi (tmp); - g_free (tmp); - den = atoi (div + 1); - - gst_value_set_fraction (dest, num, den); + if (s && sscanf (s, "%d/%d", &num, &den) == 2) { + gst_value_set_fraction (dest, num, den); + return TRUE; + } - return TRUE; + return FALSE; } static void