diff options
author | mvanbaak <mvanbaak@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-05-22 16:29:54 +0000 |
---|---|---|
committer | mvanbaak <mvanbaak@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-05-22 16:29:54 +0000 |
commit | c1210321e7aeb274076b14fc2f622edf442246fa (patch) | |
tree | bcbbf4eda53cdb8257bbc7add4616e01e31b1ae2 /codecs | |
parent | 2d9ba021dd38039616c82a4e317f652abe246ba3 (diff) |
- revert change to ast_queue_hangup and create ast_queue_hangup_with_cause
- make data member of the ast_frame struct a named union instead of a void
Recently the ast_queue_hangup function got a new parameter, the hangupcause
Feedback came in that this is no good and that instead a new function should be created.
This I did.
The hangupcause was stored in the seqno member of the ast_frame struct. This is not very
elegant, and since there's already a data member that one should be used.
Problem is, this member was a void *.
Now it's a named union so it can hold a pointer, an uint32 and there's a padding in case someone
wants to store another type in there in the future.
This commit is so massive, because all ast_frame.data uses have to be
altered to ast_frame.data.data
Thanks russellb and kpfleming for the feedback.
(closes issue #12674)
Reported by: mvanbaak
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@117802 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'codecs')
-rw-r--r-- | codecs/codec_a_mu.c | 8 | ||||
-rw-r--r-- | codecs/codec_adpcm.c | 8 | ||||
-rw-r--r-- | codecs/codec_alaw.c | 8 | ||||
-rw-r--r-- | codecs/codec_g722.c | 12 | ||||
-rw-r--r-- | codecs/codec_g726.c | 14 | ||||
-rw-r--r-- | codecs/codec_gsm.c | 10 | ||||
-rw-r--r-- | codecs/codec_lpc10.c | 8 | ||||
-rw-r--r-- | codecs/codec_resample.c | 6 | ||||
-rw-r--r-- | codecs/codec_ulaw.c | 8 | ||||
-rw-r--r-- | codecs/codec_zap.c | 6 |
10 files changed, 44 insertions, 44 deletions
diff --git a/codecs/codec_a_mu.c b/codecs/codec_a_mu.c index a478dc7af..23f04f055 100644 --- a/codecs/codec_a_mu.c +++ b/codecs/codec_a_mu.c @@ -46,7 +46,7 @@ static unsigned char a2mu[256]; static int alawtoulaw_framein(struct ast_trans_pvt *pvt, struct ast_frame *f) { int x = f->samples; - unsigned char *src = f->data; + unsigned char *src = f->data.ptr; unsigned char *dst = (unsigned char *)pvt->outbuf + pvt->samples; pvt->samples += x; @@ -62,7 +62,7 @@ static int alawtoulaw_framein(struct ast_trans_pvt *pvt, struct ast_frame *f) static int ulawtoalaw_framein(struct ast_trans_pvt *pvt, struct ast_frame *f) { int x = f->samples; - unsigned char *src = f->data; + unsigned char *src = f->data.ptr; unsigned char *dst = (unsigned char *)pvt->outbuf + pvt->samples; pvt->samples += x; @@ -87,7 +87,7 @@ static struct ast_frame *alawtoulaw_sample(void) f.mallocd = 0; f.offset = 0; f.src = __PRETTY_FUNCTION__; - f.data = ulaw_slin_ex; /* XXX what ? */ + f.data.ptr = ulaw_slin_ex; /* XXX what ? */ return &f; } @@ -101,7 +101,7 @@ static struct ast_frame *ulawtoalaw_sample(void) f.mallocd = 0; f.offset = 0; f.src = __PRETTY_FUNCTION__; - f.data = ulaw_slin_ex; + f.data.ptr = ulaw_slin_ex; return &f; } diff --git a/codecs/codec_adpcm.c b/codecs/codec_adpcm.c index 63a1ab1bc..cad4ded75 100644 --- a/codecs/codec_adpcm.c +++ b/codecs/codec_adpcm.c @@ -229,7 +229,7 @@ static int adpcmtolin_framein(struct ast_trans_pvt *pvt, struct ast_frame *f) { struct adpcm_decoder_pvt *tmp = pvt->pvt; int x = f->datalen; - unsigned char *src = f->data; + unsigned char *src = f->data.ptr; int16_t *dst = (int16_t *)pvt->outbuf + pvt->samples; while (x--) { @@ -246,7 +246,7 @@ static int lintoadpcm_framein(struct ast_trans_pvt *pvt, struct ast_frame *f) { struct adpcm_encoder_pvt *tmp = pvt->pvt; - memcpy(&tmp->inbuf[pvt->samples], f->data, f->datalen); + memcpy(&tmp->inbuf[pvt->samples], f->data.ptr, f->datalen); pvt->samples += f->samples; return 0; } @@ -296,7 +296,7 @@ static struct ast_frame *adpcmtolin_sample(void) f.mallocd = 0; f.offset = 0; f.src = __PRETTY_FUNCTION__; - f.data = adpcm_slin_ex; + f.data.ptr = adpcm_slin_ex; return &f; } @@ -312,7 +312,7 @@ static struct ast_frame *lintoadpcm_sample(void) f.mallocd = 0; f.offset = 0; f.src = __PRETTY_FUNCTION__; - f.data = slin_adpcm_ex; + f.data.ptr = slin_adpcm_ex; return &f; } diff --git a/codecs/codec_alaw.c b/codecs/codec_alaw.c index ba5808f78..b2f4f9435 100644 --- a/codecs/codec_alaw.c +++ b/codecs/codec_alaw.c @@ -44,7 +44,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") static int alawtolin_framein(struct ast_trans_pvt *pvt, struct ast_frame *f) { int i = f->samples; - unsigned char *src = f->data; + unsigned char *src = f->data.ptr; int16_t *dst = (int16_t *)pvt->outbuf + pvt->samples; pvt->samples += i; @@ -61,7 +61,7 @@ static int lintoalaw_framein(struct ast_trans_pvt *pvt, struct ast_frame *f) { int i = f->samples; char *dst = pvt->outbuf + pvt->samples; - int16_t *src = f->data; + int16_t *src = f->data.ptr; pvt->samples += i; pvt->datalen += i; /* 1 byte/sample */ @@ -83,7 +83,7 @@ static struct ast_frame *alawtolin_sample(void) f.mallocd = 0; f.offset = 0; f.src = __PRETTY_FUNCTION__; - f.data = ulaw_slin_ex; + f.data.ptr = ulaw_slin_ex; return &f; } @@ -98,7 +98,7 @@ static struct ast_frame *lintoalaw_sample(void) f.mallocd = 0; f.offset = 0; f.src = __PRETTY_FUNCTION__; - f.data = slin_ulaw_ex; + f.data.ptr = slin_ulaw_ex; return &f; } diff --git a/codecs/codec_g722.c b/codecs/codec_g722.c index 02f4720cd..a574136e8 100644 --- a/codecs/codec_g722.c +++ b/codecs/codec_g722.c @@ -108,7 +108,7 @@ static int g722tolin_framein(struct ast_trans_pvt *pvt, struct ast_frame *f) in_samples = f->samples / 2; out_samples = g722_decode(&tmp->g722, (int16_t *) &pvt->outbuf[pvt->samples * sizeof(int16_t)], - (uint8_t *) f->data, in_samples); + (uint8_t *) f->data.ptr, in_samples); pvt->samples += out_samples; @@ -123,7 +123,7 @@ static int lintog722_framein(struct ast_trans_pvt *pvt, struct ast_frame *f) int outlen; outlen = g722_encode(&tmp->g722, (uint8_t *) (&pvt->outbuf[pvt->datalen]), - (int16_t *) f->data, f->samples); + (int16_t *) f->data.ptr, f->samples); pvt->samples += outlen * 2; @@ -140,7 +140,7 @@ static struct ast_frame *g722tolin_sample(void) .datalen = sizeof(g722_slin_ex), .samples = sizeof(g722_slin_ex) * 2, .src = __PRETTY_FUNCTION__, - .data = g722_slin_ex, + .data.ptr = g722_slin_ex, }; return &f; @@ -154,7 +154,7 @@ static struct ast_frame *g722tolin16_sample(void) .datalen = sizeof(g722_slin_ex), .samples = sizeof(g722_slin_ex) * 2, .src = __PRETTY_FUNCTION__, - .data = g722_slin_ex, + .data.ptr = g722_slin_ex, }; return &f; @@ -168,7 +168,7 @@ static struct ast_frame *lintog722_sample (void) .datalen = sizeof(slin_g722_ex), .samples = sizeof(slin_g722_ex) / sizeof(slin_g722_ex[0]), .src = __PRETTY_FUNCTION__, - .data = slin_g722_ex, + .data.ptr = slin_g722_ex, }; return &f; @@ -182,7 +182,7 @@ static struct ast_frame *lin16tog722_sample (void) .datalen = sizeof(slin_g722_ex), .samples = sizeof(slin_g722_ex) / sizeof(slin_g722_ex[0]), .src = __PRETTY_FUNCTION__, - .data = slin_g722_ex, + .data.ptr = slin_g722_ex, }; return &f; diff --git a/codecs/codec_g726.c b/codecs/codec_g726.c index c8a671ee8..8d1346e66 100644 --- a/codecs/codec_g726.c +++ b/codecs/codec_g726.c @@ -692,7 +692,7 @@ static int lintog726_new(struct ast_trans_pvt *pvt) static int g726aal2tolin_framein (struct ast_trans_pvt *pvt, struct ast_frame *f) { struct g726_coder_pvt *tmp = pvt->pvt; - unsigned char *src = f->data; + unsigned char *src = f->data.ptr; int16_t *dst = (int16_t *) pvt->outbuf + pvt->samples; unsigned int i; @@ -711,7 +711,7 @@ static int g726aal2tolin_framein (struct ast_trans_pvt *pvt, struct ast_frame *f static int lintog726aal2_framein(struct ast_trans_pvt *pvt, struct ast_frame *f) { struct g726_coder_pvt *tmp = pvt->pvt; - int16_t *src = f->data; + int16_t *src = f->data.ptr; unsigned int i; for (i = 0; i < f->samples; i++) { @@ -733,7 +733,7 @@ static int lintog726aal2_framein(struct ast_trans_pvt *pvt, struct ast_frame *f) static int g726tolin_framein (struct ast_trans_pvt *pvt, struct ast_frame *f) { struct g726_coder_pvt *tmp = pvt->pvt; - unsigned char *src = f->data; + unsigned char *src = f->data.ptr; int16_t *dst = (int16_t *) pvt->outbuf + pvt->samples; unsigned int i; @@ -752,7 +752,7 @@ static int g726tolin_framein (struct ast_trans_pvt *pvt, struct ast_frame *f) static int lintog726_framein(struct ast_trans_pvt *pvt, struct ast_frame *f) { struct g726_coder_pvt *tmp = pvt->pvt; - int16_t *src = f->data; + int16_t *src = f->data.ptr; unsigned int i; for (i = 0; i < f->samples; i++) { @@ -773,7 +773,7 @@ static int lintog726_framein(struct ast_trans_pvt *pvt, struct ast_frame *f) /*! \brief convert G726-32 RFC3551 packed data into AAL2 packed data (or vice-versa) */ static int g726tog726aal2_framein(struct ast_trans_pvt *pvt, struct ast_frame *f) { - unsigned char *src = f->data; + unsigned char *src = f->data.ptr; unsigned char *dst = (unsigned char *) pvt->outbuf + pvt->samples; unsigned int i; @@ -794,7 +794,7 @@ static struct ast_frame *g726tolin_sample(void) .datalen = sizeof(g726_slin_ex), .samples = sizeof(g726_slin_ex) * 2, /* 2 samples per byte */ .src = __PRETTY_FUNCTION__, - .data = g726_slin_ex, + .data.ptr = g726_slin_ex, }; return &f; @@ -808,7 +808,7 @@ static struct ast_frame *lintog726_sample (void) .datalen = sizeof(slin_g726_ex), .samples = sizeof(slin_g726_ex) / 2, /* 1 sample per 2 bytes */ .src = __PRETTY_FUNCTION__, - .data = slin_g726_ex, + .data.ptr = slin_g726_ex, }; return &f; diff --git a/codecs/codec_gsm.c b/codecs/codec_gsm.c index bb4af8cfb..805e79b66 100644 --- a/codecs/codec_gsm.c +++ b/codecs/codec_gsm.c @@ -79,7 +79,7 @@ static struct ast_frame *lintogsm_sample(void) f.mallocd = 0; f.offset = 0; f.src = __PRETTY_FUNCTION__; - f.data = slin_gsm_ex; + f.data.ptr = slin_gsm_ex; return &f; } @@ -94,7 +94,7 @@ static struct ast_frame *gsmtolin_sample(void) f.mallocd = 0; f.offset = 0; f.src = __PRETTY_FUNCTION__; - f.data = gsm_slin_ex; + f.data.ptr = gsm_slin_ex; return &f; } @@ -119,10 +119,10 @@ static int gsmtolin_framein(struct ast_trans_pvt *pvt, struct ast_frame *f) /* XXX what's the point here! we should just work * on the full format. */ - conv65(f->data + x, data); + conv65(f->data.ptr + x, data); } else { len = GSM_SAMPLES; - src = f->data + x; + src = f->data.ptr + x; } /* XXX maybe we don't need to check */ if (pvt->samples + len > BUFFER_SAMPLES) { @@ -159,7 +159,7 @@ static int lintogsm_framein(struct ast_trans_pvt *pvt, struct ast_frame *f) ast_log(LOG_WARNING, "Out of buffer space\n"); return -1; } - 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/codecs/codec_lpc10.c b/codecs/codec_lpc10.c index 1e4ec37f3..dfcdc7988 100644 --- a/codecs/codec_lpc10.c +++ b/codecs/codec_lpc10.c @@ -86,7 +86,7 @@ static struct ast_frame *lintolpc10_sample(void) f.mallocd = 0; f.offset = 0; f.src = __PRETTY_FUNCTION__; - f.data = slin_lpc10_ex; + f.data.ptr = slin_lpc10_ex; return &f; } @@ -102,7 +102,7 @@ static struct ast_frame *lpc10tolin_sample(void) f.mallocd = 0; f.offset = 0; f.src = __PRETTY_FUNCTION__; - f.data = lpc10_slin_ex; + f.data.ptr = lpc10_slin_ex; return &f; } @@ -151,7 +151,7 @@ static int lpc10tolin_framein(struct ast_trans_pvt *pvt, struct ast_frame *f) ast_log(LOG_WARNING, "Out of buffer space\n"); return -1; } - extract_bits(bits, f->data + len); + extract_bits(bits, f->data.ptr + len); if (lpc10_decode(bits, tmpbuf, tmp->lpc10.dec)) { ast_log(LOG_WARNING, "Invalid lpc10 data\n"); return -1; @@ -179,7 +179,7 @@ static int lintolpc10_framein(struct ast_trans_pvt *pvt, struct ast_frame *f) ast_log(LOG_WARNING, "Out of buffer space\n"); return -1; } - 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/codecs/codec_resample.c b/codecs/codec_resample.c index 251d99c23..bdf9d19f9 100644 --- a/codecs/codec_resample.c +++ b/codecs/codec_resample.c @@ -102,7 +102,7 @@ static int resample_frame(struct ast_trans_pvt *pvt, { int total_in_buf_used = 0; int total_out_buf_used = 0; - int16_t *in_buf = (int16_t *) f->data; + int16_t *in_buf = (int16_t *) f->data.ptr; int16_t *out_buf = (int16_t *) pvt->outbuf + pvt->samples; float in_buf_f[f->samples]; float out_buf_f[2048]; @@ -168,7 +168,7 @@ static struct ast_frame *slin16_to_slin8_sample(void) .datalen = sizeof(slin16_slin8_ex), .samples = sizeof(slin16_slin8_ex) / sizeof(slin16_slin8_ex[0]), .src = __PRETTY_FUNCTION__, - .data = slin16_slin8_ex, + .data.ptr = slin16_slin8_ex, }; return &f; @@ -182,7 +182,7 @@ static struct ast_frame *slin8_to_slin16_sample(void) .datalen = sizeof(slin8_slin16_ex), .samples = sizeof(slin8_slin16_ex) / sizeof(slin8_slin16_ex[0]), .src = __PRETTY_FUNCTION__, - .data = slin8_slin16_ex, + .data.ptr = slin8_slin16_ex, }; return &f; diff --git a/codecs/codec_ulaw.c b/codecs/codec_ulaw.c index ebd1928a2..2e0a16467 100644 --- a/codecs/codec_ulaw.c +++ b/codecs/codec_ulaw.c @@ -44,7 +44,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") static int ulawtolin_framein(struct ast_trans_pvt *pvt, struct ast_frame *f) { int i = f->samples; - unsigned char *src = f->data; + unsigned char *src = f->data.ptr; int16_t *dst = (int16_t *)pvt->outbuf + pvt->samples; pvt->samples += i; @@ -62,7 +62,7 @@ static int lintoulaw_framein(struct ast_trans_pvt *pvt, struct ast_frame *f) { int i = f->samples; char *dst = pvt->outbuf + pvt->samples; - int16_t *src = f->data; + int16_t *src = f->data.ptr; pvt->samples += i; pvt->datalen += i; /* 1 byte/sample */ @@ -84,7 +84,7 @@ static struct ast_frame *ulawtolin_sample(void) f.mallocd = 0; f.offset = 0; f.src = __PRETTY_FUNCTION__; - f.data = ulaw_slin_ex; + f.data.ptr = ulaw_slin_ex; return &f; } @@ -103,7 +103,7 @@ static struct ast_frame *lintoulaw_sample(void) f.mallocd = 0; f.offset = 0; f.src = __PRETTY_FUNCTION__; - f.data = slin_ulaw_ex; + f.data.ptr = slin_ulaw_ex; return &f; } diff --git a/codecs/codec_zap.c b/codecs/codec_zap.c index 01d9a1ed1..645b65a35 100644 --- a/codecs/codec_zap.c +++ b/codecs/codec_zap.c @@ -144,7 +144,7 @@ static int zap_framein(struct ast_trans_pvt *pvt, struct ast_frame *f) hdr->srcoffset = 0; } - memcpy(hdr->srcdata + hdr->srcoffset + hdr->srclen, f->data, f->datalen); + memcpy(hdr->srcdata + hdr->srcoffset + hdr->srclen, f->data.ptr, f->datalen); hdr->srclen += f->datalen; pvt->samples += f->samples; @@ -162,7 +162,7 @@ static struct ast_frame *zap_frameout(struct ast_trans_pvt *pvt) pvt->f.frametype = AST_FRAME_VOICE; pvt->f.subclass = 0; pvt->f.samples = 160; - pvt->f.data = NULL; + pvt->f.data.ptr = NULL; pvt->f.offset = 0; pvt->f.datalen = 0; pvt->f.mallocd = 0; @@ -182,7 +182,7 @@ static struct ast_frame *zap_frameout(struct ast_trans_pvt *pvt) pvt->f.frametype = AST_FRAME_VOICE; pvt->f.subclass = hdr->dstfmt; pvt->f.samples = hdr->dstsamples; - pvt->f.data = hdr->dstdata + hdr->dstoffset; + pvt->f.data.ptr = hdr->dstdata + hdr->dstoffset; pvt->f.offset = hdr->dstoffset; pvt->f.datalen = hdr->dstlen; pvt->f.mallocd = 0; |