mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	filter-chain: improve some error messages
This commit is contained in:
		
							parent
							
								
									6bb73124aa
								
							
						
					
					
						commit
						ef8114ff0c
					
				
					 2 changed files with 39 additions and 18 deletions
				
			
		| 
						 | 
					@ -1172,16 +1172,19 @@ static struct plugin *plugin_load(struct impl *impl, const char *type, const cha
 | 
				
			||||||
	else if (spa_streq(type, "ladspa")) {
 | 
						else if (spa_streq(type, "ladspa")) {
 | 
				
			||||||
		pl = load_ladspa_plugin(support, n_support, path, NULL);
 | 
							pl = load_ladspa_plugin(support, n_support, path, NULL);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
#ifdef HAVE_LILV
 | 
					 | 
				
			||||||
	else if (spa_streq(type, "lv2")) {
 | 
						else if (spa_streq(type, "lv2")) {
 | 
				
			||||||
 | 
					#ifdef HAVE_LILV
 | 
				
			||||||
		pl = load_lv2_plugin(support, n_support, path, NULL);
 | 
							pl = load_lv2_plugin(support, n_support, path, NULL);
 | 
				
			||||||
	}
 | 
					#else
 | 
				
			||||||
 | 
							pw_log_error("filter-chain is compiled without lv2 support");
 | 
				
			||||||
 | 
							pl = NULL;
 | 
				
			||||||
 | 
							errno = ENOTSUP;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	else {
 | 
						} else {
 | 
				
			||||||
 | 
							pw_log_error("invalid plugin type '%s'", type);
 | 
				
			||||||
		pl = NULL;
 | 
							pl = NULL;
 | 
				
			||||||
		errno = EINVAL;
 | 
							errno = EINVAL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (pl == NULL)
 | 
						if (pl == NULL)
 | 
				
			||||||
		goto exit;
 | 
							goto exit;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1538,10 +1541,8 @@ static int load_node(struct graph *graph, struct spa_json *json)
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (spa_streq(type, "builtin")) {
 | 
						if (spa_streq(type, "builtin"))
 | 
				
			||||||
		snprintf(plugin, sizeof(plugin), "%s", "builtin");
 | 
							snprintf(plugin, sizeof(plugin), "%s", "builtin");
 | 
				
			||||||
	} else if (!spa_streq(type, "ladspa") && !spa_streq(type, "lv2"))
 | 
					 | 
				
			||||||
		return -ENOTSUP;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_info("loading type:%s plugin:%s label:%s", type, plugin, label);
 | 
						pw_log_info("loading type:%s plugin:%s label:%s", type, plugin, label);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -600,42 +600,60 @@ static void * convolver_instantiate(const struct fc_descriptor * Descriptor,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	while (spa_json_get_string(&it[1], key, sizeof(key)) > 0) {
 | 
						while (spa_json_get_string(&it[1], key, sizeof(key)) > 0) {
 | 
				
			||||||
		if (spa_streq(key, "blocksize")) {
 | 
							if (spa_streq(key, "blocksize")) {
 | 
				
			||||||
			if (spa_json_get_int(&it[1], &blocksize) <= 0)
 | 
								if (spa_json_get_int(&it[1], &blocksize) <= 0) {
 | 
				
			||||||
 | 
									pw_log_error("convolver:blocksize requires a number");
 | 
				
			||||||
				return NULL;
 | 
									return NULL;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		else if (spa_streq(key, "tailsize")) {
 | 
							else if (spa_streq(key, "tailsize")) {
 | 
				
			||||||
			if (spa_json_get_int(&it[1], &tailsize) <= 0)
 | 
								if (spa_json_get_int(&it[1], &tailsize) <= 0) {
 | 
				
			||||||
 | 
									pw_log_error("convolver:tailsize requires a number");
 | 
				
			||||||
				return NULL;
 | 
									return NULL;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		else if (spa_streq(key, "gain")) {
 | 
							else if (spa_streq(key, "gain")) {
 | 
				
			||||||
			if (spa_json_get_float(&it[1], &gain) <= 0)
 | 
								if (spa_json_get_float(&it[1], &gain) <= 0) {
 | 
				
			||||||
 | 
									pw_log_error("convolver:gain requires a number");
 | 
				
			||||||
				return NULL;
 | 
									return NULL;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		else if (spa_streq(key, "delay")) {
 | 
							else if (spa_streq(key, "delay")) {
 | 
				
			||||||
			if (spa_json_get_int(&it[1], &delay) <= 0)
 | 
								if (spa_json_get_int(&it[1], &delay) <= 0) {
 | 
				
			||||||
 | 
									pw_log_error("convolver:delay requires a number");
 | 
				
			||||||
				return NULL;
 | 
									return NULL;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		else if (spa_streq(key, "filename")) {
 | 
							else if (spa_streq(key, "filename")) {
 | 
				
			||||||
			if (spa_json_get_string(&it[1], filename, sizeof(filename)) <= 0)
 | 
								if (spa_json_get_string(&it[1], filename, sizeof(filename)) <= 0) {
 | 
				
			||||||
 | 
									pw_log_error("convolver:filename requires a string");
 | 
				
			||||||
				return NULL;
 | 
									return NULL;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		else if (spa_streq(key, "offset")) {
 | 
							else if (spa_streq(key, "offset")) {
 | 
				
			||||||
			if (spa_json_get_int(&it[1], &offset) <= 0)
 | 
								if (spa_json_get_int(&it[1], &offset) <= 0) {
 | 
				
			||||||
 | 
									pw_log_error("convolver:offset requires a number");
 | 
				
			||||||
				return NULL;
 | 
									return NULL;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		else if (spa_streq(key, "length")) {
 | 
							else if (spa_streq(key, "length")) {
 | 
				
			||||||
			if (spa_json_get_int(&it[1], &length) <= 0)
 | 
								if (spa_json_get_int(&it[1], &length) <= 0) {
 | 
				
			||||||
 | 
									pw_log_error("convolver:length requires a number");
 | 
				
			||||||
				return NULL;
 | 
									return NULL;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		else if (spa_streq(key, "channel")) {
 | 
							else if (spa_streq(key, "channel")) {
 | 
				
			||||||
			if (spa_json_get_int(&it[1], &channel) <= 0)
 | 
								if (spa_json_get_int(&it[1], &channel) <= 0) {
 | 
				
			||||||
 | 
									pw_log_error("convolver:channel requires a number");
 | 
				
			||||||
				return NULL;
 | 
									return NULL;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		else if (spa_json_next(&it[1], &val) < 0)
 | 
							else if (spa_json_next(&it[1], &val) < 0)
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (!filename[0])
 | 
						if (!filename[0]) {
 | 
				
			||||||
 | 
							pw_log_error("convolver:filename was not given");
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (delay < 0)
 | 
						if (delay < 0)
 | 
				
			||||||
		delay = 0;
 | 
							delay = 0;
 | 
				
			||||||
| 
						 | 
					@ -779,9 +797,11 @@ static void *delay_instantiate(const struct fc_descriptor * Descriptor,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	while (spa_json_get_string(&it[1], key, sizeof(key)) > 0) {
 | 
						while (spa_json_get_string(&it[1], key, sizeof(key)) > 0) {
 | 
				
			||||||
		if (spa_streq(key, "max-delay")) {
 | 
							if (spa_streq(key, "max-delay")) {
 | 
				
			||||||
			if (spa_json_get_float(&it[1], &max_delay) <= 0)
 | 
								if (spa_json_get_float(&it[1], &max_delay) <= 0) {
 | 
				
			||||||
 | 
									pw_log_error("delay:max-delay requires a number");
 | 
				
			||||||
				return NULL;
 | 
									return NULL;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		else if (spa_json_next(&it[1], &val) < 0)
 | 
							else if (spa_json_next(&it[1], &val) < 0)
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -794,7 +814,7 @@ static void *delay_instantiate(const struct fc_descriptor * Descriptor,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	impl->rate = SampleRate;
 | 
						impl->rate = SampleRate;
 | 
				
			||||||
	impl->buffer_samples = max_delay * impl->rate;
 | 
						impl->buffer_samples = max_delay * impl->rate;
 | 
				
			||||||
	pw_log_info("%lu %d", impl->rate, impl->buffer_samples);
 | 
						pw_log_info("max-delay:%f seconds rate:%lu samples:%d", max_delay, impl->rate, impl->buffer_samples);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	impl->buffer = calloc(impl->buffer_samples, sizeof(float));
 | 
						impl->buffer = calloc(impl->buffer_samples, sizeof(float));
 | 
				
			||||||
	if (impl->buffer == NULL) {
 | 
						if (impl->buffer == NULL) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue