diff options
author | David Vossel <dvossel@digium.com> | 2011-02-03 16:22:10 +0000 |
---|---|---|
committer | David Vossel <dvossel@digium.com> | 2011-02-03 16:22:10 +0000 |
commit | c26c190711a1bbe3b5fff1a93facae333757c56e (patch) | |
tree | 00da0caa5a07b7b25729f089dbcafb08129fa9be /main/image.c | |
parent | 652fb64a01c7a8656697d07e606620ee0ced6929 (diff) |
Asterisk media architecture conversion - no more format bitfields
This patch is the foundation of an entire new way of looking at media in Asterisk.
The code present in this patch is everything required to complete phase1 of my
Media Architecture proposal. For more information about this project visit the link below.
https://wiki.asterisk.org/wiki/display/AST/Media+Architecture+Proposal
The primary function of this patch is to convert all the usages of format
bitfields in Asterisk to use the new format and format_cap APIs. Functionally
no change in behavior should be present in this patch. Thanks to twilson
and russell for all the time they spent reviewing these changes.
Review: https://reviewboard.asterisk.org/r/1083/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@306010 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/image.c')
-rw-r--r-- | main/image.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/main/image.c b/main/image.c index 5da07ce06..3aa226653 100644 --- a/main/image.c +++ b/main/image.c @@ -96,7 +96,7 @@ static void make_filename(char *buf, int len, const char *filename, const char * } } -struct ast_frame *ast_read_image(const char *filename, const char *preflang, int format) +struct ast_frame *ast_read_image(const char *filename, const char *preflang, struct ast_format *format) { struct ast_imager *i; char buf[256]; @@ -109,7 +109,8 @@ struct ast_frame *ast_read_image(const char *filename, const char *preflang, int AST_RWLIST_RDLOCK(&imagers); AST_RWLIST_TRAVERSE(&imagers, i, list) { - if (i->format & format) { + /* if NULL image format, just pick the first one, otherwise match it. */ + if (!format || (ast_format_cmp(&i->format, format) == AST_FORMAT_CMP_EQUAL)) { char *stringp=NULL; ast_copy_string(tmp, i->exts, sizeof(tmp)); stringp = tmp; @@ -157,7 +158,7 @@ int ast_send_image(struct ast_channel *chan, const char *filename) struct ast_frame *f; int res = -1; if (chan->tech->send_image) { - f = ast_read_image(filename, chan->language, -1); + f = ast_read_image(filename, chan->language, NULL); if (f) { res = chan->tech->send_image(chan, f); ast_frfree(f); @@ -189,7 +190,7 @@ static char *handle_core_show_image_formats(struct ast_cli_entry *e, int cmd, st ast_cli(a->fd, FORMAT, "----", "----------", "-----------", "------"); AST_RWLIST_RDLOCK(&imagers); AST_RWLIST_TRAVERSE(&imagers, i, list) { - ast_cli(a->fd, FORMAT2, i->name, i->exts, i->desc, ast_getformatname(i->format)); + ast_cli(a->fd, FORMAT2, i->name, i->exts, i->desc, ast_getformatname(&i->format)); count_fmt++; } AST_RWLIST_UNLOCK(&imagers); |