mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 10:47:18 +00:00 
			
		
		
		
	Constify a string and strip trailing whitespace.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@199370 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
		| @@ -106,13 +106,14 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") | ||||
| 			</parameter> | ||||
| 		</syntax> | ||||
| 		<description> | ||||
| 			<para>When executing this application, two jack ports will be created;  | ||||
| 			one input and one output. Other applications can be hooked up to  | ||||
| 			<para>When executing this application, two jack ports will be created; | ||||
| 			one input and one output. Other applications can be hooked up to | ||||
| 			these ports to access audio coming from, or being send to the channel.</para> | ||||
| 		</description> | ||||
| 	</application> | ||||
|  ***/ | ||||
| static char *jack_app = "JACK"; | ||||
|  | ||||
| static const char *jack_app = "JACK"; | ||||
|  | ||||
| struct jack_data { | ||||
| 	AST_DECLARE_STRING_FIELDS( | ||||
| @@ -181,7 +182,7 @@ static void log_jack_status(const char *prefix, jack_status_t status) | ||||
| 		} else | ||||
| 			ast_str_append(&str, 0, ", %s", jack_status_to_str((1 << i))); | ||||
| 	} | ||||
| 	 | ||||
|  | ||||
| 	ast_log(LOG_NOTICE, "%s: %s\n", prefix, ast_str_buffer(str)); | ||||
| } | ||||
|  | ||||
| @@ -201,10 +202,10 @@ static int alloc_resampler(struct jack_data *jack_data, int input) | ||||
|  | ||||
| 	/* XXX Hard coded 8 kHz */ | ||||
|  | ||||
| 	to_srate = input ? 8000.0 : jack_srate;  | ||||
| 	to_srate = input ? 8000.0 : jack_srate; | ||||
| 	from_srate = input ? jack_srate : 8000.0; | ||||
|  | ||||
| 	resample_factor = input ? &jack_data->input_resample_factor :  | ||||
| 	resample_factor = input ? &jack_data->input_resample_factor : | ||||
| 		&jack_data->output_resample_factor; | ||||
|  | ||||
| 	if (from_srate == to_srate) { | ||||
| @@ -219,9 +220,9 @@ static int alloc_resampler(struct jack_data *jack_data, int input) | ||||
| 	resampler = input ? &jack_data->input_resampler : | ||||
| 		&jack_data->output_resampler; | ||||
|  | ||||
| 	if (!(*resampler = resample_open(RESAMPLE_QUALITY,  | ||||
| 	if (!(*resampler = resample_open(RESAMPLE_QUALITY, | ||||
| 		*resample_factor, *resample_factor))) { | ||||
| 		ast_log(LOG_ERROR, "Failed to open %s resampler\n",  | ||||
| 		ast_log(LOG_ERROR, "Failed to open %s resampler\n", | ||||
| 			input ? "input" : "output"); | ||||
| 		return -1; | ||||
| 	} | ||||
| @@ -233,9 +234,9 @@ static int alloc_resampler(struct jack_data *jack_data, int input) | ||||
|  * \brief Handle jack input port | ||||
|  * | ||||
|  * Read nframes number of samples from the input buffer, resample it | ||||
|  * if necessary, and write it into the appropriate ringbuffer.  | ||||
|  * if necessary, and write it into the appropriate ringbuffer. | ||||
|  */ | ||||
| static void handle_input(void *buf, jack_nframes_t nframes,  | ||||
| static void handle_input(void *buf, jack_nframes_t nframes, | ||||
| 	struct jack_data *jack_data) | ||||
| { | ||||
| 	short s_buf[nframes]; | ||||
| @@ -266,7 +267,7 @@ static void handle_input(void *buf, jack_nframes_t nframes, | ||||
|  | ||||
| 			total_out_buf_used += out_buf_used; | ||||
| 			total_in_buf_used += in_buf_used; | ||||
| 	 | ||||
|  | ||||
| 			if (total_out_buf_used == ARRAY_LEN(f_buf)) { | ||||
| 				ast_log(LOG_ERROR, "Output buffer filled ... need to increase its size, " | ||||
| 					"nframes '%d', total_out_buf_used '%d'\n", nframes, total_out_buf_used); | ||||
| @@ -276,7 +277,7 @@ static void handle_input(void *buf, jack_nframes_t nframes, | ||||
|  | ||||
| 		for (i = 0; i < total_out_buf_used; i++) | ||||
| 			s_buf[i] = f_buf[i] * (SHRT_MAX / 1.0); | ||||
| 		 | ||||
|  | ||||
| 		write_len = total_out_buf_used * sizeof(int16_t); | ||||
| 	} else { | ||||
| 		/* No resampling needed */ | ||||
| @@ -298,7 +299,7 @@ static void handle_input(void *buf, jack_nframes_t nframes, | ||||
|  * Read nframes number of samples from the ringbuffer and write it out to the | ||||
|  * output port buffer. | ||||
|  */ | ||||
| static void handle_output(void *buf, jack_nframes_t nframes,  | ||||
| static void handle_output(void *buf, jack_nframes_t nframes, | ||||
| 	struct jack_data *jack_data) | ||||
| { | ||||
| 	size_t res, len; | ||||
| @@ -368,7 +369,7 @@ static struct jack_data *destroy_jack_data(struct jack_data *jack_data) | ||||
| 		resample_close(jack_data->output_resampler); | ||||
| 		jack_data->output_resampler = NULL; | ||||
| 	} | ||||
| 	 | ||||
|  | ||||
| 	if (jack_data->input_resampler) { | ||||
| 		resample_close(jack_data->input_resampler); | ||||
| 		jack_data->input_resampler = NULL; | ||||
| @@ -539,10 +540,10 @@ static int queue_voice_frame(struct jack_data *jack_data, struct ast_frame *f) | ||||
| 			int in_buf_used; | ||||
| 			int out_buf_used; | ||||
|  | ||||
| 			out_buf_used = resample_process(jack_data->output_resampler,  | ||||
| 			out_buf_used = resample_process(jack_data->output_resampler, | ||||
| 				jack_data->output_resample_factor, | ||||
| 				&in_buf[total_in_buf_used], ARRAY_LEN(in_buf) - total_in_buf_used,  | ||||
| 				0, &in_buf_used,  | ||||
| 				&in_buf[total_in_buf_used], ARRAY_LEN(in_buf) - total_in_buf_used, | ||||
| 				0, &in_buf_used, | ||||
| 				&f_buf[total_out_buf_used], ARRAY_LEN(f_buf) - total_out_buf_used); | ||||
|  | ||||
| 			if (out_buf_used < 0) | ||||
| @@ -599,7 +600,7 @@ static int queue_voice_frame(struct jack_data *jack_data, struct ast_frame *f) | ||||
|  */ | ||||
| static void handle_jack_audio(struct ast_channel *chan, struct jack_data *jack_data, | ||||
| 	struct ast_frame *out_frame) | ||||
| {	 | ||||
| { | ||||
| 	short buf[160]; | ||||
| 	struct ast_frame f = { | ||||
| 		.frametype = AST_FRAME_VOICE, | ||||
| @@ -677,7 +678,7 @@ static struct jack_data *jack_data_alloc(void) | ||||
|  | ||||
| 	if (!(jack_data = ast_calloc(1, sizeof(*jack_data)))) | ||||
| 		return NULL; | ||||
| 	 | ||||
|  | ||||
| 	if (ast_string_field_init(jack_data, 32)) { | ||||
| 		ast_free(jack_data); | ||||
| 		return NULL; | ||||
| @@ -811,7 +812,7 @@ static const struct ast_datastore_info jack_hook_ds_info = { | ||||
| 	.destroy = jack_hook_ds_destroy, | ||||
| }; | ||||
|  | ||||
| static int jack_hook_callback(struct ast_audiohook *audiohook, struct ast_channel *chan,  | ||||
| static int jack_hook_callback(struct ast_audiohook *audiohook, struct ast_channel *chan, | ||||
| 	struct ast_frame *frame, enum ast_audiohook_direction direction) | ||||
| { | ||||
| 	struct ast_datastore *datastore; | ||||
| @@ -870,7 +871,7 @@ static int enable_jack_hook(struct ast_channel *chan, char *data) | ||||
| 	} | ||||
|  | ||||
| 	if (ast_strlen_zero(args.mode) || strcasecmp(args.mode, "manipulate")) { | ||||
| 		ast_log(LOG_ERROR, "'%s' is not a supported mode.  Only manipulate is supported.\n",  | ||||
| 		ast_log(LOG_ERROR, "'%s' is not a supported mode.  Only manipulate is supported.\n", | ||||
| 			S_OR(args.mode, "<none>")); | ||||
| 		goto return_error; | ||||
| 	} | ||||
| @@ -940,7 +941,7 @@ static int disable_jack_hook(struct ast_channel *chan) | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
| static int jack_hook_write(struct ast_channel *chan, const char *cmd, char *data,  | ||||
| static int jack_hook_write(struct ast_channel *chan, const char *cmd, char *data, | ||||
| 	const char *value) | ||||
| { | ||||
| 	int res; | ||||
| @@ -950,7 +951,7 @@ static int jack_hook_write(struct ast_channel *chan, const char *cmd, char *data | ||||
| 	else if (!strcasecmp(value, "off")) | ||||
| 		res = disable_jack_hook(chan); | ||||
| 	else { | ||||
| 		ast_log(LOG_ERROR, "'%s' is not a valid value for JACK_HOOK()\n", value);	 | ||||
| 		ast_log(LOG_ERROR, "'%s' is not a valid value for JACK_HOOK()\n", value); | ||||
| 		res = -1; | ||||
| 	} | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user