Browse Source

rtmp-services: Add get_int_val hepler function

This is just for accessing a json object.  I should be using obs_data_t
for this instead of json directly, but it doesn't really matter.
jp9000 10 years ago
parent
commit
d08701338f
1 changed files with 9 additions and 0 deletions
  1. 9 0
      plugins/rtmp-services/rtmp-common.c

+ 9 - 0
plugins/rtmp-services/rtmp-common.c

@@ -54,6 +54,15 @@ static inline const char *get_string_val(json_t *service, const char *key)
 	return json_string_value(str_val);
 }
 
+static inline int get_int_val(json_t *service, const char *key)
+{
+	json_t *integer_val = json_object_get(service, key);
+	if (!integer_val || !json_is_integer(integer_val))
+		return 0;
+
+	return (int)json_integer_value(integer_val);
+}
+
 static inline bool get_bool_val(json_t *service, const char *key)
 {
 	json_t *bool_val = json_object_get(service, key);