diff options
Diffstat (limited to 'formats/format_g719.c')
-rw-r--r-- | formats/format_g719.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/formats/format_g719.c b/formats/format_g719.c index ee9221230..8d508f0e3 100644 --- a/formats/format_g719.c +++ b/formats/format_g719.c @@ -34,6 +34,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/mod_format.h" #include "asterisk/module.h" #include "asterisk/endian.h" +#include "asterisk/format_cache.h" #define BUF_SIZE 160 /* 20 milliseconds == 160 bytes, 960 samples */ #define SAMPLES_TO_BYTES(x) ((typeof(x)) x / ((float) 960 / 160)) @@ -44,9 +45,6 @@ static struct ast_frame *g719read(struct ast_filestream *s, int *whennext) int res; /* Send a frame from the file to the appropriate channel */ - s->fr.frametype = AST_FRAME_VOICE; - ast_format_set(&s->fr.subclass.format, AST_FORMAT_G719, 0); - 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) { if (res) @@ -61,14 +59,6 @@ static int g719write(struct ast_filestream *fs, struct ast_frame *f) { int res; - 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_G719) { - ast_log(LOG_WARNING, "Asked to write non-G.719 frame (%s)!\n", ast_getformatname(&f->subclass.format)); - return -1; - } if ((res = fwrite(f->data.ptr, 1, f->datalen, fs->f)) != f->datalen) { ast_log(LOG_WARNING, "Bad write (%d/%d): %s\n", res, f->datalen, strerror(errno)); return -1; @@ -147,7 +137,8 @@ static struct ast_format_def g719_f = { static int load_module(void) { - ast_format_set(&g719_f.format, AST_FORMAT_G719, 0); + g719_f.format = ast_format_g719; + if (ast_format_def_register(&g719_f)) return AST_MODULE_LOAD_DECLINE; return AST_MODULE_LOAD_SUCCESS; |