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);
516 if (il->bytes_total >= 2 && il->mapped_file[0] == 0xff && il->mapped_file[1] == 0xd8)
518 DEBUG_1("Using custom jpeg loader");
519 image_loader_backend_set_jpeg(&il->backend);
522 image_loader_backend_set_default(&il->backend);
524 il->loader = il->backend.loader_new(image_loader_area_updated_cb, image_loader_size_cb, image_loader_area_prepared_cb, il);
525 g_mutex_unlock(il->data_mutex);
529 static void image_loader_done(ImageLoader *il)
531 image_loader_stop_loader(il);
533 image_loader_emit_done(il);
536 static void image_loader_error(ImageLoader *il)
538 image_loader_stop_loader(il);
540 DEBUG_1("pixbuf_loader reported load error for: %s", il->fd->path);
542 image_loader_emit_error(il);
545 static gboolean image_loader_continue(ImageLoader *il)
550 if (!il) return FALSE;
552 c = il->idle_read_loop_count ? il->idle_read_loop_count : 1;
553 while (c > 0 && !image_loader_get_stopping(il))
555 b = MIN(il->read_buffer_size, il->bytes_total - il->bytes_read);
559 image_loader_done(il);
563 if (b < 0 || (b > 0 && !il->backend.write(il->loader, il->mapped_file + il->bytes_read, b, &il->error)))
565 image_loader_error(il);
574 if (il->bytes_total > 0)
576 image_loader_emit_percent(il);
582 static gboolean image_loader_begin(ImageLoader *il)
586 if (il->pixbuf) return FALSE;
588 b = MIN(il->read_buffer_size, il->bytes_total - il->bytes_read);
589 if (b < 1) return FALSE;
591 image_loader_setup_loader(il);
593 g_assert(il->bytes_read == 0);
594 if (il->backend.load) {
596 if (!il->backend.load(il->loader, il->mapped_file, b, &il->error))
598 image_loader_stop_loader(il);
602 else if (!il->backend.write(il->loader, il->mapped_file, b, &il->error))
604 image_loader_stop_loader(il);
610 /* read until size is known */
611 while (il->loader && !il->backend.get_pixbuf(il->loader) && b > 0 && !image_loader_get_stopping(il))
613 b = MIN(il->read_buffer_size, il->bytes_total - il->bytes_read);
614 if (b < 0 || (b > 0 && !il->backend.write(il->loader, il->mapped_file + il->bytes_read, b, &il->error)))
616 image_loader_stop_loader(il);
621 if (!il->pixbuf) image_loader_sync_pixbuf(il);
623 if (il->bytes_read == il->bytes_total || b < 1)
625 /* done, handle (broken) loaders that do not have pixbuf till close */
626 image_loader_stop_loader(il);
628 if (!il->pixbuf) return FALSE;
630 image_loader_done(il);
636 image_loader_stop_loader(il);
643 /**************************************************************************************/
644 /* the following functions are always executed in the main thread */
647 static gboolean image_loader_setup_source(ImageLoader *il)
652 if (!il || il->loader || il->mapped_file) return FALSE;
654 il->mapped_file = NULL;
658 ExifData *exif = exif_read_fd(il->fd);
660 if (options->thumbnails.use_exif)
661 il->mapped_file = exif_get_preview(exif, (guint *)&il->bytes_total, il->requested_width, il->requested_height);
663 il->mapped_file = exif_get_preview(exif, (guint *)&il->bytes_total, 0, 0); /* get the largest available preview image or NULL for normal images*/
668 DEBUG_1("Usable reduced size (preview) image loaded from file %s", il->fd->path);
670 exif_free_fd(il->fd, exif);
674 if (!il->mapped_file)
679 pathl = path_from_utf8(il->fd->path);
680 load_fd = open(pathl, O_RDONLY | O_NONBLOCK);
682 if (load_fd == -1) return FALSE;
684 if (fstat(load_fd, &st) == 0)
686 il->bytes_total = st.st_size;
694 il->mapped_file = mmap(0, il->bytes_total, PROT_READ|PROT_WRITE, MAP_PRIVATE, load_fd, 0);
696 if (il->mapped_file == MAP_FAILED)
707 static void image_loader_stop_source(ImageLoader *il)
715 exif_free_preview(il->mapped_file);
719 munmap(il->mapped_file, il->bytes_total);
721 il->mapped_file = NULL;
725 static void image_loader_stop(ImageLoader *il)
731 g_source_remove(il->idle_id);
737 /* stop loader in the other thread */
738 g_mutex_lock(il->data_mutex);
740 while (!il->can_destroy) g_cond_wait(il->can_destroy_cond, il->data_mutex);
741 g_mutex_unlock(il->data_mutex);
744 image_loader_stop_loader(il);
745 image_loader_stop_source(il);
749 void image_loader_delay_area_ready(ImageLoader *il, gboolean enable)
751 g_mutex_lock(il->data_mutex);
752 il->delay_area_ready = enable;
757 list = g_list_reverse(il->area_param_delayed_list);
758 il->area_param_delayed_list = NULL;
759 g_mutex_unlock(il->data_mutex);
765 ImageLoaderAreaParam *par = work->data;
768 g_signal_emit(il, signals[SIGNAL_AREA_READY], 0, par->x, par->y, par->w, par->h);
776 g_mutex_unlock(il->data_mutex);
781 /**************************************************************************************/
782 /* execution via idle calls */
784 static gboolean image_loader_idle_cb(gpointer data)
786 gboolean ret = FALSE;
787 ImageLoader *il = data;
791 ret = image_loader_continue(il);
796 image_loader_stop_source(il);
803 static gboolean image_loader_start_idle(ImageLoader *il)
807 if (!il) return FALSE;
809 if (!il->fd) return FALSE;
811 if (!image_loader_setup_source(il)) return FALSE;
813 ret = image_loader_begin(il);
815 if (ret && !il->done) il->idle_id = g_idle_add_full(il->idle_priority, image_loader_idle_cb, il, NULL);
819 /**************************************************************************************/
820 /* execution via thread */
823 static GThreadPool *image_loader_thread_pool = NULL;
825 static GCond *image_loader_prio_cond = NULL;
826 static GMutex *image_loader_prio_mutex = NULL;
827 static gint image_loader_prio_num = 0;
830 static void image_loader_thread_enter_high(void)
832 g_mutex_lock(image_loader_prio_mutex);
833 image_loader_prio_num++;
834 g_mutex_unlock(image_loader_prio_mutex);
837 static void image_loader_thread_leave_high(void)
839 g_mutex_lock(image_loader_prio_mutex);
840 image_loader_prio_num--;
841 if (image_loader_prio_num == 0) g_cond_broadcast(image_loader_prio_cond); /* wake up all low prio threads */
842 g_mutex_unlock(image_loader_prio_mutex);
845 static void image_loader_thread_wait_high(void)
847 g_mutex_lock(image_loader_prio_mutex);
848 while (image_loader_prio_num)
850 g_cond_wait(image_loader_prio_cond, image_loader_prio_mutex);
853 g_mutex_unlock(image_loader_prio_mutex);
857 static void image_loader_thread_run(gpointer data, gpointer user_data)
859 ImageLoader *il = data;
863 if (il->idle_priority > G_PRIORITY_DEFAULT_IDLE)
865 /* low prio, wait untill high prio tasks finishes */
866 image_loader_thread_wait_high();
871 image_loader_thread_enter_high();
874 err = !image_loader_begin(il);
879 loader failed, we have to send signal
880 (idle mode returns the image_loader_begin return value directly)
881 (success is always reported indirectly from image_loader_begin)
883 image_loader_emit_error(il);
888 while (cont && !image_loader_get_is_done(il) && !image_loader_get_stopping(il))
890 if (il->idle_priority > G_PRIORITY_DEFAULT_IDLE)
892 /* low prio, wait untill high prio tasks finishes */
893 image_loader_thread_wait_high();
895 cont = image_loader_continue(il);
897 image_loader_stop_loader(il);
899 if (il->idle_priority <= G_PRIORITY_DEFAULT_IDLE)
902 image_loader_thread_leave_high();
905 g_mutex_lock(il->data_mutex);
906 il->can_destroy = TRUE;
907 g_cond_signal(il->can_destroy_cond);
908 g_mutex_unlock(il->data_mutex);
913 static gboolean image_loader_start_thread(ImageLoader *il)
915 if (!il) return FALSE;
917 if (!il->fd) return FALSE;
921 if (!image_loader_setup_source(il)) return FALSE;
923 if (!image_loader_thread_pool)
925 image_loader_thread_pool = g_thread_pool_new(image_loader_thread_run, NULL, -1, FALSE, NULL);
926 image_loader_prio_cond = g_cond_new();
927 image_loader_prio_mutex = g_mutex_new();
930 il->can_destroy = FALSE; /* ImageLoader can't be freed until image_loader_thread_run finishes */
932 g_thread_pool_push(image_loader_thread_pool, il, NULL);
933 DEBUG_1("Thread pool num threads: %d", g_thread_pool_get_num_threads(image_loader_thread_pool));
937 #endif /* HAVE_GTHREAD */
940 /**************************************************************************************/
941 /* public interface */
944 gboolean image_loader_start(ImageLoader *il)
946 if (!il) return FALSE;
948 if (!il->fd) return FALSE;
951 return image_loader_start_thread(il);
953 return image_loader_start_idle(il);
958 /* don't forget to gdk_pixbuf_ref() it if you want to use it after image_loader_free() */
959 GdkPixbuf *image_loader_get_pixbuf(ImageLoader *il)
962 if (!il) return NULL;
964 g_mutex_lock(il->data_mutex);
966 g_mutex_unlock(il->data_mutex);
970 gchar *image_loader_get_format(ImageLoader *il)
975 if (!il || !il->loader) return NULL;
977 mimev = il->backend.get_format_mime_types(il->loader);
978 if (!mimev) return NULL;
980 /* return first member of mimev, as GdkPixbufLoader has no way to tell us which exact one ? */
981 mime = g_strdup(mimev[0]);
987 void image_loader_set_requested_size(ImageLoader *il, gint width, gint height)
991 g_mutex_lock(il->data_mutex);
992 il->requested_width = width;
993 il->requested_height = height;
994 g_mutex_unlock(il->data_mutex);
997 void image_loader_set_buffer_size(ImageLoader *il, guint count)
1001 g_mutex_lock(il->data_mutex);
1002 il->idle_read_loop_count = count ? count : 1;
1003 g_mutex_unlock(il->data_mutex);
1006 void image_loader_set_priority(ImageLoader *il, gint priority)
1010 if (il->thread) return; /* can't change prio if the thread already runs */
1011 il->idle_priority = priority;
1015 gdouble image_loader_get_percent(ImageLoader *il)
1018 if (!il) return 0.0;
1020 g_mutex_lock(il->data_mutex);
1021 if (il->bytes_total == 0)
1027 ret = (gdouble)il->bytes_read / il->bytes_total;
1029 g_mutex_unlock(il->data_mutex);
1033 gboolean image_loader_get_is_done(ImageLoader *il)
1036 if (!il) return FALSE;
1038 g_mutex_lock(il->data_mutex);
1040 g_mutex_unlock(il->data_mutex);
1045 FileData *image_loader_get_fd(ImageLoader *il)
1048 if (!il) return NULL;
1050 g_mutex_lock(il->data_mutex);
1052 g_mutex_unlock(il->data_mutex);
1057 gboolean image_loader_get_shrunk(ImageLoader *il)
1060 if (!il) return FALSE;
1062 g_mutex_lock(il->data_mutex);
1064 g_mutex_unlock(il->data_mutex);
1068 const gchar *image_loader_get_error(ImageLoader *il)
1070 const gchar *ret = NULL;
1071 if (!il) return NULL;
1072 g_mutex_lock(il->data_mutex);
1073 if (il->error) ret = il->error->message;
1074 g_mutex_unlock(il->data_mutex);
1079 /* FIXME - this can be rather slow and blocks until the size is known */
1080 gboolean image_load_dimensions(FileData *fd, gint *width, gint *height)
1085 il = image_loader_new(fd);
1087 success = image_loader_start_idle(il);
1089 if (success && il->pixbuf)
1091 if (width) *width = gdk_pixbuf_get_width(il->pixbuf);
1092 if (height) *height = gdk_pixbuf_get_height(il->pixbuf);;
1096 if (width) *width = -1;
1097 if (height) *height = -1;
1100 image_loader_free(il);
1104 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */