diff options
author | Wim Taymans <wim.taymans@collabora.co.uk> | 2013-07-12 17:06:37 +0200 |
---|---|---|
committer | Wim Taymans <wim.taymans@collabora.co.uk> | 2013-07-12 17:06:37 +0200 |
commit | c4db3025597af2d8315d80e6d33c8526cdd13607 (patch) | |
tree | f4ee5dae5019915fb84bce8c9547d6b96704af5e | |
parent | b8c5aa3a6bf8d7287770b3dfb5094b7fa63acdc6 (diff) |
token: add method to check boolean permission
-rw-r--r-- | gst/rtsp-server/rtsp-token.c | 21 | ||||
-rw-r--r-- | gst/rtsp-server/rtsp-token.h | 2 |
2 files changed, 23 insertions, 0 deletions
diff --git a/gst/rtsp-server/rtsp-token.c b/gst/rtsp-server/rtsp-token.c index 2c228f7..b252ff5 100644 --- a/gst/rtsp-server/rtsp-token.c +++ b/gst/rtsp-server/rtsp-token.c @@ -205,3 +205,24 @@ gst_rtsp_token_get_string (GstRTSPToken * token, const gchar * field) { return gst_structure_get_string (GST_RTSP_TOKEN_STRUCTURE (token), field); } + +/** + * gst_rtsp_token_is_allowed: + * @token: a #GstRTSPToken + * @field: a field name + * + * Check if @token has a boolean @field and if it is set to %TRUE. + * + * Returns: %TRUE if @token has a boolean field named @field set to %TRUE. + */ +gboolean +gst_rtsp_token_is_allowed (GstRTSPToken * token, const gchar * field) +{ + gboolean result; + + if (!gst_structure_get_boolean (GST_RTSP_TOKEN_STRUCTURE (token), field, + &result)) + result = FALSE; + + return result; +} diff --git a/gst/rtsp-server/rtsp-token.h b/gst/rtsp-server/rtsp-token.h index fa6a888..b7c06c4 100644 --- a/gst/rtsp-server/rtsp-token.h +++ b/gst/rtsp-server/rtsp-token.h @@ -90,6 +90,8 @@ GstStructure * gst_rtsp_token_writable_structure (GstRTSPToken *token); const gchar * gst_rtsp_token_get_string (GstRTSPToken *token, const gchar *field); +gboolean gst_rtsp_token_is_allowed (GstRTSPToken *token, + const gchar *field); G_END_DECLS #endif /* __GST_RTSP_TOKEN_H__ */ |