Fix a few places where frame data was used directly.
authorJason Parker <jparker@digium.com>
Thu, 22 May 2008 17:10:53 +0000 (17:10 +0000)
committerJason Parker <jparker@digium.com>
Thu, 22 May 2008 17:10:53 +0000 (17:10 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@117828 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_jack.c
codecs/codec_speex.c
formats/format_ogg_vorbis.c
funcs/func_speex.c

index 1b5f4e7..cfa99be 100644 (file)
@@ -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;
                }
index 4946931..b9f8795 100644 (file)
@@ -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;
 }
index 669e96a..de2a20c 100644 (file)
@@ -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;
index fc4eb8e..7b24840 100644 (file)
@@ -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;
 }