~ubuntu-branches/ubuntu/saucy/libgphoto2/saucy-proposed

« back to all changes in this revision

Viewing changes to examples/preview.c

  • Committer: Package Import Robot
  • Author(s): Martin Pitt
  • Date: 2013-07-31 07:00:09 UTC
  • mfrom: (1.4.4)
  • Revision ID: package-import@ubuntu.com-20130731070009-enrbvg3hry64cxl1
Tags: 2.5.2-0ubuntu1
* New upstream release.
* Drop 01-increase_max_entries.patch, 02-libusbx_no_debug.patch,
  03-libusbx-fixes.patch: fixed upstream.
* Add libxml2-dev build dependency for new optional features.
* ABI changes: libgphoto2-2 → libgphoto2-6,
  libgphoto2-port0 → libgphoto2-port10
* debian/libgphoto2-dev-doc.install: Adjust to changed HTML API doc folder
  name.
* debian/libgphoto2-port10.install: Adjust for changed libgphoto-port ABI.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
#include "samples.h"
24
24
 
25
 
static void errordumper(GPLogLevel level, const char *domain, const char *format,
26
 
                 va_list args, void *data) {
27
 
  vfprintf(stdout, format, args);
28
 
  fprintf(stdout, "\n");
 
25
static void errordumper(GPLogLevel level, const char *domain, const char *str,
 
26
                 void *data) {
 
27
  printf("%s\n", str);
29
28
}
30
29
 
31
30
/* This seems to have no effect on where images go
139
138
        canon_enable_capture(canon, TRUE, canoncontext);
140
139
        /*set_capturetarget(canon, canoncontext);*/
141
140
        printf("Taking 100 previews and saving them to snapshot-XXX.jpg ...\n");
142
 
        for (i=0;i<99;i++) {
 
141
        for (i=0;i<100;i++) {
143
142
                CameraFile *file;
144
143
                char output_file[32];
145
144
 
149
148
                        fprintf(stderr,"gp_file_new: %d\n", retval);
150
149
                        exit(1);
151
150
                }
 
151
 
 
152
                /* autofocus every 10 shots */
 
153
                if (i%10 == 9) {
 
154
                        camera_auto_focus (canon, canoncontext);
 
155
                } else {
 
156
                        camera_manual_focus (canon, (i/10-5)/2, canoncontext);
 
157
                }
 
158
#if 0 /* testcase for EOS zooming */
 
159
                {
 
160
                        char buf[20];
 
161
                        if (i<10) set_config_value_string (canon, "eoszoom", "5", canoncontext);
 
162
                        sprintf(buf,"%d,%d",(i&0x1f)*64,(i>>5)*64);
 
163
                        fprintf(stderr, "%d - %s\n", i, buf);
 
164
                        set_config_value_string (canon, "eoszoomposition", buf, canoncontext);
 
165
                }
 
166
#endif
152
167
                retval = gp_camera_capture_preview(canon, file, canoncontext);
153
168
                if (retval != GP_OK) {
154
169
                        fprintf(stderr,"gp_camera_capture_preview(%d): %d\n", i, retval);
161
176
                        exit(1);
162
177
                }
163
178
                gp_file_unref(file);
164
 
/* if you want to capture right afterwards 
 
179
        /*
165
180
                sprintf(output_file, "image-%03d.jpg", i);
166
181
                capture_to_file(canon, canoncontext, output_file);
167
 
*/
 
182
        */
168
183
        }
169
184
        gp_camera_exit(canon, canoncontext);
170
185
        return 0;