g_return_val_if_fail (msg != NULL, GST_RTSP_EINVAL);
while (i < msg->hdr_fields->len) {
- RTSPKeyValue key_value = g_array_index (msg->hdr_fields, RTSPKeyValue, i);
+ RTSPKeyValue *key_value = &g_array_index (msg->hdr_fields, RTSPKeyValue, i);
- if (key_value.field == field && (indx == -1 || cnt++ == indx)) {
+ if (key_value->field == field && (indx == -1 || cnt++ == indx)) {
g_array_remove_index (msg->hdr_fields, i);
- g_free (key_value.value);
+ g_free (key_value->value);
res = GST_RTSP_OK;
if (indx != -1)
break;
* @value: pointer to hold the result
* @indx: the index of the header
*
- * Get the @indx header value with key @field from @msg.
+ * Get the @indx header value with key @field from @msg. The result in @value
+ * stays valid as long as it remains present in @msg.
*
* Returns: #GST_RTSP_OK when @field was found, #GST_RTSP_ENOTIMPL if the key
* was not found.
g_return_val_if_fail (msg != NULL, GST_RTSP_EINVAL);
+ /* no header initialized, there are no headers */
+ if (msg->hdr_fields == NULL)
+ return GST_RTSP_ENOTIMPL;
+
for (i = 0; i < msg->hdr_fields->len; i++) {
- RTSPKeyValue key_value = g_array_index (msg->hdr_fields, RTSPKeyValue, i);
+ RTSPKeyValue *key_value = &g_array_index (msg->hdr_fields, RTSPKeyValue, i);
- if (key_value.field == field && cnt++ == indx) {
+ if (key_value->field == field && cnt++ == indx) {
if (value)
- *value = key_value.value;
+ *value = key_value->value;
return GST_RTSP_OK;
}
}
g_return_val_if_fail (str != NULL, GST_RTSP_EINVAL);
for (i = 0; i < msg->hdr_fields->len; i++) {
- RTSPKeyValue key_value = g_array_index (msg->hdr_fields, RTSPKeyValue, i);
- const gchar *keystr = gst_rtsp_header_as_text (key_value.field);
+ RTSPKeyValue *key_value;
+ const gchar *keystr;
+
+ key_value = &g_array_index (msg->hdr_fields, RTSPKeyValue, i);
+ keystr = gst_rtsp_header_as_text (key_value->field);
- g_string_append_printf (str, "%s: %s\r\n", keystr, key_value.value);
+ g_string_append_printf (str, "%s: %s\r\n", keystr, key_value->value);
}
return GST_RTSP_OK;
}