[Asterisk-code-review] menuselect: Add a new 'options' support type (asterisk[13])

Joshua Colp asteriskteam at digium.com
Wed Mar 15 05:21:50 CDT 2017


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/5169 )

Change subject: menuselect: Add a new 'options' support type
......................................................................


menuselect: Add a new 'options' support type

The Binaural Rendering patches in the master branch required
menuselect to be updated with a new support type called 'option'.
This allows binaural rendering to be turned on or off when
bridge_softmix is built.  This patch backports the 'option'
functionality to the 13 and 14 branches.

Here's what it looks like in menuselect:

  [*] bridge_simple
  [*] bridge_softmix
      --- Module Options ---
  [ ] binaural_rendering_in_bridge_softmix

To create an option for a module, you can create (or update) the
menuselect-tree xml snippet in the directory where the module
resides and add a member element with an 'option' support_level.

Example (abbreviated) from bridges/bridges.xml:

<member name="binaural_rendering_in_bridge_softmix"
	displayname="Enable binaural rendering in bridge_softmix"
	remove_on_change="bridges/bridge_softmix.o bridges/bridge_softmix.so">
	<support_level>option</support_level>
	<depend>bridge_softmix</depend>
	<depend>fftw3</depend>
	<defaultenabled>no</defaultenabled>
</member>

The 'name' will be added or removed from the MENUSELECT_<dir>
make variable following the standard module "missing means yes"
rules.

Example (abbreviated) from bridges/Makefile:

ifeq ($(findstring binaural_rendering,$(MENUSELECT_BRIDGES)),)
bridge_softmix.o: _ASTCFLAGS+=-DBINAURAL_RENDERING
bridge_softmix.so: LIBS+=$(FFTW3_LIB)
endif

Change-Id: I66d23755ed6e81f8d439cad410f2ffa7c30f25ad
---
M menuselect/menuselect.c
M menuselect/menuselect.h
2 files changed, 9 insertions(+), 2 deletions(-)

Approvals:
  Kevin Harwell: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved



diff --git a/menuselect/menuselect.c b/menuselect/menuselect.c
index da972d8..689cebf 100644
--- a/menuselect/menuselect.c
+++ b/menuselect/menuselect.c
@@ -238,6 +238,10 @@
 		return SUPPORT_EXTERNAL;
 	}
 
+	if (!strcasecmp(support_level, "option")) {
+		return SUPPORT_OPTION;
+	}
+
 	return SUPPORT_UNSPECIFIED;
 }
 
@@ -253,6 +257,8 @@
 		return "Deprecated";
 	case SUPPORT_EXTERNAL:
 		return "External";
+	case SUPPORT_OPTION:
+		return "Module Options";
 	default:
 		return "Unspecified";
 	}
@@ -461,7 +467,7 @@
 		process_process_xml_category_child_node(cur, mem);
 	}
 
-	if (!cat->positive_output) {
+	if (!cat->positive_output && strcasecmp(mem->support_level, "option")) {
 		mem->enabled = 1;
 		if (!mem->defaultenabled || strcasecmp(mem->defaultenabled, "no")) {
 			mem->was_enabled = 1;
diff --git a/menuselect/menuselect.h b/menuselect/menuselect.h
index bf2bf4c..78ae8ef 100644
--- a/menuselect/menuselect.h
+++ b/menuselect/menuselect.h
@@ -108,7 +108,8 @@
 	SUPPORT_DEPRECATED = 2,
 	SUPPORT_UNSPECIFIED = 3,
 	SUPPORT_EXTERNAL = 4,
-	SUPPORT_COUNT = 5, /* Keep this item at the end of the list. Tracks total number of support levels. */
+	SUPPORT_OPTION = 5,
+	SUPPORT_COUNT = 6, /* Keep this item at the end of the list. Tracks total number of support levels. */
 };
 
 AST_LIST_HEAD_NOLOCK(support_level_bucket, member);

-- 
To view, visit https://gerrit.asterisk.org/5169
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I66d23755ed6e81f8d439cad410f2ffa7c30f25ad
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>



More information about the asterisk-code-review mailing list