diff options
Diffstat (limited to 'formats/format_g726.c')
-rw-r--r-- | formats/format_g726.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/formats/format_g726.c b/formats/format_g726.c index 3c5697f5d..73a57c8ee 100644 --- a/formats/format_g726.c +++ b/formats/format_g726.c @@ -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.codec = AST_FORMAT_G726; + ast_format_set(&s->fr.subclass.format, AST_FORMAT_G726, 0); 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.codec != AST_FORMAT_G726) { + if (f->subclass.format.id != AST_FORMAT_G726) { ast_log(LOG_WARNING, "Asked to write non-G726 frame (%s)!\n", - ast_getformatname(f->subclass.codec)); + ast_getformatname(&f->subclass.format)); return -1; } if (f->datalen % frame_size[fs->rate]) { @@ -174,11 +174,10 @@ static off_t g726_tell(struct ast_filestream *fs) return -1; } -static const struct ast_format f[] = { +static struct ast_format_def f[] = { { .name = "g726-40", .exts = "g726-40", - .format = AST_FORMAT_G726, .open = g726_40_open, .rewrite = g726_40_rewrite, .write = g726_write, @@ -192,7 +191,6 @@ static const struct ast_format f[] = { { .name = "g726-32", .exts = "g726-32", - .format = AST_FORMAT_G726, .open = g726_32_open, .rewrite = g726_32_rewrite, .write = g726_write, @@ -206,7 +204,6 @@ static const struct ast_format f[] = { { .name = "g726-24", .exts = "g726-24", - .format = AST_FORMAT_G726, .open = g726_24_open, .rewrite = g726_24_rewrite, .write = g726_write, @@ -220,7 +217,6 @@ static const struct ast_format f[] = { { .name = "g726-16", .exts = "g726-16", - .format = AST_FORMAT_G726, .open = g726_16_open, .rewrite = g726_16_rewrite, .write = g726_write, @@ -231,15 +227,16 @@ static const struct ast_format f[] = { .buf_size = BUF_SIZE + AST_FRIENDLY_OFFSET, .desc_size = sizeof(struct g726_desc), }, - { .format = 0 } /* terminator */ + { .desc_size = 0 } /* terminator */ }; static int load_module(void) { int i; - for (i = 0; f[i].format ; i++) { - if (ast_format_register(&f[i])) { /* errors are fatal */ + for (i = 0; f[i].desc_size ; i++) { + ast_format_set(&f[i].format, AST_FORMAT_G726, 0); + if (ast_format_def_register(&f[i])) { /* errors are fatal */ ast_log(LOG_WARNING, "Failed to register format %s.\n", f[i].name); return AST_MODULE_LOAD_FAILURE; } @@ -251,8 +248,8 @@ static int unload_module(void) { int i; - for (i = 0; f[i].format ; i++) { - if (ast_format_unregister(f[i].name)) + for (i = 0; f[i].desc_size ; i++) { + if (ast_format_def_unregister(f[i].name)) ast_log(LOG_WARNING, "Failed to unregister format %s.\n", f[i].name); } return(0); |