From d8e0c584372c51b585a52efbe2375861bc09bdcf Mon Sep 17 00:00:00 2001 From: Tilghman Lesher Date: Wed, 4 Nov 2009 14:05:12 +0000 Subject: 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 --- channels/chan_oss.c | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) (limited to 'channels/chan_oss.c') diff --git a/channels/chan_oss.c b/channels/chan_oss.c index d7b6cc3f4..6e1fff8aa 100644 --- a/channels/chan_oss.c +++ b/channels/chan_oss.c @@ -325,7 +325,7 @@ static struct chan_oss_pvt oss_default = { static int setformat(struct chan_oss_pvt *o, int mode); -static struct ast_channel *oss_request(const char *type, int format, const struct ast_channel *requestor, +static struct ast_channel *oss_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause); static int oss_digit_begin(struct ast_channel *c, char digit); static int oss_digit_end(struct ast_channel *c, char digit, unsigned int duration); @@ -591,7 +591,7 @@ static int oss_text(struct ast_channel *c, const char *text) static int oss_call(struct ast_channel *c, char *dest, int timeout) { struct chan_oss_pvt *o = c->tech_pvt; - struct ast_frame f = { 0, }; + struct ast_frame f = { AST_FRAME_CONTROL, }; AST_DECLARE_APP_ARGS(args, AST_APP_ARG(name); AST_APP_ARG(flags); @@ -602,24 +602,20 @@ static int oss_call(struct ast_channel *c, char *dest, int timeout) ast_verbose(" << Call to device '%s' dnid '%s' rdnis '%s' on console from '%s' <%s> >>\n", dest, c->cid.cid_dnid, c->cid.cid_rdnis, c->cid.cid_name, c->cid.cid_num); if (!ast_strlen_zero(args.flags) && strcasecmp(args.flags, "answer") == 0) { - f.frametype = AST_FRAME_CONTROL; - f.subclass = AST_CONTROL_ANSWER; + f.subclass.integer = AST_CONTROL_ANSWER; ast_queue_frame(c, &f); } else if (!ast_strlen_zero(args.flags) && strcasecmp(args.flags, "noanswer") == 0) { - f.frametype = AST_FRAME_CONTROL; - f.subclass = AST_CONTROL_RINGING; + f.subclass.integer = AST_CONTROL_RINGING; ast_queue_frame(c, &f); ast_indicate(c, AST_CONTROL_RINGING); } else if (o->autoanswer) { ast_verbose(" << Auto-answered >> \n"); - f.frametype = AST_FRAME_CONTROL; - f.subclass = AST_CONTROL_ANSWER; + f.subclass.integer = AST_CONTROL_ANSWER; ast_queue_frame(c, &f); o->hookstate = 1; } else { ast_verbose("<< Type 'answer' to answer, or use 'autoanswer' for future calls >> \n"); - f.frametype = AST_FRAME_CONTROL; - f.subclass = AST_CONTROL_RINGING; + f.subclass.integer = AST_CONTROL_RINGING; ast_queue_frame(c, &f); ast_indicate(c, AST_CONTROL_RINGING); } @@ -717,7 +713,7 @@ static struct ast_frame *oss_read(struct ast_channel *c) return f; /* ok we can build and deliver the frame to the caller */ f->frametype = AST_FRAME_VOICE; - f->subclass = AST_FORMAT_SLINEAR; + f->subclass.codec = AST_FORMAT_SLINEAR; f->samples = FRAME_SIZE; f->datalen = FRAME_SIZE * 2; f->data.ptr = o->oss_read_buf + AST_FRIENDLY_OFFSET; @@ -824,7 +820,7 @@ static struct ast_channel *oss_new(struct chan_oss_pvt *o, char *ext, char *ctx, return c; } -static struct ast_channel *oss_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause) +static struct ast_channel *oss_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause) { struct ast_channel *c; struct chan_oss_pvt *o; @@ -833,6 +829,7 @@ static struct ast_channel *oss_request(const char *type, int format, const struc AST_APP_ARG(flags); ); char *parse = ast_strdupa(data); + char buf[256]; AST_NONSTANDARD_APP_ARGS(args, parse, '/'); o = find_desc(args.name); @@ -844,7 +841,7 @@ static struct ast_channel *oss_request(const char *type, int format, const struc return NULL; } if ((format & AST_FORMAT_SLINEAR) == 0) { - ast_log(LOG_NOTICE, "Format 0x%x unsupported\n", format); + ast_log(LOG_NOTICE, "Format %s unsupported\n", ast_getformatname_multiple(buf, sizeof(buf), format)); return NULL; } if (o->owner) { @@ -942,7 +939,7 @@ static char *console_autoanswer(struct ast_cli_entry *e, int cmd, struct ast_cli /*! \brief helper function for the answer key/cli command */ static char *console_do_answer(int fd) { - struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_ANSWER }; + struct ast_frame f = { AST_FRAME_CONTROL, { AST_CONTROL_ANSWER } }; struct chan_oss_pvt *o = find_desc(oss_active); if (!o->owner) { if (fd > -1) @@ -1007,7 +1004,7 @@ static char *console_sendtext(struct ast_cli_entry *e, int cmd, struct ast_cli_a int i = strlen(buf); buf[i] = '\n'; f.frametype = AST_FRAME_TEXT; - f.subclass = 0; + f.subclass.integer = 0; f.data.ptr = buf; f.datalen = i + 1; ast_queue_frame(o->owner, &f); @@ -1043,7 +1040,7 @@ static char *console_hangup(struct ast_cli_entry *e, int cmd, struct ast_cli_arg static char *console_flash(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { - struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_FLASH }; + struct ast_frame f = { AST_FRAME_CONTROL, { AST_CONTROL_FLASH } }; struct chan_oss_pvt *o = find_desc(oss_active); if (cmd == CLI_INIT) { @@ -1086,7 +1083,7 @@ static char *console_dial(struct ast_cli_entry *e, int cmd, struct ast_cli_args return CLI_SHOWUSAGE; if (o->owner) { /* already in a call */ int i; - struct ast_frame f = { AST_FRAME_DTMF, 0 }; + struct ast_frame f = { AST_FRAME_DTMF, { 0 } }; const char *s; if (a->argc == e->args) { /* argument is mandatory here */ @@ -1096,7 +1093,7 @@ static char *console_dial(struct ast_cli_entry *e, int cmd, struct ast_cli_args s = a->argv[e->args]; /* send the string one char at a time */ for (i = 0; i < strlen(s); i++) { - f.subclass = s[i]; + f.subclass.integer = s[i]; ast_queue_frame(o->owner, &f); } return CLI_SUCCESS; -- cgit v1.2.3