GF_Err gf_odf_delete_descriptor(GF_Descriptor *desc)
{
	switch (desc->tag) {
	case GF_ODF_IOD_TAG :
		return gf_odf_del_iod((GF_InitialObjectDescriptor *)desc);
	case GF_ODF_OD_TAG:
		return gf_odf_del_od((GF_ObjectDescriptor *)desc);
	case GF_ODF_ESD_TAG :
		return gf_odf_del_esd((GF_ESD *)desc);
	case GF_ODF_DCD_TAG :
		return gf_odf_del_dcd((GF_DecoderConfig *)desc);
	case GF_ODF_SLC_TAG:
		return gf_odf_del_slc((GF_SLConfig *)desc);

	case GF_ODF_ISOM_IOD_TAG:
		return gf_odf_del_isom_iod((GF_IsomInitialObjectDescriptor *)desc);
	case GF_ODF_ISOM_OD_TAG:
		return gf_odf_del_isom_od((GF_IsomObjectDescriptor *)desc);

	case GF_ODF_SEGMENT_TAG:
		return gf_odf_del_segment((GF_Segment *) desc);

	case GF_ODF_MUXINFO_TAG:
		return gf_odf_del_muxinfo((GF_MuxInfo *)desc);
	case GF_ODF_BIFS_CFG_TAG:
		return gf_odf_del_bifs_cfg((GF_BIFSConfig *)desc);
	case GF_ODF_UI_CFG_TAG:
		return gf_odf_del_ui_cfg((GF_UIConfig *)desc);
	case GF_ODF_TEXT_CFG_TAG:
		return gf_odf_del_text_cfg((GF_TextConfig *)desc);
	case GF_ODF_TX3G_TAG:
		return gf_odf_del_tx3g((GF_TextSampleDescriptor*)desc);
	case GF_ODF_ELEM_MASK_TAG:
		return gf_odf_del_ElemMask((GF_ElementaryMask*)desc);
	case GF_ODF_LASER_CFG_TAG:
		return gf_odf_del_laser_cfg((GF_LASERConfig *)desc);

	case GF_ODF_AUX_VIDEO_DATA:
		return gf_odf_del_auxvid((GF_AuxVideoDescriptor *)desc);

	case GF_ODF_LANG_TAG:
	case GF_ODF_GPAC_LANG:
		return gf_odf_del_lang((GF_Language *)desc);

	case GF_ODF_ESD_INC_TAG:
		return gf_odf_del_esd_inc((GF_ES_ID_Inc *)desc);
	case GF_ODF_ESD_REF_TAG:
		return gf_odf_del_esd_ref((GF_ES_ID_Ref *)desc);

#ifndef GPAC_MINIMAL_ODF
	case GF_ODF_MEDIATIME_TAG:
		return gf_odf_del_mediatime((GF_MediaTime *) desc);
	case GF_ODF_CC_TAG:
		return gf_odf_del_cc((GF_CCDescriptor *)desc);
	case GF_ODF_CC_DATE_TAG:
		return gf_odf_del_cc_date((GF_CC_Date *)desc);
	case GF_ODF_CC_NAME_TAG:
		return gf_odf_del_cc_name((GF_CC_Name *)desc);
	case GF_ODF_CI_TAG:
		return gf_odf_del_ci((GF_CIDesc *)desc);
	case GF_ODF_TEXT_TAG:
		return gf_odf_del_exp_text((GF_ExpandedTextual *)desc);
	case GF_ODF_EXT_PL_TAG:
		return gf_odf_del_pl_ext((GF_PLExt *)desc);
	case GF_ODF_IPI_PTR_TAG:
	case GF_ODF_ISOM_IPI_PTR_TAG:
		return gf_odf_del_ipi_ptr((GF_IPIPtr *)desc);
	case GF_ODF_IPMP_TAG:
		return gf_odf_del_ipmp((GF_IPMP_Descriptor *)desc);
	case GF_ODF_IPMP_PTR_TAG:
		return gf_odf_del_ipmp_ptr((GF_IPMPPtr *)desc);
	case GF_ODF_KW_TAG:
		return gf_odf_del_kw((GF_KeyWord *)desc);
	case GF_ODF_OCI_DATE_TAG:
		return gf_odf_del_oci_date((GF_OCI_Data *)desc);
	case GF_ODF_OCI_NAME_TAG:
		return gf_odf_del_oci_name((GF_OCICreators *)desc);
	case GF_ODF_PL_IDX_TAG:
		return gf_odf_del_pl_idx((GF_PL_IDX *)desc);
	case GF_ODF_QOS_TAG:
		return gf_odf_del_qos((GF_QoS_Descriptor *)desc);
	case GF_ODF_RATING_TAG:
		return gf_odf_del_rating((GF_Rating *)desc);
	case GF_ODF_REG_TAG:
		return gf_odf_del_reg((GF_Registration *)desc);
	case GF_ODF_SHORT_TEXT_TAG:
		return gf_odf_del_short_text((GF_ShortTextual *)desc);
	case GF_ODF_SMPTE_TAG:
		return gf_odf_del_smpte_camera((GF_SMPTECamera *)desc);
	case GF_ODF_SCI_TAG:
		return gf_odf_del_sup_cid((GF_SCIDesc *)desc);

	case GF_ODF_IPMP_TL_TAG:
		return gf_odf_del_ipmp_tool_list((GF_IPMP_ToolList *)desc);
	case GF_ODF_IPMP_TOOL_TAG:
		return gf_odf_del_ipmp_tool((GF_IPMP_Tool *)desc);

#endif /*GPAC_MINIMAL_ODF*/

	default:
		return gf_odf_del_default((GF_DefaultDescriptor *)desc);
	}
	return GF_OK;
}
GF_Err gf_odf_delete_descriptor(GF_Descriptor *desc)
{
	switch (desc->tag) {
	case GF_ODF_IOD_TAG :
		return gf_odf_del_iod((GF_InitialObjectDescriptor *)desc);
	case GF_ODF_OD_TAG:
		return gf_odf_del_od((GF_ObjectDescriptor *)desc);
	case GF_ODF_ESD_TAG :
		return gf_odf_del_esd((GF_ESD *)desc);
	case GF_ODF_DCD_TAG :
		return gf_odf_del_dcd((GF_DecoderConfig *)desc);
	case GF_ODF_SLC_TAG:
		return gf_odf_del_slc((GF_SLConfig *)desc);

	case GF_ODF_ISOM_IOD_TAG:
		return gf_odf_del_isom_iod((GF_IsomInitialObjectDescriptor *)desc);
	case GF_ODF_ISOM_OD_TAG:
		return gf_odf_del_isom_od((GF_IsomObjectDescriptor *)desc);

	case GF_ODF_SEGMENT_TAG:
		return gf_odf_del_segment((GF_Segment *) desc);

	case GF_ODF_MUXINFO_TAG:
		return gf_odf_del_muxinfo((GF_MuxInfo *)desc);
	case GF_ODF_BIFS_CFG_TAG:
		return gf_odf_del_bifs_cfg((GF_BIFSConfig *)desc);
	case GF_ODF_UI_CFG_TAG:
		return gf_odf_del_ui_cfg((GF_UIConfig *)desc);
	case GF_ODF_TEXT_CFG_TAG:
		return gf_odf_del_text_cfg((GF_TextConfig *)desc);
	case GF_ODF_TX3G_TAG:
		return gf_odf_del_tx3g((GF_TextSampleDescriptor*)desc);
	case GF_ODF_ELEM_MASK_TAG:
		return gf_odf_del_ElemMask((GF_ElementaryMask*)desc);
	case GF_ODF_LASER_CFG_TAG:
		return gf_odf_del_laser_cfg((GF_LASERConfig *)desc);

	case GF_ODF_AUX_VIDEO_DATA:
		return gf_odf_del_auxvid((GF_AuxVideoDescriptor *)desc);

	case GF_ODF_LANG_TAG:
	case GF_ODF_GPAC_LANG:
		return gf_odf_del_lang((GF_Language *)desc);

	case GF_ODF_ESD_INC_TAG:
		return gf_odf_del_esd_inc((GF_ES_ID_Inc *)desc);
	case GF_ODF_ESD_REF_TAG:
		return gf_odf_del_esd_ref((GF_ES_ID_Ref *)desc);

#ifndef GPAC_MINIMAL_ODF
	case GF_ODF_MEDIATIME_TAG:
		return gf_odf_del_mediatime((GF_MediaTime *) desc);
	case GF_ODF_CC_TAG:
		return gf_odf_del_cc((GF_CCDescriptor *)desc);
	case GF_ODF_CC_DATE_TAG:
		return gf_odf_del_cc_date((GF_CC_Date *)desc);
	case GF_ODF_CC_NAME_TAG:
		return gf_odf_del_cc_name((GF_CC_Name *)desc);
	case GF_ODF_CI_TAG:
		return gf_odf_del_ci((GF_CIDesc *)desc);
	case GF_ODF_TEXT_TAG:
		return gf_odf_del_exp_text((GF_ExpandedTextual *)desc);
	case GF_ODF_EXT_PL_TAG:
		return gf_odf_del_pl_ext((GF_PLExt *)desc);
	case GF_ODF_IPI_PTR_TAG:
	case GF_ODF_ISOM_IPI_PTR_TAG:
		return gf_odf_del_ipi_ptr((GF_IPIPtr *)desc);
	case GF_ODF_IPMP_TAG:
		return gf_odf_del_ipmp((GF_IPMP_Descriptor *)desc);
	case GF_ODF_IPMP_PTR_TAG:
		return gf_odf_del_ipmp_ptr((GF_IPMPPtr *)desc);
	case GF_ODF_KW_TAG:
		return gf_odf_del_kw((GF_KeyWord *)desc);
	case GF_ODF_OCI_DATE_TAG:
		return gf_odf_del_oci_date((GF_OCI_Data *)desc);
	case GF_ODF_OCI_NAME_TAG:
		return gf_odf_del_oci_name((GF_OCICreators *)desc);
	case GF_ODF_PL_IDX_TAG:
		return gf_odf_del_pl_idx((GF_PL_IDX *)desc);
	case GF_ODF_QOS_TAG:
		return gf_odf_del_qos((GF_QoS_Descriptor *)desc);
	case GF_ODF_RATING_TAG:
		return gf_odf_del_rating((GF_Rating *)desc);
	case GF_ODF_REG_TAG:
		return gf_odf_del_reg((GF_Registration *)desc);
	case GF_ODF_SHORT_TEXT_TAG:
		return gf_odf_del_short_text((GF_ShortTextual *)desc);
	case GF_ODF_SMPTE_TAG:
		return gf_odf_del_smpte_camera((GF_SMPTECamera *)desc);
	case GF_ODF_SCI_TAG:
		return gf_odf_del_sup_cid((GF_SCIDesc *)desc);

	case GF_ODF_IPMP_TL_TAG:
		return gf_odf_del_ipmp_tool_list((GF_IPMP_ToolList *)desc);
	case GF_ODF_IPMP_TOOL_TAG:
		return gf_odf_del_ipmp_tool((GF_IPMP_Tool *)desc);

#endif  

	default:
		return gf_odf_del_default((GF_DefaultDescriptor *)desc);
	}
	return GF_OK;
}