From 710ab3ac5026dac2d0c3c916b32d494b6580d2df Mon Sep 17 00:00:00 2001 From: Christoph Huber Date: Wed, 20 Mar 2024 11:38:50 +0100 Subject: [PATCH] sdp: add sdp media lattr apply function the same way as for rattr (#1089) --- include/re_sdp.h | 2 ++ src/sdp/media.c | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/include/re_sdp.h b/include/re_sdp.h index 8ad3ab774..c5a84044b 100644 --- a/include/re_sdp.h +++ b/include/re_sdp.h @@ -131,6 +131,8 @@ const char *sdp_media_rattr(const struct sdp_media *m, const char *name); const char *sdp_media_session_rattr(const struct sdp_media *m, const struct sdp_session *sess, const char *name); +const char *sdp_media_lattr_apply(const struct sdp_media *m, const char *name, + sdp_attr_h *attrh, void *arg); const char *sdp_media_rattr_apply(const struct sdp_media *m, const char *name, sdp_attr_h *attrh, void *arg); const char *sdp_media_name(const struct sdp_media *m); diff --git a/src/sdp/media.c b/src/sdp/media.c index 19ae3cc3c..7ac0182a4 100644 --- a/src/sdp/media.c +++ b/src/sdp/media.c @@ -911,6 +911,26 @@ const char *sdp_media_session_rattr(const struct sdp_media *m, } +/** + * Apply a function handler to all matching local attributes + * + * @param m SDP Media line + * @param name Attribute name + * @param attrh Attribute handler + * @param arg Handler argument + * + * @return Attribute value if match + */ +const char *sdp_media_lattr_apply(const struct sdp_media *m, const char *name, + sdp_attr_h *attrh, void *arg) +{ + if (!m) + return NULL; + + return sdp_attr_apply(&m->lattrl, name, attrh, arg); +} + + /** * Apply a function handler to all matching remote attributes *