static void create_media_offers (SdpHandler * sdp_handler, struct SdpOfferData *data) { SdpMediaConfig *m_conf; GstSDPMedia *media; GError *err = NULL; GSList *l; media = kms_sdp_media_handler_create_offer (sdp_handler->handler, sdp_handler->media, &err); if (err != NULL) { GST_ERROR_OBJECT (sdp_handler->handler, "%s", err->message); g_error_free (err); return; } m_conf = kms_sdp_message_context_add_media (data->ctx, media, &err); if (m_conf == NULL) { GST_ERROR_OBJECT (sdp_handler->handler, "%s", err->message); g_error_free (err); return; } for (l = data->agent->priv->groups; l != NULL; l = l->next) { SdpHandlerGroup *group = l->data; GSList *ll; for (ll = group->handlers; ll != NULL; ll = ll->next) { SdpHandler *h = ll->data; SdpMediaGroup *m_group; if (sdp_handler->id != h->id) { continue; } m_group = kms_sdp_message_context_get_group (data->ctx, group->id); if (m_group == NULL) { m_group = kms_sdp_message_context_create_group (data->ctx, group->id); } if (!kms_sdp_message_context_add_media_to_group (m_group, m_conf, &err)) { GST_ERROR_OBJECT (sdp_handler->handler, "%s", err->message); g_error_free (err); return; } } } if (data->agent->priv->configure_media_callback_data != NULL) { data->agent->priv->configure_media_callback_data->callback (data->agent, m_conf, data->agent->priv->configure_media_callback_data->user_data); } }
gboolean kms_sdp_message_context_parse_groups_from_offer (SdpMessageContext * ctx, const GstSDPMessage * offer, GError ** error) { guint i, gid = 0; for (i = 0;; i++) { SdpMediaGroup *mgroup; gboolean is_bundle; const gchar *val; gchar **grp; guint j; val = gst_sdp_message_get_attribute_val_n (offer, "group", i); if (val == NULL) { return TRUE; } grp = g_strsplit (val, " ", 0); is_bundle = g_strcmp0 (grp[0] /* group type */ , "BUNDLE") == 0; if (!is_bundle) { GST_WARNING ("Group '%s' is not supported", grp[0]); g_strfreev (grp); continue; } mgroup = kms_sdp_message_context_create_group (ctx, gid++); for (j = 1; grp[j] != NULL; j++) { SdpMediaConfig *mconf; mconf = kms_sdp_context_new_media_config (g_slist_length (ctx->medias), g_strdup (grp[j]), NULL); ctx->medias = g_slist_append (ctx->medias, mconf); if (!kms_sdp_message_context_add_media_to_group (mgroup, mconf, error)) { g_strfreev (grp); return FALSE; } } g_strfreev (grp); } }