mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-22 23:28:16 +00:00
binaryregistry: Use local values in while/for loops, use branch prediction macros
This commit is contained in:
parent
3c21f2d86c
commit
b50ba09164
1 changed files with 18 additions and 12 deletions
|
@ -942,6 +942,7 @@ gst_registry_binary_load_feature (GstRegistry * registry, gchar ** in,
|
||||||
|
|
||||||
if (GST_IS_ELEMENT_FACTORY (feature)) {
|
if (GST_IS_ELEMENT_FACTORY (feature)) {
|
||||||
GstBinaryElementFactory *ef;
|
GstBinaryElementFactory *ef;
|
||||||
|
guint n;
|
||||||
GstElementFactory *factory = GST_ELEMENT_FACTORY_CAST (feature);
|
GstElementFactory *factory = GST_ELEMENT_FACTORY_CAST (feature);
|
||||||
|
|
||||||
align (*in);
|
align (*in);
|
||||||
|
@ -954,39 +955,44 @@ gst_registry_binary_load_feature (GstRegistry * registry, gchar ** in,
|
||||||
unpack_string (*in, factory->details.klass, end, fail);
|
unpack_string (*in, factory->details.klass, end, fail);
|
||||||
unpack_string (*in, factory->details.description, end, fail);
|
unpack_string (*in, factory->details.description, end, fail);
|
||||||
unpack_string (*in, factory->details.author, end, fail);
|
unpack_string (*in, factory->details.author, end, fail);
|
||||||
|
n = ef->npadtemplates;
|
||||||
GST_DEBUG ("Element factory : '%s' with npadtemplates=%d",
|
GST_DEBUG ("Element factory : '%s' with npadtemplates=%d",
|
||||||
factory->details.longname, ef->npadtemplates);
|
factory->details.longname, n);
|
||||||
|
|
||||||
/* load pad templates */
|
/* load pad templates */
|
||||||
for (i = 0; i < ef->npadtemplates; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
if (!gst_registry_binary_load_pad_template (factory, in, end)) {
|
if (G_UNLIKELY (!gst_registry_binary_load_pad_template (factory, in,
|
||||||
|
end))) {
|
||||||
GST_ERROR ("Error while loading binary pad template");
|
GST_ERROR ("Error while loading binary pad template");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* load uritypes */
|
/* load uritypes */
|
||||||
if (ef->nuriprotocols) {
|
if (G_UNLIKELY ((n = ef->nuriprotocols))) {
|
||||||
GST_DEBUG ("Reading %d UriTypes at address %p", ef->nuriprotocols, *in);
|
GST_DEBUG ("Reading %d UriTypes at address %p", n, *in);
|
||||||
|
|
||||||
align (*in);
|
align (*in);
|
||||||
factory->uri_type = *((guint *) * in);
|
factory->uri_type = *((guint *) * in);
|
||||||
*in += sizeof (factory->uri_type);
|
*in += sizeof (factory->uri_type);
|
||||||
/*unpack_element(*in, &factory->uri_type, factory->uri_type, end, fail); */
|
/*unpack_element(*in, &factory->uri_type, factory->uri_type, end, fail); */
|
||||||
|
|
||||||
factory->uri_protocols = g_new0 (gchar *, ef->nuriprotocols + 1);
|
factory->uri_protocols = g_new0 (gchar *, n + 1);
|
||||||
for (i = 0; i < ef->nuriprotocols; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
unpack_string (*in, str, end, fail);
|
unpack_string (*in, str, end, fail);
|
||||||
factory->uri_protocols[i] = str;
|
factory->uri_protocols[i] = str;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* load interfaces */
|
/* load interfaces */
|
||||||
GST_DEBUG ("Reading %d Interfaces at address %p", ef->ninterfaces, *in);
|
if (G_UNLIKELY ((n = ef->ninterfaces))) {
|
||||||
for (i = 0; i < ef->ninterfaces; i++) {
|
GST_DEBUG ("Reading %d Interfaces at address %p", n, *in);
|
||||||
|
for (i = 0; i < n; i++) {
|
||||||
unpack_string (*in, str, end, fail);
|
unpack_string (*in, str, end, fail);
|
||||||
__gst_element_factory_add_interface (factory, str);
|
__gst_element_factory_add_interface (factory, str);
|
||||||
g_free (str);
|
g_free (str);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else if (GST_IS_TYPE_FIND_FACTORY (feature)) {
|
} else if (GST_IS_TYPE_FIND_FACTORY (feature)) {
|
||||||
GstBinaryTypeFindFactory *tff;
|
GstBinaryTypeFindFactory *tff;
|
||||||
GstTypeFindFactory *factory = GST_TYPE_FIND_FACTORY (feature);
|
GstTypeFindFactory *factory = GST_TYPE_FIND_FACTORY (feature);
|
||||||
|
|
Loading…
Reference in a new issue