context: move pw_context_find_factory to impl

This commit is contained in:
Wim Taymans 2019-12-11 17:34:05 +01:00
parent 73eea24443
commit 3084809bed
4 changed files with 28 additions and 29 deletions

View file

@ -1067,29 +1067,6 @@ error:
return res;
}
/** Find a factory by name
*
* \param context the context object
* \param name the name of the factory to find
*
* Find in the list of factories registered in \a context for one with
* the given \a name.
*
* \memberof pw_context
*/
SPA_EXPORT
struct pw_impl_factory *pw_context_find_factory(struct pw_context *context,
const char *name)
{
struct pw_impl_factory *factory;
spa_list_for_each(factory, &context->factory_list, link) {
if (strcmp(factory->info.name, name) == 0)
return factory;
}
return NULL;
}
static int collect_nodes(struct pw_impl_node *driver)
{
struct spa_list queue;

View file

@ -44,7 +44,6 @@ struct pw_context;
struct pw_global;
struct pw_impl_client;
struct pw_impl_factory;
#include <pipewire/core.h>
#include <pipewire/loop.h>
@ -143,11 +142,6 @@ int pw_context_for_each_global(struct pw_context *context, /**< the context */
struct pw_global *pw_context_find_global(struct pw_context *context, /**< the context */
uint32_t id /**< the global id */);
/** Find a factory by name */
struct pw_impl_factory *
pw_context_find_factory(struct pw_context *context /**< the context */,
const char *name /**< the factory name */);
/** add a spa library for the given factory_name regex */
int pw_context_add_spa_lib(struct pw_context *context, const char *factory_regex, const char *lib);

View file

@ -288,3 +288,26 @@ void *pw_impl_factory_create_object(struct pw_impl_factory *factory,
resource, type, version, properties, new_id);
return res;
}
/** Find a factory by name
*
* \param context the context object
* \param name the name of the factory to find
*
* Find in the list of factories registered in \a context for one with
* the given \a name.
*
* \memberof pw_context
*/
SPA_EXPORT
struct pw_impl_factory *pw_context_find_factory(struct pw_context *context,
const char *name)
{
struct pw_impl_factory *factory;
spa_list_for_each(factory, &context->factory_list, link) {
if (strcmp(factory->info.name, name) == 0)
return factory;
}
return NULL;
}

View file

@ -109,6 +109,11 @@ void *pw_impl_factory_create_object(struct pw_impl_factory *factory,
struct pw_properties *properties,
uint32_t new_id);
/** Find a factory by name */
struct pw_impl_factory *
pw_context_find_factory(struct pw_context *context /**< the context */,
const char *name /**< the factory name */);
#ifdef __cplusplus
}
#endif