static M4Err AAC_ConnectService(NetClientPlugin *plug, LPNETSERVICE serv, const char *url) { char szURL[2048]; char *ext; M4Err reply; AACReader *read = plug->priv; read->service = serv; if (read->dnload) NM_CloseDownloader(read->dnload); read->dnload = NULL; strcpy(szURL, url); ext = strrchr(szURL, '#'); if (ext) ext[0] = 0; /*remote fetch*/ read->is_remote = !aac_is_local(szURL); if (read->is_remote) { aac_download_file(plug, (char *) szURL); return M4OK; } reply = M4OK; read->stream = fopen(szURL, "rb"); if (!read->stream) { reply = M4URLNotFound; } else if (!AAC_ConfigureFromFile(read)) { fclose(read->stream); read->stream = NULL; reply = M4UnsupportedURL; } NM_OnConnect(serv, NULL, reply); return M4OK; }
static GF_Err AAC_ConnectService(GF_InputService *plug, GF_ClientService *serv, const char *url) { char szURL[2048]; char *ext; GF_Err reply; AACReader *read = plug->priv; read->service = serv; if (read->dnload) gf_term_download_del(read->dnload); read->dnload = NULL; strcpy(szURL, url); ext = strrchr(szURL, '#'); if (ext) ext[0] = 0; /*remote fetch*/ read->is_remote = !aac_is_local(szURL); if (read->is_remote) { aac_download_file(plug, (char *) szURL); return GF_OK; } reply = GF_OK; read->stream = fopen(szURL, "rb"); if (!read->stream) { reply = GF_URL_ERROR; } else if (!AAC_ConfigureFromFile(read)) { fclose(read->stream); read->stream = NULL; reply = GF_NOT_SUPPORTED; } gf_term_on_connect(serv, NULL, reply); if (!reply && read->is_inline ) AAC_SetupObject(read); return GF_OK; }