[asterisk-commits] kmoore: branch kmoore/stasis-bridge_events r385307 - in /team/kmoore/stasis-b...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Apr 11 09:42:10 CDT 2013


Author: kmoore
Date: Thu Apr 11 09:42:07 2013
New Revision: 385307

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=385307
Log:
Move the video mode type string representation getter to an appropriate place so it isn't duplicated and do some more clean up

Modified:
    team/kmoore/stasis-bridge_events/include/asterisk/bridging.h
    team/kmoore/stasis-bridge_events/main/bridging.c
    team/kmoore/stasis-bridge_events/main/manager_bridging.c

Modified: team/kmoore/stasis-bridge_events/include/asterisk/bridging.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/include/asterisk/bridging.h?view=diff&rev=385307&r1=385306&r2=385307
==============================================================================
--- team/kmoore/stasis-bridge_events/include/asterisk/bridging.h (original)
+++ team/kmoore/stasis-bridge_events/include/asterisk/bridging.h Thu Apr 11 09:42:07 2013
@@ -215,6 +215,17 @@
 	AST_BRIDGE_VIDEO_MODE_TALKER_SRC,
 };
 
+/*!
+ * \brief Get string representation of a bridge video mode type.
+ * \since 12
+ *
+ * \param video_mode The video mode for which to get a string representation
+ *
+ * \retval NULL on invalid video mode types
+ * \retval A string literal describing the video mode type
+ */
+const char *ast_bridge_video_mode_type2str(enum ast_bridge_video_mode_type video_mode);
+
 /*! This is used for both SINGLE_SRC mode to set what channel
  *  should be the current single video feed */
 struct ast_bridge_video_single_src_data {

Modified: team/kmoore/stasis-bridge_events/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/main/bridging.c?view=diff&rev=385307&r1=385306&r2=385307
==============================================================================
--- team/kmoore/stasis-bridge_events/main/bridging.c (original)
+++ team/kmoore/stasis-bridge_events/main/bridging.c Thu Apr 11 09:42:07 2013
@@ -4043,6 +4043,19 @@
 	return manager;
 }
 
+const char *ast_bridge_video_mode_type2str(enum ast_bridge_video_mode_type video_mode)
+{
+	switch (video_mode) {
+	case AST_BRIDGE_VIDEO_MODE_NONE:
+		return "none";
+	case AST_BRIDGE_VIDEO_MODE_SINGLE_SRC:
+		return "single";
+	case AST_BRIDGE_VIDEO_MODE_TALKER_SRC:
+		return "talker";
+	}
+	return NULL;
+}
+
 /*!
  * \internal
  * \brief Shutdown the bridging system.

Modified: team/kmoore/stasis-bridge_events/main/manager_bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/main/manager_bridging.c?view=diff&rev=385307&r1=385306&r2=385307
==============================================================================
--- team/kmoore/stasis-bridge_events/main/manager_bridging.c (original)
+++ team/kmoore/stasis-bridge_events/main/manager_bridging.c Thu Apr 11 09:42:07 2013
@@ -263,19 +263,6 @@
 		"Uniqueid: %s\r\n", new_snapshot->video_source);
 }
 
-static const char *video_mode_to_str(enum ast_bridge_video_mode_type video_mode)
-{
-	switch (video_mode) {
-	case AST_BRIDGE_VIDEO_MODE_NONE:
-		return "none";
-	case AST_BRIDGE_VIDEO_MODE_SINGLE_SRC:
-		return "single";
-	case AST_BRIDGE_VIDEO_MODE_TALKER_SRC:
-		return "talker";
-	}
-	return NULL;
-}
-
 /*! \brief Handle bridge video mode change */
 static struct ast_manager_event_blob *bridge_video_mode(
 	struct ast_bridge_snapshot *old_snapshot,
@@ -291,7 +278,7 @@
 
 	return ast_manager_event_blob_create(
 		EVENT_FLAG_CALL, "BridgeVideoModeChange",
-		"BridgeVideoMode: %s\r\n", video_mode_to_str(new_snapshot->video_mode));
+		"BridgeVideoMode: %s\r\n", ast_bridge_video_mode_type2str(new_snapshot->video_mode));
 }
 
 bridge_snapshot_monitor bridge_monitors[] = {
@@ -322,10 +309,10 @@
 	new_snapshot = stasis_message_data(update->new_snapshot);
 
 	for (i = 0; i < ARRAY_LEN(bridge_monitors); ++i) {
-		RAII_VAR(struct ast_manager_event_blob *, ev, NULL, ao2_cleanup);
-		ev = bridge_monitors[i](old_snapshot, new_snapshot);
-
-		if (!ev) {
+		RAII_VAR(struct ast_manager_event_blob *, event, NULL, ao2_cleanup);
+
+		event = bridge_monitors[i](old_snapshot, new_snapshot);
+		if (!event) {
 			continue;
 		}
 
@@ -339,9 +326,9 @@
 			}
 		}
 
-		manager_event(ev->event_flags, ev->manager_event, "%s%s",
+		manager_event(event->event_flags, event->manager_event, "%s%s",
 			ast_str_buffer(bridge_event_string),
-			ev->extra_fields);
+			event->extra_fields);
 	}
 }
 




More information about the asterisk-commits mailing list