taglib-ruby 0.5.2 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. data/.yardopts +1 -1
  2. data/CHANGES.md +11 -0
  3. data/LICENSE.txt +0 -2
  4. data/README.md +7 -9
  5. data/docs/taglib/base.rb +35 -7
  6. data/docs/taglib/id3v2.rb +37 -5
  7. data/docs/taglib/mp4.rb +267 -0
  8. data/docs/taglib/mpeg.rb +23 -8
  9. data/ext/taglib_base/includes.i +2 -2
  10. data/ext/taglib_base/taglib_base.i +3 -0
  11. data/ext/taglib_base/taglib_base_wrap.cxx +11 -12
  12. data/ext/taglib_flac/taglib_flac_wrap.cxx +21 -25
  13. data/ext/taglib_id3v1/taglib_id3v1_wrap.cxx +4 -8
  14. data/ext/taglib_id3v2/taglib_id3v2.i +3 -0
  15. data/ext/taglib_id3v2/taglib_id3v2_wrap.cxx +528 -69
  16. data/ext/taglib_mp4/extconf.rb +4 -0
  17. data/ext/taglib_mp4/taglib_mp4.i +225 -0
  18. data/ext/taglib_mp4/taglib_mp4_wrap.cxx +4830 -0
  19. data/ext/taglib_mpeg/taglib_mpeg.i +15 -0
  20. data/ext/taglib_mpeg/taglib_mpeg_wrap.cxx +174 -88
  21. data/ext/taglib_ogg/taglib_ogg_wrap.cxx +2 -6
  22. data/ext/taglib_vorbis/taglib_vorbis_wrap.cxx +8 -12
  23. data/lib/taglib.rb +1 -0
  24. data/lib/taglib/mp4.rb +33 -0
  25. data/lib/taglib/version.rb +2 -2
  26. data/taglib-ruby.gemspec +19 -3
  27. data/tasks/ext.rake +3 -0
  28. data/tasks/swig.rake +6 -1
  29. data/test/base_test.rb +11 -0
  30. data/test/data/Makefile +5 -2
  31. data/test/data/flac-create.cpp +2 -22
  32. data/test/data/get_picture_data.cpp +22 -0
  33. data/test/data/mp4-create.cpp +38 -0
  34. data/test/data/mp4.m4a +0 -0
  35. data/test/fileref_write_test.rb +9 -0
  36. data/test/flac_file_test.rb +2 -1
  37. data/test/id3v2_header_test.rb +61 -0
  38. data/test/id3v2_write_test.rb +17 -0
  39. data/test/mp4_file_test.rb +51 -0
  40. data/test/mp4_file_write_test.rb +66 -0
  41. data/test/mp4_items_test.rb +183 -0
  42. metadata +39 -8
@@ -6,6 +6,8 @@
6
6
  #include <taglib/mpegproperties.h>
7
7
  #include <taglib/mpegfile.h>
8
8
  #include <taglib/id3v2tag.h>
9
+
10
+ static bool taglib_ruby_mpeg_file_save(TagLib::MPEG::File *file, int tags, bool stripOthers, int id3v2Version);
9
11
  %}
10
12
 
11
13
  %include "../taglib_base/includes.i"
@@ -69,12 +71,25 @@
69
71
 
70
72
  delete file;
71
73
  }
74
+
75
+ static bool taglib_ruby_mpeg_file_save(TagLib::MPEG::File *file, int tags, bool stripOthers, int id3v2Version) {
76
+ #if defined(TAGLIB_MAJOR_VERSION) && (TAGLIB_MAJOR_VERSION > 1 || (TAGLIB_MAJOR_VERSION == 1 && TAGLIB_MINOR_VERSION >= 8))
77
+ return file->save(tags, stripOthers, id3v2Version);
78
+ #else
79
+ rb_raise(rb_eArgError, "Overloaded method save(int tags, bool stripOthers, int id3v2Version) on TagLib::MPEG::File is only available when compiled against TagLib >= 1.8");
80
+ return false;
81
+ #endif
82
+ }
72
83
  %}
73
84
 
74
85
  %extend TagLib::MPEG::File {
75
86
  void close() {
76
87
  free_taglib_mpeg_file($self);
77
88
  }
89
+
90
+ bool save(int tags, bool stripOthers, int id3v2Version) {
91
+ return taglib_ruby_mpeg_file_save($self, tags, stripOthers, id3v2Version);
92
+ }
78
93
  }
79
94
 
80
95
 
@@ -1866,6 +1866,8 @@ static VALUE mMPEG;
1866
1866
  #include <taglib/mpegfile.h>
1867
1867
  #include <taglib/id3v2tag.h>
1868
1868
 
1869
+ static bool taglib_ruby_mpeg_file_save(TagLib::MPEG::File *file, int tags, bool stripOthers, int id3v2Version);
1870
+
1869
1871
 
1870
1872
  #include <taglib/tstring.h>
1871
1873
  #include <taglib/tstringlist.h>
@@ -1892,7 +1894,7 @@ TagLib::ByteVector ruby_string_to_taglib_bytevector(VALUE s) {
1892
1894
  if (NIL_P(s)) {
1893
1895
  return TagLib::ByteVector::null;
1894
1896
  } else {
1895
- return TagLib::ByteVector(RSTRING_PTR(s), RSTRING_LEN(s));
1897
+ return TagLib::ByteVector(RSTRING_PTR(StringValue(s)), RSTRING_LEN(s));
1896
1898
  }
1897
1899
  }
1898
1900
 
@@ -1910,7 +1912,7 @@ TagLib::String ruby_string_to_taglib_string(VALUE s) {
1910
1912
  if (NIL_P(s)) {
1911
1913
  return TagLib::String::null;
1912
1914
  } else {
1913
- return TagLib::String(RSTRING_PTR(CONVERT_TO_UTF8(s)), TagLib::String::UTF8);
1915
+ return TagLib::String(RSTRING_PTR(CONVERT_TO_UTF8(StringValue(s))), TagLib::String::UTF8);
1914
1916
  }
1915
1917
  }
1916
1918
 
@@ -1991,11 +1993,7 @@ SWIGINTERN int
1991
1993
  SWIG_AsCharPtrAndSize(VALUE obj, char** cptr, size_t* psize, int *alloc)
1992
1994
  {
1993
1995
  if (TYPE(obj) == T_STRING) {
1994
- #if defined(StringValuePtr)
1995
1996
  char *cstr = StringValuePtr(obj);
1996
- #else
1997
- char *cstr = STR2CSTR(obj);
1998
- #endif
1999
1997
  size_t size = RSTRING_LEN(obj) + 1;
2000
1998
  if (cptr) {
2001
1999
  if (alloc) {
@@ -2143,6 +2141,9 @@ SWIG_AsVal_bool (VALUE obj, bool *val)
2143
2141
  SWIGINTERN void TagLib_MPEG_File_close(TagLib::MPEG::File *self){
2144
2142
  free_taglib_mpeg_file(self);
2145
2143
  }
2144
+ SWIGINTERN bool TagLib_MPEG_File_save__SWIG_3(TagLib::MPEG::File *self,int tags,bool stripOthers,int id3v2Version){
2145
+ return taglib_ruby_mpeg_file_save(self, tags, stripOthers, id3v2Version);
2146
+ }
2146
2147
 
2147
2148
  static void free_taglib_mpeg_file(void *ptr) {
2148
2149
  TagLib::MPEG::File *file = (TagLib::MPEG::File *) ptr;
@@ -2184,6 +2185,15 @@ SWIGINTERN void TagLib_MPEG_File_close(TagLib::MPEG::File *self){
2184
2185
  delete file;
2185
2186
  }
2186
2187
 
2188
+ static bool taglib_ruby_mpeg_file_save(TagLib::MPEG::File *file, int tags, bool stripOthers, int id3v2Version) {
2189
+ #if defined(TAGLIB_MAJOR_VERSION) && (TAGLIB_MAJOR_VERSION > 1 || (TAGLIB_MAJOR_VERSION == 1 && TAGLIB_MINOR_VERSION >= 8))
2190
+ return file->save(tags, stripOthers, id3v2Version);
2191
+ #else
2192
+ rb_raise(rb_eArgError, "Overloaded method save(int tags, bool stripOthers, int id3v2Version) on TagLib::MPEG::File is only available when compiled against TagLib >= 1.8");
2193
+ return false;
2194
+ #endif
2195
+ }
2196
+
2187
2197
  static swig_class SwigClassXingHeader;
2188
2198
 
2189
2199
  #ifdef HAVE_RB_DEFINE_ALLOC_FUNC
@@ -2388,10 +2398,10 @@ _wrap_new_Header__SWIG_1(int argc, VALUE *argv, VALUE self) {
2388
2398
  }
2389
2399
  res1 = SWIG_ConvertPtr(argv[0], &argp1, SWIGTYPE_p_TagLib__MPEG__Header, 0 );
2390
2400
  if (!SWIG_IsOK(res1)) {
2391
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::MPEG::Header const &","TagLib::MPEG::Header", 1, argv[0] ));
2401
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::MPEG::Header const &","Header", 1, argv[0] ));
2392
2402
  }
2393
2403
  if (!argp1) {
2394
- SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "TagLib::MPEG::Header const &","TagLib::MPEG::Header", 1, argv[0]));
2404
+ SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "TagLib::MPEG::Header const &","Header", 1, argv[0]));
2395
2405
  }
2396
2406
  arg1 = reinterpret_cast< TagLib::MPEG::Header * >(argp1);
2397
2407
  result = (TagLib::MPEG::Header *)new TagLib::MPEG::Header((TagLib::MPEG::Header const &)*arg1);
@@ -2751,12 +2761,12 @@ _wrap_new_Properties__SWIG_0(int argc, VALUE *argv, VALUE self) {
2751
2761
  }
2752
2762
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_TagLib__MPEG__File, 0 | 0 );
2753
2763
  if (!SWIG_IsOK(res1)) {
2754
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::MPEG::File *","TagLib::MPEG::Properties", 1, argv[0] ));
2764
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::MPEG::File *","Properties", 1, argv[0] ));
2755
2765
  }
2756
2766
  arg1 = reinterpret_cast< TagLib::MPEG::File * >(argp1);
2757
2767
  ecode2 = SWIG_AsVal_int(argv[1], &val2);
2758
2768
  if (!SWIG_IsOK(ecode2)) {
2759
- SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "TagLib::AudioProperties::ReadStyle","TagLib::MPEG::Properties", 2, argv[1] ));
2769
+ SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "TagLib::AudioProperties::ReadStyle","Properties", 2, argv[1] ));
2760
2770
  }
2761
2771
  arg2 = static_cast< TagLib::AudioProperties::ReadStyle >(val2);
2762
2772
  result = (TagLib::MPEG::Properties *)new TagLib::MPEG::Properties(arg1,arg2);
@@ -2797,7 +2807,7 @@ _wrap_new_Properties__SWIG_1(int argc, VALUE *argv, VALUE self) {
2797
2807
  }
2798
2808
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_TagLib__MPEG__File, 0 | 0 );
2799
2809
  if (!SWIG_IsOK(res1)) {
2800
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::MPEG::File *","TagLib::MPEG::Properties", 1, argv[0] ));
2810
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::MPEG::File *","Properties", 1, argv[0] ));
2801
2811
  }
2802
2812
  arg1 = reinterpret_cast< TagLib::MPEG::File * >(argp1);
2803
2813
  result = (TagLib::MPEG::Properties *)new TagLib::MPEG::Properties(arg1);
@@ -3147,12 +3157,12 @@ _wrap_new_File__SWIG_0(int argc, VALUE *argv, VALUE self) {
3147
3157
  }
3148
3158
  ecode2 = SWIG_AsVal_bool(argv[1], &val2);
3149
3159
  if (!SWIG_IsOK(ecode2)) {
3150
- SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "bool","TagLib::MPEG::File", 2, argv[1] ));
3160
+ SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "bool","File", 2, argv[1] ));
3151
3161
  }
3152
3162
  arg2 = static_cast< bool >(val2);
3153
3163
  ecode3 = SWIG_AsVal_int(argv[2], &val3);
3154
3164
  if (!SWIG_IsOK(ecode3)) {
3155
- SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "TagLib::MPEG::Properties::ReadStyle","TagLib::MPEG::File", 3, argv[2] ));
3165
+ SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "TagLib::MPEG::Properties::ReadStyle","File", 3, argv[2] ));
3156
3166
  }
3157
3167
  arg3 = static_cast< TagLib::MPEG::Properties::ReadStyle >(val3);
3158
3168
  result = (TagLib::MPEG::File *)new TagLib::MPEG::File(arg1,arg2,arg3);
@@ -3183,7 +3193,7 @@ _wrap_new_File__SWIG_1(int argc, VALUE *argv, VALUE self) {
3183
3193
  }
3184
3194
  ecode2 = SWIG_AsVal_bool(argv[1], &val2);
3185
3195
  if (!SWIG_IsOK(ecode2)) {
3186
- SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "bool","TagLib::MPEG::File", 2, argv[1] ));
3196
+ SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "bool","File", 2, argv[1] ));
3187
3197
  }
3188
3198
  arg2 = static_cast< bool >(val2);
3189
3199
  result = (TagLib::MPEG::File *)new TagLib::MPEG::File(arg1,arg2);
@@ -3243,17 +3253,17 @@ _wrap_new_File__SWIG_3(int argc, VALUE *argv, VALUE self) {
3243
3253
  }
3244
3254
  res2 = SWIG_ConvertPtr(argv[1], &argp2,SWIGTYPE_p_TagLib__ID3v2__FrameFactory, 0 | 0 );
3245
3255
  if (!SWIG_IsOK(res2)) {
3246
- SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "TagLib::ID3v2::FrameFactory *","TagLib::MPEG::File", 2, argv[1] ));
3256
+ SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "TagLib::ID3v2::FrameFactory *","File", 2, argv[1] ));
3247
3257
  }
3248
3258
  arg2 = reinterpret_cast< TagLib::ID3v2::FrameFactory * >(argp2);
3249
3259
  ecode3 = SWIG_AsVal_bool(argv[2], &val3);
3250
3260
  if (!SWIG_IsOK(ecode3)) {
3251
- SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "bool","TagLib::MPEG::File", 3, argv[2] ));
3261
+ SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "bool","File", 3, argv[2] ));
3252
3262
  }
3253
3263
  arg3 = static_cast< bool >(val3);
3254
3264
  ecode4 = SWIG_AsVal_int(argv[3], &val4);
3255
3265
  if (!SWIG_IsOK(ecode4)) {
3256
- SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "TagLib::MPEG::Properties::ReadStyle","TagLib::MPEG::File", 4, argv[3] ));
3266
+ SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "TagLib::MPEG::Properties::ReadStyle","File", 4, argv[3] ));
3257
3267
  }
3258
3268
  arg4 = static_cast< TagLib::MPEG::Properties::ReadStyle >(val4);
3259
3269
  result = (TagLib::MPEG::File *)new TagLib::MPEG::File(arg1,arg2,arg3,arg4);
@@ -3287,12 +3297,12 @@ _wrap_new_File__SWIG_4(int argc, VALUE *argv, VALUE self) {
3287
3297
  }
3288
3298
  res2 = SWIG_ConvertPtr(argv[1], &argp2,SWIGTYPE_p_TagLib__ID3v2__FrameFactory, 0 | 0 );
3289
3299
  if (!SWIG_IsOK(res2)) {
3290
- SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "TagLib::ID3v2::FrameFactory *","TagLib::MPEG::File", 2, argv[1] ));
3300
+ SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "TagLib::ID3v2::FrameFactory *","File", 2, argv[1] ));
3291
3301
  }
3292
3302
  arg2 = reinterpret_cast< TagLib::ID3v2::FrameFactory * >(argp2);
3293
3303
  ecode3 = SWIG_AsVal_bool(argv[2], &val3);
3294
3304
  if (!SWIG_IsOK(ecode3)) {
3295
- SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "bool","TagLib::MPEG::File", 3, argv[2] ));
3305
+ SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "bool","File", 3, argv[2] ));
3296
3306
  }
3297
3307
  arg3 = static_cast< bool >(val3);
3298
3308
  result = (TagLib::MPEG::File *)new TagLib::MPEG::File(arg1,arg2,arg3);
@@ -3340,7 +3350,7 @@ _wrap_new_File__SWIG_5(int argc, VALUE *argv, VALUE self) {
3340
3350
  }
3341
3351
  res2 = SWIG_ConvertPtr(argv[1], &argp2,SWIGTYPE_p_TagLib__ID3v2__FrameFactory, 0 | 0 );
3342
3352
  if (!SWIG_IsOK(res2)) {
3343
- SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "TagLib::ID3v2::FrameFactory *","TagLib::MPEG::File", 2, argv[1] ));
3353
+ SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "TagLib::ID3v2::FrameFactory *","File", 2, argv[1] ));
3344
3354
  }
3345
3355
  arg2 = reinterpret_cast< TagLib::ID3v2::FrameFactory * >(argp2);
3346
3356
  result = (TagLib::MPEG::File *)new TagLib::MPEG::File(arg1,arg2);
@@ -3619,73 +3629,6 @@ fail:
3619
3629
  }
3620
3630
 
3621
3631
 
3622
- SWIGINTERN VALUE _wrap_File_save(int nargs, VALUE *args, VALUE self) {
3623
- int argc;
3624
- VALUE argv[4];
3625
- int ii;
3626
-
3627
- argc = nargs + 1;
3628
- argv[0] = self;
3629
- if (argc > 4) SWIG_fail;
3630
- for (ii = 1; (ii < argc); ++ii) {
3631
- argv[ii] = args[ii-1];
3632
- }
3633
- if (argc == 1) {
3634
- int _v;
3635
- void *vptr = 0;
3636
- int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_TagLib__MPEG__File, 0);
3637
- _v = SWIG_CheckState(res);
3638
- if (_v) {
3639
- return _wrap_File_save__SWIG_0(nargs, args, self);
3640
- }
3641
- }
3642
- if (argc == 2) {
3643
- int _v;
3644
- void *vptr = 0;
3645
- int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_TagLib__MPEG__File, 0);
3646
- _v = SWIG_CheckState(res);
3647
- if (_v) {
3648
- {
3649
- int res = SWIG_AsVal_int(argv[1], NULL);
3650
- _v = SWIG_CheckState(res);
3651
- }
3652
- if (_v) {
3653
- return _wrap_File_save__SWIG_1(nargs, args, self);
3654
- }
3655
- }
3656
- }
3657
- if (argc == 3) {
3658
- int _v;
3659
- void *vptr = 0;
3660
- int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_TagLib__MPEG__File, 0);
3661
- _v = SWIG_CheckState(res);
3662
- if (_v) {
3663
- {
3664
- int res = SWIG_AsVal_int(argv[1], NULL);
3665
- _v = SWIG_CheckState(res);
3666
- }
3667
- if (_v) {
3668
- {
3669
- int res = SWIG_AsVal_bool(argv[2], NULL);
3670
- _v = SWIG_CheckState(res);
3671
- }
3672
- if (_v) {
3673
- return _wrap_File_save__SWIG_2(nargs, args, self);
3674
- }
3675
- }
3676
- }
3677
- }
3678
-
3679
- fail:
3680
- Ruby_Format_OverloadedError( argc, 4, "File.save",
3681
- " bool File.save()\n"
3682
- " bool File.save(int tags)\n"
3683
- " bool File.save(int tags, bool stripOthers)\n");
3684
-
3685
- return Qnil;
3686
- }
3687
-
3688
-
3689
3632
  SWIGINTERN VALUE
3690
3633
  _wrap_File_id3v2_tag__SWIG_0(int argc, VALUE *argv, VALUE self) {
3691
3634
  TagLib::MPEG::File *arg1 = (TagLib::MPEG::File *) 0 ;
@@ -4314,6 +4257,149 @@ fail:
4314
4257
  }
4315
4258
 
4316
4259
 
4260
+ SWIGINTERN VALUE
4261
+ _wrap_File_save__SWIG_3(int argc, VALUE *argv, VALUE self) {
4262
+ TagLib::MPEG::File *arg1 = (TagLib::MPEG::File *) 0 ;
4263
+ int arg2 ;
4264
+ bool arg3 ;
4265
+ int arg4 ;
4266
+ void *argp1 = 0 ;
4267
+ int res1 = 0 ;
4268
+ int val2 ;
4269
+ int ecode2 = 0 ;
4270
+ bool val3 ;
4271
+ int ecode3 = 0 ;
4272
+ int val4 ;
4273
+ int ecode4 = 0 ;
4274
+ bool result;
4275
+ VALUE vresult = Qnil;
4276
+
4277
+ if ((argc < 3) || (argc > 3)) {
4278
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
4279
+ }
4280
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_TagLib__MPEG__File, 0 | 0 );
4281
+ if (!SWIG_IsOK(res1)) {
4282
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::MPEG::File *","save", 1, self ));
4283
+ }
4284
+ arg1 = reinterpret_cast< TagLib::MPEG::File * >(argp1);
4285
+ ecode2 = SWIG_AsVal_int(argv[0], &val2);
4286
+ if (!SWIG_IsOK(ecode2)) {
4287
+ SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","save", 2, argv[0] ));
4288
+ }
4289
+ arg2 = static_cast< int >(val2);
4290
+ ecode3 = SWIG_AsVal_bool(argv[1], &val3);
4291
+ if (!SWIG_IsOK(ecode3)) {
4292
+ SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "bool","save", 3, argv[1] ));
4293
+ }
4294
+ arg3 = static_cast< bool >(val3);
4295
+ ecode4 = SWIG_AsVal_int(argv[2], &val4);
4296
+ if (!SWIG_IsOK(ecode4)) {
4297
+ SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "int","save", 4, argv[2] ));
4298
+ }
4299
+ arg4 = static_cast< int >(val4);
4300
+ result = (bool)TagLib_MPEG_File_save__SWIG_3(arg1,arg2,arg3,arg4);
4301
+ vresult = SWIG_From_bool(static_cast< bool >(result));
4302
+ return vresult;
4303
+ fail:
4304
+ return Qnil;
4305
+ }
4306
+
4307
+
4308
+ SWIGINTERN VALUE _wrap_File_save(int nargs, VALUE *args, VALUE self) {
4309
+ int argc;
4310
+ VALUE argv[5];
4311
+ int ii;
4312
+
4313
+ argc = nargs + 1;
4314
+ argv[0] = self;
4315
+ if (argc > 5) SWIG_fail;
4316
+ for (ii = 1; (ii < argc); ++ii) {
4317
+ argv[ii] = args[ii-1];
4318
+ }
4319
+ if (argc == 1) {
4320
+ int _v;
4321
+ void *vptr = 0;
4322
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_TagLib__MPEG__File, 0);
4323
+ _v = SWIG_CheckState(res);
4324
+ if (_v) {
4325
+ return _wrap_File_save__SWIG_0(nargs, args, self);
4326
+ }
4327
+ }
4328
+ if (argc == 2) {
4329
+ int _v;
4330
+ void *vptr = 0;
4331
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_TagLib__MPEG__File, 0);
4332
+ _v = SWIG_CheckState(res);
4333
+ if (_v) {
4334
+ {
4335
+ int res = SWIG_AsVal_int(argv[1], NULL);
4336
+ _v = SWIG_CheckState(res);
4337
+ }
4338
+ if (_v) {
4339
+ return _wrap_File_save__SWIG_1(nargs, args, self);
4340
+ }
4341
+ }
4342
+ }
4343
+ if (argc == 3) {
4344
+ int _v;
4345
+ void *vptr = 0;
4346
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_TagLib__MPEG__File, 0);
4347
+ _v = SWIG_CheckState(res);
4348
+ if (_v) {
4349
+ {
4350
+ int res = SWIG_AsVal_int(argv[1], NULL);
4351
+ _v = SWIG_CheckState(res);
4352
+ }
4353
+ if (_v) {
4354
+ {
4355
+ int res = SWIG_AsVal_bool(argv[2], NULL);
4356
+ _v = SWIG_CheckState(res);
4357
+ }
4358
+ if (_v) {
4359
+ return _wrap_File_save__SWIG_2(nargs, args, self);
4360
+ }
4361
+ }
4362
+ }
4363
+ }
4364
+ if (argc == 4) {
4365
+ int _v;
4366
+ void *vptr = 0;
4367
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_TagLib__MPEG__File, 0);
4368
+ _v = SWIG_CheckState(res);
4369
+ if (_v) {
4370
+ {
4371
+ int res = SWIG_AsVal_int(argv[1], NULL);
4372
+ _v = SWIG_CheckState(res);
4373
+ }
4374
+ if (_v) {
4375
+ {
4376
+ int res = SWIG_AsVal_bool(argv[2], NULL);
4377
+ _v = SWIG_CheckState(res);
4378
+ }
4379
+ if (_v) {
4380
+ {
4381
+ int res = SWIG_AsVal_int(argv[3], NULL);
4382
+ _v = SWIG_CheckState(res);
4383
+ }
4384
+ if (_v) {
4385
+ return _wrap_File_save__SWIG_3(nargs, args, self);
4386
+ }
4387
+ }
4388
+ }
4389
+ }
4390
+ }
4391
+
4392
+ fail:
4393
+ Ruby_Format_OverloadedError( argc, 5, "File.save",
4394
+ " bool File.save()\n"
4395
+ " bool File.save(int tags)\n"
4396
+ " bool File.save(int tags, bool stripOthers)\n"
4397
+ " bool File.save(int tags, bool stripOthers, int id3v2Version)\n");
4398
+
4399
+ return Qnil;
4400
+ }
4401
+
4402
+
4317
4403
 
4318
4404
  /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
4319
4405
 
@@ -4723,7 +4809,6 @@ SWIGEXPORT void Init_taglib_mpeg(void) {
4723
4809
  rb_define_const(SwigClassFile.klass, "AllTags", SWIG_From_int(static_cast< int >(TagLib::MPEG::File::AllTags)));
4724
4810
  rb_define_method(SwigClassFile.klass, "tag", VALUEFUNC(_wrap_File_tag), -1);
4725
4811
  rb_define_method(SwigClassFile.klass, "audio_properties", VALUEFUNC(_wrap_File_audio_properties), -1);
4726
- rb_define_method(SwigClassFile.klass, "save", VALUEFUNC(_wrap_File_save), -1);
4727
4812
  rb_define_method(SwigClassFile.klass, "id3v2_tag", VALUEFUNC(_wrap_File_id3v2_tag), -1);
4728
4813
  rb_define_method(SwigClassFile.klass, "id3v1_tag", VALUEFUNC(_wrap_File_id3v1_tag), -1);
4729
4814
  rb_define_method(SwigClassFile.klass, "apetag", VALUEFUNC(_wrap_File_apetag), -1);
@@ -4734,6 +4819,7 @@ SWIGEXPORT void Init_taglib_mpeg(void) {
4734
4819
  rb_define_method(SwigClassFile.klass, "previous_frame_offset", VALUEFUNC(_wrap_File_previous_frame_offset), -1);
4735
4820
  rb_define_method(SwigClassFile.klass, "last_frame_offset", VALUEFUNC(_wrap_File_last_frame_offset), -1);
4736
4821
  rb_define_method(SwigClassFile.klass, "close", VALUEFUNC(_wrap_File_close), -1);
4822
+ rb_define_method(SwigClassFile.klass, "save", VALUEFUNC(_wrap_File_save), -1);
4737
4823
  SwigClassFile.mark = 0;
4738
4824
  SwigClassFile.destroy = (void (*)(void *)) free_taglib_mpeg_file;
4739
4825
  SwigClassFile.trackObjects = 1;
@@ -1881,7 +1881,7 @@ TagLib::ByteVector ruby_string_to_taglib_bytevector(VALUE s) {
1881
1881
  if (NIL_P(s)) {
1882
1882
  return TagLib::ByteVector::null;
1883
1883
  } else {
1884
- return TagLib::ByteVector(RSTRING_PTR(s), RSTRING_LEN(s));
1884
+ return TagLib::ByteVector(RSTRING_PTR(StringValue(s)), RSTRING_LEN(s));
1885
1885
  }
1886
1886
  }
1887
1887
 
@@ -1899,7 +1899,7 @@ TagLib::String ruby_string_to_taglib_string(VALUE s) {
1899
1899
  if (NIL_P(s)) {
1900
1900
  return TagLib::String::null;
1901
1901
  } else {
1902
- return TagLib::String(RSTRING_PTR(CONVERT_TO_UTF8(s)), TagLib::String::UTF8);
1902
+ return TagLib::String(RSTRING_PTR(CONVERT_TO_UTF8(StringValue(s))), TagLib::String::UTF8);
1903
1903
  }
1904
1904
  }
1905
1905
 
@@ -2042,11 +2042,7 @@ SWIGINTERN int
2042
2042
  SWIG_AsCharPtrAndSize(VALUE obj, char** cptr, size_t* psize, int *alloc)
2043
2043
  {
2044
2044
  if (TYPE(obj) == T_STRING) {
2045
- #if defined(StringValuePtr)
2046
2045
  char *cstr = StringValuePtr(obj);
2047
- #else
2048
- char *cstr = STR2CSTR(obj);
2049
- #endif
2050
2046
  size_t size = RSTRING_LEN(obj) + 1;
2051
2047
  if (cptr) {
2052
2048
  if (alloc) {