Files
libgphoto2/examples/sample-justfocus.c
axxel f41df32817 fix white-space and indentation inconsistencies (second round)
This is basically a continuation of the work from #1002 but her for the
camlibs directory. The purpose was to replace spaces as a means for
indentation with tab characters.

Note: there are some files which are still offending the general
rule but are (mostly) consistent within themselves. I let them be for
the moment. Fixing them would basically replace the whole file.

Also: there are still a ton of whitespace related inconsistencies like
"x=10" vs "x = 10" or "func(10)" vs "func (10)".

This is a whitespace only change (if you include newlines as whitespace).
2024-09-15 10:53:41 +02:00

72 lines
1.6 KiB
C

#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <gphoto2/gphoto2.h>
#include "samples.h"
int main(int argc, char *argv[]){
Camera *camera;
GPContext *context = gp_context_new();
int retval;
CameraEventType evttype;
void *evtdata;
CameraFile *file;
gp_camera_new(&camera);
retval = gp_camera_init(camera, context);
if (retval != GP_OK)
{
printf("Error: %s\n", gp_result_as_string(retval));
return 1;
}
do {
retval = gp_camera_wait_for_event (camera, 10, &evttype, &evtdata, context);
} while ((retval == GP_OK) && (evttype != GP_EVENT_TIMEOUT));
retval = gp_file_new(&file);
if (retval != GP_OK) {
printf("gp_file_new: %d\n", retval);
return 1;
}
/*retval = gp_camera_capture_preview(camera, file, context); */
if (retval != GP_OK) {
printf("gp_camera_capture_preview: %d\n", retval);
return 1;
}
gp_file_free (file);
if (argc == 1)
{
retval = camera_auto_focus(camera, context, 1);
if(retval != GP_OK) {
printf("Error: %s\n", gp_result_as_string(retval));
return 1;
}
} else if (argc == 2) {
int value = atoi(argv[1]);
retval = camera_manual_focus(camera, value, context);
if (retval != GP_OK) {
printf("Error: %s\n", gp_result_as_string(retval));
return 1;
}
}
do {
retval = gp_camera_wait_for_event (camera, 10, &evttype, &evtdata, context);
} while ((retval == GP_OK) && (evttype != GP_EVENT_TIMEOUT));
retval = camera_auto_focus(camera, context, 0);
if(retval != GP_OK) {
printf("Error: %s\n", gp_result_as_string(retval));
return 1;
}
gp_camera_exit(camera, context);
return 0;
}