taglib-ruby 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. data/CHANGES.md +7 -0
  2. data/Gemfile +1 -2
  3. data/Gemfile.lock +9 -8
  4. data/README.md +22 -7
  5. data/Rakefile +9 -15
  6. data/docs/taglib/base.rb +31 -8
  7. data/docs/taglib/id3v1.rb +5 -0
  8. data/docs/taglib/mpeg.rb +8 -0
  9. data/docs/taglib/ogg.rb +77 -0
  10. data/docs/taglib/vorbis.rb +43 -0
  11. data/ext/taglib_base/includes.i +25 -1
  12. data/ext/taglib_base/taglib_base.i +46 -2
  13. data/ext/taglib_base/taglib_base_wrap.cxx +176 -185
  14. data/ext/taglib_id3v1/extconf.rb +4 -0
  15. data/ext/taglib_id3v1/taglib_id3v1.i +11 -0
  16. data/ext/taglib_id3v1/taglib_id3v1_wrap.cxx +3092 -0
  17. data/ext/taglib_id3v2/taglib_id3v2.i +0 -8
  18. data/ext/taglib_id3v2/taglib_id3v2_wrap.cxx +194 -248
  19. data/ext/taglib_mpeg/taglib_mpeg.i +16 -2
  20. data/ext/taglib_mpeg/taglib_mpeg_wrap.cxx +157 -149
  21. data/ext/taglib_ogg/extconf.rb +4 -0
  22. data/ext/taglib_ogg/taglib_ogg.i +36 -0
  23. data/ext/taglib_ogg/taglib_ogg_wrap.cxx +3613 -0
  24. data/ext/taglib_vorbis/extconf.rb +4 -0
  25. data/ext/taglib_vorbis/taglib_vorbis.i +48 -0
  26. data/ext/taglib_vorbis/taglib_vorbis_wrap.cxx +3056 -0
  27. data/ext/win.cmake +6 -0
  28. data/lib/taglib/id3v1.rb +1 -0
  29. data/lib/taglib/ogg.rb +1 -0
  30. data/lib/taglib/version.rb +2 -2
  31. data/lib/taglib/vorbis.rb +1 -0
  32. data/lib/taglib.rb +10 -0
  33. data/taglib-ruby.gemspec +35 -11
  34. data/tasks/ext.rake +79 -0
  35. data/tasks/swig.rake +43 -0
  36. data/test/data/Makefile +15 -0
  37. data/test/data/id3v1-create.cpp +31 -0
  38. data/test/data/id3v1.mp3 +0 -0
  39. data/test/data/vorbis-create.cpp +42 -0
  40. data/test/data/vorbis.oga +0 -0
  41. data/test/test_fileref_write.rb +38 -0
  42. data/test/test_id3v1_tag.rb +36 -0
  43. data/test/test_id3v2_frames.rb +5 -0
  44. data/test/test_id3v2_memory.rb +23 -0
  45. data/test/test_id3v2_relative_volume.rb +5 -0
  46. data/test/test_id3v2_tag.rb +5 -0
  47. data/test/test_id3v2_unicode.rb +5 -0
  48. data/test/test_id3v2_write.rb +6 -1
  49. data/test/test_mpeg_file.rb +18 -1
  50. data/test/test_vorbis_file.rb +44 -0
  51. data/test/test_vorbis_tag.rb +79 -0
  52. metadata +113 -137
  53. data/ext/Rakefile +0 -32
@@ -1,8 +1,6 @@
1
1
  %module "TagLib::MPEG"
2
2
  %{
3
3
  #include <taglib/taglib.h>
4
- #include <taglib/tfile.h>
5
- #include <taglib/tstringlist.h>
6
4
  #include <taglib/xingheader.h>
7
5
  #include <taglib/mpegheader.h>
8
6
  #include <taglib/mpegproperties.h>
@@ -28,6 +26,9 @@
28
26
 
29
27
  // Unlink Ruby objects from the deleted C++ objects. Otherwise Ruby code
30
28
  // that calls a method on a tag after the file is deleted segfaults.
29
+ %begin %{
30
+ static void free_taglib_mpeg_file(void *ptr);
31
+ %}
31
32
  %header %{
32
33
  static void free_taglib_mpeg_file(void *ptr) {
33
34
  TagLib::MPEG::File *file = (TagLib::MPEG::File *) ptr;
@@ -51,11 +52,24 @@
51
52
  SWIG_RubyRemoveTracking(id3v2tag);
52
53
  }
53
54
 
55
+ TagLib::MPEG::Properties *properties = file->audioProperties();
56
+ if (properties) {
57
+ SWIG_RubyUnlinkObjects(properties);
58
+ SWIG_RubyRemoveTracking(properties);
59
+ }
60
+
61
+ SWIG_RubyUnlinkObjects(ptr);
54
62
  SWIG_RubyRemoveTracking(ptr);
55
63
 
56
64
  delete file;
57
65
  }
58
66
  %}
59
67
 
68
+ %extend TagLib::MPEG::File {
69
+ void close() {
70
+ free_taglib_mpeg_file($self);
71
+ }
72
+ }
73
+
60
74
 
61
75
  // vim: set filetype=cpp sw=2 ts=2 expandtab:
@@ -1,6 +1,6 @@
1
1
  /* ----------------------------------------------------------------------------
2
2
  * This file was automatically generated by SWIG (http://www.swig.org).
3
- * Version 2.0.4
3
+ * Version 2.0.5
4
4
  *
5
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
@@ -8,6 +8,9 @@
8
8
  * interface file instead.
9
9
  * ----------------------------------------------------------------------------- */
10
10
 
11
+ static void free_taglib_mpeg_file(void *ptr);
12
+
13
+
11
14
  #define SWIGRUBY
12
15
 
13
16
 
@@ -1815,23 +1818,22 @@ int SWIG_Ruby_arity( VALUE proc, int minimal )
1815
1818
 
1816
1819
  #define SWIGTYPE_p_TagLib__APE__Tag swig_types[0]
1817
1820
  #define SWIGTYPE_p_TagLib__AudioProperties swig_types[1]
1818
- #define SWIGTYPE_p_TagLib__ByteVector swig_types[2]
1819
- #define SWIGTYPE_p_TagLib__File swig_types[3]
1820
- #define SWIGTYPE_p_TagLib__ID3v1__Tag swig_types[4]
1821
- #define SWIGTYPE_p_TagLib__ID3v2__FrameFactory swig_types[5]
1822
- #define SWIGTYPE_p_TagLib__ID3v2__Tag swig_types[6]
1823
- #define SWIGTYPE_p_TagLib__MPEG__File swig_types[7]
1824
- #define SWIGTYPE_p_TagLib__MPEG__Header swig_types[8]
1825
- #define SWIGTYPE_p_TagLib__MPEG__Properties swig_types[9]
1826
- #define SWIGTYPE_p_TagLib__MPEG__XingHeader swig_types[10]
1827
- #define SWIGTYPE_p_TagLib__Tag swig_types[11]
1828
- #define SWIGTYPE_p_char swig_types[12]
1829
- #define SWIGTYPE_p_unsigned_char swig_types[13]
1830
- #define SWIGTYPE_p_unsigned_int swig_types[14]
1831
- #define SWIGTYPE_p_unsigned_long swig_types[15]
1832
- #define SWIGTYPE_p_wchar_t swig_types[16]
1833
- static swig_type_info *swig_types[18];
1834
- static swig_module_info swig_module = {swig_types, 17, 0, 0, 0, 0};
1821
+ #define SWIGTYPE_p_TagLib__File swig_types[2]
1822
+ #define SWIGTYPE_p_TagLib__ID3v1__Tag swig_types[3]
1823
+ #define SWIGTYPE_p_TagLib__ID3v2__FrameFactory swig_types[4]
1824
+ #define SWIGTYPE_p_TagLib__ID3v2__Tag swig_types[5]
1825
+ #define SWIGTYPE_p_TagLib__MPEG__File swig_types[6]
1826
+ #define SWIGTYPE_p_TagLib__MPEG__Header swig_types[7]
1827
+ #define SWIGTYPE_p_TagLib__MPEG__Properties swig_types[8]
1828
+ #define SWIGTYPE_p_TagLib__MPEG__XingHeader swig_types[9]
1829
+ #define SWIGTYPE_p_TagLib__Tag swig_types[10]
1830
+ #define SWIGTYPE_p_char swig_types[11]
1831
+ #define SWIGTYPE_p_unsigned_char swig_types[12]
1832
+ #define SWIGTYPE_p_unsigned_int swig_types[13]
1833
+ #define SWIGTYPE_p_unsigned_long swig_types[14]
1834
+ #define SWIGTYPE_p_wchar_t swig_types[15]
1835
+ static swig_type_info *swig_types[17];
1836
+ static swig_module_info swig_module = {swig_types, 16, 0, 0, 0, 0};
1835
1837
  #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
1836
1838
  #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
1837
1839
 
@@ -1846,7 +1848,7 @@ static VALUE mMPEG;
1846
1848
  #define SWIG_RUBY_THREAD_END_BLOCK
1847
1849
 
1848
1850
 
1849
- #define SWIGVERSION 0x020004
1851
+ #define SWIGVERSION 0x020005
1850
1852
  #define SWIG_VERSION SWIGVERSION
1851
1853
 
1852
1854
 
@@ -1858,8 +1860,6 @@ static VALUE mMPEG;
1858
1860
 
1859
1861
 
1860
1862
  #include <taglib/taglib.h>
1861
- #include <taglib/tfile.h>
1862
- #include <taglib/tstringlist.h>
1863
1863
  #include <taglib/xingheader.h>
1864
1864
  #include <taglib/mpegheader.h>
1865
1865
  #include <taglib/mpegproperties.h>
@@ -1867,6 +1867,10 @@ static VALUE mMPEG;
1867
1867
  #include <taglib/id3v2tag.h>
1868
1868
 
1869
1869
 
1870
+ #include <taglib/tstring.h>
1871
+ #include <taglib/tstringlist.h>
1872
+ #include <taglib/tfile.h>
1873
+
1870
1874
  #if defined(HAVE_RUBY_ENCODING_H) && HAVE_RUBY_ENCODING_H
1871
1875
  # include <ruby/encoding.h>
1872
1876
  # define ASSOCIATE_UTF8_ENCODING(value) rb_enc_associate(value, rb_utf8_encoding());
@@ -1921,6 +1925,79 @@ TagLib::StringList ruby_array_to_taglib_string_list(VALUE ary) {
1921
1925
  return result;
1922
1926
  }
1923
1927
 
1928
+ VALUE taglib_filename_to_ruby_string(TagLib::FileName filename) {
1929
+ #ifdef _WIN32
1930
+ const char *s = (const char *) filename;
1931
+ return rb_tainted_str_new2(s);
1932
+ #else
1933
+ return rb_tainted_str_new2(filename);
1934
+ #endif
1935
+ }
1936
+
1937
+ TagLib::FileName ruby_string_to_taglib_filename(VALUE s) {
1938
+ #ifdef _WIN32
1939
+ const char *filename = StringValuePtr(s);
1940
+ return TagLib::FileName(filename);
1941
+ #else
1942
+ return StringValuePtr(s);
1943
+ #endif
1944
+ }
1945
+
1946
+
1947
+
1948
+ SWIGINTERN swig_type_info*
1949
+ SWIG_pchar_descriptor(void)
1950
+ {
1951
+ static int init = 0;
1952
+ static swig_type_info* info = 0;
1953
+ if (!init) {
1954
+ info = SWIG_TypeQuery("_p_char");
1955
+ init = 1;
1956
+ }
1957
+ return info;
1958
+ }
1959
+
1960
+
1961
+ SWIGINTERN int
1962
+ SWIG_AsCharPtrAndSize(VALUE obj, char** cptr, size_t* psize, int *alloc)
1963
+ {
1964
+ if (TYPE(obj) == T_STRING) {
1965
+ #if defined(StringValuePtr)
1966
+ char *cstr = StringValuePtr(obj);
1967
+ #else
1968
+ char *cstr = STR2CSTR(obj);
1969
+ #endif
1970
+ size_t size = RSTRING_LEN(obj) + 1;
1971
+ if (cptr) {
1972
+ if (alloc) {
1973
+ if (*alloc == SWIG_NEWOBJ) {
1974
+ *cptr = reinterpret_cast< char* >(memcpy((new char[size]), cstr, sizeof(char)*(size)));
1975
+ } else {
1976
+ *cptr = cstr;
1977
+ *alloc = SWIG_OLDOBJ;
1978
+ }
1979
+ }
1980
+ }
1981
+ if (psize) *psize = size;
1982
+ return SWIG_OK;
1983
+ } else {
1984
+ swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
1985
+ if (pchar_descriptor) {
1986
+ void* vptr = 0;
1987
+ if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
1988
+ if (cptr) *cptr = (char *)vptr;
1989
+ if (psize) *psize = vptr ? (strlen((char*)vptr) + 1) : 0;
1990
+ if (alloc) *alloc = SWIG_OLDOBJ;
1991
+ return SWIG_OK;
1992
+ }
1993
+ }
1994
+ }
1995
+ return SWIG_TypeError;
1996
+ }
1997
+
1998
+
1999
+
2000
+
1924
2001
 
1925
2002
  SWIGINTERNINLINE VALUE
1926
2003
  SWIG_From_bool (bool value)
@@ -1963,7 +2040,7 @@ SWIG_ruby_failed(void)
1963
2040
  }
1964
2041
 
1965
2042
 
1966
- /*@SWIG:/usr/share/swig2.0/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2043
+ /*@SWIG:/usr/local/share/swig/2.0.5/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
1967
2044
  SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args)
1968
2045
  {
1969
2046
  VALUE obj = args[0];
@@ -2015,60 +2092,6 @@ SWIG_From_int (int value)
2015
2092
  }
2016
2093
 
2017
2094
 
2018
- SWIGINTERN swig_type_info*
2019
- SWIG_pchar_descriptor(void)
2020
- {
2021
- static int init = 0;
2022
- static swig_type_info* info = 0;
2023
- if (!init) {
2024
- info = SWIG_TypeQuery("_p_char");
2025
- init = 1;
2026
- }
2027
- return info;
2028
- }
2029
-
2030
-
2031
- SWIGINTERN int
2032
- SWIG_AsCharPtrAndSize(VALUE obj, char** cptr, size_t* psize, int *alloc)
2033
- {
2034
- if (TYPE(obj) == T_STRING) {
2035
- #if defined(StringValuePtr)
2036
- char *cstr = StringValuePtr(obj);
2037
- #else
2038
- char *cstr = STR2CSTR(obj);
2039
- #endif
2040
- size_t size = RSTRING_LEN(obj) + 1;
2041
- if (cptr) {
2042
- if (alloc) {
2043
- if (*alloc == SWIG_NEWOBJ) {
2044
- *cptr = reinterpret_cast< char* >(memcpy((new char[size]), cstr, sizeof(char)*(size)));
2045
- } else {
2046
- *cptr = cstr;
2047
- *alloc = SWIG_OLDOBJ;
2048
- }
2049
- }
2050
- }
2051
- if (psize) *psize = size;
2052
- return SWIG_OK;
2053
- } else {
2054
- swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
2055
- if (pchar_descriptor) {
2056
- void* vptr = 0;
2057
- if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
2058
- if (cptr) *cptr = (char *)vptr;
2059
- if (psize) *psize = vptr ? (strlen((char*)vptr) + 1) : 0;
2060
- if (alloc) *alloc = SWIG_OLDOBJ;
2061
- return SWIG_OK;
2062
- }
2063
- }
2064
- }
2065
- return SWIG_TypeError;
2066
- }
2067
-
2068
-
2069
-
2070
-
2071
-
2072
2095
  SWIGINTERN int
2073
2096
  SWIG_AsVal_bool (VALUE obj, bool *val)
2074
2097
  {
@@ -2088,6 +2111,9 @@ SWIG_AsVal_bool (VALUE obj, bool *val)
2088
2111
  return SWIG_TypeError;
2089
2112
  }
2090
2113
 
2114
+ SWIGINTERN void TagLib_MPEG_File_close(TagLib::MPEG::File *self){
2115
+ free_taglib_mpeg_file(self);
2116
+ }
2091
2117
 
2092
2118
  static void free_taglib_mpeg_file(void *ptr) {
2093
2119
  TagLib::MPEG::File *file = (TagLib::MPEG::File *) ptr;
@@ -2111,12 +2137,19 @@ SWIG_AsVal_bool (VALUE obj, bool *val)
2111
2137
  SWIG_RubyRemoveTracking(id3v2tag);
2112
2138
  }
2113
2139
 
2140
+ TagLib::MPEG::Properties *properties = file->audioProperties();
2141
+ if (properties) {
2142
+ SWIG_RubyUnlinkObjects(properties);
2143
+ SWIG_RubyRemoveTracking(properties);
2144
+ }
2145
+
2146
+ SWIG_RubyUnlinkObjects(ptr);
2114
2147
  SWIG_RubyRemoveTracking(ptr);
2115
2148
 
2116
2149
  delete file;
2117
2150
  }
2118
2151
 
2119
- swig_class SwigClassXingHeader;
2152
+ static swig_class SwigClassXingHeader;
2120
2153
 
2121
2154
  #ifdef HAVE_RB_DEFINE_ALLOC_FUNC
2122
2155
  SWIGINTERN VALUE
@@ -2267,7 +2300,7 @@ fail:
2267
2300
  }
2268
2301
 
2269
2302
 
2270
- swig_class SwigClassHeader;
2303
+ static swig_class SwigClassHeader;
2271
2304
 
2272
2305
  SWIGINTERN VALUE
2273
2306
  _wrap_new_Header__SWIG_0(int argc, VALUE *argv, VALUE self) {
@@ -2348,19 +2381,18 @@ SWIGINTERN VALUE _wrap_new_Header(int nargs, VALUE *args, VALUE self) {
2348
2381
  if (argc == 1) {
2349
2382
  int _v;
2350
2383
  void *vptr = 0;
2351
- int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_TagLib__ByteVector, 0);
2384
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_TagLib__MPEG__Header, 0);
2352
2385
  _v = SWIG_CheckState(res);
2353
2386
  if (_v) {
2354
- return _wrap_new_Header__SWIG_0(nargs, args, self);
2387
+ return _wrap_new_Header__SWIG_1(nargs, args, self);
2355
2388
  }
2356
2389
  }
2357
2390
  if (argc == 1) {
2358
2391
  int _v;
2359
- void *vptr = 0;
2360
- int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_TagLib__MPEG__Header, 0);
2392
+ int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
2361
2393
  _v = SWIG_CheckState(res);
2362
2394
  if (_v) {
2363
- return _wrap_new_Header__SWIG_1(nargs, args, self);
2395
+ return _wrap_new_Header__SWIG_0(nargs, args, self);
2364
2396
  }
2365
2397
  }
2366
2398
 
@@ -2667,7 +2699,7 @@ fail:
2667
2699
  }
2668
2700
 
2669
2701
 
2670
- swig_class SwigClassProperties;
2702
+ static swig_class SwigClassProperties;
2671
2703
 
2672
2704
  SWIGINTERN VALUE
2673
2705
  _wrap_new_Properties__SWIG_0(int argc, VALUE *argv, VALUE self) {
@@ -3056,16 +3088,13 @@ fail:
3056
3088
  }
3057
3089
 
3058
3090
 
3059
- swig_class SwigClassFile;
3091
+ static swig_class SwigClassFile;
3060
3092
 
3061
3093
  SWIGINTERN VALUE
3062
3094
  _wrap_new_File__SWIG_0(int argc, VALUE *argv, VALUE self) {
3063
- TagLib::FileName arg1 = (TagLib::FileName) 0 ;
3095
+ SwigValueWrapper< TagLib::FileName > arg1 ;
3064
3096
  bool arg2 ;
3065
3097
  TagLib::MPEG::Properties::ReadStyle arg3 ;
3066
- int res1 ;
3067
- char *buf1 = 0 ;
3068
- int alloc1 = 0 ;
3069
3098
  bool val2 ;
3070
3099
  int ecode2 = 0 ;
3071
3100
  int val3 ;
@@ -3075,11 +3104,9 @@ _wrap_new_File__SWIG_0(int argc, VALUE *argv, VALUE self) {
3075
3104
  if ((argc < 3) || (argc > 3)) {
3076
3105
  rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
3077
3106
  }
3078
- res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
3079
- if (!SWIG_IsOK(res1)) {
3080
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::FileName","TagLib::MPEG::File", 1, argv[0] ));
3107
+ {
3108
+ arg1 = ruby_string_to_taglib_filename(argv[0]);
3081
3109
  }
3082
- arg1 = reinterpret_cast< TagLib::FileName >(buf1);
3083
3110
  ecode2 = SWIG_AsVal_bool(argv[1], &val2);
3084
3111
  if (!SWIG_IsOK(ecode2)) {
3085
3112
  SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "bool","TagLib::MPEG::File", 2, argv[1] ));
@@ -3093,21 +3120,16 @@ _wrap_new_File__SWIG_0(int argc, VALUE *argv, VALUE self) {
3093
3120
  result = (TagLib::MPEG::File *)new TagLib::MPEG::File(arg1,arg2,arg3);
3094
3121
  DATA_PTR(self) = result;
3095
3122
  SWIG_RubyAddTracking(result, self);
3096
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
3097
3123
  return self;
3098
3124
  fail:
3099
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
3100
3125
  return Qnil;
3101
3126
  }
3102
3127
 
3103
3128
 
3104
3129
  SWIGINTERN VALUE
3105
3130
  _wrap_new_File__SWIG_1(int argc, VALUE *argv, VALUE self) {
3106
- TagLib::FileName arg1 = (TagLib::FileName) 0 ;
3131
+ SwigValueWrapper< TagLib::FileName > arg1 ;
3107
3132
  bool arg2 ;
3108
- int res1 ;
3109
- char *buf1 = 0 ;
3110
- int alloc1 = 0 ;
3111
3133
  bool val2 ;
3112
3134
  int ecode2 = 0 ;
3113
3135
  TagLib::MPEG::File *result = 0 ;
@@ -3115,11 +3137,9 @@ _wrap_new_File__SWIG_1(int argc, VALUE *argv, VALUE self) {
3115
3137
  if ((argc < 2) || (argc > 2)) {
3116
3138
  rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
3117
3139
  }
3118
- res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
3119
- if (!SWIG_IsOK(res1)) {
3120
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::FileName","TagLib::MPEG::File", 1, argv[0] ));
3140
+ {
3141
+ arg1 = ruby_string_to_taglib_filename(argv[0]);
3121
3142
  }
3122
- arg1 = reinterpret_cast< TagLib::FileName >(buf1);
3123
3143
  ecode2 = SWIG_AsVal_bool(argv[1], &val2);
3124
3144
  if (!SWIG_IsOK(ecode2)) {
3125
3145
  SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "bool","TagLib::MPEG::File", 2, argv[1] ));
@@ -3128,50 +3148,38 @@ _wrap_new_File__SWIG_1(int argc, VALUE *argv, VALUE self) {
3128
3148
  result = (TagLib::MPEG::File *)new TagLib::MPEG::File(arg1,arg2);
3129
3149
  DATA_PTR(self) = result;
3130
3150
  SWIG_RubyAddTracking(result, self);
3131
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
3132
3151
  return self;
3133
3152
  fail:
3134
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
3135
3153
  return Qnil;
3136
3154
  }
3137
3155
 
3138
3156
 
3139
3157
  SWIGINTERN VALUE
3140
3158
  _wrap_new_File__SWIG_2(int argc, VALUE *argv, VALUE self) {
3141
- TagLib::FileName arg1 = (TagLib::FileName) 0 ;
3142
- int res1 ;
3143
- char *buf1 = 0 ;
3144
- int alloc1 = 0 ;
3159
+ SwigValueWrapper< TagLib::FileName > arg1 ;
3145
3160
  TagLib::MPEG::File *result = 0 ;
3146
3161
 
3147
3162
  if ((argc < 1) || (argc > 1)) {
3148
3163
  rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
3149
3164
  }
3150
- res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
3151
- if (!SWIG_IsOK(res1)) {
3152
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::FileName","TagLib::MPEG::File", 1, argv[0] ));
3165
+ {
3166
+ arg1 = ruby_string_to_taglib_filename(argv[0]);
3153
3167
  }
3154
- arg1 = reinterpret_cast< TagLib::FileName >(buf1);
3155
3168
  result = (TagLib::MPEG::File *)new TagLib::MPEG::File(arg1);
3156
3169
  DATA_PTR(self) = result;
3157
3170
  SWIG_RubyAddTracking(result, self);
3158
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
3159
3171
  return self;
3160
3172
  fail:
3161
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
3162
3173
  return Qnil;
3163
3174
  }
3164
3175
 
3165
3176
 
3166
3177
  SWIGINTERN VALUE
3167
3178
  _wrap_new_File__SWIG_3(int argc, VALUE *argv, VALUE self) {
3168
- TagLib::FileName arg1 = (TagLib::FileName) 0 ;
3179
+ SwigValueWrapper< TagLib::FileName > arg1 ;
3169
3180
  TagLib::ID3v2::FrameFactory *arg2 = (TagLib::ID3v2::FrameFactory *) 0 ;
3170
3181
  bool arg3 ;
3171
3182
  TagLib::MPEG::Properties::ReadStyle arg4 ;
3172
- int res1 ;
3173
- char *buf1 = 0 ;
3174
- int alloc1 = 0 ;
3175
3183
  void *argp2 = 0 ;
3176
3184
  int res2 = 0 ;
3177
3185
  bool val3 ;
@@ -3183,11 +3191,9 @@ _wrap_new_File__SWIG_3(int argc, VALUE *argv, VALUE self) {
3183
3191
  if ((argc < 4) || (argc > 4)) {
3184
3192
  rb_raise(rb_eArgError, "wrong # of arguments(%d for 4)",argc); SWIG_fail;
3185
3193
  }
3186
- res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
3187
- if (!SWIG_IsOK(res1)) {
3188
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::FileName","TagLib::MPEG::File", 1, argv[0] ));
3194
+ {
3195
+ arg1 = ruby_string_to_taglib_filename(argv[0]);
3189
3196
  }
3190
- arg1 = reinterpret_cast< TagLib::FileName >(buf1);
3191
3197
  res2 = SWIG_ConvertPtr(argv[1], &argp2,SWIGTYPE_p_TagLib__ID3v2__FrameFactory, 0 | 0 );
3192
3198
  if (!SWIG_IsOK(res2)) {
3193
3199
  SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "TagLib::ID3v2::FrameFactory *","TagLib::MPEG::File", 2, argv[1] ));
@@ -3206,22 +3212,17 @@ _wrap_new_File__SWIG_3(int argc, VALUE *argv, VALUE self) {
3206
3212
  result = (TagLib::MPEG::File *)new TagLib::MPEG::File(arg1,arg2,arg3,arg4);
3207
3213
  DATA_PTR(self) = result;
3208
3214
  SWIG_RubyAddTracking(result, self);
3209
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
3210
3215
  return self;
3211
3216
  fail:
3212
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
3213
3217
  return Qnil;
3214
3218
  }
3215
3219
 
3216
3220
 
3217
3221
  SWIGINTERN VALUE
3218
3222
  _wrap_new_File__SWIG_4(int argc, VALUE *argv, VALUE self) {
3219
- TagLib::FileName arg1 = (TagLib::FileName) 0 ;
3223
+ SwigValueWrapper< TagLib::FileName > arg1 ;
3220
3224
  TagLib::ID3v2::FrameFactory *arg2 = (TagLib::ID3v2::FrameFactory *) 0 ;
3221
3225
  bool arg3 ;
3222
- int res1 ;
3223
- char *buf1 = 0 ;
3224
- int alloc1 = 0 ;
3225
3226
  void *argp2 = 0 ;
3226
3227
  int res2 = 0 ;
3227
3228
  bool val3 ;
@@ -3231,11 +3232,9 @@ _wrap_new_File__SWIG_4(int argc, VALUE *argv, VALUE self) {
3231
3232
  if ((argc < 3) || (argc > 3)) {
3232
3233
  rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
3233
3234
  }
3234
- res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
3235
- if (!SWIG_IsOK(res1)) {
3236
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::FileName","TagLib::MPEG::File", 1, argv[0] ));
3235
+ {
3236
+ arg1 = ruby_string_to_taglib_filename(argv[0]);
3237
3237
  }
3238
- arg1 = reinterpret_cast< TagLib::FileName >(buf1);
3239
3238
  res2 = SWIG_ConvertPtr(argv[1], &argp2,SWIGTYPE_p_TagLib__ID3v2__FrameFactory, 0 | 0 );
3240
3239
  if (!SWIG_IsOK(res2)) {
3241
3240
  SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "TagLib::ID3v2::FrameFactory *","TagLib::MPEG::File", 2, argv[1] ));
@@ -3249,10 +3248,8 @@ _wrap_new_File__SWIG_4(int argc, VALUE *argv, VALUE self) {
3249
3248
  result = (TagLib::MPEG::File *)new TagLib::MPEG::File(arg1,arg2,arg3);
3250
3249
  DATA_PTR(self) = result;
3251
3250
  SWIG_RubyAddTracking(result, self);
3252
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
3253
3251
  return self;
3254
3252
  fail:
3255
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
3256
3253
  return Qnil;
3257
3254
  }
3258
3255
 
@@ -3276,11 +3273,8 @@ _wrap_File_allocate(VALUE self) {
3276
3273
 
3277
3274
  SWIGINTERN VALUE
3278
3275
  _wrap_new_File__SWIG_5(int argc, VALUE *argv, VALUE self) {
3279
- TagLib::FileName arg1 = (TagLib::FileName) 0 ;
3276
+ SwigValueWrapper< TagLib::FileName > arg1 ;
3280
3277
  TagLib::ID3v2::FrameFactory *arg2 = (TagLib::ID3v2::FrameFactory *) 0 ;
3281
- int res1 ;
3282
- char *buf1 = 0 ;
3283
- int alloc1 = 0 ;
3284
3278
  void *argp2 = 0 ;
3285
3279
  int res2 = 0 ;
3286
3280
  TagLib::MPEG::File *result = 0 ;
@@ -3288,11 +3282,9 @@ _wrap_new_File__SWIG_5(int argc, VALUE *argv, VALUE self) {
3288
3282
  if ((argc < 2) || (argc > 2)) {
3289
3283
  rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
3290
3284
  }
3291
- res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
3292
- if (!SWIG_IsOK(res1)) {
3293
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::FileName","TagLib::MPEG::File", 1, argv[0] ));
3285
+ {
3286
+ arg1 = ruby_string_to_taglib_filename(argv[0]);
3294
3287
  }
3295
- arg1 = reinterpret_cast< TagLib::FileName >(buf1);
3296
3288
  res2 = SWIG_ConvertPtr(argv[1], &argp2,SWIGTYPE_p_TagLib__ID3v2__FrameFactory, 0 | 0 );
3297
3289
  if (!SWIG_IsOK(res2)) {
3298
3290
  SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "TagLib::ID3v2::FrameFactory *","TagLib::MPEG::File", 2, argv[1] ));
@@ -3301,10 +3293,8 @@ _wrap_new_File__SWIG_5(int argc, VALUE *argv, VALUE self) {
3301
3293
  result = (TagLib::MPEG::File *)new TagLib::MPEG::File(arg1,arg2);
3302
3294
  DATA_PTR(self) = result;
3303
3295
  SWIG_RubyAddTracking(result, self);
3304
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
3305
3296
  return self;
3306
3297
  fail:
3307
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
3308
3298
  return Qnil;
3309
3299
  }
3310
3300
 
@@ -4250,6 +4240,27 @@ fail:
4250
4240
  }
4251
4241
 
4252
4242
 
4243
+ SWIGINTERN VALUE
4244
+ _wrap_File_close(int argc, VALUE *argv, VALUE self) {
4245
+ TagLib::MPEG::File *arg1 = (TagLib::MPEG::File *) 0 ;
4246
+ void *argp1 = 0 ;
4247
+ int res1 = 0 ;
4248
+
4249
+ if ((argc < 0) || (argc > 0)) {
4250
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
4251
+ }
4252
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_TagLib__MPEG__File, 0 | 0 );
4253
+ if (!SWIG_IsOK(res1)) {
4254
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "TagLib::MPEG::File *","close", 1, self ));
4255
+ }
4256
+ arg1 = reinterpret_cast< TagLib::MPEG::File * >(argp1);
4257
+ TagLib_MPEG_File_close(arg1);
4258
+ return Qnil;
4259
+ fail:
4260
+ return Qnil;
4261
+ }
4262
+
4263
+
4253
4264
 
4254
4265
  /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
4255
4266
 
@@ -4261,7 +4272,6 @@ static void *_p_TagLib__MPEG__PropertiesTo_p_TagLib__AudioProperties(void *x, in
4261
4272
  }
4262
4273
  static swig_type_info _swigt__p_TagLib__APE__Tag = {"_p_TagLib__APE__Tag", "TagLib::APE::Tag *", 0, 0, (void*)0, 0};
4263
4274
  static swig_type_info _swigt__p_TagLib__AudioProperties = {"_p_TagLib__AudioProperties", "TagLib::AudioProperties *", 0, 0, (void*)0, 0};
4264
- static swig_type_info _swigt__p_TagLib__ByteVector = {"_p_TagLib__ByteVector", "TagLib::ByteVector *", 0, 0, (void*)0, 0};
4265
4275
  static swig_type_info _swigt__p_TagLib__File = {"_p_TagLib__File", "TagLib::File *", 0, 0, (void*)0, 0};
4266
4276
  static swig_type_info _swigt__p_TagLib__ID3v1__Tag = {"_p_TagLib__ID3v1__Tag", "TagLib::ID3v1::Tag *", 0, 0, (void*)0, 0};
4267
4277
  static swig_type_info _swigt__p_TagLib__ID3v2__FrameFactory = {"_p_TagLib__ID3v2__FrameFactory", "TagLib::ID3v2::FrameFactory *", 0, 0, (void*)0, 0};
@@ -4280,7 +4290,6 @@ static swig_type_info _swigt__p_wchar_t = {"_p_wchar_t", "TagLib::wchar *|wchar_
4280
4290
  static swig_type_info *swig_type_initial[] = {
4281
4291
  &_swigt__p_TagLib__APE__Tag,
4282
4292
  &_swigt__p_TagLib__AudioProperties,
4283
- &_swigt__p_TagLib__ByteVector,
4284
4293
  &_swigt__p_TagLib__File,
4285
4294
  &_swigt__p_TagLib__ID3v1__Tag,
4286
4295
  &_swigt__p_TagLib__ID3v2__FrameFactory,
@@ -4299,7 +4308,6 @@ static swig_type_info *swig_type_initial[] = {
4299
4308
 
4300
4309
  static swig_cast_info _swigc__p_TagLib__APE__Tag[] = { {&_swigt__p_TagLib__APE__Tag, 0, 0, 0},{0, 0, 0, 0}};
4301
4310
  static swig_cast_info _swigc__p_TagLib__AudioProperties[] = { {&_swigt__p_TagLib__AudioProperties, 0, 0, 0}, {&_swigt__p_TagLib__MPEG__Properties, _p_TagLib__MPEG__PropertiesTo_p_TagLib__AudioProperties, 0, 0},{0, 0, 0, 0}};
4302
- static swig_cast_info _swigc__p_TagLib__ByteVector[] = { {&_swigt__p_TagLib__ByteVector, 0, 0, 0},{0, 0, 0, 0}};
4303
4311
  static swig_cast_info _swigc__p_TagLib__File[] = { {&_swigt__p_TagLib__MPEG__File, _p_TagLib__MPEG__FileTo_p_TagLib__File, 0, 0}, {&_swigt__p_TagLib__File, 0, 0, 0},{0, 0, 0, 0}};
4304
4312
  static swig_cast_info _swigc__p_TagLib__ID3v1__Tag[] = { {&_swigt__p_TagLib__ID3v1__Tag, 0, 0, 0},{0, 0, 0, 0}};
4305
4313
  static swig_cast_info _swigc__p_TagLib__ID3v2__FrameFactory[] = { {&_swigt__p_TagLib__ID3v2__FrameFactory, 0, 0, 0},{0, 0, 0, 0}};
@@ -4318,7 +4326,6 @@ static swig_cast_info _swigc__p_wchar_t[] = { {&_swigt__p_wchar_t, 0, 0, 0},{0,
4318
4326
  static swig_cast_info *swig_cast_initial[] = {
4319
4327
  _swigc__p_TagLib__APE__Tag,
4320
4328
  _swigc__p_TagLib__AudioProperties,
4321
- _swigc__p_TagLib__ByteVector,
4322
4329
  _swigc__p_TagLib__File,
4323
4330
  _swigc__p_TagLib__ID3v1__Tag,
4324
4331
  _swigc__p_TagLib__ID3v2__FrameFactory,
@@ -4675,6 +4682,7 @@ SWIGEXPORT void Init_taglib_mpeg(void) {
4675
4682
  rb_define_method(SwigClassFile.klass, "next_frame_offset", VALUEFUNC(_wrap_File_next_frame_offset), -1);
4676
4683
  rb_define_method(SwigClassFile.klass, "previous_frame_offset", VALUEFUNC(_wrap_File_previous_frame_offset), -1);
4677
4684
  rb_define_method(SwigClassFile.klass, "last_frame_offset", VALUEFUNC(_wrap_File_last_frame_offset), -1);
4685
+ rb_define_method(SwigClassFile.klass, "close", VALUEFUNC(_wrap_File_close), -1);
4678
4686
  SwigClassFile.mark = 0;
4679
4687
  SwigClassFile.destroy = (void (*)(void *)) free_taglib_mpeg_file;
4680
4688
  SwigClassFile.trackObjects = 1;