GF_ODCom *gf_odf_create_command(u8 tag)
{
	GF_ODCom *com;
	switch (tag) {
	case GF_ODF_OD_UPDATE_TAG:
		return gf_odf_new_od_update();
	case GF_ODF_OD_REMOVE_TAG:
		return gf_odf_new_od_remove();
	case GF_ODF_ESD_UPDATE_TAG:
		return gf_odf_new_esd_update();
	case GF_ODF_ESD_REMOVE_TAG:
		return gf_odf_new_esd_remove();
	//special case for ESDRemove in the file format...
	case GF_ODF_ESD_REMOVE_REF_TAG:
		com = gf_odf_new_esd_remove();
		if (!com) return com;
		com->tag = GF_ODF_ESD_REMOVE_REF_TAG;
		return com;

#ifndef GPAC_MINIMAL_ODF
	case GF_ODF_IPMP_UPDATE_TAG:
		return gf_odf_new_ipmp_update();
	case GF_ODF_IPMP_REMOVE_TAG:
		return gf_odf_new_ipmp_remove();

	default:
		if ( (tag >= GF_ODF_COM_ISO_BEGIN_TAG) &&
		        ( tag <= GF_ODF_COM_ISO_END_TAG) ) {
			return NULL;
		}
		com = gf_odf_new_base_command();
		if (!com) return com;
		com->tag = tag;
		return com;
#else
	default:
		return NULL;
#endif
	}
}
GF_ODCom *gf_odf_create_command(u8 tag)
{
	GF_ODCom *com;
	switch (tag) {
	case GF_ODF_OD_UPDATE_TAG:
		return gf_odf_new_od_update();
	case GF_ODF_OD_REMOVE_TAG:
		return gf_odf_new_od_remove();
	case GF_ODF_ESD_UPDATE_TAG:
		return gf_odf_new_esd_update();
	case GF_ODF_ESD_REMOVE_TAG:
		return gf_odf_new_esd_remove();
	 
	case GF_ODF_ESD_REMOVE_REF_TAG:
		com = gf_odf_new_esd_remove();
		if (!com) return com;
		com->tag = GF_ODF_ESD_REMOVE_REF_TAG;
		return com;

#ifndef GPAC_MINIMAL_ODF
	case GF_ODF_IPMP_UPDATE_TAG:
		return gf_odf_new_ipmp_update();
	case GF_ODF_IPMP_REMOVE_TAG:
		return gf_odf_new_ipmp_remove();

	default:
		if ( (tag >= GF_ODF_COM_ISO_BEGIN_TAG) &&
		        ( tag <= GF_ODF_COM_ISO_END_TAG) ) {
			return NULL;
		}
		com = gf_odf_new_base_command();
		if (!com) return com;
		com->tag = tag;
		return com;
#else
	default:
		return NULL;
#endif
	}
}