| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | /* PipeWire
 | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Copyright © 2019 Wim Taymans | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Permission is hereby granted, free of charge, to any person obtaining a | 
					
						
							|  |  |  |  * copy of this software and associated documentation files (the "Software"), | 
					
						
							|  |  |  |  * to deal in the Software without restriction, including without limitation | 
					
						
							|  |  |  |  * the rights to use, copy, modify, merge, publish, distribute, sublicense, | 
					
						
							|  |  |  |  * and/or sell copies of the Software, and to permit persons to whom the | 
					
						
							|  |  |  |  * Software is furnished to do so, subject to the following conditions: | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * The above copyright notice and this permission notice (including the next | 
					
						
							|  |  |  |  * paragraph) shall be included in all copies or substantial portions of the | 
					
						
							|  |  |  |  * Software. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 
					
						
							|  |  |  |  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 
					
						
							|  |  |  |  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL | 
					
						
							|  |  |  |  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | 
					
						
							|  |  |  |  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | 
					
						
							|  |  |  |  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 
					
						
							|  |  |  |  * DEALINGS IN THE SOFTWARE. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <pipewire/pipewire.h>
 | 
					
						
							| 
									
										
										
										
											2019-12-11 10:57:10 +01:00
										 |  |  | #include <pipewire/global.h>
 | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define TEST_FUNC(a,b,func)	\
 | 
					
						
							|  |  |  | do {				\ | 
					
						
							|  |  |  | 	a.func = b.func;	\ | 
					
						
							|  |  |  | 	spa_assert(SPA_PTRDIFF(&a.func, &a) == SPA_PTRDIFF(&b.func, &b)); \ | 
					
						
							|  |  |  | } while(0) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void test_abi(void) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | 	struct pw_context_events ev; | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | 	struct { | 
					
						
							|  |  |  | 		uint32_t version; | 
					
						
							|  |  |  | 		void (*destroy) (void *data); | 
					
						
							|  |  |  | 		void (*free) (void *data); | 
					
						
							|  |  |  | 		void (*info_changed) (void *data, const struct pw_core_info *info); | 
					
						
							|  |  |  | 		void (*check_access) (void *data, struct pw_client *client); | 
					
						
							|  |  |  | 		void (*global_added) (void *data, struct pw_global *global); | 
					
						
							|  |  |  | 		void (*global_removed) (void *data, struct pw_global *global); | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | 	} test = { PW_VERSION_CONTEXT_EVENTS, NULL }; | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	TEST_FUNC(ev, test, destroy); | 
					
						
							|  |  |  | 	TEST_FUNC(ev, test, free); | 
					
						
							|  |  |  | 	TEST_FUNC(ev, test, info_changed); | 
					
						
							|  |  |  | 	TEST_FUNC(ev, test, check_access); | 
					
						
							|  |  |  | 	TEST_FUNC(ev, test, global_added); | 
					
						
							|  |  |  | 	TEST_FUNC(ev, test, global_removed); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | 	spa_assert(PW_VERSION_CONTEXT_EVENTS == 0); | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | 	spa_assert(sizeof(ev) == sizeof(test)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | static void context_destroy_error(void *data) | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | { | 
					
						
							|  |  |  | 	spa_assert_not_reached(); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | static void context_free_error(void *data) | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | { | 
					
						
							|  |  |  | 	spa_assert_not_reached(); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | static void context_info_changed_error(void *data, const struct pw_core_info *info) | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | { | 
					
						
							|  |  |  | 	spa_assert_not_reached(); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | static void context_check_access_error(void *data, struct pw_client *client) | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | { | 
					
						
							|  |  |  | 	spa_assert_not_reached(); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | static void context_global_added_error(void *data, struct pw_global *global) | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | { | 
					
						
							|  |  |  | 	spa_assert_not_reached(); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | static void context_global_removed_error(void *data, struct pw_global *global) | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | { | 
					
						
							|  |  |  | 	spa_assert_not_reached(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | static const struct pw_context_events context_events_error = | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | 	PW_VERSION_CONTEXT_EVENTS, | 
					
						
							|  |  |  | 	.destroy = context_destroy_error, | 
					
						
							|  |  |  | 	.free = context_free_error, | 
					
						
							|  |  |  | 	.info_changed = context_info_changed_error, | 
					
						
							|  |  |  | 	.check_access = context_check_access_error, | 
					
						
							|  |  |  | 	.global_added = context_global_added_error, | 
					
						
							|  |  |  | 	.global_removed = context_global_removed_error, | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int destroy_count = 0; | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | static void context_destroy_count(void *data) | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | { | 
					
						
							|  |  |  | 	destroy_count++; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | static int free_count = 0; | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | static void context_free_count(void *data) | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | { | 
					
						
							|  |  |  | 	free_count++; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | static int global_removed_count = 0; | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | static void context_global_removed_count(void *data, struct pw_global *global) | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | { | 
					
						
							|  |  |  | 	global_removed_count++; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | static int context_foreach_count = 0; | 
					
						
							|  |  |  | static int context_foreach(void *data, struct pw_global *global) | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | 	context_foreach_count++; | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | static int context_foreach_error(void *data, struct pw_global *global) | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | 	context_foreach_count++; | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | 	return -1; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | static void test_create(void) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct pw_main_loop *loop; | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | 	struct pw_context *context; | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | 	struct spa_hook listener = { NULL, }; | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | 	struct pw_context_events context_events = context_events_error; | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | 	struct pw_global *global; | 
					
						
							|  |  |  | 	int res; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	loop = pw_main_loop_new(NULL); | 
					
						
							|  |  |  | 	spa_assert(loop != NULL); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | 	context = pw_context_new(pw_main_loop_get_loop(loop), | 
					
						
							| 
									
										
										
										
											2019-12-06 17:12:07 +01:00
										 |  |  | 			pw_properties_new( | 
					
						
							|  |  |  | 				PW_KEY_CORE_PROFILE_MODULES, "none", | 
					
						
							|  |  |  | 				NULL), 12); | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | 	spa_assert(context != NULL); | 
					
						
							|  |  |  | 	pw_context_add_listener(context, &listener, &context_events, context); | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* check main loop */ | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | 	spa_assert(pw_context_get_main_loop(context) == pw_main_loop_get_loop(loop)); | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | 	/* check user data */ | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | 	spa_assert(pw_context_get_user_data(context) != NULL); | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* check info */ | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | 	spa_assert(pw_context_get_info(context) != NULL); | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* check global */ | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | 	global = pw_context_get_global(context); | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | 	spa_assert(global != NULL); | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | 	spa_assert(pw_context_find_global(context, 0) == global); | 
					
						
							|  |  |  | 	spa_assert(pw_global_get_context(global) == context); | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | 	spa_assert(pw_global_get_type(global) == PW_TYPE_INTERFACE_Core); | 
					
						
							| 
									
										
										
										
											2019-12-11 07:46:59 +01:00
										 |  |  | 	spa_assert(pw_global_get_version(global) == PW_VERSION_CORE); | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | 	spa_assert(pw_global_get_id(global) == 0); | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | 	spa_assert(pw_global_get_object(global) == (void*)context); | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* iterate globals */ | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | 	spa_assert(context_foreach_count == 0); | 
					
						
							|  |  |  | 	res = pw_context_for_each_global(context, context_foreach, context); | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | 	spa_assert(res == 0); | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | 	spa_assert(context_foreach_count == 1); | 
					
						
							|  |  |  | 	res = pw_context_for_each_global(context, context_foreach_error, context); | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | 	spa_assert(res == -1); | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | 	spa_assert(context_foreach_count == 2); | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* check destroy */ | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | 	context_events.destroy = context_destroy_count; | 
					
						
							|  |  |  | 	context_events.free = context_free_count; | 
					
						
							|  |  |  | 	context_events.global_removed = context_global_removed_count; | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	spa_assert(destroy_count == 0); | 
					
						
							|  |  |  | 	spa_assert(free_count == 0); | 
					
						
							|  |  |  | 	spa_assert(global_removed_count == 0); | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | 	pw_context_destroy(context); | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | 	spa_assert(destroy_count == 1); | 
					
						
							|  |  |  | 	spa_assert(free_count == 1); | 
					
						
							|  |  |  | 	spa_assert(global_removed_count == 1); | 
					
						
							|  |  |  | 	pw_main_loop_destroy(loop); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int info_changed_count = 0; | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | static void context_info_changed_count(void *data, const struct pw_core_info *info) | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | { | 
					
						
							|  |  |  | 	spa_assert(spa_dict_lookup(info->props, "foo") == NULL); | 
					
						
							|  |  |  | 	spa_assert(!strcmp(spa_dict_lookup(info->props, "biz"), "buzz")); | 
					
						
							|  |  |  | 	spa_assert(!strcmp(spa_dict_lookup(info->props, "buzz"), "frizz")); | 
					
						
							|  |  |  | 	info_changed_count++; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2019-01-09 10:48:18 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | static void test_properties(void) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct pw_main_loop *loop; | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | 	struct pw_context *context; | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | 	const struct pw_properties *props; | 
					
						
							|  |  |  | 	struct spa_hook listener = { NULL, }; | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | 	struct pw_context_events context_events = context_events_error; | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | 	struct spa_dict_item items[3]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	loop = pw_main_loop_new(NULL); | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | 	context = pw_context_new(pw_main_loop_get_loop(loop), | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | 			pw_properties_new("foo", "bar", | 
					
						
							|  |  |  | 					  "biz", "fuzz", | 
					
						
							|  |  |  | 					  NULL), | 
					
						
							|  |  |  | 			0); | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | 	spa_assert(context != NULL); | 
					
						
							|  |  |  | 	spa_assert(pw_context_get_user_data(context) == NULL); | 
					
						
							|  |  |  | 	pw_context_add_listener(context, &listener, &context_events, context); | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | 	context_events.info_changed = context_info_changed_count; | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | 	spa_assert(info_changed_count == 0); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | 	props = pw_context_get_properties(context); | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | 	spa_assert(props != NULL); | 
					
						
							|  |  |  | 	spa_assert(!strcmp(pw_properties_get(props, "foo"), "bar")); | 
					
						
							|  |  |  | 	spa_assert(!strcmp(pw_properties_get(props, "biz"), "fuzz")); | 
					
						
							|  |  |  | 	spa_assert(pw_properties_get(props, "buzz") == NULL); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* remove foo */ | 
					
						
							|  |  |  | 	items[0] = SPA_DICT_ITEM_INIT("foo", NULL); | 
					
						
							|  |  |  | 	/* change biz */ | 
					
						
							|  |  |  | 	items[1] = SPA_DICT_ITEM_INIT("biz", "buzz"); | 
					
						
							|  |  |  | 	/* add buzz */ | 
					
						
							|  |  |  | 	items[2] = SPA_DICT_ITEM_INIT("buzz", "frizz"); | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | 	pw_context_update_properties(context, &SPA_DICT_INIT(items, 3)); | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	spa_assert(info_changed_count == 1); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | 	spa_assert(props == pw_context_get_properties(context)); | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | 	spa_assert(pw_properties_get(props, "foo") == NULL); | 
					
						
							|  |  |  | 	spa_assert(!strcmp(pw_properties_get(props, "biz"), "buzz")); | 
					
						
							|  |  |  | 	spa_assert(!strcmp(pw_properties_get(props, "buzz"), "frizz")); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	spa_hook_remove(&listener); | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | 	pw_context_destroy(context); | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | 	pw_main_loop_destroy(loop); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void test_support(void) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct pw_main_loop *loop; | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | 	struct pw_context *context; | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | 	const struct spa_support *support; | 
					
						
							|  |  |  | 	uint32_t n_support; | 
					
						
							|  |  |  | 	uint32_t types[] = { | 
					
						
							| 
									
										
										
										
											2019-06-06 16:40:15 +02:00
										 |  |  | 		SPA_TYPE_INTERFACE_DataSystem, | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | 		SPA_TYPE_INTERFACE_DataLoop, | 
					
						
							| 
									
										
										
										
											2019-06-06 16:40:15 +02:00
										 |  |  | 		SPA_TYPE_INTERFACE_System, | 
					
						
							| 
									
										
										
										
											2019-06-06 15:20:43 +02:00
										 |  |  | 		SPA_TYPE_INTERFACE_Loop, | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | 		SPA_TYPE_INTERFACE_LoopUtils, | 
					
						
							|  |  |  | 		SPA_TYPE_INTERFACE_Log, | 
					
						
							|  |  |  | 		SPA_TYPE_INTERFACE_DBus, | 
					
						
							|  |  |  | 		SPA_TYPE_INTERFACE_CPU | 
					
						
							|  |  |  | 	}; | 
					
						
							|  |  |  | 	size_t i; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	loop = pw_main_loop_new(NULL); | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | 	context = pw_context_new(pw_main_loop_get_loop(loop), NULL, 0); | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | 	support = pw_context_get_support(context, &n_support); | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | 	spa_assert(support != NULL); | 
					
						
							|  |  |  | 	spa_assert(n_support > 0); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	for (i = 0; i < SPA_N_ELEMENTS(types); i++) { | 
					
						
							|  |  |  | 		spa_assert(spa_support_find(support, n_support, types[i]) != NULL); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-10 18:19:56 +01:00
										 |  |  | 	pw_context_destroy(context); | 
					
						
							| 
									
										
										
										
											2019-01-08 17:38:34 +01:00
										 |  |  | 	pw_main_loop_destroy(loop); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int main(int argc, char *argv[]) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	pw_init(&argc, &argv); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	test_abi(); | 
					
						
							|  |  |  | 	test_create(); | 
					
						
							|  |  |  | 	test_properties(); | 
					
						
							|  |  |  | 	test_support(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } |