diff --git a/gst/gstelement.c b/gst/gstelement.c index 5ea6ef5def..13ff5a80e2 100644 --- a/gst/gstelement.c +++ b/gst/gstelement.c @@ -976,25 +976,29 @@ _gst_element_request_pad (GstElement * element, GstPadTemplate * templ, /* Can either be %s or %d or %u, do sanity checking for %d */ if (*(str + 1) == 'd') { - gint tmp; + gint64 tmp; /* it's an int */ - tmp = strtol (data, &endptr, 10); - g_return_val_if_fail (tmp != G_MINLONG && tmp != G_MAXLONG + tmp = g_ascii_strtoll (data, &endptr, 10); + g_return_val_if_fail (tmp >= G_MININT && tmp <= G_MAXINT && *endptr == '\0', NULL); } else if (*(str + 1) == 'u') { - guint tmp; + guint64 tmp; /* it's an int */ - tmp = strtoul (data, &endptr, 10); - g_return_val_if_fail (tmp != G_MAXULONG && *endptr == '\0', NULL); + tmp = g_ascii_strtoull (data, &endptr, 10); + g_return_val_if_fail (tmp <= G_MAXUINT && *endptr == '\0', NULL); } } pad = gst_element_get_static_pad (element, name); - if (pad) + if (pad) { gst_object_unref (pad); - g_return_val_if_fail (pad == NULL, NULL); + /* FIXME 0.11: Change this to g_return_val_if_fail() */ + g_critical ("Element %s already has a pad named %s, the behaviour of " + " gst_element_get_request_pad() for existing pads is undefined!", + GST_ELEMENT_NAME (element), name); + } } #endif @@ -1071,7 +1075,7 @@ gst_element_get_request_pad (GstElement * element, const gchar * name) && strlen (name) > str - templ->name_template) { data = name + (str - templ->name_template); if (*(str + 1) == 'd') { - gint tmp; + glong tmp; /* it's an int */ tmp = strtol (data, &endptr, 10); @@ -1082,7 +1086,7 @@ gst_element_get_request_pad (GstElement * element, const gchar * name) break; } } else if (*(str + 1) == 'u') { - guint tmp; + gulong tmp; /* it's an int */ tmp = strtoul (data, &endptr, 10); diff --git a/gst/gstevent.h b/gst/gstevent.h index 3e5cbe73ce..1f2a37f5b4 100644 --- a/gst/gstevent.h +++ b/gst/gstevent.h @@ -302,7 +302,11 @@ typedef enum { * When doing fast forward (rate > 1.0) or fast reverse (rate < -1.0) trickmode * playback, the @GST_SEEK_FLAG_SKIP flag can be used to instruct decoders * and demuxers to adjust the playback rate by skipping frames. This can improve - * performance and decrease CPU usage because not all frames need to be decoded. + * performance and decrease CPU usage because not all frames need to be decoded. + * + * Also see part-seeking.txt in the GStreamer design documentation for more + * details on the meaning of these flags and the behaviour expected of + * elements that handle them. */ typedef enum { GST_SEEK_FLAG_NONE = 0, diff --git a/gst/gstpoll.c b/gst/gstpoll.c index ba9fdc8bca..76a7a30e6a 100644 --- a/gst/gstpoll.c +++ b/gst/gstpoll.c @@ -210,8 +210,11 @@ release_all_wakeup (GstPoll * set) /* try to remove all pending control messages */ if (g_atomic_int_compare_and_exchange (&set->control_pending, old, 0)) { /* we managed to remove all messages, read the control socket */ - (void) RELEASE_EVENT (set); - break; + if (RELEASE_EVENT (set)) + break; + else + /* retry again until we read it successfully */ + g_atomic_int_exchange_and_add (&set->control_pending, 1); } } return old; @@ -1375,8 +1378,13 @@ gst_poll_wait (GstPoll * set, GstClockTime timeout) t = 0; } - wait_ret = WSAWaitForMultipleEvents (set->active_events->len, - (HANDLE *) set->active_events->data, FALSE, t, FALSE); + if (set->active_events->len != 0) { + wait_ret = WSAWaitForMultipleEvents (set->active_events->len, + (HANDLE *) set->active_events->data, FALSE, t, FALSE); + } else { + wait_ret = WSA_WAIT_FAILED; + WSASetLastError (WSA_INVALID_PARAMETER); + } if (ignore_count == 0 && wait_ret == WSA_WAIT_TIMEOUT) { res = 0; diff --git a/gst/gststructure.c b/gst/gststructure.c index 011639a41a..92b6b93d35 100644 --- a/gst/gststructure.c +++ b/gst/gststructure.c @@ -782,6 +782,25 @@ gst_structure_set_field (GstStructure * structure, GstStructureField * field) g_value_unset (&field->value); return; } + } else if (G_UNLIKELY (GST_VALUE_HOLDS_DATE (&field->value))) { + const GDate *d; + + d = gst_value_get_date (&field->value); + /* only check for NULL GDates in taglists, as they might make sense + * in other, generic structs */ + if (G_UNLIKELY ((IS_TAGLIST (structure) && d == NULL))) { + GIT_G_WARNING ("Trying to set NULL GDate on field '%s' on taglist. " + "Please file a bug.", g_quark_to_string (field->name)); + g_value_unset (&field->value); + return; + } else if (G_UNLIKELY (d != NULL && !g_date_valid (d))) { + g_warning + ("Trying to set invalid GDate on %s field '%s'. Please file a bug.", + IS_TAGLIST (structure) ? "taglist" : "structure", + g_quark_to_string (field->name)); + g_value_unset (&field->value); + return; + } } for (i = 0; i < len; i++) { diff --git a/gst/gstutils.h b/gst/gstutils.h index de964ba419..96f2116a72 100644 --- a/gst/gstutils.h +++ b/gst/gstutils.h @@ -216,7 +216,7 @@ type_as_function ## _implements_interface_init (GstImplementsInterfaceClass *kla } \ \ static void \ -type_as_function ## _init_interfaces (GType type) \ +type_as_function ## _init_interfaces (GType type_var) \ { \ static const GInterfaceInfo implements_iface_info = { \ (GInterfaceInitFunc) type_as_function ## _implements_interface_init,\ @@ -229,9 +229,9 @@ type_as_function ## _init_interfaces (GType type) \ NULL, \ }; \ \ - g_type_add_interface_static (type, GST_TYPE_IMPLEMENTS_INTERFACE, \ + g_type_add_interface_static (type_var, GST_TYPE_IMPLEMENTS_INTERFACE, \ &implements_iface_info); \ - g_type_add_interface_static (type, interface_type_as_macro, \ + g_type_add_interface_static (type_var, interface_type_as_macro, \ &iface_info); \ } \ \ diff --git a/tests/check/elements/.gitignore b/tests/check/elements/.gitignore index 77c3967d76..8ab5437ad5 100644 --- a/tests/check/elements/.gitignore +++ b/tests/check/elements/.gitignore @@ -5,6 +5,7 @@ fakesink fdsrc filesink filesrc +funnel identity multiqueue queue