From: <mar...@us...> - 2013-10-10 14:56:19
|
Revision: 14564 http://sourceforge.net/p/gphoto/code/14564 Author: marcusmeissner Date: 2013-10-10 14:56:15 +0000 (Thu, 10 Oct 2013) Log Message: ----------- movierecord decoding Modified Paths: -------------- trunk/libgphoto2/camlibs/ptp2/config.c Modified: trunk/libgphoto2/camlibs/ptp2/config.c =================================================================== --- trunk/libgphoto2/camlibs/ptp2/config.c 2013-10-10 14:36:04 UTC (rev 14563) +++ trunk/libgphoto2/camlibs/ptp2/config.c 2013-10-10 14:56:15 UTC (rev 14564) @@ -1960,6 +1960,7 @@ static int _get_Canon_EOS_EVFRecordTarget(CONFIG_GET_ARGS) { char buf[20]; + int inlist = 0; /* if (!(dpd->FormFlag & PTP_DPFF_Enumeration)) return (GP_ERROR); @@ -1967,10 +1968,38 @@ if (dpd->DataType != PTP_DTC_UINT32) return (GP_ERROR); - gp_widget_new (GP_WIDGET_TEXT, _(menu->label), widget); + gp_widget_new (GP_WIDGET_RADIO, _(menu->label), widget); gp_widget_set_name (*widget, menu->name); - sprintf(buf,"%d",dpd->CurrentValue.u32); - gp_widget_set_value (*widget,buf); + + if (dpd->FormFlag & PTP_DPFF_Enumeration) { + int i; + + for (i = 0; i<dpd->FORM.Enum.NumberOfValues; i++) { + switch (dpd->FORM.Enum.SupportedValue[i].u32) { + case 0: gp_widget_add_choice (*widget, _("None")); + if (dpd->CurrentValue.u32 == 0) { + gp_widget_set_value (*widget,_("None")); + inlist = 1; + } + break; + case 4: gp_widget_add_choice (*widget, _("Card")); + if (dpd->CurrentValue.u32 == 4) { + gp_widget_set_value (*widget,_("Card")); + inlist = 1; + } + break; + default: + sprintf (buf, _("Unknown %d"), dpd->FORM.Enum.SupportedValue[i].u32); + gp_widget_add_choice (*widget, buf); + break; + } + } + } + if (!inlist) { + sprintf(buf,_("Unknown %d"),dpd->CurrentValue.u32); + gp_widget_add_choice (*widget, buf); + gp_widget_set_value (*widget,buf); + } return GP_OK; } @@ -1982,7 +2011,15 @@ ret = gp_widget_get_value (widget, &value); if (ret != GP_OK) return ret; - if (!sscanf(value, "%d", &i)) + if (!strcmp(value,_("Card"))) { + propval->u32 = 4; + return GP_OK; + } + if (!strcmp(value,_("None"))) { + propval->u32 = 0; + return GP_OK; + } + if (!sscanf(value, _("Unknown %d"), &i)) return GP_ERROR; propval->u32 = i; return GP_OK; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |