diff options
author | Matthias Vogelgesang <matthias.vogelgesang@gmail.com> | 2013-05-13 10:07:44 +0200 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@gmail.com> | 2013-05-13 10:07:44 +0200 |
commit | deed5778e82c6833d804730a514b93bbafea3040 (patch) | |
tree | 42e9ff1c154afa53ea8d1af262117dd3ec081eb4 | |
parent | 5a9276f2ca8efd32ba35224bf83ab4f024a0d8de (diff) | |
download | libuca-deed5778e82c6833d804730a514b93bbafea3040.tar.gz libuca-deed5778e82c6833d804730a514b93bbafea3040.tar.bz2 libuca-deed5778e82c6833d804730a514b93bbafea3040.tar.xz libuca-deed5778e82c6833d804730a514b93bbafea3040.zip |
Make writing TIFF files optional
-rw-r--r-- | bin/tools/grab.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/bin/tools/grab.c b/bin/tools/grab.c index 72ae3b2..123b05e 100644 --- a/bin/tools/grab.c +++ b/bin/tools/grab.c @@ -34,6 +34,9 @@ typedef struct { gint n_frames; gdouble duration; gchar *filename; +#ifdef HAVE_LIBTIFF + gboolean write_tiff; +#endif } Options; @@ -93,7 +96,8 @@ write_tiff (RingBuffer *buffer, TIFFClose (tif); } -#else +#endif + static void write_raw (RingBuffer *buffer, Options *opts) @@ -122,7 +126,6 @@ write_raw (RingBuffer *buffer, g_free (filename); } } -#endif static GError * record_frames (UcaCamera *camera, Options *opts) @@ -191,7 +194,10 @@ record_frames (UcaCamera *camera, Options *opts) uca_camera_stop_recording (camera, &error); #ifdef HAVE_LIBTIFF - write_tiff (buffer, opts, roi_width, roi_height, bits); + if (opts->write_tiff) + write_tiff (buffer, opts, roi_width, roi_height, bits); + else + write_raw (buffer, opts); #else write_raw (buffer, opts); #endif @@ -213,13 +219,19 @@ main (int argc, char *argv[]) static Options opts = { .n_frames = -1, .duration = -1.0, - .filename = NULL + .filename = NULL, +#ifdef HAVE_LIBTIFF + .write_tiff = FALSE, +#endif }; static GOptionEntry entries[] = { { "num-frames", 'n', 0, G_OPTION_ARG_INT, &opts.n_frames, "Number of frames to acquire", "N" }, { "duration", 'd', 0, G_OPTION_ARG_DOUBLE, &opts.duration, "Duration in seconds", NULL }, { "output", 'o', 0, G_OPTION_ARG_STRING, &opts.filename, "Output file name", "FILE" }, +#ifdef HAVE_LIBTIFF + { "write-tiff", 't', 0, G_OPTION_ARG_NONE, &opts.write_tiff, "Write as TIFF", NULL }, +#endif { NULL } }; |