mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-22 20:56:39 +00:00 
			
		
		
		
	Expand codec bitfield from 32 bits to 64 bits.
Reviewboard: https://reviewboard.asterisk.org/r/416/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@227580 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
		| @@ -61,7 +61,7 @@ static struct ast_frame *g723_read(struct ast_filestream *s, int *whennext) | ||||
| 	} | ||||
| 	/* Read the data into the buffer */ | ||||
| 	s->fr.frametype = AST_FRAME_VOICE; | ||||
| 	s->fr.subclass = AST_FORMAT_G723_1; | ||||
| 	s->fr.subclass.codec = AST_FORMAT_G723_1; | ||||
| 	s->fr.mallocd = 0; | ||||
| 	AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, size); | ||||
| 	if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != size) { | ||||
| @@ -82,7 +82,7 @@ static int g723_write(struct ast_filestream *s, struct ast_frame *f) | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-voice frame!\n"); | ||||
| 		return -1; | ||||
| 	} | ||||
| 	if (f->subclass != AST_FORMAT_G723_1) { | ||||
| 	if (f->subclass.codec != AST_FORMAT_G723_1) { | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-g723 frame!\n"); | ||||
| 		return -1; | ||||
| 	} | ||||
|   | ||||
| @@ -119,7 +119,7 @@ static struct ast_frame *g726_read(struct ast_filestream *s, int *whennext) | ||||
|  | ||||
| 	/* Send a frame from the file to the appropriate channel */ | ||||
| 	s->fr.frametype = AST_FRAME_VOICE; | ||||
| 	s->fr.subclass = AST_FORMAT_G726; | ||||
| 	s->fr.subclass.codec = AST_FORMAT_G726; | ||||
| 	s->fr.mallocd = 0; | ||||
| 	AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, frame_size[fs->rate]); | ||||
| 	s->fr.samples = 8 * FRAME_TIME; | ||||
| @@ -141,9 +141,9 @@ static int g726_write(struct ast_filestream *s, struct ast_frame *f) | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-voice frame!\n"); | ||||
| 		return -1; | ||||
| 	} | ||||
| 	if (f->subclass != AST_FORMAT_G726) { | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-G726 frame (%d)!\n",  | ||||
| 						f->subclass); | ||||
| 	if (f->subclass.codec != AST_FORMAT_G726) { | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-G726 frame (%s)!\n",  | ||||
| 						ast_getformatname(f->subclass.codec)); | ||||
| 		return -1; | ||||
| 	} | ||||
| 	if (f->datalen % frame_size[fs->rate]) { | ||||
|   | ||||
| @@ -46,7 +46,7 @@ static struct ast_frame *g729_read(struct ast_filestream *s, int *whennext) | ||||
| 	int res; | ||||
| 	/* Send a frame from the file to the appropriate channel */ | ||||
| 	s->fr.frametype = AST_FRAME_VOICE; | ||||
| 	s->fr.subclass = AST_FORMAT_G729A; | ||||
| 	s->fr.subclass.codec = AST_FORMAT_G729A; | ||||
| 	s->fr.mallocd = 0; | ||||
| 	s->fr.samples = G729A_SAMPLES; | ||||
| 	AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, BUF_SIZE); | ||||
| @@ -66,8 +66,8 @@ static int g729_write(struct ast_filestream *fs, struct ast_frame *f) | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-voice frame!\n"); | ||||
| 		return -1; | ||||
| 	} | ||||
| 	if (f->subclass != AST_FORMAT_G729A) { | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-G729 frame (%d)!\n", f->subclass); | ||||
| 	if (f->subclass.codec != AST_FORMAT_G729A) { | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-G729 frame (%s)!\n", ast_getformatname(f->subclass.codec)); | ||||
| 		return -1; | ||||
| 	} | ||||
| 	if (f->datalen % 10) { | ||||
|   | ||||
| @@ -53,7 +53,7 @@ static struct ast_frame *gsm_read(struct ast_filestream *s, int *whennext) | ||||
| 	int res; | ||||
|  | ||||
| 	s->fr.frametype = AST_FRAME_VOICE; | ||||
| 	s->fr.subclass = AST_FORMAT_GSM; | ||||
| 	s->fr.subclass.codec = AST_FORMAT_GSM; | ||||
| 	AST_FRAME_SET_BUFFER(&(s->fr), s->buf, AST_FRIENDLY_OFFSET, GSM_FRAME_SIZE) | ||||
| 	s->fr.mallocd = 0; | ||||
| 	if ((res = fread(s->fr.data.ptr, 1, GSM_FRAME_SIZE, s->f)) != GSM_FRAME_SIZE) { | ||||
| @@ -74,8 +74,8 @@ static int gsm_write(struct ast_filestream *fs, struct ast_frame *f) | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-voice frame!\n"); | ||||
| 		return -1; | ||||
| 	} | ||||
| 	if (f->subclass != AST_FORMAT_GSM) { | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-GSM frame (%d)!\n", f->subclass); | ||||
| 	if (f->subclass.codec != AST_FORMAT_GSM) { | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-GSM frame (%s)!\n", ast_getformatname(f->subclass.codec)); | ||||
| 		return -1; | ||||
| 	} | ||||
| 	if (!(f->datalen % 65)) { | ||||
|   | ||||
| @@ -64,7 +64,7 @@ static int h263_open(struct ast_filestream *s) | ||||
| static struct ast_frame *h263_read(struct ast_filestream *s, int *whennext) | ||||
| { | ||||
| 	int res; | ||||
| 	int mark; | ||||
| 	format_t mark; | ||||
| 	unsigned short len; | ||||
| 	unsigned int ts; | ||||
| 	struct h263_desc *fs = (struct h263_desc *)s->_private; | ||||
| @@ -80,7 +80,7 @@ static struct ast_frame *h263_read(struct ast_filestream *s, int *whennext) | ||||
| 		return NULL; | ||||
| 	} | ||||
| 	s->fr.frametype = AST_FRAME_VIDEO; | ||||
| 	s->fr.subclass = AST_FORMAT_H263; | ||||
| 	s->fr.subclass.codec = AST_FORMAT_H263; | ||||
| 	s->fr.mallocd = 0; | ||||
| 	AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, len); | ||||
| 	if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) { | ||||
| @@ -90,7 +90,7 @@ static struct ast_frame *h263_read(struct ast_filestream *s, int *whennext) | ||||
| 	} | ||||
| 	s->fr.samples = fs->lastts;	/* XXX what ? */ | ||||
| 	s->fr.datalen = len; | ||||
| 	s->fr.subclass |= mark; | ||||
| 	s->fr.subclass.codec |= mark; | ||||
| 	s->fr.delivery.tv_sec = 0; | ||||
| 	s->fr.delivery.tv_usec = 0; | ||||
| 	if ((res = fread(&ts, 1, sizeof(ts), s->f)) == sizeof(ts)) { | ||||
| @@ -106,18 +106,18 @@ static int h263_write(struct ast_filestream *fs, struct ast_frame *f) | ||||
| 	int res; | ||||
| 	unsigned int ts; | ||||
| 	unsigned short len; | ||||
| 	int subclass; | ||||
| 	int mark=0; | ||||
| 	format_t subclass; | ||||
| 	format_t mark=0; | ||||
| 	if (f->frametype != AST_FRAME_VIDEO) { | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-video frame!\n"); | ||||
| 		return -1; | ||||
| 	} | ||||
| 	subclass = f->subclass; | ||||
| 	subclass = f->subclass.codec; | ||||
| 	if (subclass & 0x1) | ||||
| 		mark=0x8000; | ||||
| 	subclass &= ~0x1; | ||||
| 	if (subclass != AST_FORMAT_H263) { | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-h263 frame (%d)!\n", f->subclass); | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-h263 frame (%s)!\n", ast_getformatname(f->subclass.codec)); | ||||
| 		return -1; | ||||
| 	} | ||||
| 	ts = htonl(f->samples); | ||||
|   | ||||
| @@ -72,7 +72,7 @@ static struct ast_frame *h264_read(struct ast_filestream *s, int *whennext) | ||||
| 		len = BUF_SIZE;	/* XXX truncate */ | ||||
| 	} | ||||
| 	s->fr.frametype = AST_FRAME_VIDEO; | ||||
| 	s->fr.subclass = AST_FORMAT_H264; | ||||
| 	s->fr.subclass.codec = AST_FORMAT_H264; | ||||
| 	s->fr.mallocd = 0; | ||||
| 	AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, len); | ||||
| 	if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) { | ||||
| @@ -82,7 +82,7 @@ static struct ast_frame *h264_read(struct ast_filestream *s, int *whennext) | ||||
| 	} | ||||
| 	s->fr.samples = fs->lastts; | ||||
| 	s->fr.datalen = len; | ||||
| 	s->fr.subclass |= mark; | ||||
| 	s->fr.subclass.codec |= mark; | ||||
| 	s->fr.delivery.tv_sec = 0; | ||||
| 	s->fr.delivery.tv_usec = 0; | ||||
| 	if ((res = fread(&ts, 1, sizeof(ts), s->f)) == sizeof(ts)) { | ||||
| @@ -104,9 +104,9 @@ static int h264_write(struct ast_filestream *s, struct ast_frame *f) | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-video frame!\n"); | ||||
| 		return -1; | ||||
| 	} | ||||
| 	mark = (f->subclass & 0x1) ? 0x8000 : 0; | ||||
| 	if ((f->subclass & ~0x1) != AST_FORMAT_H264) { | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-h264 frame (%d)!\n", f->subclass); | ||||
| 	mark = (f->subclass.codec & 0x1) ? 0x8000 : 0; | ||||
| 	if ((f->subclass.codec & ~0x1) != AST_FORMAT_H264) { | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-h264 frame (%s)!\n", ast_getformatname(f->subclass.codec)); | ||||
| 		return -1; | ||||
| 	} | ||||
| 	ts = htonl(f->samples); | ||||
|   | ||||
| @@ -45,7 +45,7 @@ static struct ast_frame *ilbc_read(struct ast_filestream *s, int *whennext) | ||||
| 	int res; | ||||
| 	/* Send a frame from the file to the appropriate channel */ | ||||
| 	s->fr.frametype = AST_FRAME_VOICE; | ||||
| 	s->fr.subclass = AST_FORMAT_ILBC; | ||||
| 	s->fr.subclass.codec = AST_FORMAT_ILBC; | ||||
| 	s->fr.mallocd = 0; | ||||
| 	AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, ILBC_BUF_SIZE); | ||||
| 	if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) { | ||||
| @@ -64,8 +64,8 @@ static int ilbc_write(struct ast_filestream *fs, struct ast_frame *f) | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-voice frame!\n"); | ||||
| 		return -1; | ||||
| 	} | ||||
| 	if (f->subclass != AST_FORMAT_ILBC) { | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-iLBC frame (%d)!\n", f->subclass); | ||||
| 	if (f->subclass.codec != AST_FORMAT_ILBC) { | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-iLBC frame (%s)!\n", ast_getformatname(f->subclass.codec)); | ||||
| 		return -1; | ||||
| 	} | ||||
| 	if (f->datalen % 50) { | ||||
|   | ||||
| @@ -48,7 +48,7 @@ static struct ast_frame *jpeg_read_image(int fd, int len) | ||||
| 	} | ||||
| 	memset(&fr, 0, sizeof(fr)); | ||||
| 	fr.frametype = AST_FRAME_IMAGE; | ||||
| 	fr.subclass = AST_FORMAT_JPEG; | ||||
| 	fr.subclass.codec = AST_FORMAT_JPEG; | ||||
| 	fr.data.ptr = buf; | ||||
| 	fr.src = "JPEG Read"; | ||||
| 	fr.datalen = len; | ||||
| @@ -74,7 +74,7 @@ static int jpeg_write_image(int fd, struct ast_frame *fr) | ||||
| 		ast_log(LOG_WARNING, "Not an image\n"); | ||||
| 		return -1; | ||||
| 	} | ||||
| 	if (fr->subclass != AST_FORMAT_JPEG) { | ||||
| 	if (fr->subclass.codec != AST_FORMAT_JPEG) { | ||||
| 		ast_log(LOG_WARNING, "Not a jpeg image\n"); | ||||
| 		return -1; | ||||
| 	} | ||||
|   | ||||
| @@ -291,9 +291,9 @@ static int ogg_vorbis_write(struct ast_filestream *fs, struct ast_frame *f) | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-voice frame!\n"); | ||||
| 		return -1; | ||||
| 	} | ||||
| 	if (f->subclass != AST_FORMAT_SLINEAR) { | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-SLINEAR frame (%d)!\n", | ||||
| 				f->subclass); | ||||
| 	if (f->subclass.codec != AST_FORMAT_SLINEAR) { | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-SLINEAR frame (%s)!\n", | ||||
| 			ast_getformatname(f->subclass.codec)); | ||||
| 		return -1; | ||||
| 	} | ||||
| 	if (!f->datalen) | ||||
| @@ -438,7 +438,7 @@ static struct ast_frame *ogg_vorbis_read(struct ast_filestream *fs, | ||||
| 	short *buf;	/* SLIN data buffer */ | ||||
|  | ||||
| 	fs->fr.frametype = AST_FRAME_VOICE; | ||||
| 	fs->fr.subclass = AST_FORMAT_SLINEAR; | ||||
| 	fs->fr.subclass.codec = 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.ptr);	/* SLIN data buffer */ | ||||
|   | ||||
| @@ -80,7 +80,7 @@ static struct ast_frame *pcm_read(struct ast_filestream *s, int *whennext) | ||||
| 	/* Send a frame from the file to the appropriate channel */ | ||||
|  | ||||
| 	s->fr.frametype = AST_FRAME_VOICE; | ||||
| 	s->fr.subclass = s->fmt->format; | ||||
| 	s->fr.subclass.codec = s->fmt->format; | ||||
| 	s->fr.mallocd = 0; | ||||
| 	AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, BUF_SIZE); | ||||
| 	if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) < 1) { | ||||
| @@ -163,8 +163,8 @@ static int pcm_write(struct ast_filestream *fs, struct ast_frame *f) | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-voice frame!\n"); | ||||
| 		return -1; | ||||
| 	} | ||||
| 	if (f->subclass != fs->fmt->format) { | ||||
| 		ast_log(LOG_WARNING, "Asked to write incompatible format frame (%d)!\n", f->subclass); | ||||
| 	if (f->subclass.codec != fs->fmt->format) { | ||||
| 		ast_log(LOG_WARNING, "Asked to write incompatible format frame (%s)!\n", ast_getformatname(f->subclass.codec)); | ||||
| 		return -1; | ||||
| 	} | ||||
|  | ||||
|   | ||||
| @@ -41,7 +41,7 @@ static struct ast_frame *siren14read(struct ast_filestream *s, int *whennext) | ||||
| 	/* Send a frame from the file to the appropriate channel */ | ||||
|  | ||||
| 	s->fr.frametype = AST_FRAME_VOICE; | ||||
| 	s->fr.subclass = AST_FORMAT_SIREN14; | ||||
| 	s->fr.subclass.codec = AST_FORMAT_SIREN14; | ||||
| 	s->fr.mallocd = 0; | ||||
| 	AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, BUF_SIZE); | ||||
| 	if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) { | ||||
| @@ -61,8 +61,8 @@ static int siren14write(struct ast_filestream *fs, struct ast_frame *f) | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-voice frame!\n"); | ||||
| 		return -1; | ||||
| 	} | ||||
| 	if (f->subclass != AST_FORMAT_SIREN14) { | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-Siren14 frame (%d)!\n", f->subclass); | ||||
| 	if (f->subclass.codec != AST_FORMAT_SIREN14) { | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-Siren14 frame (%s)!\n", ast_getformatname(f->subclass.codec)); | ||||
| 		return -1; | ||||
| 	} | ||||
| 	if ((res = fwrite(f->data.ptr, 1, f->datalen, fs->f)) != f->datalen) { | ||||
|   | ||||
| @@ -41,7 +41,7 @@ static struct ast_frame *siren7read(struct ast_filestream *s, int *whennext) | ||||
| 	/* Send a frame from the file to the appropriate channel */ | ||||
|  | ||||
| 	s->fr.frametype = AST_FRAME_VOICE; | ||||
| 	s->fr.subclass = AST_FORMAT_SIREN7; | ||||
| 	s->fr.subclass.codec = AST_FORMAT_SIREN7; | ||||
| 	s->fr.mallocd = 0; | ||||
| 	AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, BUF_SIZE); | ||||
| 	if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) { | ||||
| @@ -61,8 +61,8 @@ static int siren7write(struct ast_filestream *fs, struct ast_frame *f) | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-voice frame!\n"); | ||||
| 		return -1; | ||||
| 	} | ||||
| 	if (f->subclass != AST_FORMAT_SIREN7) { | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-Siren7 frame (%d)!\n", f->subclass); | ||||
| 	if (f->subclass.codec != AST_FORMAT_SIREN7) { | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-Siren7 frame (%s)!\n", ast_getformatname(f->subclass.codec)); | ||||
| 		return -1; | ||||
| 	} | ||||
| 	if ((res = fwrite(f->data.ptr, 1, f->datalen, fs->f)) != f->datalen) { | ||||
|   | ||||
| @@ -39,7 +39,7 @@ static struct ast_frame *slinear_read(struct ast_filestream *s, int *whennext) | ||||
| 	/* Send a frame from the file to the appropriate channel */ | ||||
|  | ||||
| 	s->fr.frametype = AST_FRAME_VOICE; | ||||
| 	s->fr.subclass = AST_FORMAT_SLINEAR; | ||||
| 	s->fr.subclass.codec = AST_FORMAT_SLINEAR; | ||||
| 	s->fr.mallocd = 0; | ||||
| 	AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, BUF_SIZE); | ||||
| 	if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) < 1) { | ||||
| @@ -59,8 +59,8 @@ static int slinear_write(struct ast_filestream *fs, struct ast_frame *f) | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-voice frame!\n"); | ||||
| 		return -1; | ||||
| 	} | ||||
| 	if (f->subclass != AST_FORMAT_SLINEAR) { | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-slinear frame (%d)!\n", f->subclass); | ||||
| 	if (f->subclass.codec != AST_FORMAT_SLINEAR) { | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-slinear frame (%s)!\n", ast_getformatname(f->subclass.codec)); | ||||
| 		return -1; | ||||
| 	} | ||||
| 	if ((res = fwrite(f->data.ptr, 1, f->datalen, fs->f)) != f->datalen) { | ||||
|   | ||||
| @@ -40,7 +40,7 @@ static struct ast_frame *slinear_read(struct ast_filestream *s, int *whennext) | ||||
| 	/* Send a frame from the file to the appropriate channel */ | ||||
|  | ||||
| 	s->fr.frametype = AST_FRAME_VOICE; | ||||
| 	s->fr.subclass = AST_FORMAT_SLINEAR16; | ||||
| 	s->fr.subclass.codec = AST_FORMAT_SLINEAR16; | ||||
| 	s->fr.mallocd = 0; | ||||
| 	AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, BUF_SIZE); | ||||
| 	if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) < 1) { | ||||
| @@ -61,8 +61,8 @@ static int slinear_write(struct ast_filestream *fs, struct ast_frame *f) | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-voice frame!\n"); | ||||
| 		return -1; | ||||
| 	} | ||||
| 	if (f->subclass != AST_FORMAT_SLINEAR16) { | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-slinear16 frame (%d)!\n", f->subclass); | ||||
| 	if (f->subclass.codec != AST_FORMAT_SLINEAR16) { | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-slinear16 frame (%s)!\n", ast_getformatname(f->subclass.codec)); | ||||
| 		return -1; | ||||
| 	} | ||||
| 	if ((res = fwrite(f->data.ptr, 1, f->datalen, fs->f)) != f->datalen) { | ||||
|   | ||||
| @@ -41,7 +41,7 @@ static struct ast_frame *vox_read(struct ast_filestream *s, int *whennext) | ||||
|  | ||||
| 	/* Send a frame from the file to the appropriate channel */ | ||||
| 	s->fr.frametype = AST_FRAME_VOICE; | ||||
| 	s->fr.subclass = AST_FORMAT_ADPCM; | ||||
| 	s->fr.subclass.codec = AST_FORMAT_ADPCM; | ||||
| 	s->fr.mallocd = 0; | ||||
| 	AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, BUF_SIZE); | ||||
| 	if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) < 1) { | ||||
| @@ -61,8 +61,8 @@ static int vox_write(struct ast_filestream *s, struct ast_frame *f) | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-voice frame!\n"); | ||||
| 		return -1; | ||||
| 	} | ||||
| 	if (f->subclass != AST_FORMAT_ADPCM) { | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-ADPCM frame (%d)!\n", f->subclass); | ||||
| 	if (f->subclass.codec != AST_FORMAT_ADPCM) { | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-ADPCM frame (%s)!\n", ast_getformatname(f->subclass.codec)); | ||||
| 		return -1; | ||||
| 	} | ||||
| 	if ((res = fwrite(f->data.ptr, 1, f->datalen, s->f)) != f->datalen) { | ||||
|   | ||||
| @@ -361,7 +361,7 @@ static struct ast_frame *wav_read(struct ast_filestream *s, int *whennext) | ||||
| 		bytes = 0; | ||||
| /* 	ast_debug(1, "here: %d, maxlen: %d, bytes: %d\n", here, s->maxlen, bytes); */ | ||||
| 	s->fr.frametype = AST_FRAME_VOICE; | ||||
| 	s->fr.subclass = AST_FORMAT_SLINEAR; | ||||
| 	s->fr.subclass.codec = AST_FORMAT_SLINEAR; | ||||
| 	s->fr.mallocd = 0; | ||||
| 	AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, bytes); | ||||
| 	 | ||||
| @@ -397,8 +397,8 @@ static int wav_write(struct ast_filestream *fs, struct ast_frame *f) | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-voice frame!\n"); | ||||
| 		return -1; | ||||
| 	} | ||||
| 	if (f->subclass != AST_FORMAT_SLINEAR) { | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-SLINEAR frame (%d)!\n", f->subclass); | ||||
| 	if (f->subclass.codec != AST_FORMAT_SLINEAR) { | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-SLINEAR frame (%s)!\n", ast_getformatname(f->subclass.codec)); | ||||
| 		return -1; | ||||
| 	} | ||||
| 	if (!f->datalen) | ||||
|   | ||||
| @@ -395,7 +395,7 @@ static struct ast_frame *wav_read(struct ast_filestream *s, int *whennext) | ||||
| 	struct wavg_desc *fs = (struct wavg_desc *)s->_private; | ||||
|  | ||||
| 	s->fr.frametype = AST_FRAME_VOICE; | ||||
| 	s->fr.subclass = AST_FORMAT_GSM; | ||||
| 	s->fr.subclass.codec = AST_FORMAT_GSM; | ||||
| 	s->fr.offset = AST_FRIENDLY_OFFSET; | ||||
| 	s->fr.samples = GSM_SAMPLES; | ||||
| 	s->fr.mallocd = 0; | ||||
| @@ -432,8 +432,8 @@ static int wav_write(struct ast_filestream *s, struct ast_frame *f) | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-voice frame!\n"); | ||||
| 		return -1; | ||||
| 	} | ||||
| 	if (f->subclass != AST_FORMAT_GSM) { | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-GSM frame (%d)!\n", f->subclass); | ||||
| 	if (f->subclass.codec != AST_FORMAT_GSM) { | ||||
| 		ast_log(LOG_WARNING, "Asked to write non-GSM frame (%s)!\n", ast_getformatname(f->subclass.codec)); | ||||
| 		return -1; | ||||
| 	} | ||||
| 	/* XXX this might fail... if the input is a multiple of MSGSM_FRAME_SIZE | ||||
|   | ||||
		Reference in New Issue
	
	Block a user