[asterisk-commits] dvossel: branch dvossel/fixtheworld_phase1_step3 r300760 - in /team/dvossel/f...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Jan 6 00:04:03 UTC 2011
Author: dvossel
Date: Wed Jan 5 18:04:00 2011
New Revision: 300760
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=300760
Log:
updates to file.c
Modified:
team/dvossel/fixtheworld_phase1_step3/include/asterisk/mod_format.h
team/dvossel/fixtheworld_phase1_step3/main/file.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=300760&r1=300759&r2=300760
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/include/asterisk/mod_format.h (original)
+++ team/dvossel/fixtheworld_phase1_step3/include/asterisk/mod_format.h Wed Jan 5 18:04:00 2011
@@ -76,7 +76,7 @@
void (*close)(struct ast_filestream *);
char * (*getcomment)(struct ast_filestream *); /*!< Retrieve file comment */
- AST_LIST_ENTRY(ast_format) list; /*!< Link */
+ AST_LIST_ENTRY(ast_format_def) list; /*!< Link */
/*!
* If the handler needs a buffer (for read, typically)
@@ -110,7 +110,7 @@
/*! Transparently translate from another format -- just once */
struct ast_trans_pvt *trans;
struct ast_tranlator_pvt *tr;
- int lastwriteformat;
+ struct ast_format lastwriteformat;
int lasttimeout;
struct ast_channel *owner;
FILE *f;
@@ -127,7 +127,7 @@
* \retval 0 on success
* \retval -1 on failure
*/
-int __ast_format_register(const struct ast_format_def *f, struct ast_module *mod);
+int __ast_format_def_register(const struct ast_format_def *f, struct ast_module *mod);
#define ast_format_register(f) __ast_format_register(f, ast_module_info->self)
/*!
@@ -137,7 +137,7 @@
* \retval 0 on success
* \retval -1 on failure to unregister
*/
-int ast_format_unregister(const char *name);
+int ast_format_def_unregister(const char *name);
#if defined(__cplusplus) || defined(c_plusplus)
}
Modified: team/dvossel/fixtheworld_phase1_step3/main/file.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/main/file.c?view=diff&rev=300760&r1=300759&r2=300760
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/main/file.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/main/file.c Wed Jan 5 18:04:00 2011
@@ -59,9 +59,9 @@
*/
int ast_language_is_prefix = 1;
-static AST_RWLIST_HEAD_STATIC(formats, ast_format);
-
-int __ast_format_register(const struct ast_format_def *f, struct ast_module *mod)
+static AST_RWLIST_HEAD_STATIC(formats, ast_format_def);
+
+int __ast_format_def_register(const struct ast_format_def *f, struct ast_module *mod)
{
struct ast_format_def *tmp;
@@ -98,7 +98,7 @@
return 0;
}
-int ast_format_unregister(const char *name)
+int ast_format_def_unregister(const char *name)
{
struct ast_format_def *tmp;
int res = -1;
@@ -130,8 +130,8 @@
if (tmp->stream) {
ast_closestream(tmp->stream);
tmp->stream = NULL;
- if (tmp->oldwriteformat && ast_set_write_format(tmp, tmp->oldwriteformat))
- ast_log(LOG_WARNING, "Unable to restore format back to %s\n", ast_getformatname(tmp->oldwriteformat));
+ if (tmp->oldwriteformat.id && ast_set_write_format(tmp, &tmp->oldwriteformat))
+ ast_log(LOG_WARNING, "Unable to restore format back to %s\n", ast_getformatname(&tmp->oldwriteformat));
}
/* Stop the video stream too */
if (tmp->vstream != NULL) {
@@ -149,10 +149,10 @@
int res = -1;
int alt = 0;
if (f->frametype == AST_FRAME_VIDEO) {
- if (fs->fmt->format & AST_FORMAT_AUDIO_MASK) {
+ if (AST_FORMAT_GET_TYPE(fs->fmt->format.id) == AST_FORMAT_TYPE_AUDIO) {
/* This is the audio portion. Call the video one... */
if (!fs->vfs && fs->filename) {
- const char *type = ast_getformatname(f->subclass.codec & ~0x1);
+ const char *type = ast_getformatname(&f->subclass.format);
fs->vfs = ast_writefile(fs->filename, type, NULL, fs->flags, 0, fs->mode);
ast_debug(1, "Opened video output file\n");
}
@@ -168,7 +168,7 @@
ast_log(LOG_WARNING, "Tried to write non-voice frame\n");
return -1;
}
- if (((fs->fmt->format | alt) & f->subclass.codec) == f->subclass.codec) {
+ if ((ast_format_cmp(&fs->fmt->format, &f->subclass.format) == AST_FORMAT_CMP_EQUAL)) {
res = fs->fmt->write(fs, f);
if (res < 0)
ast_log(LOG_WARNING, "Natural write failed\n");
@@ -177,18 +177,18 @@
} else {
/* XXX If they try to send us a type of frame that isn't the normal frame, and isn't
the one we've setup a translator for, we do the "wrong thing" XXX */
- if (fs->trans && f->subclass.codec != fs->lastwriteformat) {
+ if (fs->trans && (ast_format_cmp(&f->subclass.format, &fs->lastwriteformat) != AST_FORMAT_CMP_EQUAL)) {
ast_translator_free_path(fs->trans);
fs->trans = NULL;
}
if (!fs->trans)
- fs->trans = ast_translator_build_path(fs->fmt->format, f->subclass.codec);
+ fs->trans = ast_translator_build_path(&fs->fmt->format, &f->subclass.format);
if (!fs->trans)
ast_log(LOG_WARNING, "Unable to translate to format %s, source format %s\n",
- fs->fmt->name, ast_getformatname(f->subclass.codec));
+ fs->fmt->name, ast_getformatname(&f->subclass.format));
else {
struct ast_frame *trf;
- fs->lastwriteformat = f->subclass.codec;
+ ast_format_copy(&f->subclass.format, &fs->lastwriteformat);
/* Get the translated frame but don't consume the original in case they're using it on another stream */
if ((trf = ast_translate(fs->trans, f, 0))) {
struct ast_frame *cur;
@@ -298,7 +298,7 @@
/* Stop a running stream if there is one */
if (f->owner) {
- if (f->fmt->format < AST_FORMAT_AUDIO_MASK) {
+ if (AST_FORMAT_GET_TYPE(f->fmt->format.id) == AST_FORMAT_TYPE_AUDIO) {
f->owner->stream = NULL;
AST_SCHED_DEL(f->owner->sched, f->owner->streamid);
ast_settimeout(f->owner, 0, NULL, NULL);
More information about the asterisk-commits
mailing list