aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-rtp.c
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2016-12-05 23:00:33 +0100
committerAnders Broman <a.broman58@gmail.com>2016-12-06 08:59:56 +0000
commit104b9fe5afc1f7aac1df263dd8e9af1fd1cb449f (patch)
tree6f1f97924a8bfac01209491702c435e4616e58cb /epan/dissectors/packet-rtp.c
parent89bc07c5d59ead31cad3ab5eea4378b6bb60bce9 (diff)
rtp: add function to duplicate rtp_dyn_payload_t
There is no way to iterate through the contents. For a future patch to the SDP dissector (where the session-level info is copied to the media-level), it would be nice to duplicate the dynamic payload info. Change-Id: I79b8349e5e157298a28fc608e20c2c2e03e76400 Reviewed-on: https://code.wireshark.org/review/19106 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-rtp.c')
-rw-r--r--epan/dissectors/packet-rtp.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/epan/dissectors/packet-rtp.c b/epan/dissectors/packet-rtp.c
index ab01da6cde..2efc2deed4 100644
--- a/epan/dissectors/packet-rtp.c
+++ b/epan/dissectors/packet-rtp.c
@@ -1006,6 +1006,27 @@ rtp_dyn_payload_t* rtp_dyn_payload_new(void)
return rtp_dyn_payload;
}
+/* Creates a copy of the given dynamic payload information. */
+rtp_dyn_payload_t* rtp_dyn_payload_dup(rtp_dyn_payload_t *rtp_dyn_payload)
+{
+ rtp_dyn_payload_t *rtp_dyn_payload2 = rtp_dyn_payload_new();
+ GHashTableIter iter;
+ gpointer key, value;
+
+ g_hash_table_iter_init(&iter, rtp_dyn_payload->table);
+ while (g_hash_table_iter_next(&iter, &key, &value)) {
+ const guint pt = GPOINTER_TO_UINT(key);
+ encoding_name_and_rate_t *encoding_name_and_rate_pt =
+ (encoding_name_and_rate_t *)value;
+
+ rtp_dyn_payload_insert(rtp_dyn_payload2, pt,
+ encoding_name_and_rate_pt->encoding_name,
+ encoding_name_and_rate_pt->sample_rate);
+ }
+
+ return rtp_dyn_payload2;
+}
+
static rtp_dyn_payload_t*
rtp_dyn_payload_ref(rtp_dyn_payload_t *rtp_dyn_payload)
{