static int camera_viewfinder(Camera camera, GPContext context, int onoff)
{
CameraWidget widget = NULL, child = NULL;
CameraWidgetType type;
int ret,val;
ret = gp_camera_get_config (camera, &widget, context);
if (ret < GP_OK) {
fprintf (stderr, "camera_get_config failed: %d\n", ret);
return ret;
}
ret = _lookup_widget2 (widget, "viewfinder", &child);
if (ret < GP_OK) {
fprintf (stderr, "lookup 'viewfinder' failed: %d\n", ret);
goto out;
}
/* check that this is a toggle */
ret = gp_widget_get_type (child, &type);
if (ret < GP_OK) {
fprintf (stderr, "widget get type failed: %d\n", ret);
goto out;
}
switch (type) {
case GP_WIDGET_TOGGLE:
break;
default:
fprintf (stderr, "widget has bad type %d\n", type);
ret = GP_ERROR_BAD_PARAMETERS;
goto out;
}
ret = gp_widget_get_value (child, &val);
if (ret < GP_OK) {
fprintf (stderr, "could not get widget value: %d\n", ret);
goto out;
}
val = onoff;
ret = gp_widget_set_value (child, &val);
if (ret < GP_OK) {
fprintf (stderr, "could not set widget value to 1: %d\n", ret);
goto out;
}
ret = gp_camera_set_config (camera, widget, context);
if (ret < GP_OK) {
fprintf (stderr, "could not set config tree to eosviewfinder: %d\n", ret);
goto out;
}
out:
gp_widget_free (widget);
return ret;
}
// init camera ....
/*
start use
Can I set the size of the live preview?
*/
while(true) {
int retval = gp_file_new(&file);
std::this_thread::sleep_for(std::chrono::milliseconds(7));//Device busy
if (retval != GP_OK) {
static int camera_viewfinder(Camera camera, GPContext context, int onoff) { CameraWidget widget = NULL, child = NULL; CameraWidgetType type; int ret,val;
}
// init camera ....
/*
Can I set the size of the live preview? */
while(true) {
int retval = gp_file_new(&file); std::this_thread::sleep_for(std::chrono::milliseconds(7));//Device busy if (retval != GP_OK) {
}
int retval = gp_camera_capture_preview(mCanon, file, mCanonContext);// success std::this_thread::sleep_for(std::chrono::milliseconds(2));//Device busy retval = gp_file_save(file, output_file.c_str());// jpg size is 960x640 }
problem: How can I set the camera's live preview size?
gphoto2 --list-config /main/actions/syncdatetimeutc
/main/actions/syncdatetime /main/actions/uilock /main/actions/autofocusdrive /main/actions/manualfocusdrive /main/actions/cancelautofocus /main/actions/eoszoom /main/actions/eoszoomposition /main/actions/viewfinder /main/actions/eosremoterelease /main/actions/opcode /main/settings/datetimeutc /main/settings/datetime /main/settings/reviewtime /main/settings/output /main/settings/movierecordtarget /main/settings/evfmode /main/settings/ownername /main/settings/artist /main/settings/copyright /main/settings/customfuncex /main/settings/focusinfo /main/settings/focusarea /main/settings/autopoweroff /main/settings/depthoffield /main/settings/capturetarget /main/settings/capture /main/status/serialnumber /main/status/manufacturer /main/status/cameramodel /main/status/deviceversion /main/status/vendorextension /main/status/model /main/status/ptpversion /main/status/Battery Level /main/status/batterylevel /main/status/lensname /main/status/eosserialnumber /main/status/shuttercounter /main/status/availableshots /main/imgsettings/imageformat /main/imgsettings/imageformatsd /main/imgsettings/imageformatcf /main/imgsettings/iso /main/imgsettings/whitebalance /main/imgsettings/colortemperature /main/imgsettings/whitebalanceadjusta /main/imgsettings/whitebalanceadjustb /main/imgsettings/whitebalancexa /main/imgsettings/whitebalancexb /main/imgsettings/colorspace /main/capturesettings/exposurecompensation /main/capturesettings/focusmode /main/capturesettings/aspectratio /main/capturesettings/storageid /main/capturesettings/autoexposuremode /main/capturesettings/drivemode /main/capturesettings/picturestyle /main/capturesettings/aperture /main/capturesettings/shutterspeed /main/capturesettings/bracketmode /main/capturesettings/aeb /main/other/d402 /main/other/d407 /main/other/d406 /main/other/d303 /main/other/5001