summaryrefslogtreecommitdiff
path: root/gdk-pixbuf/io-ani.c
blob: c6c4642cf4490aaaa7ef78a2f20a6ec2ad169a61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
/* -*- mode: C; c-file-style: "linux" -*- */
/* GdkPixbuf library - ANI image loader
 *
 * Copyright (C) 2002 The Free Software Foundation
 *
 * Authors: Matthias Clasen <maclas@gmx.de>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */

#undef DEBUG_ANI

#include "config.h"
#include <stdlib.h>
#include <string.h>
#include "gdk-pixbuf-loader.h"
#include "io-ani-animation.h"

static int
lsb_32 (guchar *src)
{
	return src[0] | (src[1] << 8) | (src[2] << 16) | (src[3] << 24);
}

#define MAKE_TAG(a,b,c,d) ( (guint32)d << 24 | \
			    (guint32)c << 16 | \
			    (guint32)b <<  8 | \
			    (guint32)a )

#define TAG_RIFF MAKE_TAG('R','I','F','F')
#define TAG_ACON MAKE_TAG('A','C','O','N')
#define TAG_LIST MAKE_TAG('L','I','S','T')
#define TAG_INAM MAKE_TAG('I','N','A','M')
#define TAG_IART MAKE_TAG('I','A','R','T')
#define TAG_anih MAKE_TAG('a','n','i','h')
#define TAG_seq  MAKE_TAG('s','e','q',' ')
#define TAG_rate MAKE_TAG('r','a','t','e')
#define TAG_icon MAKE_TAG('i','c','o','n')

typedef struct _AniLoaderContext 
{
        guint32 cp;
        
        guchar *buffer;
        guchar *byte;
        guint   n_bytes;
        guint   buffer_size;
        
        GdkPixbufModulePreparedFunc prepared_func;
        GdkPixbufModuleUpdatedFunc updated_func;
        gpointer user_data;
        
        guint32 data_size;
        
        guint32 HeaderSize;
        guint32 NumFrames; 
        guint32 NumSteps; 
        guint32 Width;   
        guint32 Height; 
        guint32 BitCount; 
        guint32 NumPlanes; 
        guint32 DisplayRate; 
        guint32 Flags;
        
        guint32 chunk_id;
        guint32 chunk_size;
        
        gchar  *title;
        gchar  *author;

        GdkPixbufAniAnim *animation;
	GdkPixbufLoader *loader;

        int     pos;
} AniLoaderContext;


#define BYTES_LEFT(context) \
        ((context)->n_bytes - ((context)->byte - (context)->buffer))

static void
read_int8 (AniLoaderContext *context,
           guchar     *data,
           int        count)
{
        int total = MIN (count, BYTES_LEFT (context));
        memcpy (data, context->byte, total);
        context->byte += total;
        context->cp += total;
}


static guint32
read_int32 (AniLoaderContext *context)
{
        guint32 result;

        read_int8 (context, (guchar*) &result, 4);
        return lsb_32 ((guchar *) &result);
}

static void
context_free (AniLoaderContext *context)
{
        if (!context)
                return;

	if (context->loader) 
	{
		gdk_pixbuf_loader_close (context->loader, NULL);
		g_object_unref (context->loader);
	}
        if (context->animation) 
		g_object_unref (context->animation);
        g_free (context->buffer);
        g_free (context->title);
        g_free (context->author);
        
        g_free (context);
}

static void
prepared_callback (GdkPixbufLoader *loader,
                   gpointer data)
{
	AniLoaderContext *context = (AniLoaderContext*)data;

#ifdef DEBUG_ANI
	g_print ("%d pixbuf prepared\n", context->pos);
#endif

	GdkPixbuf *pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
        if (!pixbuf)
		return;

	if (gdk_pixbuf_get_width (pixbuf) > context->animation->width) 
		context->animation->width = gdk_pixbuf_get_width (pixbuf);
	
	if (gdk_pixbuf_get_height (pixbuf) > context->animation->height) 
		context->animation->height = gdk_pixbuf_get_height (pixbuf);
	
	if (context->title != NULL) 
		gdk_pixbuf_set_option (pixbuf, "Title", context->title);
	
	if (context->author != NULL) 
		gdk_pixbuf_set_option (pixbuf, "Author", context->author);

	g_object_ref (pixbuf);
	context->animation->pixbufs[context->pos] = pixbuf;

	if (context->pos == 0) 
	{
		(* context->prepared_func) (pixbuf, 
					    GDK_PIXBUF_ANIMATION (context->animation), 
					    context->user_data);
	}
	else {
		/* FIXME - this is necessary for nice display of loading 
		   animations because GtkImage ignores 
		   gdk_pixbuf_animation_iter_on_currently_loading_frame()
		   and always exposes the full frame */
		GdkPixbuf *last = context->animation->pixbufs[context->pos - 1];
		gint width = MIN (gdk_pixbuf_get_width (last), gdk_pixbuf_get_width (pixbuf));
		gint height = MIN (gdk_pixbuf_get_height (last), gdk_pixbuf_get_height (pixbuf));
		gdk_pixbuf_copy_area (last, 0, 0, width, height, pixbuf, 0, 0);
	}

	context->pos++;
}

static void
updated_callback (GdkPixbufLoader* loader,
		  gint x, gint y, gint width, gint height,
		  gpointer data)
{
	AniLoaderContext *context = (AniLoaderContext*)data;

	GdkPixbuf *pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
	
	(* context->updated_func) (pixbuf, 
				   x, y, width, height,
				   context->user_data);
}

static gboolean
ani_load_chunk (AniLoaderContext *context, GError **error)
{
        int i;
        
        if (context->chunk_id == 0x0) {
                if (BYTES_LEFT (context) < 8)
                        return FALSE;
                context->chunk_id = read_int32 (context);
                context->chunk_size = read_int32 (context);
		/* Pad it up to word length */
		if (context->chunk_size % 2)
			context->chunk_size += (2 - (context->chunk_size % 2));
        
        }
        
        while (context->chunk_id == TAG_LIST)
	{
		if (BYTES_LEFT (context) < 12)
			return FALSE;
                        
		read_int32 (context);
		context->chunk_id = read_int32 (context);
		context->chunk_size = read_int32 (context);
		/* Pad it up to word length */
		if (context->chunk_size % 2)
			context->chunk_size += (2 - (context->chunk_size % 2));
        
	}
        
	if (context->chunk_id == TAG_icon) 
	{
		GError *loader_error = NULL;
		guchar *data;
		guint32 towrite;

		if (context->loader == NULL) 
		{
			if (context->pos >= context->NumFrames) 
			{
				g_set_error_literal (error,
                                                     GDK_PIXBUF_ERROR,
                                                     GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
                                                     _("Unexpected icon chunk in animation"));
				return FALSE; 
			}

#ifdef DEBUG_ANI
			g_print ("opening loader\n");
#endif
			context->loader = gdk_pixbuf_loader_new_with_type ("ico", &loader_error);
			if (loader_error) 
			{
				g_propagate_error (error, loader_error);
				return FALSE;
			}
			g_signal_connect (context->loader, "area_prepared",
					  G_CALLBACK (prepared_callback), context);
			g_signal_connect (context->loader, "area_updated",
					  G_CALLBACK (updated_callback), context);
		}

		towrite = MIN (context->chunk_size, BYTES_LEFT (context));
		data = context->byte;
		context->byte += towrite;
		context->cp += towrite;
#ifdef DEBUG_ANI
		g_print ("miss %d, get %d, leftover %d\n", context->chunk_size, towrite, BYTES_LEFT (context));
#endif
		context->chunk_size -= towrite;
		if (!gdk_pixbuf_loader_write (context->loader, data, towrite, &loader_error)) 
		{
			g_propagate_error (error, loader_error);
			gdk_pixbuf_loader_close (context->loader, NULL);
			g_object_unref (context->loader);
			context->loader = NULL;
			return FALSE; 
		}
		if (context->chunk_size == 0) 
		{
#ifdef DEBUG_ANI
			g_print ("closing loader\n");
#endif
			if (!gdk_pixbuf_loader_close (context->loader, &loader_error)) 
			{
				g_propagate_error (error, loader_error);
				g_object_unref (context->loader);
				context->loader = NULL;
				return FALSE;
			}
			g_object_unref (context->loader);
			context->loader = NULL;
			context->chunk_id = 0x0;
		}
		return BYTES_LEFT (context) > 0;
	}

        if (BYTES_LEFT (context) < context->chunk_size)
                return FALSE;
        
        if (context->chunk_id == TAG_anih) 
	{
		context->HeaderSize = read_int32 (context);
		context->NumFrames = read_int32 (context);
		context->NumSteps = read_int32 (context);
		context->Width = read_int32 (context);
		context->Height = read_int32 (context);
		context->BitCount = read_int32 (context);
		context->NumPlanes = read_int32 (context);
		context->DisplayRate = read_int32 (context);
		context->Flags = read_int32 (context);
                        
#ifdef DEBUG_ANI	  
		g_print ("HeaderSize \t%" G_GUINT32_FORMAT
			 "\nNumFrames \t%" G_GUINT32_FORMAT
			 "\nNumSteps \t%" G_GUINT32_FORMAT
			 "\nWidth    \t%" G_GUINT32_FORMAT
			 "\nHeight   \t%" G_GUINT32_FORMAT
			 "\nBitCount \t%" G_GUINT32_FORMAT
			 "\nNumPlanes \t%" G_GUINT32_FORMAT
			 "\nDisplayRate \t%" G_GUINT32_FORMAT
			 "\nSequenceFlag \t%d"
			 "\nIconFlag \t%d"
			 "\n",
			 context->HeaderSize, context->NumFrames, 
			 context->NumSteps, context->Width, 
			 context->Height, context->BitCount, 
			 context->NumPlanes, context->DisplayRate, 
			 (context->Flags & 0x2) != 0, 
			 (context->Flags & 0x1) != 0);
#endif
		if (!(context->Flags & 0x2))
			context->NumSteps = context->NumFrames;
		if (context->NumFrames == 0 || 
		    context->NumFrames >= 1024 || 
		    context->NumSteps == 0 || 
		    context->NumSteps >= 1024) 
		{
			g_set_error_literal (error,
                                             GDK_PIXBUF_ERROR,
                                             GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
                                             _("Invalid header in animation"));
			return FALSE;
		}
      
		context->animation = g_object_new (GDK_TYPE_PIXBUF_ANI_ANIM, NULL);        
		if (!context->animation) 
		{
			g_set_error_literal (error,
                                             GDK_PIXBUF_ERROR,
                                             GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
                                             _("Not enough memory to load animation"));
			return FALSE;
		}

		context->animation->n_pixbufs = context->NumFrames;
		context->animation->n_frames = context->NumSteps;

		context->animation->total_time = context->NumSteps * (context->DisplayRate * 1000 / 60);
		context->animation->width = 0;
		context->animation->height = 0;

		context->animation->pixbufs = g_try_new0 (GdkPixbuf*, context->NumFrames);
		context->animation->delay = g_try_new (gint, context->NumSteps);
		context->animation->sequence = g_try_new (gint, context->NumSteps);

		if (!context->animation->pixbufs || 
		    !context->animation->delay || 
		    !context->animation->sequence) 
		{
			g_set_error_literal (error,
                                             GDK_PIXBUF_ERROR,
                                             GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
                                             _("Not enough memory to load animation"));
			return FALSE;
		}

		for (i = 0; i < context->NumSteps; i++) 
		{
			/* default values if the corresponding chunks are absent */
			context->animation->delay[i] = context->DisplayRate * 1000 / 60;
			context->animation->sequence[i] = MIN (i, context->NumFrames  - 1);	  
		}
	}
        else if (context->chunk_id == TAG_rate) 
	{
		if (context->chunk_size != 4 * context->NumSteps) 
		{
			g_set_error_literal (error,
                                             GDK_PIXBUF_ERROR,
                                             GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
                                             _("Malformed chunk in animation"));
			return FALSE; 
		}
		if (!context->animation) 
		{
			g_set_error_literal (error,
                                             GDK_PIXBUF_ERROR,
                                             GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
                                             _("Invalid header in animation"));
			return FALSE;
		}

		context->animation->total_time = 0;
		for (i = 0; i < context->NumSteps; i++) 
		{
			context->animation->delay[i] = read_int32 (context) * 1000 / 60;
			context->animation->total_time += context->animation->delay[i];
		}
	}
        else if (context->chunk_id == TAG_seq) 
	{
		if (context->chunk_size != 4 * context->NumSteps) 
		{
			g_set_error_literal (error,
                                             GDK_PIXBUF_ERROR,
                                             GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
                                             _("Malformed chunk in animation"));
			return FALSE; 
		}
		if (!context->animation) 
		{
			g_set_error_literal (error,
                                             GDK_PIXBUF_ERROR,
                                             GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
                                             _("Invalid header in animation"));
			return FALSE;
		}
		for (i = 0; i < context->NumSteps; i++) 
		{
			context->animation->sequence[i] = read_int32 (context);
			if (context->animation->sequence[i] >= context->NumFrames) 
			{
				g_set_error_literal (error,
                                                     GDK_PIXBUF_ERROR,
                                                     GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
                                                     _("Malformed chunk in animation"));
				return FALSE; 
			}
		}
	}
        else if (context->chunk_id == TAG_INAM) 
	{
		if (!context->animation) 
		{
			g_set_error_literal (error,
                                             GDK_PIXBUF_ERROR,
                                             GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
                                             _("Invalid header in animation"));
			return FALSE;
		}
		context->title = g_try_malloc (context->chunk_size + 1);
		if (!context->title) 
		{
			g_set_error_literal (error,
                                             GDK_PIXBUF_ERROR,
                                             GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
                                             _("Not enough memory to load animation"));
			return FALSE;
		}
		context->title[context->chunk_size] = 0;
		read_int8 (context, (guchar *)context->title, context->chunk_size);
#ifdef DEBUG_ANI
		g_print ("INAM %s\n", context->title);
#endif
		for (i = 0; i < context->pos; i++)
			gdk_pixbuf_set_option (context->animation->pixbufs[i], "Title", context->title);			
	}
        else if (context->chunk_id == TAG_IART) 
	{
		if (!context->animation) 
		{
			g_set_error_literal (error,
                                             GDK_PIXBUF_ERROR,
                                             GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
                                             _("Invalid header in animation"));
			return FALSE;
		}
		context->author = g_try_malloc (context->chunk_size + 1);
		if (!context->author) 
		{
			g_set_error_literal (error,
                                             GDK_PIXBUF_ERROR,
                                             GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
                                             _("Not enough memory to load animation"));
			return FALSE;
		}
		context->author[context->chunk_size] = 0;
		read_int8 (context, (guchar *)context->author, context->chunk_size);
#ifdef DEBUG_ANI
		g_print ("IART %s\n", context->author);
#endif
		for (i = 0; i < context->pos; i++)
			gdk_pixbuf_set_option (context->animation->pixbufs[i], "Author", context->author);			
	}

#ifdef DEBUG_ANI
	{
		gint32 dummy = lsb_32 ((guchar *)&context->chunk_id);
        
		g_print ("Loaded chunk with ID '%c%c%c%c' and length %" G_GUINT32_FORMAT "\n",
			 ((char*)&dummy)[0], ((char*)&dummy)[1],
			 ((char*)&dummy)[2], ((char*)&dummy)[3], 
			 context->chunk_size);
	}
#endif 
		
	context->chunk_id = 0x0;
        return TRUE;
}

static gboolean
gdk_pixbuf__ani_image_load_increment (gpointer data,
				      const guchar *buf, guint size,
				      GError **error)
{
        AniLoaderContext *context = (AniLoaderContext *)data;
        
        if (context->n_bytes + size >= context->buffer_size) {
                int drop = context->byte - context->buffer;
                memmove (context->buffer, context->byte, context->n_bytes - drop);
                context->n_bytes -= drop;
                context->byte = context->buffer;
                if (context->n_bytes + size >= context->buffer_size) {
			guchar *tmp;
                        context->buffer_size = MAX (context->n_bytes + size, context->buffer_size + 4096);
#ifdef DEBUG_ANI
                        g_print ("growing buffer to %" G_GUINT32_FORMAT "\n", context->buffer_size);
#endif
                        tmp = g_try_realloc (context->buffer, context->buffer_size);
                        if (!tmp) 
			{
				g_set_error_literal (error,
                                                     GDK_PIXBUF_ERROR,
                                                     GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
                                                     _("Not enough memory to load animation"));
				return FALSE;
			}
                        context->byte = context->buffer = tmp;
                }
        }
        memcpy (context->buffer + context->n_bytes, buf, size);
        context->n_bytes += size;

        if (context->data_size == 0) 
	{
		guint32 riff_id, chunk_id;
                        
		if (BYTES_LEFT (context) < 12)
			return TRUE;
                        
		riff_id = read_int32 (context);
		context->data_size = read_int32 (context);
		chunk_id = read_int32 (context);
                        
		if (riff_id != TAG_RIFF || 
		    context->data_size == 0 || 
		    chunk_id != TAG_ACON) 
		{
			g_set_error_literal (error,
                                             GDK_PIXBUF_ERROR,
                                             GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
                                             _("Invalid header in animation"));
			return FALSE; 
		}
	}
        
        if (context->cp < context->data_size + 8) 
	{
		GError *chunk_error = NULL;

		while (ani_load_chunk (context, &chunk_error)) ;
		if (chunk_error) 
		{
			g_propagate_error (error, chunk_error);
			return FALSE;
		}
	}

        return TRUE;
}

static gpointer
gdk_pixbuf__ani_image_begin_load (GdkPixbufModuleSizeFunc size_func, 
                                  GdkPixbufModulePreparedFunc prepared_func, 
				  GdkPixbufModuleUpdatedFunc  updated_func,
				  gpointer user_data,
				  GError **error)
{
        AniLoaderContext *context;
        
	g_assert (size_func != NULL);
	g_assert (prepared_func != NULL);
	g_assert (updated_func != NULL);

        context = g_new0 (AniLoaderContext, 1);
        
        context->prepared_func = prepared_func;
        context->updated_func = updated_func;
        context->user_data = user_data;
        
        context->pos = 0;
        
        context->buffer_size = 4096;
        context->buffer = g_try_malloc (context->buffer_size);
        if (!context->buffer) 
	{
		context_free (context);
		g_set_error_literal (error,
                                     GDK_PIXBUF_ERROR,
                                     GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
                                     _("Not enough memory to load animation"));
		return NULL;
	}
        
        context->byte = context->buffer;
        context->n_bytes = 0;
        
        return (gpointer) context;
}

static gboolean
gdk_pixbuf__ani_image_stop_load (gpointer data,
				 GError **error)
{
        AniLoaderContext *context = (AniLoaderContext *) data;
        gboolean retval;

	g_return_val_if_fail (context != NULL, TRUE);
        if (!context->animation) {
                g_set_error_literal (error,
                                     GDK_PIXBUF_ERROR,
                                     GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
                                     _("ANI image was truncated or incomplete."));
                retval = FALSE;
        }
        else {
                retval = TRUE;
        }
        context_free (context);

        return retval;
}

#ifndef INCLUDE_ani
#define MODULE_ENTRY(function) G_MODULE_EXPORT void function
#else
#define MODULE_ENTRY(function) void _gdk_pixbuf__ani_ ## function
#endif

MODULE_ENTRY (fill_vtable) (GdkPixbufModule *module)
{
        module->begin_load = gdk_pixbuf__ani_image_begin_load;
        module->stop_load = gdk_pixbuf__ani_image_stop_load;
        module->load_increment = gdk_pixbuf__ani_image_load_increment;
}

MODULE_ENTRY (fill_info) (GdkPixbufFormat *info)
{
	static const GdkPixbufModulePattern signature[] = {
		{ "RIFF    ACON", "    xxxx    ", 100 },
		{ NULL, NULL, 0 }
	};
	static const gchar * mime_types[] = {
		"application/x-navi-animation",
		NULL
	};
	static const gchar * extensions[] = {
		"ani",
		NULL
	};
	
	info->name = "ani";
	info->signature = (GdkPixbufModulePattern *) signature;
	info->description = NC_("image format", "Windows animated cursor");
	info->mime_types = (gchar **) mime_types;
	info->extensions = (gchar **) extensions;
	info->flags = GDK_PIXBUF_FORMAT_THREADSAFE;
	info->license = "LGPL";
}