[AMR] Change the Payload type preference to a range and have separate
ranges for AMR and AMR-WB. Change-Id: If5dca10b226a09168f1b1f834d97b826f8b777d6 Reviewed-on: https://code.wireshark.org/review/24105 Reviewed-by: Anders Broman <a.broman58@gmail.com> Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
parent
395c54c489
commit
33d28030b1
|
@ -89,9 +89,10 @@ static expert_field ei_amr_padding_bits_not0 = EI_INIT;
|
|||
static expert_field ei_amr_padding_bits_correct = EI_INIT;
|
||||
static expert_field ei_amr_reserved = EI_INIT;
|
||||
|
||||
/* The dynamic payload type which will be dissected as AMR */
|
||||
|
||||
static guint temp_dynamic_payload_type = 0;
|
||||
/* The dynamic payload types which will be dissected as AMR */
|
||||
#define AMR_DEFAULT_DYN_PT_RANGE "0"
|
||||
static range_t *global_amr_dynamic_payload_types;
|
||||
static range_t *global_amr_wb_dynamic_payload_types;
|
||||
static gint amr_encoding_type = 0;
|
||||
static gint pref_amr_mode = AMR_NB;
|
||||
|
||||
|
@ -797,12 +798,17 @@ proto_register_amr(void)
|
|||
|
||||
amr_module = prefs_register_protocol(proto_amr, proto_reg_handoff_amr);
|
||||
|
||||
prefs_register_uint_preference(amr_module, "dynamic.payload.type",
|
||||
"AMR dynamic payload type",
|
||||
"The dynamic payload type which will be interpreted as AMR"
|
||||
"; The value must be greater than 95",
|
||||
10,
|
||||
&temp_dynamic_payload_type);
|
||||
prefs_register_range_preference(amr_module, "dynamic.payload.type",
|
||||
"AMR dynamic payload types",
|
||||
"The dynamic payload types which will be interpreted as AMR"
|
||||
"(default " AMR_DEFAULT_DYN_PT_RANGE ")",
|
||||
&global_amr_dynamic_payload_types, 127);
|
||||
|
||||
prefs_register_range_preference(amr_module, "wb.dynamic.payload.type",
|
||||
"AMR-WB dynamic payload types",
|
||||
"The dynamic payload types which will be interpreted as AMR-WB"
|
||||
"(default " AMR_DEFAULT_DYN_PT_RANGE ")",
|
||||
&global_amr_wb_dynamic_payload_types, 127);
|
||||
|
||||
prefs_register_enum_preference(amr_module, "encoding.version",
|
||||
"Type of AMR encoding of the payload",
|
||||
|
@ -828,8 +834,9 @@ proto_register_amr(void)
|
|||
void
|
||||
proto_reg_handoff_amr(void)
|
||||
{
|
||||
static guint dynamic_payload_type;
|
||||
static gboolean amr_prefs_initialized = FALSE;
|
||||
static range_t *amr_dynamic_payload_types;
|
||||
static range_t *amr_wb_dynamic_payload_types;
|
||||
static gboolean amr_prefs_initialized = FALSE;
|
||||
|
||||
if (!amr_prefs_initialized) {
|
||||
dissector_handle_t amr_name_handle;
|
||||
|
@ -854,14 +861,18 @@ proto_reg_handoff_amr(void)
|
|||
*/
|
||||
amr_prefs_initialized = TRUE;
|
||||
} else {
|
||||
if ( dynamic_payload_type > 95 )
|
||||
dissector_delete_uint("rtp.pt", dynamic_payload_type, amr_handle);
|
||||
dissector_delete_uint_range("rtp.pt", amr_dynamic_payload_types, amr_handle);
|
||||
dissector_delete_uint_range("rtp.pt", amr_wb_dynamic_payload_types, amr_wb_handle);
|
||||
}
|
||||
|
||||
dynamic_payload_type = temp_dynamic_payload_type;
|
||||
amr_dynamic_payload_types = range_copy(wmem_epan_scope(), global_amr_dynamic_payload_types);
|
||||
amr_wb_dynamic_payload_types = range_copy(wmem_epan_scope(), global_amr_wb_dynamic_payload_types);
|
||||
|
||||
if ( dynamic_payload_type > 95 ) {
|
||||
dissector_add_uint("rtp.pt", dynamic_payload_type, amr_handle);
|
||||
if(!value_is_in_range(amr_dynamic_payload_types, 0)){
|
||||
dissector_add_uint_range("rtp.pt", amr_dynamic_payload_types, amr_handle);
|
||||
}
|
||||
if (!value_is_in_range(amr_wb_dynamic_payload_types, 0)) {
|
||||
dissector_add_uint_range("rtp.pt", amr_wb_dynamic_payload_types, amr_wb_handle);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue