From f7eb823a7a4551139abd677a2024705012d035c6 Mon Sep 17 00:00:00 2001 From: Jason Parker Date: Thu, 22 May 2008 17:10:53 +0000 Subject: [PATCH] Fix a few places where frame data was used directly. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@117828 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- apps/app_jack.c | 8 ++++---- codecs/codec_speex.c | 8 ++++---- formats/format_ogg_vorbis.c | 4 ++-- funcs/func_speex.c | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/apps/app_jack.c b/apps/app_jack.c index 1b5f4e7382..cfa99be407 100644 --- a/apps/app_jack.c +++ b/apps/app_jack.c @@ -484,7 +484,7 @@ static int queue_voice_frame(struct jack_data *jack_data, struct ast_frame *f) float f_buf[f->samples * 8]; size_t f_buf_used = 0; int i; - int16_t *s_buf = f->data; + int16_t *s_buf = f->data.ptr; size_t res; memset(f_buf, 0, sizeof(f_buf)); @@ -572,7 +572,7 @@ static void handle_jack_audio(struct ast_channel *chan, struct jack_data *jack_d .frametype = AST_FRAME_VOICE, .subclass = AST_FORMAT_SLINEAR, .src = "JACK", - .data = buf, + .data.ptr = buf, .datalen = sizeof(buf), .samples = ARRAY_LEN(buf), }; @@ -582,7 +582,7 @@ static void handle_jack_audio(struct ast_channel *chan, struct jack_data *jack_d char *read_buf; read_len = out_frame ? out_frame->datalen : sizeof(buf); - read_buf = out_frame ? out_frame->data : buf; + read_buf = out_frame ? out_frame->data.ptr : buf; res = jack_ringbuffer_read_space(jack_data->input_rb); @@ -590,7 +590,7 @@ static void handle_jack_audio(struct ast_channel *chan, struct jack_data *jack_d /* Not enough data ready for another frame, move on ... */ if (out_frame) { ast_debug(1, "Sending an empty frame for the JACK_HOOK\n"); - memset(out_frame->data, 0, out_frame->datalen); + memset(out_frame->data.ptr, 0, out_frame->datalen); } break; } diff --git a/codecs/codec_speex.c b/codecs/codec_speex.c index 4946931828..b9f8795351 100644 --- a/codecs/codec_speex.c +++ b/codecs/codec_speex.c @@ -165,7 +165,7 @@ static struct ast_frame *lintospeex_sample(void) f.mallocd = 0; f.offset = 0; f.src = __PRETTY_FUNCTION__; - f.data = slin_speex_ex; + f.data.ptr = slin_speex_ex; return &f; } @@ -180,7 +180,7 @@ static struct ast_frame *speextolin_sample(void) f.mallocd = 0; f.offset = 0; f.src = __PRETTY_FUNCTION__; - f.data = speex_slin_ex; + f.data.ptr = speex_slin_ex; return &f; } @@ -220,7 +220,7 @@ static int speextolin_framein(struct ast_trans_pvt *pvt, struct ast_frame *f) } /* Read in bits */ - speex_bits_read_from(&tmp->bits, f->data, f->datalen); + speex_bits_read_from(&tmp->bits, f->data.ptr, f->datalen); for (;;) { #ifdef _SPEEX_TYPES_H res = speex_decode_int(tmp->speex, &tmp->bits, fout); @@ -249,7 +249,7 @@ static int lintospeex_framein(struct ast_trans_pvt *pvt, struct ast_frame *f) /* XXX We should look at how old the rest of our stream is, and if it is too old, then we should overwrite it entirely, otherwise we can get artifacts of earlier talk that do not belong */ - memcpy(tmp->buf + pvt->samples, f->data, f->datalen); + memcpy(tmp->buf + pvt->samples, f->data.ptr, f->datalen); pvt->samples += f->samples; return 0; } diff --git a/formats/format_ogg_vorbis.c b/formats/format_ogg_vorbis.c index 669e96a7d5..de2a20c745 100644 --- a/formats/format_ogg_vorbis.c +++ b/formats/format_ogg_vorbis.c @@ -291,7 +291,7 @@ static int ogg_vorbis_write(struct ast_filestream *fs, struct ast_frame *f) if (!f->datalen) return -1; - data = (short *) f->data; + data = (short *) f->data.ptr; buffer = vorbis_analysis_buffer(&s->vd, f->samples); @@ -433,7 +433,7 @@ static struct ast_frame *ogg_vorbis_read(struct ast_filestream *fs, fs->fr.subclass = AST_FORMAT_SLINEAR; fs->fr.mallocd = 0; AST_FRAME_SET_BUFFER(&fs->fr, fs->buf, AST_FRIENDLY_OFFSET, BUF_SIZE); - buf = (short *)(fs->fr.data); /* SLIN data buffer */ + buf = (short *)(fs->fr.data.ptr); /* SLIN data buffer */ while (samples_out != SAMPLES_MAX) { float **pcm; diff --git a/funcs/func_speex.c b/funcs/func_speex.c index fc4eb8e3ec..7b24840101 100644 --- a/funcs/func_speex.c +++ b/funcs/func_speex.c @@ -135,7 +135,7 @@ static int speex_callback(struct ast_audiohook *audiohook, struct ast_channel *c speex_preprocess_ctl(sdi->state, SPEEX_PREPROCESS_SET_DENOISE, &sdi->denoise); } - speex_preprocess(sdi->state, frame->data, NULL); + speex_preprocess(sdi->state, frame->data.ptr, NULL); return 0; }