void RP_FetchSDP(NetClientPlugin *plug, char *url, RTPStream *stream) { M4Err e; SDPFetch *sdp; RTPClient *rtp = (RTPClient *) plug->priv; /*if local URL get file*/ if (strstr(url, "data:application/sdp")) { RP_SDPFromData(rtp, url, stream); return; } if (!strnicmp(url, "file://", 7) || !strstr(url, "://")) { RP_SDPFromFile(rtp, url, stream); return; } sdp = malloc(sizeof(SDPFetch)); memset(sdp, 0, sizeof(SDPFetch)); sdp->client = rtp; sdp->remote_url = strdup(url); sdp->chan = stream; /*otherwise setup download*/ if (rtp->dnload) NM_CloseDownloader(rtp->dnload); rtp->dnload = NULL; rtp->sdp_temp = sdp; e = NM_FetchFile(rtp->service, url, 0, SDP_OnStatus, SDP_OnData, rtp, &rtp->dnload); if (e) NM_OnConnect(rtp->service, NULL, e); /*service confirm is done once fetched*/ }
void RP_FetchSDP(RTPClient *rtp, char *url, RTPStream *stream, char *original_url) { SDPFetch *sdp; /*if local URL get file*/ if (strstr(url, "data:application/sdp")) { RP_SDPFromData(rtp, url, stream); return; } if (!strnicmp(url, "file://", 7) || !strstr(url, "://")) { RP_SDPFromFile(rtp, url, stream); return; } sdp = (SDPFetch*)gf_malloc(sizeof(SDPFetch)); memset(sdp, 0, sizeof(SDPFetch)); sdp->client = rtp; sdp->remote_url = gf_strdup(url); sdp->chan = stream; if (original_url) { sdp->original_url = gf_strdup(original_url); } /*otherwise setup download*/ if (rtp->dnload) gf_service_download_del(rtp->dnload); rtp->dnload = NULL; rtp->sdp_temp = sdp; rtp->dnload = gf_service_download_new(rtp->service, url, 0, SDP_NetIO, rtp); if (!rtp->dnload) { gf_service_connect_ack(rtp->service, NULL, GF_NOT_SUPPORTED); } else { /*start our download (threaded)*/ gf_dm_sess_process(rtp->dnload); } /*service confirm is done once fetched*/ }