[asterisk-commits] dlee: branch dlee/record r392763 - in /team/dlee/record: include/asterisk/ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jun 24 15:24:26 CDT 2013


Author: dlee
Date: Mon Jun 24 15:24:25 2013
New Revision: 392763

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=392763
Log:
Janitor unnecessary since I'm using ast_play_and_record

Modified:
    team/dlee/record/include/asterisk/channel.h
    team/dlee/record/main/channel.c

Modified: team/dlee/record/include/asterisk/channel.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/include/asterisk/channel.h?view=diff&rev=392763&r1=392762&r2=392763
==============================================================================
--- team/dlee/record/include/asterisk/channel.h (original)
+++ team/dlee/record/include/asterisk/channel.h Mon Jun 24 15:24:25 2013
@@ -1834,32 +1834,6 @@
 
 /*! \brief Send empty audio to prime a channel driver */
 int ast_prod(struct ast_channel *chan);
-
-/*! \brief An object which resets a channel's formats on cleanup */
-struct ast_format_janitor;
-
-/*!
- * \brief Creates a janitor object which resets a channel's format specifiers
- * when the janitor is cleaned up. Meant for use with RAII_VAR().
- *
- * \code
- * RAII_VAR(struct ast_format_janitor *, janitor,
- *	ast_format_janitor_create(chan), ast_format_janitor_dtor);
- * \endocde
- *
- * \param chan Channel to reset at destruction.
- * \return Janitor object.
- * \return \c NULL on error.
- */
-struct ast_format_janitor *ast_format_janitor_create(struct ast_channel *chan);
-
-/*!
- * \brief Destroy a janitor object, created with ast_format_janitor_create().
- *
- * \param janitor Janitor object to destroy. May be \c NULL.
- */
-void ast_format_janitor_dtor(struct ast_format_janitor *janitor);
-
 /*!
  * \brief Sets read format on channel chan from capabilities
  * Set read format for channel to whichever component of "format" is best.

Modified: team/dlee/record/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/main/channel.c?view=diff&rev=392763&r1=392762&r2=392763
==============================================================================
--- team/dlee/record/main/channel.c (original)
+++ team/dlee/record/main/channel.c Mon Jun 24 15:24:25 2013
@@ -5308,62 +5308,6 @@
 	}
 	ast_channel_unlock(chan);
 	return res;
-}
-
-struct ast_format_janitor {
-	struct ast_channel *channel;
-	struct ast_format rfmt;
-	struct ast_format wfmt;
-};
-
-struct ast_format_janitor *ast_format_janitor_create(struct ast_channel *chan)
-{
-	struct ast_format_janitor *janitor;
-
-	if (chan == NULL) {
-		return NULL;
-	}
-
-	janitor = ast_calloc(1, sizeof(*janitor));
-	if (janitor == NULL) {
-		return NULL;
-	}
-
-	janitor->channel = ast_channel_ref(chan);
-	ast_format_clear(&janitor->rfmt);
-	ast_format_copy(&janitor->rfmt, ast_channel_readformat(chan));
-	ast_format_clear(&janitor->wfmt);
-	ast_format_copy(&janitor->wfmt, ast_channel_writeformat(chan));
-
-	return janitor;
-}
-
-void ast_format_janitor_dtor(struct ast_format_janitor *janitor)
-{
-	int res;
-
-	if (janitor == NULL) {
-		return;
-	}
-
-	if (janitor->rfmt.id != ast_channel_readformat(janitor->channel)->id) {
-		res = ast_set_read_format(janitor->channel, &janitor->rfmt);
-		if (res != 0) {
-			ast_log(LOG_WARNING,
-				"Failed to reset channel read format");
-		}
-	}
-
-	if (janitor->wfmt.id != ast_channel_writeformat(janitor->channel)->id) {
-		res = ast_set_write_format(janitor->channel, &janitor->wfmt);
-		if (res != 0) {
-			ast_log(LOG_WARNING,
-				"Failed to reset channel write format");
-		}
-	}
-
-	janitor->channel = ast_channel_unref(janitor->channel);
-	ast_free(janitor);
 }
 
 struct set_format_trans_access {




More information about the asterisk-commits mailing list