taglib-ruby 0.6.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +1 -1
  3. data/{CHANGES.md → CHANGELOG.md} +46 -11
  4. data/README.md +61 -17
  5. data/Rakefile +12 -3
  6. data/docs/taglib/aiff.rb +95 -0
  7. data/docs/taglib/base.rb +30 -2
  8. data/docs/taglib/flac.rb +60 -4
  9. data/docs/taglib/id3v1.rb +29 -0
  10. data/docs/taglib/id3v2.rb +22 -3
  11. data/docs/taglib/mp4.rb +124 -13
  12. data/docs/taglib/mpeg.rb +30 -1
  13. data/docs/taglib/ogg.rb +47 -5
  14. data/docs/taglib/riff.rb +3 -0
  15. data/docs/taglib/vorbis.rb +1 -1
  16. data/docs/taglib/wav.rb +116 -0
  17. data/ext/extconf_common.rb +24 -3
  18. data/ext/taglib_aiff/extconf.rb +4 -0
  19. data/ext/taglib_aiff/taglib_aiff.i +84 -0
  20. data/ext/taglib_aiff/taglib_aiff_wrap.cxx +3111 -0
  21. data/ext/taglib_base/includes.i +34 -5
  22. data/ext/taglib_base/taglib_base.i +42 -2
  23. data/ext/taglib_base/taglib_base_wrap.cxx +226 -186
  24. data/ext/taglib_flac/taglib_flac.i +21 -18
  25. data/ext/taglib_flac/taglib_flac_wrap.cxx +519 -955
  26. data/ext/taglib_flac_picture/extconf.rb +4 -0
  27. data/ext/taglib_flac_picture/includes.i +15 -0
  28. data/ext/taglib_flac_picture/taglib_flac_picture.i +15 -0
  29. data/ext/taglib_flac_picture/taglib_flac_picture_wrap.cxx +3087 -0
  30. data/ext/taglib_id3v1/taglib_id3v1.i +19 -0
  31. data/ext/taglib_id3v1/taglib_id3v1_wrap.cxx +391 -193
  32. data/ext/taglib_id3v2/relativevolumeframe.i +4 -17
  33. data/ext/taglib_id3v2/taglib_id3v2.i +72 -2
  34. data/ext/taglib_id3v2/taglib_id3v2_wrap.cxx +3051 -1113
  35. data/ext/taglib_mp4/taglib_mp4.i +101 -20
  36. data/ext/taglib_mp4/taglib_mp4_wrap.cxx +1088 -282
  37. data/ext/taglib_mpeg/taglib_mpeg.i +11 -16
  38. data/ext/taglib_mpeg/taglib_mpeg_wrap.cxx +646 -317
  39. data/ext/taglib_ogg/taglib_ogg.i +11 -0
  40. data/ext/taglib_ogg/taglib_ogg_wrap.cxx +478 -192
  41. data/ext/taglib_vorbis/taglib_vorbis.i +8 -0
  42. data/ext/taglib_vorbis/taglib_vorbis_wrap.cxx +202 -156
  43. data/ext/taglib_wav/extconf.rb +4 -0
  44. data/ext/taglib_wav/taglib_wav.i +90 -0
  45. data/ext/taglib_wav/taglib_wav_wrap.cxx +3423 -0
  46. data/lib/taglib.rb +2 -0
  47. data/lib/taglib/aiff.rb +7 -0
  48. data/lib/taglib/mp4.rb +2 -1
  49. data/lib/taglib/version.rb +2 -2
  50. data/lib/taglib/wav.rb +11 -0
  51. data/taglib-ruby.gemspec +42 -8
  52. data/tasks/ext.rake +48 -20
  53. data/tasks/gemspec_check.rake +1 -1
  54. data/tasks/swig.rake +36 -2
  55. data/test/aiff_examples_test.rb +39 -0
  56. data/test/aiff_file_test.rb +103 -0
  57. data/test/aiff_file_write_test.rb +88 -0
  58. data/test/data/Makefile +8 -2
  59. data/test/data/aiff-sample.aiff +0 -0
  60. data/test/data/flac_nopic.flac +0 -0
  61. data/test/data/vorbis-create.cpp +20 -1
  62. data/test/data/vorbis.oga +0 -0
  63. data/test/data/wav-create.cpp +55 -0
  64. data/test/data/wav-dump.cpp +74 -0
  65. data/test/data/wav-sample.wav +0 -0
  66. data/test/file_test.rb +21 -0
  67. data/test/fileref_properties_test.rb +1 -1
  68. data/test/flac_file_test.rb +45 -30
  69. data/test/flac_picture_memory_test.rb +43 -0
  70. data/test/id3v1_genres_test.rb +23 -0
  71. data/test/id3v1_tag_test.rb +1 -0
  72. data/test/id3v2_frames_test.rb +64 -0
  73. data/test/id3v2_tag_test.rb +6 -6
  74. data/test/id3v2_unknown_frames_test.rb +30 -0
  75. data/test/id3v2_write_test.rb +10 -13
  76. data/test/mp4_file_test.rb +33 -4
  77. data/test/mp4_file_write_test.rb +5 -5
  78. data/test/mp4_items_test.rb +83 -29
  79. data/test/mpeg_file_test.rb +120 -7
  80. data/test/vorbis_file_test.rb +2 -2
  81. data/test/vorbis_tag_test.rb +61 -7
  82. data/test/wav_examples_test.rb +42 -0
  83. data/test/wav_file_test.rb +108 -0
  84. data/test/wav_file_write_test.rb +113 -0
  85. metadata +86 -56
@@ -1,6 +1,7 @@
1
1
  %module "TagLib::ID3v1"
2
2
  %{
3
3
  #include <taglib/id3v1tag.h>
4
+ #include <taglib/id3v1genres.h>
4
5
  %}
5
6
 
6
7
  %include "../taglib_base/includes.i"
@@ -8,4 +9,22 @@
8
9
 
9
10
  %include <taglib/id3v1tag.h>
10
11
 
12
+ %typemap(out) TagLib::ID3v1::GenreMap {
13
+ $result = taglib_id3v1_genre_map_to_ruby_hash($1);
14
+ }
15
+
16
+ %include <taglib/id3v1genres.h>
17
+
18
+ %{
19
+ VALUE taglib_id3v1_genre_map_to_ruby_hash(const TagLib::ID3v1::GenreMap &map) {
20
+ VALUE hsh = rb_hash_new();
21
+ for (TagLib::ID3v1::GenreMap::ConstIterator it = map.begin(); it != map.end(); it++) {
22
+ rb_hash_aset(hsh,
23
+ taglib_string_to_ruby_string(it->first),
24
+ INT2NUM(it->second));
25
+ }
26
+ return hsh;
27
+ }
28
+ %}
29
+
11
30
  // vim: set filetype=cpp sw=2 ts=2 expandtab:
@@ -1,11 +1,11 @@
1
1
  /* ----------------------------------------------------------------------------
2
2
  * This file was automatically generated by SWIG (http://www.swig.org).
3
- * Version 2.0.9
4
- *
5
- * This file is not intended to be easily readable and contains a number of
3
+ * Version 3.0.7
4
+ *
5
+ * This file is not intended to be easily readable and contains a number of
6
6
  * coding conventions designed to improve portability and efficiency. Do not make
7
- * changes to this file unless you know what you are doing--modify the SWIG
8
- * interface file instead.
7
+ * changes to this file unless you know what you are doing--modify the SWIG
8
+ * interface file instead.
9
9
  * ----------------------------------------------------------------------------- */
10
10
 
11
11
  #define SWIGRUBY
@@ -65,28 +65,28 @@ template <typename T> T SwigValueInit() {
65
65
  #ifndef SWIGUNUSED
66
66
  # if defined(__GNUC__)
67
67
  # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
68
- # define SWIGUNUSED __attribute__ ((__unused__))
68
+ # define SWIGUNUSED __attribute__ ((__unused__))
69
69
  # else
70
70
  # define SWIGUNUSED
71
71
  # endif
72
72
  # elif defined(__ICC)
73
- # define SWIGUNUSED __attribute__ ((__unused__))
73
+ # define SWIGUNUSED __attribute__ ((__unused__))
74
74
  # else
75
- # define SWIGUNUSED
75
+ # define SWIGUNUSED
76
76
  # endif
77
77
  #endif
78
78
 
79
79
  #ifndef SWIG_MSC_UNSUPPRESS_4505
80
80
  # if defined(_MSC_VER)
81
81
  # pragma warning(disable : 4505) /* unreferenced local function has been removed */
82
- # endif
82
+ # endif
83
83
  #endif
84
84
 
85
85
  #ifndef SWIGUNUSEDPARM
86
86
  # ifdef __cplusplus
87
87
  # define SWIGUNUSEDPARM(p)
88
88
  # else
89
- # define SWIGUNUSEDPARM(p) p SWIGUNUSED
89
+ # define SWIGUNUSEDPARM(p) p SWIGUNUSED
90
90
  # endif
91
91
  #endif
92
92
 
@@ -129,7 +129,7 @@ template <typename T> T SwigValueInit() {
129
129
  # define SWIGSTDCALL __stdcall
130
130
  # else
131
131
  # define SWIGSTDCALL
132
- # endif
132
+ # endif
133
133
  #endif
134
134
 
135
135
  /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
@@ -142,6 +142,19 @@ template <typename T> T SwigValueInit() {
142
142
  # define _SCL_SECURE_NO_DEPRECATE
143
143
  #endif
144
144
 
145
+ /* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */
146
+ #if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES)
147
+ # define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
148
+ #endif
149
+
150
+ /* Intel's compiler complains if a variable which was never initialised is
151
+ * cast to void, which is a common idiom which we use to indicate that we
152
+ * are aware a variable isn't used. So we just silence that warning.
153
+ * See: https://github.com/swig/swig/issues/192 for more discussion.
154
+ */
155
+ #ifdef __INTEL_COMPILER
156
+ # pragma warning disable 592
157
+ #endif
145
158
 
146
159
  /* -----------------------------------------------------------------------------
147
160
  * This section contains generic SWIG labels for method/variable
@@ -174,28 +187,28 @@ template <typename T> T SwigValueInit() {
174
187
  #ifndef SWIGUNUSED
175
188
  # if defined(__GNUC__)
176
189
  # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
177
- # define SWIGUNUSED __attribute__ ((__unused__))
190
+ # define SWIGUNUSED __attribute__ ((__unused__))
178
191
  # else
179
192
  # define SWIGUNUSED
180
193
  # endif
181
194
  # elif defined(__ICC)
182
- # define SWIGUNUSED __attribute__ ((__unused__))
195
+ # define SWIGUNUSED __attribute__ ((__unused__))
183
196
  # else
184
- # define SWIGUNUSED
197
+ # define SWIGUNUSED
185
198
  # endif
186
199
  #endif
187
200
 
188
201
  #ifndef SWIG_MSC_UNSUPPRESS_4505
189
202
  # if defined(_MSC_VER)
190
203
  # pragma warning(disable : 4505) /* unreferenced local function has been removed */
191
- # endif
204
+ # endif
192
205
  #endif
193
206
 
194
207
  #ifndef SWIGUNUSEDPARM
195
208
  # ifdef __cplusplus
196
209
  # define SWIGUNUSEDPARM(p)
197
210
  # else
198
- # define SWIGUNUSEDPARM(p) p SWIGUNUSED
211
+ # define SWIGUNUSEDPARM(p) p SWIGUNUSED
199
212
  # endif
200
213
  #endif
201
214
 
@@ -238,7 +251,7 @@ template <typename T> T SwigValueInit() {
238
251
  # define SWIGSTDCALL __stdcall
239
252
  # else
240
253
  # define SWIGSTDCALL
241
- # endif
254
+ # endif
242
255
  #endif
243
256
 
244
257
  /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
@@ -251,6 +264,19 @@ template <typename T> T SwigValueInit() {
251
264
  # define _SCL_SECURE_NO_DEPRECATE
252
265
  #endif
253
266
 
267
+ /* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */
268
+ #if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES)
269
+ # define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
270
+ #endif
271
+
272
+ /* Intel's compiler complains if a variable which was never initialised is
273
+ * cast to void, which is a common idiom which we use to indicate that we
274
+ * are aware a variable isn't used. So we just silence that warning.
275
+ * See: https://github.com/swig/swig/issues/192 for more discussion.
276
+ */
277
+ #ifdef __INTEL_COMPILER
278
+ # pragma warning disable 592
279
+ #endif
254
280
 
255
281
  /* -----------------------------------------------------------------------------
256
282
  * swigrun.swg
@@ -276,7 +302,7 @@ template <typename T> T SwigValueInit() {
276
302
  You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
277
303
  creating a static or dynamic library from the SWIG runtime code.
278
304
  In 99.9% of the cases, SWIG just needs to declare them as 'static'.
279
-
305
+
280
306
  But only do this if strictly necessary, ie, if you have problems
281
307
  with your compiler or suchlike.
282
308
  */
@@ -302,16 +328,16 @@ template <typename T> T SwigValueInit() {
302
328
  #define SWIG_POINTER_OWN 0x1
303
329
 
304
330
 
305
- /*
331
+ /*
306
332
  Flags/methods for returning states.
307
-
308
- The SWIG conversion methods, as ConvertPtr, return an integer
333
+
334
+ The SWIG conversion methods, as ConvertPtr, return an integer
309
335
  that tells if the conversion was successful or not. And if not,
310
336
  an error code can be returned (see swigerrors.swg for the codes).
311
-
337
+
312
338
  Use the following macros/flags to set or process the returning
313
339
  states.
314
-
340
+
315
341
  In old versions of SWIG, code such as the following was usually written:
316
342
 
317
343
  if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
@@ -344,23 +370,23 @@ template <typename T> T SwigValueInit() {
344
370
  } else {
345
371
  // fail code
346
372
  }
347
-
373
+
348
374
  I.e., now SWIG_ConvertPtr can return new objects and you can
349
375
  identify the case and take care of the deallocation. Of course that
350
376
  also requires SWIG_ConvertPtr to return new result values, such as
351
377
 
352
- int SWIG_ConvertPtr(obj, ptr,...) {
353
- if (<obj is ok>) {
354
- if (<need new object>) {
355
- *ptr = <ptr to new allocated object>;
356
- return SWIG_NEWOBJ;
357
- } else {
358
- *ptr = <ptr to old object>;
359
- return SWIG_OLDOBJ;
360
- }
361
- } else {
362
- return SWIG_BADOBJ;
363
- }
378
+ int SWIG_ConvertPtr(obj, ptr,...) {
379
+ if (<obj is ok>) {
380
+ if (<need new object>) {
381
+ *ptr = <ptr to new allocated object>;
382
+ return SWIG_NEWOBJ;
383
+ } else {
384
+ *ptr = <ptr to old object>;
385
+ return SWIG_OLDOBJ;
386
+ }
387
+ } else {
388
+ return SWIG_BADOBJ;
389
+ }
364
390
  }
365
391
 
366
392
  Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
@@ -374,17 +400,17 @@ template <typename T> T SwigValueInit() {
374
400
  int fooi(int);
375
401
 
376
402
  and you call
377
-
403
+
378
404
  food(1) // cast rank '1' (1 -> 1.0)
379
405
  fooi(1) // cast rank '0'
380
406
 
381
407
  just use the SWIG_AddCast()/SWIG_CheckState()
382
408
  */
383
409
 
384
- #define SWIG_OK (0)
410
+ #define SWIG_OK (0)
385
411
  #define SWIG_ERROR (-1)
386
412
  #define SWIG_IsOK(r) (r >= 0)
387
- #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
413
+ #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
388
414
 
389
415
  /* The CastRankLimit says how many bits are used for the cast rank */
390
416
  #define SWIG_CASTRANKLIMIT (1 << 8)
@@ -415,14 +441,14 @@ template <typename T> T SwigValueInit() {
415
441
  # endif
416
442
  # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
417
443
  # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
418
- SWIGINTERNINLINE int SWIG_AddCast(int r) {
444
+ SWIGINTERNINLINE int SWIG_AddCast(int r) {
419
445
  return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
420
446
  }
421
- SWIGINTERNINLINE int SWIG_CheckState(int r) {
422
- return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
447
+ SWIGINTERNINLINE int SWIG_CheckState(int r) {
448
+ return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
423
449
  }
424
450
  #else /* no cast-rank mode */
425
- # define SWIG_AddCast
451
+ # define SWIG_AddCast(r) (r)
426
452
  # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
427
453
  #endif
428
454
 
@@ -466,7 +492,7 @@ typedef struct swig_module_info {
466
492
  void *clientdata; /* Language specific module data */
467
493
  } swig_module_info;
468
494
 
469
- /*
495
+ /*
470
496
  Compare two type names skipping the space characters, therefore
471
497
  "char*" == "char *" and "Class<int>" == "Class<int >", etc.
472
498
 
@@ -486,18 +512,18 @@ SWIG_TypeNameComp(const char *f1, const char *l1,
486
512
 
487
513
  /*
488
514
  Check type equivalence in a name list like <name1>|<name2>|...
489
- Return 0 if not equal, 1 if equal
515
+ Return 0 if equal, -1 if nb < tb, 1 if nb > tb
490
516
  */
491
517
  SWIGRUNTIME int
492
- SWIG_TypeEquiv(const char *nb, const char *tb) {
493
- int equiv = 0;
518
+ SWIG_TypeCmp(const char *nb, const char *tb) {
519
+ int equiv = 1;
494
520
  const char* te = tb + strlen(tb);
495
521
  const char* ne = nb;
496
- while (!equiv && *ne) {
522
+ while (equiv != 0 && *ne) {
497
523
  for (nb = ne; *ne; ++ne) {
498
524
  if (*ne == '|') break;
499
525
  }
500
- equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
526
+ equiv = SWIG_TypeNameComp(nb, ne, tb, te);
501
527
  if (*ne) ++ne;
502
528
  }
503
529
  return equiv;
@@ -505,24 +531,13 @@ SWIG_TypeEquiv(const char *nb, const char *tb) {
505
531
 
506
532
  /*
507
533
  Check type equivalence in a name list like <name1>|<name2>|...
508
- Return 0 if equal, -1 if nb < tb, 1 if nb > tb
534
+ Return 0 if not equal, 1 if equal
509
535
  */
510
536
  SWIGRUNTIME int
511
- SWIG_TypeCompare(const char *nb, const char *tb) {
512
- int equiv = 0;
513
- const char* te = tb + strlen(tb);
514
- const char* ne = nb;
515
- while (!equiv && *ne) {
516
- for (nb = ne; *ne; ++ne) {
517
- if (*ne == '|') break;
518
- }
519
- equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
520
- if (*ne) ++ne;
521
- }
522
- return equiv;
537
+ SWIG_TypeEquiv(const char *nb, const char *tb) {
538
+ return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
523
539
  }
524
540
 
525
-
526
541
  /*
527
542
  Check the typename
528
543
  */
@@ -550,7 +565,7 @@ SWIG_TypeCheck(const char *c, swig_type_info *ty) {
550
565
  return 0;
551
566
  }
552
567
 
553
- /*
568
+ /*
554
569
  Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
555
570
  */
556
571
  SWIGRUNTIME swig_cast_info *
@@ -585,7 +600,7 @@ SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
585
600
  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
586
601
  }
587
602
 
588
- /*
603
+ /*
589
604
  Dynamic pointer casting. Down an inheritance hierarchy
590
605
  */
591
606
  SWIGRUNTIME swig_type_info *
@@ -629,7 +644,7 @@ SWIG_TypePrettyName(const swig_type_info *type) {
629
644
  return type->name;
630
645
  }
631
646
 
632
- /*
647
+ /*
633
648
  Set the clientdata field for a type
634
649
  */
635
650
  SWIGRUNTIME void
@@ -637,14 +652,14 @@ SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
637
652
  swig_cast_info *cast = ti->cast;
638
653
  /* if (ti->clientdata == clientdata) return; */
639
654
  ti->clientdata = clientdata;
640
-
655
+
641
656
  while (cast) {
642
657
  if (!cast->converter) {
643
658
  swig_type_info *tc = cast->type;
644
659
  if (!tc->clientdata) {
645
660
  SWIG_TypeClientData(tc, clientdata);
646
661
  }
647
- }
662
+ }
648
663
  cast = cast->next;
649
664
  }
650
665
  }
@@ -653,31 +668,31 @@ SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
653
668
  SWIG_TypeClientData(ti, clientdata);
654
669
  ti->owndata = 1;
655
670
  }
656
-
671
+
657
672
  /*
658
673
  Search for a swig_type_info structure only by mangled name
659
674
  Search is a O(log #types)
660
-
661
- We start searching at module start, and finish searching when start == end.
675
+
676
+ We start searching at module start, and finish searching when start == end.
662
677
  Note: if start == end at the beginning of the function, we go all the way around
663
678
  the circular list.
664
679
  */
665
680
  SWIGRUNTIME swig_type_info *
666
- SWIG_MangledTypeQueryModule(swig_module_info *start,
667
- swig_module_info *end,
681
+ SWIG_MangledTypeQueryModule(swig_module_info *start,
682
+ swig_module_info *end,
668
683
  const char *name) {
669
684
  swig_module_info *iter = start;
670
685
  do {
671
686
  if (iter->size) {
672
- register size_t l = 0;
673
- register size_t r = iter->size - 1;
687
+ size_t l = 0;
688
+ size_t r = iter->size - 1;
674
689
  do {
675
690
  /* since l+r >= 0, we can (>> 1) instead (/ 2) */
676
- register size_t i = (l + r) >> 1;
691
+ size_t i = (l + r) >> 1;
677
692
  const char *iname = iter->types[i]->name;
678
693
  if (iname) {
679
- register int compare = strcmp(name, iname);
680
- if (compare == 0) {
694
+ int compare = strcmp(name, iname);
695
+ if (compare == 0) {
681
696
  return iter->types[i];
682
697
  } else if (compare < 0) {
683
698
  if (i) {
@@ -702,14 +717,14 @@ SWIG_MangledTypeQueryModule(swig_module_info *start,
702
717
  Search for a swig_type_info structure for either a mangled name or a human readable name.
703
718
  It first searches the mangled names of the types, which is a O(log #types)
704
719
  If a type is not found it then searches the human readable names, which is O(#types).
705
-
706
- We start searching at module start, and finish searching when start == end.
720
+
721
+ We start searching at module start, and finish searching when start == end.
707
722
  Note: if start == end at the beginning of the function, we go all the way around
708
723
  the circular list.
709
724
  */
710
725
  SWIGRUNTIME swig_type_info *
711
- SWIG_TypeQueryModule(swig_module_info *start,
712
- swig_module_info *end,
726
+ SWIG_TypeQueryModule(swig_module_info *start,
727
+ swig_module_info *end,
713
728
  const char *name) {
714
729
  /* STEP 1: Search the name field using binary search */
715
730
  swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
@@ -720,7 +735,7 @@ SWIG_TypeQueryModule(swig_module_info *start,
720
735
  of the str field (the human readable name) */
721
736
  swig_module_info *iter = start;
722
737
  do {
723
- register size_t i = 0;
738
+ size_t i = 0;
724
739
  for (; i < iter->size; ++i) {
725
740
  if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
726
741
  return iter->types[i];
@@ -728,56 +743,56 @@ SWIG_TypeQueryModule(swig_module_info *start,
728
743
  iter = iter->next;
729
744
  } while (iter != end);
730
745
  }
731
-
746
+
732
747
  /* neither found a match */
733
748
  return 0;
734
749
  }
735
750
 
736
- /*
751
+ /*
737
752
  Pack binary data into a string
738
753
  */
739
754
  SWIGRUNTIME char *
740
755
  SWIG_PackData(char *c, void *ptr, size_t sz) {
741
756
  static const char hex[17] = "0123456789abcdef";
742
- register const unsigned char *u = (unsigned char *) ptr;
743
- register const unsigned char *eu = u + sz;
757
+ const unsigned char *u = (unsigned char *) ptr;
758
+ const unsigned char *eu = u + sz;
744
759
  for (; u != eu; ++u) {
745
- register unsigned char uu = *u;
760
+ unsigned char uu = *u;
746
761
  *(c++) = hex[(uu & 0xf0) >> 4];
747
762
  *(c++) = hex[uu & 0xf];
748
763
  }
749
764
  return c;
750
765
  }
751
766
 
752
- /*
767
+ /*
753
768
  Unpack binary data from a string
754
769
  */
755
770
  SWIGRUNTIME const char *
756
771
  SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
757
- register unsigned char *u = (unsigned char *) ptr;
758
- register const unsigned char *eu = u + sz;
772
+ unsigned char *u = (unsigned char *) ptr;
773
+ const unsigned char *eu = u + sz;
759
774
  for (; u != eu; ++u) {
760
- register char d = *(c++);
761
- register unsigned char uu;
775
+ char d = *(c++);
776
+ unsigned char uu;
762
777
  if ((d >= '0') && (d <= '9'))
763
778
  uu = ((d - '0') << 4);
764
779
  else if ((d >= 'a') && (d <= 'f'))
765
780
  uu = ((d - ('a'-10)) << 4);
766
- else
781
+ else
767
782
  return (char *) 0;
768
783
  d = *(c++);
769
784
  if ((d >= '0') && (d <= '9'))
770
785
  uu |= (d - '0');
771
786
  else if ((d >= 'a') && (d <= 'f'))
772
787
  uu |= (d - ('a'-10));
773
- else
788
+ else
774
789
  return (char *) 0;
775
790
  *u = uu;
776
791
  }
777
792
  return c;
778
793
  }
779
794
 
780
- /*
795
+ /*
781
796
  Pack 'void *' into a string buffer.
782
797
  */
783
798
  SWIGRUNTIME char *
@@ -837,18 +852,18 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
837
852
  #endif
838
853
 
839
854
  /* Errors in SWIG */
840
- #define SWIG_UnknownError -1
841
- #define SWIG_IOError -2
842
- #define SWIG_RuntimeError -3
843
- #define SWIG_IndexError -4
844
- #define SWIG_TypeError -5
845
- #define SWIG_DivisionByZero -6
846
- #define SWIG_OverflowError -7
847
- #define SWIG_SyntaxError -8
848
- #define SWIG_ValueError -9
855
+ #define SWIG_UnknownError -1
856
+ #define SWIG_IOError -2
857
+ #define SWIG_RuntimeError -3
858
+ #define SWIG_IndexError -4
859
+ #define SWIG_TypeError -5
860
+ #define SWIG_DivisionByZero -6
861
+ #define SWIG_OverflowError -7
862
+ #define SWIG_SyntaxError -8
863
+ #define SWIG_ValueError -9
849
864
  #define SWIG_SystemError -10
850
865
  #define SWIG_AttributeError -11
851
- #define SWIG_MemoryError -12
866
+ #define SWIG_MemoryError -12
852
867
  #define SWIG_NullReferenceError -13
853
868
 
854
869
 
@@ -1514,14 +1529,13 @@ SWIG_Ruby_InitRuntime(void)
1514
1529
  SWIGRUNTIME void
1515
1530
  SWIG_Ruby_define_class(swig_type_info *type)
1516
1531
  {
1517
- VALUE klass;
1518
1532
  char *klass_name = (char *) malloc(4 + strlen(type->name) + 1);
1519
1533
  sprintf(klass_name, "TYPE%s", type->name);
1520
1534
  if (NIL_P(_cSWIG_Pointer)) {
1521
1535
  _cSWIG_Pointer = rb_define_class_under(_mSWIG, "Pointer", rb_cObject);
1522
1536
  rb_undef_method(CLASS_OF(_cSWIG_Pointer), "new");
1523
1537
  }
1524
- klass = rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer);
1538
+ rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer);
1525
1539
  free((void *) klass_name);
1526
1540
  }
1527
1541
 
@@ -1774,7 +1788,7 @@ SWIG_Ruby_SetModule(swig_module_info *pointer)
1774
1788
  SWIGINTERN
1775
1789
  int SWIG_Ruby_isCallable( VALUE proc )
1776
1790
  {
1777
- if ( rb_respond_to( proc, swig_call_id ) == Qtrue )
1791
+ if ( rb_respond_to( proc, swig_call_id ) )
1778
1792
  return 1;
1779
1793
  return 0;
1780
1794
  }
@@ -1787,7 +1801,7 @@ int SWIG_Ruby_isCallable( VALUE proc )
1787
1801
  SWIGINTERN
1788
1802
  int SWIG_Ruby_arity( VALUE proc, int minimal )
1789
1803
  {
1790
- if ( rb_respond_to( proc, swig_arity_id ) == Qtrue )
1804
+ if ( rb_respond_to( proc, swig_arity_id ) )
1791
1805
  {
1792
1806
  VALUE num = rb_funcall( proc, swig_arity_id, 0 );
1793
1807
  int arity = NUM2INT(num);
@@ -1813,17 +1827,18 @@ int SWIG_Ruby_arity( VALUE proc, int minimal )
1813
1827
 
1814
1828
  /* -------- TYPES TABLE (BEGIN) -------- */
1815
1829
 
1816
- #define SWIGTYPE_p_TagLib__File swig_types[0]
1817
- #define SWIGTYPE_p_TagLib__ID3v1__StringHandler swig_types[1]
1818
- #define SWIGTYPE_p_TagLib__ID3v1__Tag swig_types[2]
1819
- #define SWIGTYPE_p_TagLib__Tag swig_types[3]
1820
- #define SWIGTYPE_p_char swig_types[4]
1821
- #define SWIGTYPE_p_unsigned_char swig_types[5]
1822
- #define SWIGTYPE_p_unsigned_int swig_types[6]
1823
- #define SWIGTYPE_p_unsigned_long swig_types[7]
1824
- #define SWIGTYPE_p_wchar_t swig_types[8]
1825
- static swig_type_info *swig_types[10];
1826
- static swig_module_info swig_module = {swig_types, 9, 0, 0, 0, 0};
1830
+ #define SWIGTYPE_p_MapT_TagLib__String_int_t swig_types[0]
1831
+ #define SWIGTYPE_p_TagLib__File swig_types[1]
1832
+ #define SWIGTYPE_p_TagLib__ID3v1__StringHandler swig_types[2]
1833
+ #define SWIGTYPE_p_TagLib__ID3v1__Tag swig_types[3]
1834
+ #define SWIGTYPE_p_TagLib__Tag swig_types[4]
1835
+ #define SWIGTYPE_p_char swig_types[5]
1836
+ #define SWIGTYPE_p_unsigned_char swig_types[6]
1837
+ #define SWIGTYPE_p_unsigned_int swig_types[7]
1838
+ #define SWIGTYPE_p_unsigned_long swig_types[8]
1839
+ #define SWIGTYPE_p_wchar_t swig_types[9]
1840
+ static swig_type_info *swig_types[11];
1841
+ static swig_module_info swig_module = {swig_types, 10, 0, 0, 0, 0};
1827
1842
  #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
1828
1843
  #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
1829
1844
 
@@ -1838,7 +1853,7 @@ static VALUE mID3v1;
1838
1853
  #define SWIG_RUBY_THREAD_END_BLOCK
1839
1854
 
1840
1855
 
1841
- #define SWIGVERSION 0x020009
1856
+ #define SWIGVERSION 0x030007
1842
1857
  #define SWIG_VERSION SWIGVERSION
1843
1858
 
1844
1859
 
@@ -1850,6 +1865,7 @@ static VALUE mID3v1;
1850
1865
 
1851
1866
 
1852
1867
  #include <taglib/id3v1tag.h>
1868
+ #include <taglib/id3v1genres.h>
1853
1869
 
1854
1870
 
1855
1871
  #include <taglib/tstring.h>
@@ -1859,9 +1875,11 @@ static VALUE mID3v1;
1859
1875
  #if defined(HAVE_RUBY_ENCODING_H) && HAVE_RUBY_ENCODING_H
1860
1876
  # include <ruby/encoding.h>
1861
1877
  # define ASSOCIATE_UTF8_ENCODING(value) rb_enc_associate(value, rb_utf8_encoding());
1878
+ # define ASSOCIATE_FILESYSTEM_ENCODING(value) rb_enc_associate(value, rb_filesystem_encoding());
1862
1879
  # define CONVERT_TO_UTF8(value) rb_str_export_to_enc(value, rb_utf8_encoding())
1863
1880
  #else
1864
1881
  # define ASSOCIATE_UTF8_ENCODING(value) /* nothing */
1882
+ # define ASSOCIATE_FILESYSTEM_ENCODING(value)
1865
1883
  # define CONVERT_TO_UTF8(value) value
1866
1884
  #endif
1867
1885
 
@@ -1869,7 +1887,7 @@ VALUE taglib_bytevector_to_ruby_string(const TagLib::ByteVector &byteVector) {
1869
1887
  if (byteVector.isNull()) {
1870
1888
  return Qnil;
1871
1889
  } else {
1872
- return rb_tainted_str_new(byteVector.data(), byteVector.size());
1890
+ return rb_str_new(byteVector.data(), byteVector.size());
1873
1891
  }
1874
1892
  }
1875
1893
 
@@ -1885,7 +1903,7 @@ VALUE taglib_string_to_ruby_string(const TagLib::String & string) {
1885
1903
  if (string.isNull()) {
1886
1904
  return Qnil;
1887
1905
  } else {
1888
- VALUE result = rb_tainted_str_new2(string.toCString(true));
1906
+ VALUE result = rb_str_new2(string.toCString(true));
1889
1907
  ASSOCIATE_UTF8_ENCODING(result);
1890
1908
  return result;
1891
1909
  }
@@ -1914,7 +1932,7 @@ TagLib::StringList ruby_array_to_taglib_string_list(VALUE ary) {
1914
1932
  return result;
1915
1933
  }
1916
1934
  for (long i = 0; i < RARRAY_LEN(ary); i++) {
1917
- VALUE e = RARRAY_PTR(ary)[i];
1935
+ VALUE e = rb_ary_entry(ary, i);
1918
1936
  TagLib::String s = ruby_string_to_taglib_string(e);
1919
1937
  result.append(s);
1920
1938
  }
@@ -1922,12 +1940,15 @@ TagLib::StringList ruby_array_to_taglib_string_list(VALUE ary) {
1922
1940
  }
1923
1941
 
1924
1942
  VALUE taglib_filename_to_ruby_string(TagLib::FileName filename) {
1943
+ VALUE result;
1925
1944
  #ifdef _WIN32
1926
1945
  const char *s = (const char *) filename;
1927
- return rb_tainted_str_new2(s);
1946
+ result = rb_str_new2(s);
1928
1947
  #else
1929
- return rb_tainted_str_new2(filename);
1948
+ result = rb_str_new2(filename);
1930
1949
  #endif
1950
+ ASSOCIATE_FILESYSTEM_ENCODING(result);
1951
+ return result;
1931
1952
  }
1932
1953
 
1933
1954
  TagLib::FileName ruby_string_to_taglib_filename(VALUE s) {
@@ -2016,7 +2037,7 @@ SWIG_ruby_failed(void)
2016
2037
  }
2017
2038
 
2018
2039
 
2019
- /*@SWIG:/usr/local/share/swig/2.0.9/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2040
+ /*@SWIG:/usr/local/share/swig/3.0.7/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2020
2041
  SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args)
2021
2042
  {
2022
2043
  VALUE obj = args[0];
@@ -2072,7 +2093,7 @@ SWIG_From_unsigned_SS_int (unsigned int value)
2072
2093
  }
2073
2094
 
2074
2095
 
2075
- /*@SWIG:/usr/local/share/swig/2.0.9/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2096
+ /*@SWIG:/usr/local/share/swig/3.0.7/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2076
2097
  SWIGINTERN VALUE SWIG_AUX_NUM2ULONG(VALUE *args)
2077
2098
  {
2078
2099
  VALUE obj = args[0];
@@ -2116,8 +2137,75 @@ SWIG_AsVal_unsigned_SS_int (VALUE obj, unsigned int *val)
2116
2137
  return res;
2117
2138
  }
2118
2139
 
2140
+
2141
+ SWIGINTERN int
2142
+ SWIG_AsVal_int (VALUE obj, int *val)
2143
+ {
2144
+ long v;
2145
+ int res = SWIG_AsVal_long (obj, &v);
2146
+ if (SWIG_IsOK(res)) {
2147
+ if ((v < INT_MIN || v > INT_MAX)) {
2148
+ return SWIG_OverflowError;
2149
+ } else {
2150
+ if (val) *val = static_cast< int >(v);
2151
+ }
2152
+ }
2153
+ return res;
2154
+ }
2155
+
2156
+
2157
+ SWIGINTERNINLINE VALUE
2158
+ SWIG_From_int (int value)
2159
+ {
2160
+ return SWIG_From_long (value);
2161
+ }
2162
+
2163
+
2164
+ VALUE taglib_id3v1_genre_map_to_ruby_hash(const TagLib::ID3v1::GenreMap &map) {
2165
+ VALUE hsh = rb_hash_new();
2166
+ for (TagLib::ID3v1::GenreMap::ConstIterator it = map.begin(); it != map.end(); it++) {
2167
+ rb_hash_aset(hsh,
2168
+ taglib_string_to_ruby_string(it->first),
2169
+ INT2NUM(it->second));
2170
+ }
2171
+ return hsh;
2172
+ }
2173
+
2119
2174
  static swig_class SwigClassStringHandler;
2120
2175
 
2176
+ #ifdef HAVE_RB_DEFINE_ALLOC_FUNC
2177
+ SWIGINTERN VALUE
2178
+ _wrap_StringHandler_allocate(VALUE self) {
2179
+ #else
2180
+ SWIGINTERN VALUE
2181
+ _wrap_StringHandler_allocate(int argc, VALUE *argv, VALUE self) {
2182
+ #endif
2183
+
2184
+
2185
+ VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_TagLib__ID3v1__StringHandler);
2186
+ #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
2187
+ rb_obj_call_init(vresult, argc, argv);
2188
+ #endif
2189
+ return vresult;
2190
+ }
2191
+
2192
+
2193
+ SWIGINTERN VALUE
2194
+ _wrap_new_StringHandler(int argc, VALUE *argv, VALUE self) {
2195
+ TagLib::ID3v1::StringHandler *result = 0 ;
2196
+
2197
+ if ((argc < 0) || (argc > 0)) {
2198
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2199
+ }
2200
+ result = (TagLib::ID3v1::StringHandler *)new TagLib::ID3v1::StringHandler();
2201
+ DATA_PTR(self) = result;
2202
+ SWIG_RubyAddTracking(result, self);
2203
+ return self;
2204
+ fail:
2205
+ return Qnil;
2206
+ }
2207
+
2208
+
2121
2209
  SWIGINTERN VALUE
2122
2210
  _wrap_StringHandler_parse(int argc, VALUE *argv, VALUE self) {
2123
2211
  TagLib::ID3v1::StringHandler *arg1 = (TagLib::ID3v1::StringHandler *) 0 ;
@@ -2182,39 +2270,6 @@ fail:
2182
2270
  }
2183
2271
 
2184
2272
 
2185
- #ifdef HAVE_RB_DEFINE_ALLOC_FUNC
2186
- SWIGINTERN VALUE
2187
- _wrap_StringHandler_allocate(VALUE self) {
2188
- #else
2189
- SWIGINTERN VALUE
2190
- _wrap_StringHandler_allocate(int argc, VALUE *argv, VALUE self) {
2191
- #endif
2192
-
2193
-
2194
- VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_TagLib__ID3v1__StringHandler);
2195
- #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
2196
- rb_obj_call_init(vresult, argc, argv);
2197
- #endif
2198
- return vresult;
2199
- }
2200
-
2201
-
2202
- SWIGINTERN VALUE
2203
- _wrap_new_StringHandler(int argc, VALUE *argv, VALUE self) {
2204
- TagLib::ID3v1::StringHandler *result = 0 ;
2205
-
2206
- if ((argc < 0) || (argc > 0)) {
2207
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2208
- }
2209
- result = (TagLib::ID3v1::StringHandler *)new TagLib::ID3v1::StringHandler();
2210
- DATA_PTR(self) = result;
2211
- SWIG_RubyAddTracking(result, self);
2212
- return self;
2213
- fail:
2214
- return Qnil;
2215
- }
2216
-
2217
-
2218
2273
  SWIGINTERN void
2219
2274
  free_TagLib_ID3v1_StringHandler(TagLib::ID3v1::StringHandler *arg1) {
2220
2275
  SWIG_RubyRemoveTracking(arg1);
@@ -2511,7 +2566,7 @@ _wrap_Tag_year(int argc, VALUE *argv, VALUE self) {
2511
2566
  TagLib::ID3v1::Tag *arg1 = (TagLib::ID3v1::Tag *) 0 ;
2512
2567
  void *argp1 = 0 ;
2513
2568
  int res1 = 0 ;
2514
- TagLib::uint result;
2569
+ unsigned int result;
2515
2570
  VALUE vresult = Qnil;
2516
2571
 
2517
2572
  if ((argc < 0) || (argc > 0)) {
@@ -2522,7 +2577,7 @@ _wrap_Tag_year(int argc, VALUE *argv, VALUE self) {
2522
2577
  SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::ID3v1::Tag const *","year", 1, self ));
2523
2578
  }
2524
2579
  arg1 = reinterpret_cast< TagLib::ID3v1::Tag * >(argp1);
2525
- result = (TagLib::uint)((TagLib::ID3v1::Tag const *)arg1)->year();
2580
+ result = (unsigned int)((TagLib::ID3v1::Tag const *)arg1)->year();
2526
2581
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
2527
2582
  return vresult;
2528
2583
  fail:
@@ -2535,7 +2590,7 @@ _wrap_Tag_track(int argc, VALUE *argv, VALUE self) {
2535
2590
  TagLib::ID3v1::Tag *arg1 = (TagLib::ID3v1::Tag *) 0 ;
2536
2591
  void *argp1 = 0 ;
2537
2592
  int res1 = 0 ;
2538
- TagLib::uint result;
2593
+ unsigned int result;
2539
2594
  VALUE vresult = Qnil;
2540
2595
 
2541
2596
  if ((argc < 0) || (argc > 0)) {
@@ -2546,7 +2601,7 @@ _wrap_Tag_track(int argc, VALUE *argv, VALUE self) {
2546
2601
  SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::ID3v1::Tag const *","track", 1, self ));
2547
2602
  }
2548
2603
  arg1 = reinterpret_cast< TagLib::ID3v1::Tag * >(argp1);
2549
- result = (TagLib::uint)((TagLib::ID3v1::Tag const *)arg1)->track();
2604
+ result = (unsigned int)((TagLib::ID3v1::Tag const *)arg1)->track();
2550
2605
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
2551
2606
  return vresult;
2552
2607
  fail:
@@ -2692,7 +2747,7 @@ fail:
2692
2747
  SWIGINTERN VALUE
2693
2748
  _wrap_Tag_yeare___(int argc, VALUE *argv, VALUE self) {
2694
2749
  TagLib::ID3v1::Tag *arg1 = (TagLib::ID3v1::Tag *) 0 ;
2695
- TagLib::uint arg2 ;
2750
+ unsigned int arg2 ;
2696
2751
  void *argp1 = 0 ;
2697
2752
  int res1 = 0 ;
2698
2753
  unsigned int val2 ;
@@ -2708,9 +2763,9 @@ _wrap_Tag_yeare___(int argc, VALUE *argv, VALUE self) {
2708
2763
  arg1 = reinterpret_cast< TagLib::ID3v1::Tag * >(argp1);
2709
2764
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
2710
2765
  if (!SWIG_IsOK(ecode2)) {
2711
- SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "TagLib::uint","setYear", 2, argv[0] ));
2766
+ SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "unsigned int","setYear", 2, argv[0] ));
2712
2767
  }
2713
- arg2 = static_cast< TagLib::uint >(val2);
2768
+ arg2 = static_cast< unsigned int >(val2);
2714
2769
  (arg1)->setYear(arg2);
2715
2770
  return Qnil;
2716
2771
  fail:
@@ -2721,7 +2776,7 @@ fail:
2721
2776
  SWIGINTERN VALUE
2722
2777
  _wrap_Tag_tracke___(int argc, VALUE *argv, VALUE self) {
2723
2778
  TagLib::ID3v1::Tag *arg1 = (TagLib::ID3v1::Tag *) 0 ;
2724
- TagLib::uint arg2 ;
2779
+ unsigned int arg2 ;
2725
2780
  void *argp1 = 0 ;
2726
2781
  int res1 = 0 ;
2727
2782
  unsigned int val2 ;
@@ -2737,9 +2792,9 @@ _wrap_Tag_tracke___(int argc, VALUE *argv, VALUE self) {
2737
2792
  arg1 = reinterpret_cast< TagLib::ID3v1::Tag * >(argp1);
2738
2793
  ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
2739
2794
  if (!SWIG_IsOK(ecode2)) {
2740
- SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "TagLib::uint","setTrack", 2, argv[0] ));
2795
+ SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "unsigned int","setTrack", 2, argv[0] ));
2741
2796
  }
2742
- arg2 = static_cast< TagLib::uint >(val2);
2797
+ arg2 = static_cast< unsigned int >(val2);
2743
2798
  (arg1)->setTrack(arg2);
2744
2799
  return Qnil;
2745
2800
  fail:
@@ -2747,6 +2802,59 @@ fail:
2747
2802
  }
2748
2803
 
2749
2804
 
2805
+ SWIGINTERN VALUE
2806
+ _wrap_Tag_genre_number(int argc, VALUE *argv, VALUE self) {
2807
+ TagLib::ID3v1::Tag *arg1 = (TagLib::ID3v1::Tag *) 0 ;
2808
+ void *argp1 = 0 ;
2809
+ int res1 = 0 ;
2810
+ unsigned int result;
2811
+ VALUE vresult = Qnil;
2812
+
2813
+ if ((argc < 0) || (argc > 0)) {
2814
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2815
+ }
2816
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_TagLib__ID3v1__Tag, 0 | 0 );
2817
+ if (!SWIG_IsOK(res1)) {
2818
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::ID3v1::Tag const *","genreNumber", 1, self ));
2819
+ }
2820
+ arg1 = reinterpret_cast< TagLib::ID3v1::Tag * >(argp1);
2821
+ result = (unsigned int)((TagLib::ID3v1::Tag const *)arg1)->genreNumber();
2822
+ vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
2823
+ return vresult;
2824
+ fail:
2825
+ return Qnil;
2826
+ }
2827
+
2828
+
2829
+ SWIGINTERN VALUE
2830
+ _wrap_Tag_genre_numbere___(int argc, VALUE *argv, VALUE self) {
2831
+ TagLib::ID3v1::Tag *arg1 = (TagLib::ID3v1::Tag *) 0 ;
2832
+ unsigned int arg2 ;
2833
+ void *argp1 = 0 ;
2834
+ int res1 = 0 ;
2835
+ unsigned int val2 ;
2836
+ int ecode2 = 0 ;
2837
+
2838
+ if ((argc < 1) || (argc > 1)) {
2839
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2840
+ }
2841
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_TagLib__ID3v1__Tag, 0 | 0 );
2842
+ if (!SWIG_IsOK(res1)) {
2843
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::ID3v1::Tag *","setGenreNumber", 1, self ));
2844
+ }
2845
+ arg1 = reinterpret_cast< TagLib::ID3v1::Tag * >(argp1);
2846
+ ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
2847
+ if (!SWIG_IsOK(ecode2)) {
2848
+ SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "unsigned int","setGenreNumber", 2, argv[0] ));
2849
+ }
2850
+ arg2 = static_cast< unsigned int >(val2);
2851
+ (arg1)->setGenreNumber(arg2);
2852
+ return Qnil;
2853
+ fail:
2854
+ return Qnil;
2855
+ }
2856
+
2857
+
2750
2858
  SWIGINTERN VALUE
2751
2859
  _wrap_Tag_string_handlere___(int argc, VALUE *argv, VALUE self) {
2752
2860
  TagLib::ID3v1::StringHandler *arg1 = (TagLib::ID3v1::StringHandler *) 0 ;
@@ -2768,12 +2876,97 @@ fail:
2768
2876
  }
2769
2877
 
2770
2878
 
2879
+ SWIGINTERN VALUE
2880
+ _wrap_genre_list(int argc, VALUE *argv, VALUE self) {
2881
+ TagLib::StringList result;
2882
+ VALUE vresult = Qnil;
2883
+
2884
+ if ((argc < 0) || (argc > 0)) {
2885
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2886
+ }
2887
+ result = TagLib::ID3v1::genreList();
2888
+ {
2889
+ vresult = taglib_string_list_to_ruby_array(result);
2890
+ }
2891
+ return vresult;
2892
+ fail:
2893
+ return Qnil;
2894
+ }
2895
+
2896
+
2897
+ SWIGINTERN VALUE
2898
+ _wrap_genre_map(int argc, VALUE *argv, VALUE self) {
2899
+ TagLib::ID3v1::GenreMap result;
2900
+ VALUE vresult = Qnil;
2901
+
2902
+ if ((argc < 0) || (argc > 0)) {
2903
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2904
+ }
2905
+ result = TagLib::ID3v1::genreMap();
2906
+ {
2907
+ vresult = taglib_id3v1_genre_map_to_ruby_hash(result);
2908
+ }
2909
+ return vresult;
2910
+ fail:
2911
+ return Qnil;
2912
+ }
2913
+
2914
+
2915
+ SWIGINTERN VALUE
2916
+ _wrap_genre(int argc, VALUE *argv, VALUE self) {
2917
+ int arg1 ;
2918
+ int val1 ;
2919
+ int ecode1 = 0 ;
2920
+ TagLib::String result;
2921
+ VALUE vresult = Qnil;
2922
+
2923
+ if ((argc < 1) || (argc > 1)) {
2924
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2925
+ }
2926
+ ecode1 = SWIG_AsVal_int(argv[0], &val1);
2927
+ if (!SWIG_IsOK(ecode1)) {
2928
+ SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "int","TagLib::ID3v1::genre", 1, argv[0] ));
2929
+ }
2930
+ arg1 = static_cast< int >(val1);
2931
+ result = TagLib::ID3v1::genre(arg1);
2932
+ {
2933
+ vresult = taglib_string_to_ruby_string(result);
2934
+ }
2935
+ return vresult;
2936
+ fail:
2937
+ return Qnil;
2938
+ }
2939
+
2940
+
2941
+ SWIGINTERN VALUE
2942
+ _wrap_genre_index(int argc, VALUE *argv, VALUE self) {
2943
+ TagLib::String *arg1 = 0 ;
2944
+ TagLib::String tmp1 ;
2945
+ int result;
2946
+ VALUE vresult = Qnil;
2947
+
2948
+ if ((argc < 1) || (argc > 1)) {
2949
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2950
+ }
2951
+ {
2952
+ tmp1 = ruby_string_to_taglib_string(argv[0]);
2953
+ arg1 = &tmp1;
2954
+ }
2955
+ result = (int)TagLib::ID3v1::genreIndex((TagLib::String const &)*arg1);
2956
+ vresult = SWIG_From_int(static_cast< int >(result));
2957
+ return vresult;
2958
+ fail:
2959
+ return Qnil;
2960
+ }
2961
+
2962
+
2771
2963
 
2772
2964
  /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
2773
2965
 
2774
2966
  static void *_p_TagLib__ID3v1__TagTo_p_TagLib__Tag(void *x, int *SWIGUNUSEDPARM(newmemory)) {
2775
2967
  return (void *)((TagLib::Tag *) ((TagLib::ID3v1::Tag *) x));
2776
2968
  }
2969
+ static swig_type_info _swigt__p_MapT_TagLib__String_int_t = {"_p_MapT_TagLib__String_int_t", "TagLib::ID3v1::GenreMap *|Map< TagLib::String,int > *", 0, 0, (void*)0, 0};
2777
2970
  static swig_type_info _swigt__p_TagLib__File = {"_p_TagLib__File", "TagLib::File *", 0, 0, (void*)0, 0};
2778
2971
  static swig_type_info _swigt__p_TagLib__ID3v1__StringHandler = {"_p_TagLib__ID3v1__StringHandler", "TagLib::ID3v1::StringHandler *", 0, 0, (void*)0, 0};
2779
2972
  static swig_type_info _swigt__p_TagLib__ID3v1__Tag = {"_p_TagLib__ID3v1__Tag", "TagLib::ID3v1::Tag *", 0, 0, (void*)0, 0};
@@ -2785,6 +2978,7 @@ static swig_type_info _swigt__p_unsigned_long = {"_p_unsigned_long", "TagLib::ul
2785
2978
  static swig_type_info _swigt__p_wchar_t = {"_p_wchar_t", "TagLib::wchar *|wchar_t *", 0, 0, (void*)0, 0};
2786
2979
 
2787
2980
  static swig_type_info *swig_type_initial[] = {
2981
+ &_swigt__p_MapT_TagLib__String_int_t,
2788
2982
  &_swigt__p_TagLib__File,
2789
2983
  &_swigt__p_TagLib__ID3v1__StringHandler,
2790
2984
  &_swigt__p_TagLib__ID3v1__Tag,
@@ -2796,6 +2990,7 @@ static swig_type_info *swig_type_initial[] = {
2796
2990
  &_swigt__p_wchar_t,
2797
2991
  };
2798
2992
 
2993
+ static swig_cast_info _swigc__p_MapT_TagLib__String_int_t[] = { {&_swigt__p_MapT_TagLib__String_int_t, 0, 0, 0},{0, 0, 0, 0}};
2799
2994
  static swig_cast_info _swigc__p_TagLib__File[] = { {&_swigt__p_TagLib__File, 0, 0, 0},{0, 0, 0, 0}};
2800
2995
  static swig_cast_info _swigc__p_TagLib__ID3v1__StringHandler[] = { {&_swigt__p_TagLib__ID3v1__StringHandler, 0, 0, 0},{0, 0, 0, 0}};
2801
2996
  static swig_cast_info _swigc__p_TagLib__ID3v1__Tag[] = { {&_swigt__p_TagLib__ID3v1__Tag, 0, 0, 0},{0, 0, 0, 0}};
@@ -2807,6 +3002,7 @@ static swig_cast_info _swigc__p_unsigned_long[] = { {&_swigt__p_unsigned_long,
2807
3002
  static swig_cast_info _swigc__p_wchar_t[] = { {&_swigt__p_wchar_t, 0, 0, 0},{0, 0, 0, 0}};
2808
3003
 
2809
3004
  static swig_cast_info *swig_cast_initial[] = {
3005
+ _swigc__p_MapT_TagLib__String_int_t,
2810
3006
  _swigc__p_TagLib__File,
2811
3007
  _swigc__p_TagLib__ID3v1__StringHandler,
2812
3008
  _swigc__p_TagLib__ID3v1__Tag,
@@ -2823,18 +3019,18 @@ static swig_cast_info *swig_cast_initial[] = {
2823
3019
 
2824
3020
  /* -----------------------------------------------------------------------------
2825
3021
  * Type initialization:
2826
- * This problem is tough by the requirement that no dynamic
2827
- * memory is used. Also, since swig_type_info structures store pointers to
3022
+ * This problem is tough by the requirement that no dynamic
3023
+ * memory is used. Also, since swig_type_info structures store pointers to
2828
3024
  * swig_cast_info structures and swig_cast_info structures store pointers back
2829
- * to swig_type_info structures, we need some lookup code at initialization.
2830
- * The idea is that swig generates all the structures that are needed.
2831
- * The runtime then collects these partially filled structures.
2832
- * The SWIG_InitializeModule function takes these initial arrays out of
3025
+ * to swig_type_info structures, we need some lookup code at initialization.
3026
+ * The idea is that swig generates all the structures that are needed.
3027
+ * The runtime then collects these partially filled structures.
3028
+ * The SWIG_InitializeModule function takes these initial arrays out of
2833
3029
  * swig_module, and does all the lookup, filling in the swig_module.types
2834
3030
  * array with the correct data and linking the correct swig_cast_info
2835
3031
  * structures together.
2836
3032
  *
2837
- * The generated swig_type_info structures are assigned staticly to an initial
3033
+ * The generated swig_type_info structures are assigned statically to an initial
2838
3034
  * array. We just loop through that array, and handle each type individually.
2839
3035
  * First we lookup if this type has been already loaded, and if so, use the
2840
3036
  * loaded structure instead of the generated one. Then we have to fill in the
@@ -2844,17 +3040,17 @@ static swig_cast_info *swig_cast_initial[] = {
2844
3040
  * a column is one of the swig_cast_info structures for that type.
2845
3041
  * The cast_initial array is actually an array of arrays, because each row has
2846
3042
  * a variable number of columns. So to actually build the cast linked list,
2847
- * we find the array of casts associated with the type, and loop through it
3043
+ * we find the array of casts associated with the type, and loop through it
2848
3044
  * adding the casts to the list. The one last trick we need to do is making
2849
3045
  * sure the type pointer in the swig_cast_info struct is correct.
2850
3046
  *
2851
- * First off, we lookup the cast->type name to see if it is already loaded.
3047
+ * First off, we lookup the cast->type name to see if it is already loaded.
2852
3048
  * There are three cases to handle:
2853
3049
  * 1) If the cast->type has already been loaded AND the type we are adding
2854
3050
  * casting info to has not been loaded (it is in this module), THEN we
2855
3051
  * replace the cast->type pointer with the type pointer that has already
2856
3052
  * been loaded.
2857
- * 2) If BOTH types (the one we are adding casting info to, and the
3053
+ * 2) If BOTH types (the one we are adding casting info to, and the
2858
3054
  * cast->type) are loaded, THEN the cast info has already been loaded by
2859
3055
  * the previous module so we just ignore it.
2860
3056
  * 3) Finally, if cast->type has not already been loaded, then we add that
@@ -2878,7 +3074,7 @@ SWIGRUNTIME void
2878
3074
  SWIG_InitializeModule(void *clientdata) {
2879
3075
  size_t i;
2880
3076
  swig_module_info *module_head, *iter;
2881
- int found, init;
3077
+ int init;
2882
3078
 
2883
3079
  /* check to see if the circular list has been setup, if not, set it up */
2884
3080
  if (swig_module.next==0) {
@@ -2897,27 +3093,23 @@ SWIG_InitializeModule(void *clientdata) {
2897
3093
  /* This is the first module loaded for this interpreter */
2898
3094
  /* so set the swig module into the interpreter */
2899
3095
  SWIG_SetModule(clientdata, &swig_module);
2900
- module_head = &swig_module;
2901
3096
  } else {
2902
3097
  /* the interpreter has loaded a SWIG module, but has it loaded this one? */
2903
- found=0;
2904
3098
  iter=module_head;
2905
3099
  do {
2906
3100
  if (iter==&swig_module) {
2907
- found=1;
2908
- break;
3101
+ /* Our module is already in the list, so there's nothing more to do. */
3102
+ return;
2909
3103
  }
2910
3104
  iter=iter->next;
2911
3105
  } while (iter!= module_head);
2912
3106
 
2913
- /* if the is found in the list, then all is done and we may leave */
2914
- if (found) return;
2915
- /* otherwise we must add out module into the list */
3107
+ /* otherwise we must add our module into the list */
2916
3108
  swig_module.next = module_head->next;
2917
3109
  module_head->next = &swig_module;
2918
3110
  }
2919
3111
 
2920
- /* When multiple interpeters are used, a module could have already been initialized in
3112
+ /* When multiple interpreters are used, a module could have already been initialized in
2921
3113
  a different interpreter, but not yet have a pointer in this interpreter.
2922
3114
  In this case, we do not want to continue adding types... everything should be
2923
3115
  set up already */
@@ -2931,7 +3123,7 @@ SWIG_InitializeModule(void *clientdata) {
2931
3123
  swig_type_info *type = 0;
2932
3124
  swig_type_info *ret;
2933
3125
  swig_cast_info *cast;
2934
-
3126
+
2935
3127
  #ifdef SWIGRUNTIME_DEBUG
2936
3128
  printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
2937
3129
  #endif
@@ -2958,7 +3150,7 @@ SWIG_InitializeModule(void *clientdata) {
2958
3150
  /* Insert casting types */
2959
3151
  cast = swig_module.cast_initial[i];
2960
3152
  while (cast->type) {
2961
-
3153
+
2962
3154
  /* Don't need to add information already in the list */
2963
3155
  ret = 0;
2964
3156
  #ifdef SWIGRUNTIME_DEBUG
@@ -3107,9 +3299,15 @@ SWIGEXPORT void Init_taglib_id3v1(void) {
3107
3299
  rb_define_method(SwigClassTag.klass, "genre=", VALUEFUNC(_wrap_Tag_genree___), -1);
3108
3300
  rb_define_method(SwigClassTag.klass, "year=", VALUEFUNC(_wrap_Tag_yeare___), -1);
3109
3301
  rb_define_method(SwigClassTag.klass, "track=", VALUEFUNC(_wrap_Tag_tracke___), -1);
3302
+ rb_define_method(SwigClassTag.klass, "genre_number", VALUEFUNC(_wrap_Tag_genre_number), -1);
3303
+ rb_define_method(SwigClassTag.klass, "genre_number=", VALUEFUNC(_wrap_Tag_genre_numbere___), -1);
3110
3304
  rb_define_singleton_method(SwigClassTag.klass, "string_handler=", VALUEFUNC(_wrap_Tag_string_handlere___), -1);
3111
3305
  SwigClassTag.mark = 0;
3112
3306
  SwigClassTag.destroy = (void (*)(void *)) free_TagLib_ID3v1_Tag;
3113
3307
  SwigClassTag.trackObjects = 1;
3308
+ rb_define_module_function(mID3v1, "genre_list", VALUEFUNC(_wrap_genre_list), -1);
3309
+ rb_define_module_function(mID3v1, "genre_map", VALUEFUNC(_wrap_genre_map), -1);
3310
+ rb_define_module_function(mID3v1, "genre", VALUEFUNC(_wrap_genre), -1);
3311
+ rb_define_module_function(mID3v1, "genre_index", VALUEFUNC(_wrap_genre_index), -1);
3114
3312
  }
3115
3313