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()
2005-09-29 Tim-Philipp Müller <tim at centricular dot net>
+ * 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 <tim at centricular dot net>
+
* gst/gstcaps.c: (gst_caps_do_simplify):
Thou shalt not free a structure and then continue using it
in the next loop iteration.
then override the <function>set_caps ()</function>.
</para>
</listitem>
+ <listitem>
+ <para>
+ <function>gst_pad_use_explicit_caps ()</function> has been replaced by
+ <function>gst_pad_use_fixed_caps ()</function>. You can then set the
+ fixed caps to use on a pad with <function>gst_pad_set_caps ()</function>.
+ </para>
+ </listitem>
</itemizedlist>
</sect1>
</chapter>
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