4 * Copyright (C) 2008 - 2010 The Geeqie Team
8 * This software is released under the GNU General Public License (GNU GPL).
9 * Please read the included file COPYING for more information.
10 * This software comes with no warranty of any kind, use at your own risk!
15 #include "image-load.h"
16 #include "image_load_gdk.h"
17 #include "image_load_jpeg.h"
21 #include "ui_fileops.h"
22 #include "gq-marshal.h"
27 #define IMAGE_LOADER_READ_BUFFER_SIZE_DEFAULT 4096
28 #define IMAGE_LOADER_IDLE_READ_LOOP_COUNT_DEFAULT 1
31 /**************************************************************************************/
32 /* image loader class */
36 SIGNAL_AREA_READY = 0,
44 static guint signals[SIGNAL_COUNT] = { 0 };
46 static void image_loader_init(GTypeInstance *instance, gpointer g_class);
47 static void image_loader_class_init(ImageLoaderClass *class);
48 static void image_loader_finalize(GObject *object);
49 static void image_loader_stop(ImageLoader *il);
51 GType image_loader_get_type(void)
53 static GType type = 0;
56 static const GTypeInfo info = {
57 sizeof(ImageLoaderClass),
59 NULL, /* base_finalize */
60 (GClassInitFunc)image_loader_class_init, /* class_init */
61 NULL, /* class_finalize */
62 NULL, /* class_data */
65 (GInstanceInitFunc)image_loader_init, /* instance_init */
66 NULL /* value_table */
68 type = g_type_register_static(G_TYPE_OBJECT, "ImageLoaderType", &info, 0);
73 static void image_loader_init(GTypeInstance *instance, gpointer g_class)
75 ImageLoader *il = (ImageLoader *)instance;
79 il->idle_priority = G_PRIORITY_DEFAULT_IDLE;
88 il->idle_read_loop_count = IMAGE_LOADER_IDLE_READ_LOOP_COUNT_DEFAULT;
89 il->read_buffer_size = IMAGE_LOADER_READ_BUFFER_SIZE_DEFAULT;
90 il->mapped_file = NULL;
92 il->requested_width = 0;
93 il->requested_height = 0;
96 il->can_destroy = TRUE;
99 il->data_mutex = g_mutex_new();
100 il->can_destroy_cond = g_cond_new();
102 DEBUG_1("new image loader %p, bufsize=%" G_GSIZE_FORMAT " idle_loop=%u", il, il->read_buffer_size, il->idle_read_loop_count);
105 static void image_loader_class_init(ImageLoaderClass *class)
107 GObjectClass *gobject_class = G_OBJECT_CLASS (class);
109 // gobject_class->set_property = image_loader_set_property;
110 // gobject_class->get_property = image_loader_get_property;
112 gobject_class->finalize = image_loader_finalize;
115 signals[SIGNAL_AREA_READY] =
116 g_signal_new("area_ready",
117 G_OBJECT_CLASS_TYPE(gobject_class),
119 G_STRUCT_OFFSET(ImageLoaderClass, area_ready),
121 gq_marshal_VOID__INT_INT_INT_INT,
128 signals[SIGNAL_ERROR] =
129 g_signal_new("error",
130 G_OBJECT_CLASS_TYPE(gobject_class),
132 G_STRUCT_OFFSET(ImageLoaderClass, error),
134 g_cclosure_marshal_VOID__VOID,
137 signals[SIGNAL_DONE] =
139 G_OBJECT_CLASS_TYPE(gobject_class),
141 G_STRUCT_OFFSET(ImageLoaderClass, done),
143 g_cclosure_marshal_VOID__VOID,
146 signals[SIGNAL_PERCENT] =
147 g_signal_new("percent",
148 G_OBJECT_CLASS_TYPE(gobject_class),
150 G_STRUCT_OFFSET(ImageLoaderClass, percent),
152 g_cclosure_marshal_VOID__DOUBLE,
156 signals[SIGNAL_SIZE] =
157 g_signal_new("size_prepared",
158 G_OBJECT_CLASS_TYPE(gobject_class),
160 G_STRUCT_OFFSET(ImageLoaderClass, area_ready),
162 gq_marshal_VOID__INT_INT,
169 static void image_loader_finalize(GObject *object)
171 ImageLoader *il = (ImageLoader *)object;
173 image_loader_stop(il);
175 if (il->error) DEBUG_1("%s", image_loader_get_error(il));
177 DEBUG_1("freeing image loader %p bytes_read=%" G_GSIZE_FORMAT, il, il->bytes_read);
179 if (il->idle_done_id)
181 g_source_remove(il->idle_done_id);
182 il->idle_done_id = 0;
185 while (g_source_remove_by_user_data(il))
187 DEBUG_2("pending signals detected");
190 while (il->area_param_list)
192 DEBUG_1("pending area_ready signals detected");
193 while (g_source_remove_by_user_data(il->area_param_list->data)) {}
194 g_free(il->area_param_list->data);
195 il->area_param_list = g_list_delete_link(il->area_param_list, il->area_param_list);
198 while (il->area_param_delayed_list)
200 g_free(il->area_param_delayed_list->data);
201 il->area_param_delayed_list = g_list_delete_link(il->area_param_delayed_list, il->area_param_delayed_list);
204 if (il->pixbuf) g_object_unref(il->pixbuf);
206 if (il->error) g_error_free(il->error);
208 file_data_unref(il->fd);
210 g_mutex_free(il->data_mutex);
211 g_cond_free(il->can_destroy_cond);
215 void image_loader_free(ImageLoader *il)
218 g_object_unref(G_OBJECT(il));
222 ImageLoader *image_loader_new(FileData *fd)
226 if (!fd) return NULL;
228 il = (ImageLoader *) g_object_new(TYPE_IMAGE_LOADER, NULL);
230 il->fd = file_data_ref(fd);
235 /**************************************************************************************/
236 /* send signals via idle calbacks - the callback are executed in the main thread */
238 typedef struct _ImageLoaderAreaParam ImageLoaderAreaParam;
239 struct _ImageLoaderAreaParam {
248 static gboolean image_loader_emit_area_ready_cb(gpointer data)
250 ImageLoaderAreaParam *par = data;
251 ImageLoader *il = par->il;
252 g_signal_emit(il, signals[SIGNAL_AREA_READY], 0, par->x, par->y, par->w, par->h);
253 g_mutex_lock(il->data_mutex);
254 il->area_param_list = g_list_remove(il->area_param_list, par);
256 g_mutex_unlock(il->data_mutex);
261 static gboolean image_loader_emit_done_cb(gpointer data)
263 ImageLoader *il = data;
264 g_signal_emit(il, signals[SIGNAL_DONE], 0);
268 static gboolean image_loader_emit_error_cb(gpointer data)
270 ImageLoader *il = data;
271 g_signal_emit(il, signals[SIGNAL_ERROR], 0);
275 static gboolean image_loader_emit_percent_cb(gpointer data)
277 ImageLoader *il = data;
278 g_signal_emit(il, signals[SIGNAL_PERCENT], 0, image_loader_get_percent(il));
282 /* DONE and ERROR are emited only once, thus they can have normal priority
283 PERCENT and AREA_READY should be processed ASAP
286 static void image_loader_emit_done(ImageLoader *il)
288 g_idle_add_full(il->idle_priority, image_loader_emit_done_cb, il, NULL);
291 static void image_loader_emit_error(ImageLoader *il)
293 g_idle_add_full(il->idle_priority, image_loader_emit_error_cb, il, NULL);
296 static void image_loader_emit_percent(ImageLoader *il)
298 g_idle_add_full(G_PRIORITY_HIGH, image_loader_emit_percent_cb, il, NULL);
301 /* this function expects that il->data_mutex is locked by caller */
302 static void image_loader_emit_area_ready(ImageLoader *il, guint x, guint y, guint w, guint h)
304 ImageLoaderAreaParam *par = g_new0(ImageLoaderAreaParam, 1);
311 il->area_param_list = g_list_prepend(il->area_param_list, par);
313 g_idle_add_full(G_PRIORITY_HIGH, image_loader_emit_area_ready_cb, par, NULL);
316 /**************************************************************************************/
317 /* the following functions may be executed in separate thread */
319 /* this function expects that il->data_mutex is locked by caller */
320 static void image_loader_queue_delayed_area_ready(ImageLoader *il, guint x, guint y, guint w, guint h)
322 ImageLoaderAreaParam *par = g_new0(ImageLoaderAreaParam, 1);
329 il->area_param_delayed_list = g_list_prepend(il->area_param_delayed_list, par);
334 static gboolean image_loader_get_stopping(ImageLoader *il)
337 if (!il) return FALSE;
339 g_mutex_lock(il->data_mutex);
341 g_mutex_unlock(il->data_mutex);
347 static void image_loader_sync_pixbuf(ImageLoader *il)
351 g_mutex_lock(il->data_mutex);
355 g_mutex_unlock(il->data_mutex);
359 pb = il->backend.get_pixbuf(il->loader);
361 if (pb == il->pixbuf)
363 g_mutex_unlock(il->data_mutex);
367 if (g_ascii_strcasecmp(".jps", il->fd->extension) == 0)
369 g_object_set_data(G_OBJECT(pb), "stereo_data", GINT_TO_POINTER(STEREO_PIXBUF_CROSS));
372 if (il->pixbuf) g_object_unref(il->pixbuf);
375 if (il->pixbuf) g_object_ref(il->pixbuf);
377 g_mutex_unlock(il->data_mutex);
380 static void image_loader_area_updated_cb(gpointer loader,
381 guint x, guint y, guint w, guint h,
384 ImageLoader *il = data;
386 if (!image_loader_get_pixbuf(il))
388 image_loader_sync_pixbuf(il);
389 if (!image_loader_get_pixbuf(il))
391 log_printf("critical: area_ready signal with NULL pixbuf (out of mem?)\n");
395 g_mutex_lock(il->data_mutex);
396 if (il->delay_area_ready)
397 image_loader_queue_delayed_area_ready(il, x, y, w, h);
399 image_loader_emit_area_ready(il, x, y, w, h);
401 if (il->stopping) il->backend.abort(il->loader);
403 g_mutex_unlock(il->data_mutex);
406 static void image_loader_area_prepared_cb(gpointer loader, gpointer data)
408 ImageLoader *il = data;
414 http://bugzilla.gnome.org/show_bug.cgi?id=547669
415 http://bugzilla.gnome.org/show_bug.cgi?id=589334
417 gchar *format = il->backend.get_format_name(loader);
418 if (strcmp(format, "svg") == 0 ||
419 strcmp(format, "xpm") == 0)
427 pb = il->backend.get_pixbuf(loader);
429 h = gdk_pixbuf_get_height(pb);
430 rs = gdk_pixbuf_get_rowstride(pb);
431 pix = gdk_pixbuf_get_pixels(pb);
433 memset(pix, 0, rs * h); /*this should be faster than pixbuf_fill */
437 static void image_loader_size_cb(gpointer loader,
438 gint width, gint height, gpointer data)
440 ImageLoader *il = data;
442 gboolean scale = FALSE;
445 g_mutex_lock(il->data_mutex);
446 if (il->requested_width < 1 || il->requested_height < 1)
448 g_mutex_unlock(il->data_mutex);
449 g_signal_emit(il, signals[SIGNAL_SIZE], 0, width, height);
452 g_mutex_unlock(il->data_mutex);
454 mime_types = il->backend.get_format_mime_types(loader);
456 while (mime_types[n])
458 if (strstr(mime_types[n], "jpeg")) scale = TRUE;
461 g_strfreev(mime_types);
465 g_signal_emit(il, signals[SIGNAL_SIZE], 0, width, height);
469 g_mutex_lock(il->data_mutex);
472 if (width > il->requested_width || height > il->requested_height)
475 if (((gdouble)il->requested_width / width) < ((gdouble)il->requested_height / height))
477 nw = il->requested_width;
478 nh = (gdouble)nw / width * height;
483 nh = il->requested_height;
484 nw = (gdouble)nh / height * width;
488 il->backend.set_size(loader, nw, nh);
491 g_mutex_unlock(il->data_mutex);
493 g_signal_emit(il, signals[SIGNAL_SIZE], 0, nw, nh);
496 static void image_loader_stop_loader(ImageLoader *il)
502 /* some loaders do not have a pixbuf till close, order is important here */
503 il->backend.close(il->loader, il->error ? NULL : &il->error); /* we are interested in the first error only */
504 image_loader_sync_pixbuf(il);
505 il->backend.free(il->loader);
508 g_mutex_lock(il->data_mutex);
510 g_mutex_unlock(il->data_mutex);
513 static void image_loader_setup_loader(ImageLoader *il)
515 g_mutex_lock(il->data_mutex);
517 if (il->bytes_total >= 2 && il->mapped_file[0] == 0xff && il->mapped_file[1] == 0xd8)
519 DEBUG_1("Using custom jpeg loader");
520 image_loader_backend_set_jpeg(&il->backend);
524 image_loader_backend_set_default(&il->backend);
526 il->loader = il->backend.loader_new(image_loader_area_updated_cb, image_loader_size_cb, image_loader_area_prepared_cb, il);
527 g_mutex_unlock(il->data_mutex);
531 static void image_loader_done(ImageLoader *il)
533 image_loader_stop_loader(il);
535 image_loader_emit_done(il);
538 static void image_loader_error(ImageLoader *il)
540 image_loader_stop_loader(il);
542 DEBUG_1("pixbuf_loader reported load error for: %s", il->fd->path);
544 image_loader_emit_error(il);
547 static gboolean image_loader_continue(ImageLoader *il)
552 if (!il) return FALSE;
554 c = il->idle_read_loop_count ? il->idle_read_loop_count : 1;
555 while (c > 0 && !image_loader_get_stopping(il))
557 b = MIN(il->read_buffer_size, il->bytes_total - il->bytes_read);
561 image_loader_done(il);
565 if (b < 0 || (b > 0 && !il->backend.write(il->loader, il->mapped_file + il->bytes_read, b, &il->error)))
567 image_loader_error(il);
576 if (il->bytes_total > 0)
578 image_loader_emit_percent(il);
584 static gboolean image_loader_begin(ImageLoader *il)
588 if (il->pixbuf) return FALSE;
590 b = MIN(il->read_buffer_size, il->bytes_total - il->bytes_read);
591 if (b < 1) return FALSE;
593 image_loader_setup_loader(il);
595 g_assert(il->bytes_read == 0);
596 if (il->backend.load) {
598 if (!il->backend.load(il->loader, il->mapped_file, b, &il->error))
600 image_loader_stop_loader(il);
604 else if (!il->backend.write(il->loader, il->mapped_file, b, &il->error))
606 image_loader_stop_loader(il);
612 /* read until size is known */
613 while (il->loader && !il->backend.get_pixbuf(il->loader) && b > 0 && !image_loader_get_stopping(il))
615 b = MIN(il->read_buffer_size, il->bytes_total - il->bytes_read);
616 if (b < 0 || (b > 0 && !il->backend.write(il->loader, il->mapped_file + il->bytes_read, b, &il->error)))
618 image_loader_stop_loader(il);
623 if (!il->pixbuf) image_loader_sync_pixbuf(il);
625 if (il->bytes_read == il->bytes_total || b < 1)
627 /* done, handle (broken) loaders that do not have pixbuf till close */
628 image_loader_stop_loader(il);
630 if (!il->pixbuf) return FALSE;
632 image_loader_done(il);
638 image_loader_stop_loader(il);
645 /**************************************************************************************/
646 /* the following functions are always executed in the main thread */
649 static gboolean image_loader_setup_source(ImageLoader *il)
654 if (!il || il->loader || il->mapped_file) return FALSE;
656 il->mapped_file = NULL;
660 ExifData *exif = exif_read_fd(il->fd);
662 if (options->thumbnails.use_exif)
663 il->mapped_file = exif_get_preview(exif, (guint *)&il->bytes_total, il->requested_width, il->requested_height);
665 il->mapped_file = exif_get_preview(exif, (guint *)&il->bytes_total, 0, 0); /* get the largest available preview image or NULL for normal images*/
670 DEBUG_1("Usable reduced size (preview) image loaded from file %s", il->fd->path);
672 exif_free_fd(il->fd, exif);
676 if (!il->mapped_file)
681 pathl = path_from_utf8(il->fd->path);
682 load_fd = open(pathl, O_RDONLY | O_NONBLOCK);
684 if (load_fd == -1) return FALSE;
686 if (fstat(load_fd, &st) == 0)
688 il->bytes_total = st.st_size;
696 il->mapped_file = mmap(0, il->bytes_total, PROT_READ|PROT_WRITE, MAP_PRIVATE, load_fd, 0);
698 if (il->mapped_file == MAP_FAILED)
709 static void image_loader_stop_source(ImageLoader *il)
717 exif_free_preview(il->mapped_file);
721 munmap(il->mapped_file, il->bytes_total);
723 il->mapped_file = NULL;
727 static void image_loader_stop(ImageLoader *il)
733 g_source_remove(il->idle_id);
739 /* stop loader in the other thread */
740 g_mutex_lock(il->data_mutex);
742 while (!il->can_destroy) g_cond_wait(il->can_destroy_cond, il->data_mutex);
743 g_mutex_unlock(il->data_mutex);
746 image_loader_stop_loader(il);
747 image_loader_stop_source(il);
751 void image_loader_delay_area_ready(ImageLoader *il, gboolean enable)
753 g_mutex_lock(il->data_mutex);
754 il->delay_area_ready = enable;
759 list = g_list_reverse(il->area_param_delayed_list);
760 il->area_param_delayed_list = NULL;
761 g_mutex_unlock(il->data_mutex);
767 ImageLoaderAreaParam *par = work->data;
770 g_signal_emit(il, signals[SIGNAL_AREA_READY], 0, par->x, par->y, par->w, par->h);
778 g_mutex_unlock(il->data_mutex);
783 /**************************************************************************************/
784 /* execution via idle calls */
786 static gboolean image_loader_idle_cb(gpointer data)
788 gboolean ret = FALSE;
789 ImageLoader *il = data;
793 ret = image_loader_continue(il);
798 image_loader_stop_source(il);
805 static gboolean image_loader_start_idle(ImageLoader *il)
809 if (!il) return FALSE;
811 if (!il->fd) return FALSE;
813 if (!image_loader_setup_source(il)) return FALSE;
815 ret = image_loader_begin(il);
817 if (ret && !il->done) il->idle_id = g_idle_add_full(il->idle_priority, image_loader_idle_cb, il, NULL);
821 /**************************************************************************************/
822 /* execution via thread */
825 static GThreadPool *image_loader_thread_pool = NULL;
827 static GCond *image_loader_prio_cond = NULL;
828 static GMutex *image_loader_prio_mutex = NULL;
829 static gint image_loader_prio_num = 0;
832 static void image_loader_thread_enter_high(void)
834 g_mutex_lock(image_loader_prio_mutex);
835 image_loader_prio_num++;
836 g_mutex_unlock(image_loader_prio_mutex);
839 static void image_loader_thread_leave_high(void)
841 g_mutex_lock(image_loader_prio_mutex);
842 image_loader_prio_num--;
843 if (image_loader_prio_num == 0) g_cond_broadcast(image_loader_prio_cond); /* wake up all low prio threads */
844 g_mutex_unlock(image_loader_prio_mutex);
847 static void image_loader_thread_wait_high(void)
849 g_mutex_lock(image_loader_prio_mutex);
850 while (image_loader_prio_num)
852 g_cond_wait(image_loader_prio_cond, image_loader_prio_mutex);
855 g_mutex_unlock(image_loader_prio_mutex);
859 static void image_loader_thread_run(gpointer data, gpointer user_data)
861 ImageLoader *il = data;
865 if (il->idle_priority > G_PRIORITY_DEFAULT_IDLE)
867 /* low prio, wait untill high prio tasks finishes */
868 image_loader_thread_wait_high();
873 image_loader_thread_enter_high();
876 err = !image_loader_begin(il);
881 loader failed, we have to send signal
882 (idle mode returns the image_loader_begin return value directly)
883 (success is always reported indirectly from image_loader_begin)
885 image_loader_emit_error(il);
890 while (cont && !image_loader_get_is_done(il) && !image_loader_get_stopping(il))
892 if (il->idle_priority > G_PRIORITY_DEFAULT_IDLE)
894 /* low prio, wait untill high prio tasks finishes */
895 image_loader_thread_wait_high();
897 cont = image_loader_continue(il);
899 image_loader_stop_loader(il);
901 if (il->idle_priority <= G_PRIORITY_DEFAULT_IDLE)
904 image_loader_thread_leave_high();
907 g_mutex_lock(il->data_mutex);
908 il->can_destroy = TRUE;
909 g_cond_signal(il->can_destroy_cond);
910 g_mutex_unlock(il->data_mutex);
915 static gboolean image_loader_start_thread(ImageLoader *il)
917 if (!il) return FALSE;
919 if (!il->fd) return FALSE;
923 if (!image_loader_setup_source(il)) return FALSE;
925 if (!image_loader_thread_pool)
927 image_loader_thread_pool = g_thread_pool_new(image_loader_thread_run, NULL, -1, FALSE, NULL);
928 image_loader_prio_cond = g_cond_new();
929 image_loader_prio_mutex = g_mutex_new();
932 il->can_destroy = FALSE; /* ImageLoader can't be freed until image_loader_thread_run finishes */
934 g_thread_pool_push(image_loader_thread_pool, il, NULL);
935 DEBUG_1("Thread pool num threads: %d", g_thread_pool_get_num_threads(image_loader_thread_pool));
939 #endif /* HAVE_GTHREAD */
942 /**************************************************************************************/
943 /* public interface */
946 gboolean image_loader_start(ImageLoader *il)
948 if (!il) return FALSE;
950 if (!il->fd) return FALSE;
953 return image_loader_start_thread(il);
955 return image_loader_start_idle(il);
960 /* don't forget to gdk_pixbuf_ref() it if you want to use it after image_loader_free() */
961 GdkPixbuf *image_loader_get_pixbuf(ImageLoader *il)
964 if (!il) return NULL;
966 g_mutex_lock(il->data_mutex);
968 g_mutex_unlock(il->data_mutex);
972 gchar *image_loader_get_format(ImageLoader *il)
977 if (!il || !il->loader) return NULL;
979 mimev = il->backend.get_format_mime_types(il->loader);
980 if (!mimev) return NULL;
982 /* return first member of mimev, as GdkPixbufLoader has no way to tell us which exact one ? */
983 mime = g_strdup(mimev[0]);
989 void image_loader_set_requested_size(ImageLoader *il, gint width, gint height)
993 g_mutex_lock(il->data_mutex);
994 il->requested_width = width;
995 il->requested_height = height;
996 g_mutex_unlock(il->data_mutex);
999 void image_loader_set_buffer_size(ImageLoader *il, guint count)
1003 g_mutex_lock(il->data_mutex);
1004 il->idle_read_loop_count = count ? count : 1;
1005 g_mutex_unlock(il->data_mutex);
1008 void image_loader_set_priority(ImageLoader *il, gint priority)
1012 if (il->thread) return; /* can't change prio if the thread already runs */
1013 il->idle_priority = priority;
1017 gdouble image_loader_get_percent(ImageLoader *il)
1020 if (!il) return 0.0;
1022 g_mutex_lock(il->data_mutex);
1023 if (il->bytes_total == 0)
1029 ret = (gdouble)il->bytes_read / il->bytes_total;
1031 g_mutex_unlock(il->data_mutex);
1035 gboolean image_loader_get_is_done(ImageLoader *il)
1038 if (!il) return FALSE;
1040 g_mutex_lock(il->data_mutex);
1042 g_mutex_unlock(il->data_mutex);
1047 FileData *image_loader_get_fd(ImageLoader *il)
1050 if (!il) return NULL;
1052 g_mutex_lock(il->data_mutex);
1054 g_mutex_unlock(il->data_mutex);
1059 gboolean image_loader_get_shrunk(ImageLoader *il)
1062 if (!il) return FALSE;
1064 g_mutex_lock(il->data_mutex);
1066 g_mutex_unlock(il->data_mutex);
1070 const gchar *image_loader_get_error(ImageLoader *il)
1072 const gchar *ret = NULL;
1073 if (!il) return NULL;
1074 g_mutex_lock(il->data_mutex);
1075 if (il->error) ret = il->error->message;
1076 g_mutex_unlock(il->data_mutex);
1081 /* FIXME - this can be rather slow and blocks until the size is known */
1082 gboolean image_load_dimensions(FileData *fd, gint *width, gint *height)
1087 il = image_loader_new(fd);
1089 success = image_loader_start_idle(il);
1091 if (success && il->pixbuf)
1093 if (width) *width = gdk_pixbuf_get_width(il->pixbuf);
1094 if (height) *height = gdk_pixbuf_get_height(il->pixbuf);;
1098 if (width) *width = -1;
1099 if (height) *height = -1;
1102 image_loader_free(il);
1106 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */