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()
This commit is contained in:
Tim-Philipp Müller 2005-09-29 12:05:51 +00:00
parent 356893d5f8
commit fa0afcafb4
3 changed files with 20 additions and 12 deletions

View file

@ -1,3 +1,11 @@
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> 2005-09-29 Tim-Philipp Müller <tim at centricular dot net>
* gst/gstcaps.c: (gst_caps_do_simplify): * gst/gstcaps.c: (gst_caps_do_simplify):

View file

@ -176,6 +176,13 @@
then override the <function>set_caps ()</function>. then override the <function>set_caps ()</function>.
</para> </para>
</listitem> </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> </itemizedlist>
</sect1> </sect1>
</chapter> </chapter>

View file

@ -2823,20 +2823,13 @@ static gboolean
gst_value_deserialize_fraction (GValue * dest, const char *s) gst_value_deserialize_fraction (GValue * dest, const char *s)
{ {
gint num, den; gint num, den;
char *div;
char *tmp;
div = strstr (s, "/"); if (s && sscanf (s, "%d/%d", &num, &den) == 2) {
if (!div) gst_value_set_fraction (dest, num, den);
return FALSE; return TRUE;
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); return FALSE;
return TRUE;
} }
static void static void