[asterisk-commits] dvossel: branch dvossel/fixtheworld_phase1_step3 r300579 - in /team/dvossel/f...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Jan 5 17:05:55 UTC 2011
Author: dvossel
Date: Wed Jan 5 11:05:52 2011
New Revision: 300579
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=300579
Log:
update to channel.c
Modified:
team/dvossel/fixtheworld_phase1_step3/include/asterisk/mod_format.h
team/dvossel/fixtheworld_phase1_step3/include/asterisk/translate.h
team/dvossel/fixtheworld_phase1_step3/main/channel.c
Modified: team/dvossel/fixtheworld_phase1_step3/include/asterisk/mod_format.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/include/asterisk/mod_format.h?view=diff&rev=300579&r1=300578&r2=300579
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/include/asterisk/mod_format.h (original)
+++ team/dvossel/fixtheworld_phase1_step3/include/asterisk/mod_format.h Wed Jan 5 11:05:52 2011
@@ -44,7 +44,7 @@
char name[80]; /*!< Name of format */
char exts[80]; /*!< Extensions (separated by | if more than one)
this format can read. First is assumed for writing (e.g. .mp3) */
- format_t format; /*!< Format of frames it uses/provides (one only) */
+ struct ast_format format; /*!< Format of frames it uses/provides (one only) */
/*!
* \brief Prepare an input stream for playback.
* \return 0 on success, -1 on error.
Modified: team/dvossel/fixtheworld_phase1_step3/include/asterisk/translate.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/include/asterisk/translate.h?view=diff&rev=300579&r1=300578&r2=300579
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/include/asterisk/translate.h (original)
+++ team/dvossel/fixtheworld_phase1_step3/include/asterisk/translate.h Wed Jan 5 11:05:52 2011
@@ -280,7 +280,7 @@
*
* \note dst_cap and src_cap are not mondified.
*/
-int ast_translator_best_choice(struct ast_format *dst_cap,
+int ast_translator_best_choice(struct ast_cap *dst_cap,
struct ast_cap *src_cap,
struct ast_format *dst_fmt_out,
struct ast_format *src_fmt_out);
Modified: team/dvossel/fixtheworld_phase1_step3/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/main/channel.c?view=diff&rev=300579&r1=300578&r2=300579
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/main/channel.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/main/channel.c Wed Jan 5 11:05:52 2011
@@ -2632,8 +2632,8 @@
ast_translator_free_path(clonechan->readtrans);
clonechan->writetrans = NULL;
clonechan->readtrans = NULL;
- clonechan->rawwriteformat = clonechan->nativeformats;
- clonechan->rawreadformat = clonechan->nativeformats;
+ ast_best_codec(clonechan->nativeformats, &clonechan->rawwriteformat);
+ ast_best_codec(clonechan->nativeformats, &clonechan->rawreadformat);
}
void ast_set_hangupsource(struct ast_channel *chan, const char *source, int force)
@@ -4521,6 +4521,7 @@
int ast_prod(struct ast_channel *chan)
{
struct ast_frame a = { AST_FRAME_VOICE };
+ char nothing[128];
/* Send an empty audio frame to get things moving */
if (chan->_state != AST_STATE_UP) {
@@ -4848,7 +4849,7 @@
#ifndef MONITOR_CONSTANT_DELAY
int jump = chan->insmpl - chan->outsmpl - 4 * cur->samples;
if (jump >= 0) {
- jump = calc_monitor_jump((chan->insmpl - chan->outsmpl), ast_format_rate(f->subclass.codec), ast_format_rate(chan->monitor->read_stream->fmt->format));
+ jump = calc_monitor_jump((chan->insmpl - chan->outsmpl), ast_format_rate(&f->subclass.format), ast_format_rate(&chan->monitor->read_stream->fmt->format));
if (ast_seekstream(chan->monitor->write_stream, jump, SEEK_FORCECUR) == -1)
ast_log(LOG_WARNING, "Failed to perform seek in monitoring write stream, synchronization between the files may be broken\n");
chan->outsmpl += (chan->insmpl - chan->outsmpl) + cur->samples;
@@ -4953,14 +4954,14 @@
/* See if the underlying channel driver is capable of performing transcoding for us */
if (!ast_channel_setoption(chan, direction ? AST_OPTION_FORMAT_WRITE : AST_OPTION_FORMAT_READ, &best_set_fmt, sizeof(best_set_fmt), 0)) {
ast_debug(1, "Channel driver natively set channel %s to %s format %s\n", chan->name,
- direction ? "write" : "read", ast_getformatname(best_set_fmt));
+ direction ? "write" : "read", ast_getformatname(&best_set_fmt));
ast_format_copy(&best_set_fmt, format);
ast_format_copy(&best_set_fmt, rawformat);
ast_channel_lock(chan);
- ast_format_cap_remove_all(chan->nativeformats);
- ast_format_cap_add(chan->nativeformats, best_set_fmt);
+ ast_cap_remove_all(chan->nativeformats);
+ ast_cap_add(chan->nativeformats, &best_set_fmt);
ast_channel_unlock(chan);
if (*trans) {
@@ -4973,10 +4974,10 @@
/* Find a translation path from the native format to one of the desired formats */
if (!direction) {
/* reading */
- res = ast_translator_best_choice(&cap_set, &cap_native, &best_set_fmt, &best_native_fmt);
+ res = ast_translator_best_choice(cap_set, cap_native, &best_set_fmt, &best_native_fmt);
} else {
/* writing */
- res = ast_translator_best_choice(&cap_native, &cap_set, &best_native_fmt, &best_set_fmt);
+ res = ast_translator_best_choice(cap_native, cap_set, &best_native_fmt, &best_set_fmt);
}
if (res < 0) {
@@ -4990,7 +4991,7 @@
ast_channel_lock(chan);
if ((ast_format_cmp(rawformat, &best_native_fmt) != AST_FORMAT_CMP_NOT_EQUAL) &&
- (ast_format_cmp(format, &best_set_fmt) != AST_FORMAT_CMP_NOT_EQUAL)
+ (ast_format_cmp(format, &best_set_fmt) != AST_FORMAT_CMP_NOT_EQUAL) &&
((ast_format_cmp(rawformat, format) != AST_FORMAT_CMP_NOT_EQUAL) || (*trans))) {
/* the channel is already in these formats, so nothing to do */
ast_channel_unlock(chan);
@@ -5036,7 +5037,7 @@
int ast_set_read_format(struct ast_channel *chan, struct ast_format *format)
{
- struct ast_cap *tmp_cap = ast_cap_alloc();
+ struct ast_cap *cap = ast_cap_alloc();
int res;
if (!cap) {
return -1;
@@ -5044,19 +5045,19 @@
ast_cap_add(cap, format);
res = set_format(chan,
- tmp_cap,
+ cap,
&chan->rawreadformat,
&chan->readformat,
&chan->readtrans,
0);
- ast_cap_destroy(tmp_cap);
+ ast_cap_destroy(cap);
return res;
}
int ast_set_read_format_by_id(struct ast_channel *chan, enum ast_format_id id)
{
- struct ast_cap *tmp_cap = ast_cap_alloc();
+ struct ast_cap *cap = ast_cap_alloc();
struct ast_format tmp_format;
int res;
if (!cap) {
@@ -5065,20 +5066,20 @@
ast_cap_add(cap, ast_format_set(&tmp_format, id, 0));
res = set_format(chan,
- tmp_cap,
+ cap,
&chan->rawreadformat,
&chan->readformat,
&chan->readtrans,
0);
- ast_cap_destroy(tmp_cap);
+ ast_cap_destroy(cap);
return res;
}
-int ast_set_read_format_from_cap(struct ast_channel *chan, struct ast_cap *formats)
+int ast_set_read_format_from_cap(struct ast_channel *chan, struct ast_cap *cap)
{
return set_format(chan,
- formats,
+ cap,
&chan->rawreadformat,
&chan->readformat,
&chan->readtrans,
@@ -5087,7 +5088,7 @@
int ast_set_write_format(struct ast_channel *chan, struct ast_format *format)
{
- struct ast_cap *tmp_cap = ast_cap_alloc();
+ struct ast_cap *cap = ast_cap_alloc();
int res;
if (!cap) {
return -1;
@@ -5095,19 +5096,19 @@
ast_cap_add(cap, format);
res = set_format(chan,
- tmp_cap,
+ cap,
&chan->rawwriteformat,
&chan->writeformat,
&chan->writetrans,
1);
- ast_cap_destroy(tmp_cap);
+ ast_cap_destroy(cap);
return res;
}
int ast_set_write_format_by_id(struct ast_channel *chan, enum ast_format_id id)
{
- struct ast_cap *tmp_cap = ast_cap_alloc();
+ struct ast_cap *cap = ast_cap_alloc();
struct ast_format tmp_format;
int res;
if (!cap) {
@@ -5116,20 +5117,20 @@
ast_cap_add(cap, ast_format_set(&tmp_format, id, 0));
res = set_format(chan,
- tmp_cap,
+ cap,
&chan->rawwriteformat,
&chan->writeformat,
&chan->writetrans,
1);
- ast_cap_destroy(tmp_cap);
+ ast_cap_destroy(cap);
return res;
}
-int ast_set_write_format_from_cap(struct ast_channel *chan, struct ast_cap *formats)
+int ast_set_write_format_from_cap(struct ast_channel *chan, struct ast_cap *cap)
{
return set_format(chan,
- formats,
+ cap,
&chan->rawwriteformat,
&chan->writeformat,
&chan->writetrans,
@@ -5172,7 +5173,7 @@
}
}
-struct ast_channel *ast_call_forward(struct ast_channel *caller, struct ast_channel *orig, int *timeout, format_t format, struct outgoing_helper *oh, int *outstate)
+struct ast_channel *ast_call_forward(struct ast_channel *caller, struct ast_channel *orig, int *timeout, struct ast_cap *cap, struct outgoing_helper *oh, int *outstate)
{
char tmpchan[256];
struct ast_channel *new = NULL;
@@ -5195,7 +5196,7 @@
data = tmpchan;
type = "Local";
}
- if (!(new = ast_request(type, format, orig, data, &cause))) {
+ if (!(new = ast_request(type, cap, orig, data, &cause))) {
ast_log(LOG_NOTICE, "Unable to create channel for call forward to '%s/%s' (cause = %d)\n", type, data, cause);
handle_cause(cause, outstate);
ast_hangup(orig);
@@ -5253,7 +5254,7 @@
return new;
}
-struct ast_channel *__ast_request_and_dial(const char *type, format_t format, const struct ast_channel *requestor, void *data, int timeout, int *outstate, const char *cid_num, const char *cid_name, struct outgoing_helper *oh)
+struct ast_channel *__ast_request_and_dial(const char *type, struct ast_cap *cap, const struct ast_channel *requestor, void *data, int timeout, int *outstate, const char *cid_num, const char *cid_name, struct outgoing_helper *oh)
{
int dummy_outstate;
int cause = 0;
@@ -5267,7 +5268,7 @@
else
outstate = &dummy_outstate; /* make outstate always a valid pointer */
- chan = ast_request(type, format, requestor, data, &cause);
+ chan = ast_request(type, cap, requestor, data, &cause);
if (!chan) {
ast_log(LOG_NOTICE, "Unable to request channel %s/%s\n", type, (char *)data);
handle_cause(cause, outstate);
@@ -5319,7 +5320,7 @@
if (timeout > -1)
timeout = res;
if (!ast_strlen_zero(chan->call_forward)) {
- if (!(chan = ast_call_forward(NULL, chan, NULL, format, oh, outstate))) {
+ if (!(chan = ast_call_forward(NULL, chan, NULL, cap, oh, outstate))) {
return NULL;
}
continue;
@@ -5412,9 +5413,9 @@
return chan;
}
-struct ast_channel *ast_request_and_dial(const char *type, format_t format, const struct ast_channel *requestor, void *data, int timeout, int *outstate, const char *cidnum, const char *cidname)
-{
- return __ast_request_and_dial(type, format, requestor, data, timeout, outstate, cidnum, cidname, NULL);
+struct ast_channel *ast_request_and_dial(const char *type, struct ast_cap *cap, const struct ast_channel *requestor, void *data, int timeout, int *outstate, const char *cidnum, const char *cidname)
+{
+ return __ast_request_and_dial(type, cap, requestor, data, timeout, outstate, cidnum, cidname, NULL);
}
static int set_security_requirements(const struct ast_channel *requestor, struct ast_channel *out)
@@ -5457,11 +5458,11 @@
return 0;
}
-struct ast_channel *ast_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause)
+struct ast_channel *ast_request(const char *type, struct ast_cap *cap, const struct ast_channel *requestor, void *data, int *cause)
{
struct chanlist *chan;
struct ast_channel *c;
- format_t capabilities;
+ struct ast_cap *capabilities;
format_t fmt;
int res;
int foo;
More information about the asterisk-commits
mailing list