summaryrefslogtreecommitdiff
path: root/formats/format_g723.c
diff options
context:
space:
mode:
Diffstat (limited to 'formats/format_g723.c')
-rw-r--r--formats/format_g723.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/formats/format_g723.c b/formats/format_g723.c
index c3c194d15..51fe6b049 100644
--- a/formats/format_g723.c
+++ b/formats/format_g723.c
@@ -35,6 +35,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/mod_format.h"
#include "asterisk/module.h"
+#include "asterisk/format_cache.h"
#define G723_MAX_SIZE 1024
@@ -64,9 +65,6 @@ static struct ast_frame *g723_read(struct ast_filestream *s, int *whennext)
return NULL;
}
/* Read the data into the buffer */
- s->fr.frametype = AST_FRAME_VOICE;
- ast_format_set(&s->fr.subclass.format, AST_FORMAT_G723_1, 0);
- 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) {
ast_log(LOG_WARNING, "Short read (%d of %d bytes) (%s)!\n", res, size, strerror(errno));
@@ -82,14 +80,6 @@ static int g723_write(struct ast_filestream *s, struct ast_frame *f)
uint16_t size;
int res;
/* XXX there used to be a check s->fr means a read stream */
- if (f->frametype != AST_FRAME_VOICE) {
- ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
- return -1;
- }
- if (f->subclass.format.id != AST_FORMAT_G723_1) {
- ast_log(LOG_WARNING, "Asked to write non-g723 frame!\n");
- return -1;
- }
delay = 0;
if (f->datalen <= 0) {
ast_log(LOG_WARNING, "Short frame ignored (%d bytes long?)\n", f->datalen);
@@ -151,7 +141,7 @@ static struct ast_format_def g723_1_f = {
static int load_module(void)
{
- ast_format_set(&g723_1_f.format, AST_FORMAT_G723_1, 0);
+ g723_1_f.format = ast_format_g723;
if (ast_format_def_register(&g723_1_f))
return AST_MODULE_LOAD_FAILURE;