[svn-commits] russell: trunk r199370 - /trunk/apps/app_jack.c
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Sat Jun 6 16:40:59 CDT 2009
Author: russell
Date: Sat Jun 6 16:40:56 2009
New Revision: 199370
URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=199370
Log:
Constify a string and strip trailing whitespace.
Modified:
trunk/apps/app_jack.c
Modified: trunk/apps/app_jack.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_jack.c?view=diff&rev=199370&r1=199369&r2=199370
==============================================================================
--- trunk/apps/app_jack.c (original)
+++ trunk/apps/app_jack.c Sat Jun 6 16:40:56 2009
@@ -106,13 +106,14 @@
</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 @@
} 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 @@
/* 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 @@
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 @@
* \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 @@
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 @@
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 @@
* 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 @@
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 @@
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 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 @@
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 @@
.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 @@
}
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 @@
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 @@
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;
}
More information about the svn-commits
mailing list