double arv_camera_get_frame_rate (ArvCamera *camera) { ArvGcNode *feature; g_return_val_if_fail (ARV_IS_CAMERA (camera), -1.0); switch (camera->priv->vendor) { case ARV_CAMERA_VENDOR_BASLER: case ARV_CAMERA_VENDOR_PROSILICA: return arv_device_get_float_feature_value (camera->priv->device, "AcquisitionFrameRateAbs"); case ARV_CAMERA_VENDOR_TIS: feature = arv_device_get_feature (camera->priv->device, "FPS"); if (ARV_IS_GC_FEATURE_NODE (feature) && g_strcmp0 (arv_dom_node_get_node_name (ARV_DOM_NODE (feature)), "Enumeration") == 0) { gint64 i; i = arv_gc_enumeration_get_int_value (ARV_GC_ENUMERATION (feature), NULL); if (i > 0) return (int)((10000000/(double) i) * 100 + 0.5) / 100.0; else return 0; } else return arv_device_get_float_feature_value (camera->priv->device, "FPS"); case ARV_CAMERA_VENDOR_DALSA: case ARV_CAMERA_VENDOR_UNKNOWN: return arv_device_get_float_feature_value (camera->priv->device, camera->priv->use_acquisition_frame_rate_abs ? "AcquisitionFrameRateAbs": "AcquisitionFrameRate"); } return -1.0; }
static gint64 arv_gc_enumeration_get_integer_value (ArvGcInteger *gc_integer, GError **error) { ArvGcEnumeration *gc_enumeration = ARV_GC_ENUMERATION (gc_integer); return arv_gc_enumeration_get_int_value (gc_enumeration, error); }
const char * arv_gc_enumeration_get_string_value (ArvGcEnumeration *enumeration) { const GSList *iter; gint64 value; g_return_val_if_fail (ARV_IS_GC_ENUMERATION (enumeration), NULL); value = arv_gc_enumeration_get_int_value (enumeration); for (iter = enumeration->entries; iter != NULL; iter = iter->next) { if (arv_gc_enum_entry_get_value (iter->data) == value) { const char *string; string = arv_gc_feature_node_get_name (iter->data); arv_log_genicam ("[GcEnumeration::get_string_value] value = %Ld - string = %s", value, string); return string; } } arv_warning_genicam ("[GcEnumeration::get_string_value] value = %Ld not found for node %s", value, arv_gc_feature_node_get_name (ARV_GC_FEATURE_NODE (enumeration))); return NULL; }
const char * arv_gc_enumeration_get_string_value (ArvGcEnumeration *enumeration, GError **error) { const GSList *iter; GError *local_error = NULL; gint64 value; g_return_val_if_fail (ARV_IS_GC_ENUMERATION (enumeration), NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL); value = arv_gc_enumeration_get_int_value (enumeration, &local_error); if (local_error != NULL) { g_propagate_error (error, local_error); return NULL; } for (iter = enumeration->entries; iter != NULL; iter = iter->next) { gint64 enum_value; enum_value = arv_gc_enum_entry_get_value (iter->data, &local_error); if (local_error != NULL) { g_propagate_error (error, local_error); return NULL; } if (enum_value == value) { const char *string; string = arv_gc_feature_node_get_name (iter->data); arv_log_genicam ("[GcEnumeration::get_string_value] value = %Ld - string = %s", value, string); return string; } } arv_warning_genicam ("[GcEnumeration::get_string_value] value = %Ld not found for node %s", value, arv_gc_feature_node_get_name (ARV_GC_FEATURE_NODE (enumeration))); return NULL; }