diff options
Diffstat (limited to 'main')
-rw-r--r-- | main/abstract_jb.c | 2 | ||||
-rw-r--r-- | main/app.c | 2 | ||||
-rw-r--r-- | main/audiohook.c | 8 | ||||
-rw-r--r-- | main/channel.c | 42 | ||||
-rw-r--r-- | main/dsp.c | 10 | ||||
-rw-r--r-- | main/features.c | 4 | ||||
-rw-r--r-- | main/file.c | 2 | ||||
-rw-r--r-- | main/frame.c | 40 | ||||
-rw-r--r-- | main/indications.c | 2 | ||||
-rw-r--r-- | main/rtp.c | 42 | ||||
-rw-r--r-- | main/slinfactory.c | 2 | ||||
-rw-r--r-- | main/translate.c | 2 | ||||
-rw-r--r-- | main/udptl.c | 8 |
13 files changed, 89 insertions, 77 deletions
diff --git a/main/abstract_jb.c b/main/abstract_jb.c index e51187d7b..a4637c1b0 100644 --- a/main/abstract_jb.c +++ b/main/abstract_jb.c @@ -415,7 +415,7 @@ static void jb_get_and_deliver(struct ast_channel *chan) f->samples = interpolation_len * 8; f->mallocd = 0; f->src = "JB interpolation"; - f->data = NULL; + f->data.ptr = NULL; f->delivery = ast_tvadd(jb->timebase, ast_samp2tv(jb->next, 1000)); f->offset = AST_FRIENDLY_OFFSET; /* deliver the interpolated frame */ diff --git a/main/app.c b/main/app.c index 0cd6ba844..ebdd237b3 100644 --- a/main/app.c +++ b/main/app.c @@ -337,7 +337,7 @@ static int linear_generator(struct ast_channel *chan, void *data, int len, int s struct ast_frame f = { .frametype = AST_FRAME_VOICE, .subclass = AST_FORMAT_SLINEAR, - .data = buf + AST_FRIENDLY_OFFSET / 2, + .data.ptr = buf + AST_FRIENDLY_OFFSET / 2, .offset = AST_FRIENDLY_OFFSET, }; int res; diff --git a/main/audiohook.c b/main/audiohook.c index 37970174e..0e75cc6cd 100644 --- a/main/audiohook.c +++ b/main/audiohook.c @@ -158,7 +158,7 @@ static struct ast_frame *audiohook_read_frame_single(struct ast_audiohook *audio struct ast_frame frame = { .frametype = AST_FRAME_VOICE, .subclass = AST_FORMAT_SLINEAR, - .data = buf, + .data.ptr = buf, .datalen = sizeof(buf), .samples = samples, }; @@ -185,7 +185,7 @@ static struct ast_frame *audiohook_read_frame_both(struct ast_audiohook *audioho struct ast_frame frame = { .frametype = AST_FRAME_VOICE, .subclass = AST_FORMAT_SLINEAR, - .data = NULL, + .data.ptr = NULL, .datalen = sizeof(buf1), .samples = samples, }; @@ -263,7 +263,7 @@ static struct ast_frame *audiohook_read_frame_both(struct ast_audiohook *audioho final_buf = buf2; /* Make the final buffer part of the frame, so it gets duplicated fine */ - frame.data = final_buf; + frame.data.ptr = final_buf; /* Yahoo, a combined copy of the audio! */ return ast_frdup(&frame); @@ -586,7 +586,7 @@ static struct ast_frame *audio_audiohook_write_list(struct ast_channel *chan, st } AST_LIST_TRAVERSE_SAFE_END /* We take all of the combined whisper sources and combine them into the audio being written out */ - for (i = 0, data1 = middle_frame->data, data2 = combine_buf; i < samples; i++, data1++, data2++) + for (i = 0, data1 = middle_frame->data.ptr, data2 = combine_buf; i < samples; i++, data1++, data2++) ast_slinear_saturated_add(data1, data2); end_frame = middle_frame; } diff --git a/main/channel.c b/main/channel.c index ae005cf9d..6b100ff36 100644 --- a/main/channel.c +++ b/main/channel.c @@ -1008,18 +1008,30 @@ int ast_queue_frame(struct ast_channel *chan, struct ast_frame *fin) } /*! \brief Queue a hangup frame for channel */ -int ast_queue_hangup(struct ast_channel *chan, int cause) +int ast_queue_hangup(struct ast_channel *chan) +{ + struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_HANGUP }; + /* Yeah, let's not change a lock-critical value without locking */ + if (!ast_channel_trylock(chan)) { + chan->_softhangup |= AST_SOFTHANGUP_DEV; + ast_channel_unlock(chan); + } + return ast_queue_frame(chan, &f); +} + +/*! \brief Queue a hangup frame for channel */ +int ast_queue_hangup_with_cause(struct ast_channel *chan, int cause) { struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_HANGUP }; if (cause >= 0) - f.seqno = cause; + f.data.uint32 = cause; /* Yeah, let's not change a lock-critical value without locking */ if (!ast_channel_trylock(chan)) { chan->_softhangup |= AST_SOFTHANGUP_DEV; if (cause < 0) - f.seqno = chan->hangupcause; + f.data.uint32 = chan->hangupcause; ast_channel_unlock(chan); } @@ -1043,7 +1055,7 @@ int ast_queue_control_data(struct ast_channel *chan, enum ast_control_frame_type struct ast_frame f = { AST_FRAME_CONTROL, }; f.subclass = control; - f.data = (void *) data; + f.data.ptr = (void *) data; f.datalen = datalen; return ast_queue_frame(chan, &f); @@ -2235,7 +2247,7 @@ int ast_waitfordigit_full(struct ast_channel *c, int ms, int audiofd, int cmdfd) case AST_FRAME_VOICE: /* Write audio if appropriate */ if (audiofd > -1) - write(audiofd, f->data, f->datalen); + write(audiofd, f->data.ptr, f->datalen); default: /* Ignore */ break; @@ -2429,7 +2441,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio) /* Interpret hangup and return NULL */ /* XXX why not the same for frames from the channel ? */ if (f->frametype == AST_FRAME_CONTROL && f->subclass == AST_CONTROL_HANGUP) { - cause = f->seqno; + cause = f->data.uint32; ast_frfree(f); f = NULL; } @@ -2835,7 +2847,7 @@ char *ast_recvtext(struct ast_channel *chan, int timeout) if (f->frametype == AST_FRAME_CONTROL && f->subclass == AST_CONTROL_HANGUP) done = 1; /* force a break */ else if (f->frametype == AST_FRAME_TEXT) { /* what we want */ - buf = ast_strndup((char *) f->data, f->datalen); /* dup and break */ + buf = ast_strndup((char *) f->data.ptr, f->datalen); /* dup and break */ done = 1; } ast_frfree(f); @@ -2933,7 +2945,7 @@ int ast_prod(struct ast_channel *chan) if (chan->_state != AST_STATE_UP) { ast_debug(1, "Prodding channel '%s'\n", chan->name); a.subclass = chan->rawwriteformat; - a.data = nothing + AST_FRIENDLY_OFFSET; + a.data.ptr = nothing + AST_FRIENDLY_OFFSET; a.src = "ast_prod"; if (ast_write(chan, &a)) ast_log(LOG_WARNING, "Prodding channel '%s' failed\n", chan->name); @@ -2996,7 +3008,7 @@ int ast_write(struct ast_channel *chan, struct ast_frame *fr) } else if (fr->frametype == AST_FRAME_CONTROL && fr->subclass == AST_CONTROL_UNHOLD) { /* This is a side case where Echo is basically being called and the person put themselves on hold and took themselves off hold */ res = (chan->tech->indicate == NULL) ? 0 : - chan->tech->indicate(chan, fr->subclass, fr->data, fr->datalen); + chan->tech->indicate(chan, fr->subclass, fr->data.ptr, fr->datalen); } res = 0; /* XXX explain, why 0 ? */ goto done; @@ -3009,7 +3021,7 @@ int ast_write(struct ast_channel *chan, struct ast_frame *fr) switch (fr->frametype) { case AST_FRAME_CONTROL: res = (chan->tech->indicate == NULL) ? 0 : - chan->tech->indicate(chan, fr->subclass, fr->data, fr->datalen); + chan->tech->indicate(chan, fr->subclass, fr->data.ptr, fr->datalen); break; case AST_FRAME_DTMF_BEGIN: if (chan->audiohooks) { @@ -3045,12 +3057,12 @@ int ast_write(struct ast_channel *chan, struct ast_frame *fr) chan->tech->write_text(chan, fr); } else { res = (chan->tech->send_text == NULL) ? 0 : - chan->tech->send_text(chan, (char *) fr->data); + chan->tech->send_text(chan, (char *) fr->data.ptr); } break; case AST_FRAME_HTML: res = (chan->tech->send_html == NULL) ? 0 : - chan->tech->send_html(chan, fr->subclass, (char *) fr->data, fr->datalen); + chan->tech->send_html(chan, fr->subclass, (char *) fr->data.ptr, fr->datalen); break; case AST_FRAME_VIDEO: /* XXX Handle translation of video codecs one day XXX */ @@ -4212,7 +4224,7 @@ static enum ast_bridge_result ast_generic_bridge(struct ast_channel *c0, struct case AST_CONTROL_UNHOLD: case AST_CONTROL_VIDUPDATE: case AST_CONTROL_SRCUPDATE: - ast_indicate_data(other, f->subclass, f->data, f->datalen); + ast_indicate_data(other, f->subclass, f->data.ptr, f->datalen); break; default: *fo = f; @@ -4689,7 +4701,7 @@ static int tonepair_generator(struct ast_channel *chan, void *data, int len, int ts->f.datalen = len; ts->f.samples = samples; ts->f.offset = AST_FRIENDLY_OFFSET; - ts->f.data = ts->data; + ts->f.data.ptr = ts->data; ast_write(chan, &ts->f); ts->pos += x; if (ts->duration > 0) { @@ -4873,7 +4885,7 @@ static int silence_generator_generate(struct ast_channel *chan, void *data, int struct ast_frame frame = { .frametype = AST_FRAME_VOICE, .subclass = AST_FORMAT_SLINEAR, - .data = buf, + .data.ptr = buf, .samples = samples, .datalen = sizeof(buf), }; diff --git a/main/dsp.c b/main/dsp.c index 935bcb0bf..c0f4746df 100644 --- a/main/dsp.c +++ b/main/dsp.c @@ -1075,7 +1075,7 @@ int ast_dsp_call_progress(struct ast_dsp *dsp, struct ast_frame *inf) ast_log(LOG_WARNING, "Can only check call progress in signed-linear frames\n"); return 0; } - return __ast_dsp_call_progress(dsp, inf->data, inf->datalen / 2); + return __ast_dsp_call_progress(dsp, inf->data.ptr, inf->datalen / 2); } static int __ast_dsp_silence_noise(struct ast_dsp *dsp, short *s, int len, int *totalsilence, int *totalnoise) @@ -1236,7 +1236,7 @@ int ast_dsp_silence(struct ast_dsp *dsp, struct ast_frame *f, int *totalsilence) ast_log(LOG_WARNING, "Can only calculate silence on signed-linear frames :(\n"); return 0; } - s = f->data; + s = f->data.ptr; len = f->datalen/2; return __ast_dsp_silence_noise(dsp, s, len, totalsilence, NULL); } @@ -1254,7 +1254,7 @@ int ast_dsp_noise(struct ast_dsp *dsp, struct ast_frame *f, int *totalnoise) ast_log(LOG_WARNING, "Can only calculate noise on signed-linear frames :(\n"); return 0; } - s = f->data; + s = f->data.ptr; len = f->datalen/2; return __ast_dsp_silence_noise(dsp, s, len, NULL, totalnoise); } @@ -1276,12 +1276,12 @@ struct ast_frame *ast_dsp_process(struct ast_channel *chan, struct ast_dsp *dsp, if (af->frametype != AST_FRAME_VOICE) return af; - odata = af->data; + odata = af->data.ptr; len = af->datalen; /* Make sure we have short data */ switch (af->subclass) { case AST_FORMAT_SLINEAR: - shortdata = af->data; + shortdata = af->data.ptr; len = af->datalen / 2; break; case AST_FORMAT_ULAW: diff --git a/main/features.c b/main/features.c index 333b5a0f2..7b2d54726 100644 --- a/main/features.c +++ b/main/features.c @@ -2202,10 +2202,10 @@ int ast_bridge_call(struct ast_channel *chan,struct ast_channel *peer,struct ast break; case AST_CONTROL_HOLD: case AST_CONTROL_UNHOLD: - ast_indicate_data(other, f->subclass, f->data, f->datalen); + ast_indicate_data(other, f->subclass, f->data.ptr, f->datalen); break; case AST_CONTROL_OPTION: - aoh = f->data; + aoh = f->data.ptr; /* Forward option Requests */ if (aoh && aoh->flag == AST_OPTION_FLAG_REQUEST) { ast_channel_setoption(other, ntohs(aoh->option), aoh->data, diff --git a/main/file.c b/main/file.c index 81d51e9a2..86efb6000 100644 --- a/main/file.c +++ b/main/file.c @@ -1193,7 +1193,7 @@ static int waitstream_core(struct ast_channel *c, const char *breakon, case AST_FRAME_VOICE: /* Write audio if appropriate */ if (audiofd > -1) - write(audiofd, fr->data, fr->datalen); + write(audiofd, fr->data.ptr, fr->datalen); default: /* Ignore all others */ break; diff --git a/main/frame.c b/main/frame.c index 75c6f91cc..f92628e28 100644 --- a/main/frame.c +++ b/main/frame.c @@ -180,7 +180,7 @@ int __ast_smoother_feed(struct ast_smoother *s, struct ast_frame *f, int swap) on the next read, thus eliminating the douple copy */ if (swap) - ast_swapcopy_samples(f->data, f->data, f->samples); + ast_swapcopy_samples(f->data.ptr, f->data.ptr, f->samples); s->opt = f; return 0; } @@ -192,9 +192,9 @@ int __ast_smoother_feed(struct ast_smoother *s, struct ast_frame *f, int swap) } } if (swap) - ast_swapcopy_samples(s->data+s->len, f->data, f->samples); + ast_swapcopy_samples(s->data+s->len, f->data.ptr, f->samples); else - memcpy(s->data + s->len, f->data, f->datalen); + memcpy(s->data + s->len, f->data.ptr, f->datalen); /* If either side is empty, reset the delivery time */ if (!s->len || ast_tvzero(f->delivery) || ast_tvzero(s->delivery)) /* XXX really ? */ s->delivery = f->delivery; @@ -229,14 +229,14 @@ struct ast_frame *ast_smoother_read(struct ast_smoother *s) /* Make frame */ s->f.frametype = AST_FRAME_VOICE; s->f.subclass = s->format; - s->f.data = s->framedata + AST_FRIENDLY_OFFSET; + s->f.data.ptr = s->framedata + AST_FRIENDLY_OFFSET; s->f.offset = AST_FRIENDLY_OFFSET; s->f.datalen = len; /* Samples will be improper given VAD, but with VAD the concept really doesn't even exist */ s->f.samples = len * s->samplesperbyte; /* XXX rounding */ s->f.delivery = s->delivery; /* Fill Data */ - memcpy(s->f.data, s->data, len); + memcpy(s->f.data.ptr, s->data, len); s->len -= len; /* Move remaining data to the front if applicable */ if (s->len) { @@ -331,8 +331,8 @@ void ast_frame_free(struct ast_frame *fr, int cache) #endif if (fr->mallocd & AST_MALLOCD_DATA) { - if (fr->data) - ast_free(fr->data - fr->offset); + if (fr->data.ptr) + ast_free(fr->data.ptr - fr->offset); } if (fr->mallocd & AST_MALLOCD_SRC) { if (fr->src) @@ -404,8 +404,8 @@ struct ast_frame *ast_frisolate(struct ast_frame *fr) newdata += AST_FRIENDLY_OFFSET; out->offset = AST_FRIENDLY_OFFSET; out->datalen = fr->datalen; - memcpy(newdata, fr->data, fr->datalen); - out->data = newdata; + memcpy(newdata, fr->data.ptr, fr->datalen); + out->data.ptr = newdata; } out->mallocd = AST_MALLOCD_HDR | AST_MALLOCD_SRC | AST_MALLOCD_DATA; @@ -470,8 +470,8 @@ struct ast_frame *ast_frdup(const struct ast_frame *f) out->mallocd = AST_MALLOCD_HDR; out->offset = AST_FRIENDLY_OFFSET; if (out->datalen) { - out->data = buf + sizeof(*out) + AST_FRIENDLY_OFFSET; - memcpy(out->data, f->data, out->datalen); + out->data.ptr = buf + sizeof(*out) + AST_FRIENDLY_OFFSET; + memcpy(out->data.ptr, f->data.ptr, out->datalen); } if (srclen > 0) { out->src = buf + sizeof(*out) + AST_FRIENDLY_OFFSET + f->datalen; @@ -780,7 +780,7 @@ void ast_frame_dump(const char *name, struct ast_frame *f, char *prefix) if (f->datalen != sizeof(enum ast_control_t38)) { message = "Invalid"; } else { - enum ast_control_t38 state = *((enum ast_control_t38 *) f->data); + enum ast_control_t38 state = *((enum ast_control_t38 *) f->data.ptr); if (state == AST_T38_REQUEST_NEGOTIATE) message = "Negotiation Requested"; else if (state == AST_T38_REQUEST_TERMINATE) @@ -813,7 +813,7 @@ void ast_frame_dump(const char *name, struct ast_frame *f, char *prefix) case AST_FRAME_TEXT: strcpy(ftype, "Text"); strcpy(subclass, "N/A"); - ast_copy_string(moreinfo, f->data, sizeof(moreinfo)); + ast_copy_string(moreinfo, f->data.ptr, sizeof(moreinfo)); break; case AST_FRAME_IMAGE: strcpy(ftype, "Image"); @@ -824,7 +824,7 @@ void ast_frame_dump(const char *name, struct ast_frame *f, char *prefix) switch(f->subclass) { case AST_HTML_URL: strcpy(subclass, "URL"); - ast_copy_string(moreinfo, f->data, sizeof(moreinfo)); + ast_copy_string(moreinfo, f->data.ptr, sizeof(moreinfo)); break; case AST_HTML_DATA: strcpy(subclass, "Data"); @@ -843,7 +843,7 @@ void ast_frame_dump(const char *name, struct ast_frame *f, char *prefix) break; case AST_HTML_LINKURL: strcpy(subclass, "Link URL"); - ast_copy_string(moreinfo, f->data, sizeof(moreinfo)); + ast_copy_string(moreinfo, f->data.ptr, sizeof(moreinfo)); break; case AST_HTML_UNLINK: strcpy(subclass, "Unlink"); @@ -1403,10 +1403,10 @@ int ast_codec_get_samples(struct ast_frame *f) int samples=0; switch(f->subclass) { case AST_FORMAT_SPEEX: - samples = speex_samples(f->data, f->datalen); + samples = speex_samples(f->data.ptr, f->datalen); break; case AST_FORMAT_G723_1: - samples = g723_samples(f->data, f->datalen); + samples = g723_samples(f->data.ptr, f->datalen); break; case AST_FORMAT_ILBC: samples = 240 * (f->datalen / 50); @@ -1424,7 +1424,7 @@ int ast_codec_get_samples(struct ast_frame *f) case AST_FORMAT_LPC10: /* assumes that the RTP packet contains one LPC10 frame */ samples = 22 * 8; - samples += (((char *)(f->data))[7] & 0x1) * 8; + samples += (((char *)(f->data.ptr))[7] & 0x1) * 8; break; case AST_FORMAT_ULAW: case AST_FORMAT_ALAW: @@ -1484,7 +1484,7 @@ int ast_codec_get_len(int format, int samples) int ast_frame_adjust_volume(struct ast_frame *f, int adjustment) { int count; - short *fdata = f->data; + short *fdata = f->data.ptr; short adjust_value = abs(adjustment); if ((f->frametype != AST_FRAME_VOICE) || (f->subclass != AST_FORMAT_SLINEAR)) @@ -1518,7 +1518,7 @@ int ast_frame_slinear_sum(struct ast_frame *f1, struct ast_frame *f2) if (f1->samples != f2->samples) return -1; - for (count = 0, data1 = f1->data, data2 = f2->data; + for (count = 0, data1 = f1->data.ptr, data2 = f2->data.ptr; count < f1->samples; count++, data1++, data2++) ast_slinear_saturated_add(data1, data2); diff --git a/main/indications.c b/main/indications.c index 2bb3e440e..f75f27bad 100644 --- a/main/indications.c +++ b/main/indications.c @@ -188,7 +188,7 @@ static int playtones_generator(struct ast_channel *chan, void *data, int len, in ps->f.datalen = len; ps->f.samples = samples; ps->f.offset = AST_FRIENDLY_OFFSET; - ps->f.data = ps->data; + ps->f.data.ptr = ps->data; ps->f.delivery.tv_sec = 0; ps->f.delivery.tv_usec = 0; ast_write(chan, &ps->f); diff --git a/main/rtp.c b/main/rtp.c index 647ed808c..e11243358 100644 --- a/main/rtp.c +++ b/main/rtp.c @@ -1035,12 +1035,12 @@ static struct ast_frame *process_rfc3389(struct ast_rtp *rtp, unsigned char *dat if (!len) return NULL; if (len < 24) { - rtp->f.data = rtp->rawdata + AST_FRIENDLY_OFFSET; + rtp->f.data.ptr = rtp->rawdata + AST_FRIENDLY_OFFSET; rtp->f.datalen = len - 1; rtp->f.offset = AST_FRIENDLY_OFFSET; - memcpy(rtp->f.data, data + 1, len - 1); + memcpy(rtp->f.data.ptr, data + 1, len - 1); } else { - rtp->f.data = NULL; + rtp->f.data.ptr = NULL; rtp->f.offset = 0; rtp->f.datalen = 0; } @@ -1621,14 +1621,14 @@ struct ast_frame *ast_rtp_read(struct ast_rtp *rtp) rtp->f.mallocd = 0; rtp->f.datalen = res - hdrlen; - rtp->f.data = rtp->rawdata + hdrlen + AST_FRIENDLY_OFFSET; + rtp->f.data.ptr = rtp->rawdata + hdrlen + AST_FRIENDLY_OFFSET; rtp->f.offset = hdrlen + AST_FRIENDLY_OFFSET; rtp->f.seqno = seqno; if (rtp->f.subclass == AST_FORMAT_T140 && (int)seqno - (prev_seqno+1) > 0 && (int)seqno - (prev_seqno+1) < 10) { - unsigned char *data = rtp->f.data; + unsigned char *data = rtp->f.data.ptr; - memmove(rtp->f.data+3, rtp->f.data, rtp->f.datalen); + memmove(rtp->f.data.ptr+3, rtp->f.data.ptr, rtp->f.datalen); rtp->f.datalen +=3; *data++ = 0xEF; *data++ = 0xBF; @@ -1636,7 +1636,7 @@ struct ast_frame *ast_rtp_read(struct ast_rtp *rtp) } if (rtp->f.subclass == AST_FORMAT_T140RED) { - unsigned char *data = rtp->f.data; + unsigned char *data = rtp->f.data.ptr; unsigned char *header_end; int num_generations; int header_length; @@ -1659,14 +1659,14 @@ struct ast_frame *ast_rtp_read(struct ast_rtp *rtp) if (!(rtp->f.datalen - len)) return &ast_null_frame; - rtp->f.data += len; + rtp->f.data.ptr += len; rtp->f.datalen -= len; } else if (diff > num_generations && diff < 10) { len -= 3; - rtp->f.data += len; + rtp->f.data.ptr += len; rtp->f.datalen -= len; - data = rtp->f.data; + data = rtp->f.data.ptr; *data++ = 0xEF; *data++ = 0xBF; *data = 0xBD; @@ -1674,7 +1674,7 @@ struct ast_frame *ast_rtp_read(struct ast_rtp *rtp) for ( x = 0; x < num_generations - diff; x++) len += data[x * 4 + 3]; - rtp->f.data += len; + rtp->f.data.ptr += len; rtp->f.datalen -= len; } } @@ -3147,7 +3147,7 @@ static int ast_rtp_raw_write(struct ast_rtp *rtp, struct ast_frame *f, int codec rtp->lastts = f->ts * 8; /* Get a pointer to the header */ - rtpheader = (unsigned char *)(f->data - hdrlen); + rtpheader = (unsigned char *)(f->data.ptr - hdrlen); put_unaligned_uint32(rtpheader, htonl((2 << 30) | (codec << 16) | (rtp->seqno) | (mark << 23))); put_unaligned_uint32(rtpheader + 4, htonl(rtp->lastts)); @@ -3278,7 +3278,7 @@ int ast_rtp_write(struct ast_rtp *rtp, struct ast_frame *_f) ast_smoother_feed(rtp->smoother, _f); } - while ((f = ast_smoother_read(rtp->smoother)) && (f->data)) { + while ((f = ast_smoother_read(rtp->smoother)) && (f->data.ptr)) { if (f->subclass == AST_FORMAT_G722) { /* G.722 is silllllllllllllly */ f->samples /= 2; @@ -3292,7 +3292,7 @@ int ast_rtp_write(struct ast_rtp *rtp, struct ast_frame *_f) f = ast_frdup(_f); /*! \bug XXX this might never be free'd. Why do we do this? */ else f = _f; - if (f->data) + if (f->data.ptr) ast_rtp_raw_write(rtp, f, codec); if (f != _f) ast_frfree(f); @@ -3499,7 +3499,7 @@ static enum ast_bridge_result bridge_native_loop(struct ast_channel *c0, struct oldcodec0 = codec0 = pr0->get_codec(c0); if (pr1->get_codec && c1->tech_pvt) oldcodec1 = codec1 = pr1->get_codec(c1); - ast_indicate_data(other, fr->subclass, fr->data, fr->datalen); + ast_indicate_data(other, fr->subclass, fr->data.ptr, fr->datalen); ast_frfree(fr); } else { *fo = fr; @@ -3733,7 +3733,7 @@ static enum ast_bridge_result bridge_p2p_loop(struct ast_channel *c0, struct ast p0_callback = p2p_callback_enable(c0, p0, &p0_iod[0]); p1_callback = p2p_callback_enable(c1, p1, &p1_iod[0]); } - ast_indicate_data(other, fr->subclass, fr->data, fr->datalen); + ast_indicate_data(other, fr->subclass, fr->data.ptr, fr->datalen); ast_frfree(fr); } else { *fo = fr; @@ -4372,7 +4372,7 @@ static int red_write(const void *data) * \param red redundant data structure */ static struct ast_frame *red_t140_to_red(struct rtp_red *red) { - unsigned char *data = red->t140red.data; + unsigned char *data = red->t140red.data.ptr; int len = 0; int i; @@ -4395,7 +4395,7 @@ static struct ast_frame *red_t140_to_red(struct rtp_red *red) { len += data[i*4+3] = red->len[i]; /* add primary data to buffer */ - memcpy(&data[len], red->t140.data, red->t140.datalen); + memcpy(&data[len], red->t140.data.ptr, red->t140.datalen); red->t140red.datalen = len + red->t140.datalen; /* no primary data and no generations to send */ @@ -4425,11 +4425,11 @@ int rtp_red_init(struct ast_rtp *rtp, int ti, int *red_data_pt, int num_gen) r->t140.frametype = AST_FRAME_TEXT; r->t140.subclass = AST_FORMAT_T140RED; - r->t140.data = &r->buf_data; + r->t140.data.ptr = &r->buf_data; r->t140.ts = 0; r->t140red = r->t140; - r->t140red.data = &r->t140red_data; + r->t140red.data.ptr = &r->t140red_data; r->t140red.datalen = 0; r->ti = ti; r->num_gen = num_gen; @@ -4458,7 +4458,7 @@ void red_buffer_t140(struct ast_rtp *rtp, struct ast_frame *f) { if( f->datalen > -1 ) { struct rtp_red *red = rtp->red; - memcpy(&red->buf_data[red->t140.datalen], f->data, f->datalen); + memcpy(&red->buf_data[red->t140.datalen], f->data.ptr, f->datalen); red->t140.datalen += f->datalen; red->t140.ts = f->ts; } diff --git a/main/slinfactory.c b/main/slinfactory.c index af70399e6..0e3a39b22 100644 --- a/main/slinfactory.c +++ b/main/slinfactory.c @@ -161,7 +161,7 @@ int ast_slinfactory_read(struct ast_slinfactory *sf, short *buf, size_t samples) } if ((frame_ptr = AST_LIST_REMOVE_HEAD(&sf->queue, frame_list))) { - frame_data = frame_ptr->data; + frame_data = frame_ptr->data.ptr; if (frame_ptr->samples <= ineed) { memcpy(offset, frame_data, frame_ptr->samples * sizeof(*offset)); diff --git a/main/translate.c b/main/translate.c index 750b2f5b6..9326f4880 100644 --- a/main/translate.c +++ b/main/translate.c @@ -235,7 +235,7 @@ struct ast_frame *ast_trans_frameout(struct ast_trans_pvt *pvt, f->mallocd = 0; f->offset = AST_FRIENDLY_OFFSET; f->src = pvt->t->name; - f->data = pvt->outbuf; + f->data.ptr = pvt->outbuf; ast_set_flag(f, AST_FRFLAG_FROM_TRANSLATOR); diff --git a/main/udptl.c b/main/udptl.c index ea78f094a..8d6d62c1a 100644 --- a/main/udptl.c +++ b/main/udptl.c @@ -357,7 +357,7 @@ static int udptl_rx_packet(struct ast_udptl *s, uint8_t *buf, int len) s->f[ifp_no].mallocd = 0; s->f[ifp_no].seqno = seq_no - i; s->f[ifp_no].datalen = lengths[i - 1]; - s->f[ifp_no].data = (uint8_t *) bufs[i - 1]; + s->f[ifp_no].data.ptr = (uint8_t *) bufs[i - 1]; s->f[ifp_no].offset = 0; s->f[ifp_no].src = "UDPTL"; if (ifp_no > 0) @@ -459,7 +459,7 @@ static int udptl_rx_packet(struct ast_udptl *s, uint8_t *buf, int len) s->f[ifp_no].mallocd = 0; s->f[ifp_no].seqno = j; s->f[ifp_no].datalen = s->rx[l].buf_len; - s->f[ifp_no].data = s->rx[l].buf; + s->f[ifp_no].data.ptr = s->rx[l].buf; s->f[ifp_no].offset = 0; s->f[ifp_no].src = "UDPTL"; if (ifp_no > 0) @@ -480,7 +480,7 @@ static int udptl_rx_packet(struct ast_udptl *s, uint8_t *buf, int len) s->f[ifp_no].mallocd = 0; s->f[ifp_no].seqno = seq_no; s->f[ifp_no].datalen = ifp_len; - s->f[ifp_no].data = (uint8_t *) ifp; + s->f[ifp_no].data.ptr = (uint8_t *) ifp; s->f[ifp_no].offset = 0; s->f[ifp_no].src = "UDPTL"; if (ifp_no > 0) @@ -909,7 +909,7 @@ int ast_udptl_write(struct ast_udptl *s, struct ast_frame *f) seq = s->tx_seq_no & 0xFFFF; /* Cook up the UDPTL packet, with the relevant EC info. */ - len = udptl_build_packet(s, buf, f->data, f->datalen); + len = udptl_build_packet(s, buf, f->data.ptr, f->datalen); if (len > 0 && s->them.sin_port && s->them.sin_addr.s_addr) { if ((res = sendto(s->fd, buf, len, 0, (struct sockaddr *) &s->them, sizeof(s->them))) < 0) |