[asterisk-commits] dvossel: branch dvossel/fixtheworld_phase1_step3 r302002 - /team/dvossel/fixt...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Jan 14 16:31:32 CST 2011
Author: dvossel
Date: Fri Jan 14 16:31:28 2011
New Revision: 302002
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=302002
Log:
update to chan_oss.c
Modified:
team/dvossel/fixtheworld_phase1_step3/channels/chan_oss.c
Modified: team/dvossel/fixtheworld_phase1_step3/channels/chan_oss.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/channels/chan_oss.c?view=diff&rev=302002&r1=302001&r2=302002
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/channels/chan_oss.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/channels/chan_oss.c Fri Jan 14 16:31:28 2011
@@ -326,7 +326,7 @@
static int setformat(struct chan_oss_pvt *o, int mode);
-static struct ast_channel *oss_request(const char *type, format_t format, const struct ast_channel *requestor,
+static struct ast_channel *oss_request(const char *type, struct ast_cap *cap, 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);
@@ -344,7 +344,6 @@
static struct ast_channel_tech oss_tech = {
.type = "Console",
.description = tdesc,
- .capabilities = AST_FORMAT_SLINEAR, /* overwritten later */
.requester = oss_request,
.send_digit_begin = oss_digit_begin,
.send_digit_end = oss_digit_end,
@@ -719,7 +718,7 @@
return f;
/* ok we can build and deliver the frame to the caller */
f->frametype = AST_FRAME_VOICE;
- f->subclass.codec = AST_FORMAT_SLINEAR;
+ ast_format_set(&f->subclass.format, AST_FORMAT_SLINEAR, 0);
f->samples = FRAME_SIZE;
f->datalen = FRAME_SIZE * 2;
f->data.ptr = o->oss_read_buf + AST_FRIENDLY_OFFSET;
@@ -794,13 +793,15 @@
if (o->sounddev < 0)
setformat(o, O_RDWR);
ast_channel_set_fd(c, 0, o->sounddev); /* -1 if device closed, override later */
- c->nativeformats = AST_FORMAT_SLINEAR;
+
+ ast_format_set(&c->readformat, AST_FORMAT_SLINEAR, 0);
+ ast_format_set(&c->writeformat, AST_FORMAT_SLINEAR, 0);
+ ast_cap_add(c->nativeformats, &c->readformat);
+
/* if the console makes the call, add video to the offer */
- if (state == AST_STATE_RINGING)
- c->nativeformats |= console_video_formats;
-
- c->readformat = AST_FORMAT_SLINEAR;
- c->writeformat = AST_FORMAT_SLINEAR;
+ //if (state == AST_STATE_RINGING) /* TODO XXX CONSOLE VIDEO IS DISABLED UNTIL IT GETS A MAINTAINER */
+ // c->nativeformats |= console_video_formats;
+
c->tech_pvt = o;
if (!ast_strlen_zero(o->language))
@@ -830,7 +831,7 @@
return c;
}
-static struct ast_channel *oss_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause)
+static struct ast_channel *oss_request(const char *type, struct ast_cap *cap, const struct ast_channel *requestor, void *data, int *cause)
{
struct ast_channel *c;
struct chan_oss_pvt *o;
@@ -840,6 +841,7 @@
);
char *parse = ast_strdupa(data);
char buf[256];
+ struct ast_format tmpfmt;
AST_NONSTANDARD_APP_ARGS(args, parse, '/');
o = find_desc(args.name);
@@ -850,8 +852,8 @@
/* XXX we could default to 'dsp' perhaps ? */
return NULL;
}
- if ((format & AST_FORMAT_SLINEAR) == 0) {
- ast_log(LOG_NOTICE, "Format %s unsupported\n", ast_getformatname_multiple(buf, sizeof(buf), format));
+ if (!(ast_cap_iscompatible(cap, ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR, 0)))) {
+ ast_log(LOG_NOTICE, "Format %s unsupported\n", ast_getformatname_multiple(buf, sizeof(buf), cap));
return NULL;
}
if (o->owner) {
@@ -1437,6 +1439,7 @@
struct ast_config *cfg = NULL;
char *ctg = NULL;
struct ast_flags config_flags = { 0 };
+ struct ast_format tmpfmt;
/* Copy the default jb config over global_jbconf */
memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf));
@@ -1463,7 +1466,13 @@
return AST_MODULE_LOAD_FAILURE;
}
- oss_tech.capabilities |= console_video_formats;
+ if (!(oss_tech.capabilities = ast_cap_alloc())) {
+ return AST_MODULE_LOAD_FAILURE;
+ }
+ ast_cap_add(oss_tech.capabilities, ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR, 0));
+
+ /* TODO XXX CONSOLE VIDEO IS DISABLE UNTIL IT HAS A MAINTAINER
+ * add console_video_formats to oss_tech.capabilities once this occurs. */
if (ast_channel_register(&oss_tech)) {
ast_log(LOG_ERROR, "Unable to register channel type 'OSS'\n");
@@ -1495,6 +1504,7 @@
ast_free(o);
o = next;
}
+ oss_tech.capabilities = ast_cap_destroy(oss_tech.capabilities);
return 0;
}
More information about the asterisk-commits
mailing list