GF_Err ISOR_DisconnectChannel(GF_InputService *plug, LPNETCHANNEL channel) { ISOMChannel *ch; GF_Err e; ISOMReader *read; if (!plug || !plug->priv) return GF_SERVICE_ERROR; read = (ISOMReader *) plug->priv; if (!read->mov) return GF_SERVICE_ERROR; gf_mx_p(read->segment_mutex); e = GF_OK; ch = isor_get_channel(read, channel); assert(ch); if (!ch) { e = GF_STREAM_NOT_FOUND; goto exit; } /*signal the service is broken but still process the delete*/ isor_delete_channel(read, ch); assert(!isor_get_channel(read, channel)); exit: if (read->input->query_proxy && read->input->proxy_udta && read->input->proxy_type) { send_proxy_command(read, 1, 0, e, NULL, channel); } else { gf_service_disconnect_ack(read->service, channel, e); } gf_mx_v(read->segment_mutex); return e; }
GF_Err ISOR_CloseService(GF_InputService *plug) { GF_Err reply; ISOMReader *read; if (!plug || !plug->priv) return GF_SERVICE_ERROR; read = (ISOMReader *) plug->priv; reply = GF_OK; read->disconnected = GF_TRUE; while (gf_list_count(read->channels)) { ISOMChannel *ch = (ISOMChannel *)gf_list_get(read->channels, 0); gf_list_rem(read->channels, 0); isor_delete_channel(read, ch); } if (read->dnload) gf_service_download_del(read->dnload); read->dnload = NULL; if (read->mov) gf_isom_close(read->mov); read->mov = NULL; if (read->input->query_proxy && read->input->proxy_udta && read->input->proxy_type) { send_proxy_command(read, GF_TRUE, GF_FALSE, reply, NULL, NULL); } else { gf_service_disconnect_ack(read->service, NULL, reply); } return GF_OK; }
GF_Err ISOR_CloseService(GF_InputService *plug) { GF_Err reply; ISOMReader *read; if (!plug || !plug->priv) return GF_SERVICE_ERROR; read = (ISOMReader *) plug->priv; reply = GF_OK; if (read->mov) gf_isom_close(read->mov); read->mov = NULL; while (gf_list_count(read->channels)) { ISOMChannel *ch = (ISOMChannel *)gf_list_get(read->channels, 0); gf_list_rem(read->channels, 0); isor_delete_channel(read, ch); } if (read->dnload) gf_term_download_del(read->dnload); read->dnload = NULL; gf_term_on_disconnect(read->service, NULL, reply); return GF_OK; }
GF_Err ISOR_DisconnectChannel(GF_InputService *plug, LPNETCHANNEL channel) { ISOMChannel *ch; GF_Err e; ISOMReader *read; if (!plug || !plug->priv) return GF_SERVICE_ERROR; read = (ISOMReader *) plug->priv; if (!read->mov) return GF_SERVICE_ERROR; e = GF_OK; ch = isor_get_channel(read, channel); assert(ch); if (!ch) { e = GF_STREAM_NOT_FOUND; goto exit; } /*signal the service is broken but still process the delete*/ isor_delete_channel(read, ch); assert(!isor_get_channel(read, channel)); exit: gf_term_on_disconnect(read->service, channel, e); return e; }