taglib-ruby 1.1.2 → 2.0.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 (37) hide show
  1. checksums.yaml +4 -4
  2. data/.github/FUNDING.yml +1 -0
  3. data/CHANGELOG.md +22 -0
  4. data/README.md +16 -12
  5. data/docs/taglib/mpeg.rb +1 -9
  6. data/ext/extconf_common.rb +21 -12
  7. data/ext/taglib_aiff/taglib_aiff.i +5 -0
  8. data/ext/taglib_aiff/taglib_aiff_wrap.cxx +327 -111
  9. data/ext/taglib_base/includes.i +14 -14
  10. data/ext/taglib_base/taglib_base.i +37 -4
  11. data/ext/taglib_base/taglib_base_wrap.cxx +414 -422
  12. data/ext/taglib_flac/taglib_flac.i +8 -3
  13. data/ext/taglib_flac/taglib_flac_wrap.cxx +356 -406
  14. data/ext/taglib_flac_picture/taglib_flac_picture.i +4 -0
  15. data/ext/taglib_flac_picture/taglib_flac_picture_wrap.cxx +229 -122
  16. data/ext/taglib_id3v1/taglib_id3v1_wrap.cxx +196 -102
  17. data/ext/taglib_id3v2/taglib_id3v2.i +5 -0
  18. data/ext/taglib_id3v2/taglib_id3v2_wrap.cxx +727 -568
  19. data/ext/taglib_mp4/taglib_mp4.i +22 -18
  20. data/ext/taglib_mp4/taglib_mp4_wrap.cxx +2141 -1493
  21. data/ext/taglib_mpeg/taglib_mpeg.i +6 -0
  22. data/ext/taglib_mpeg/taglib_mpeg_wrap.cxx +546 -379
  23. data/ext/taglib_ogg/taglib_ogg.i +0 -2
  24. data/ext/taglib_ogg/taglib_ogg_wrap.cxx +162 -107
  25. data/ext/taglib_vorbis/taglib_vorbis.i +1 -0
  26. data/ext/taglib_vorbis/taglib_vorbis_wrap.cxx +141 -109
  27. data/ext/taglib_wav/taglib_wav.i +6 -2
  28. data/ext/taglib_wav/taglib_wav_wrap.cxx +290 -147
  29. data/lib/taglib/version.rb +3 -3
  30. data/taglib-ruby.gemspec +1 -0
  31. data/tasks/ext.rake +23 -39
  32. data/tasks/swig.rake +14 -4
  33. data/test/id3v2_write_test.rb +1 -1
  34. data/test/wav_examples_test.rb +1 -1
  35. data/test/wav_file_test.rb +1 -1
  36. data/test/wav_file_write_test.rb +6 -6
  37. metadata +4 -3
@@ -4,6 +4,7 @@
4
4
  #define TAGLIB_EXPORT
5
5
  #define TAGLIB_IGNORE_MISSING_DESTRUCTOR
6
6
  #define TAGLIB_DEPRECATED
7
+ #define TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
7
8
 
8
9
  // Replaces the typemap from swigtype.swg and just adds the line
9
10
  // SWIG_RubyUnlinkObjects. This is done to be safe in the case when a
@@ -36,34 +37,26 @@
36
37
  #endif
37
38
 
38
39
  VALUE taglib_bytevector_to_ruby_string(const TagLib::ByteVector &byteVector) {
39
- if (byteVector.isNull()) {
40
- return Qnil;
41
- } else {
42
- return rb_str_new(byteVector.data(), byteVector.size());
43
- }
40
+ return rb_str_new(byteVector.data(), byteVector.size());
44
41
  }
45
42
 
46
43
  TagLib::ByteVector ruby_string_to_taglib_bytevector(VALUE s) {
47
44
  if (NIL_P(s)) {
48
- return TagLib::ByteVector::null;
45
+ return TagLib::ByteVector();
49
46
  } else {
50
47
  return TagLib::ByteVector(RSTRING_PTR(StringValue(s)), RSTRING_LEN(s));
51
48
  }
52
49
  }
53
50
 
54
51
  VALUE taglib_string_to_ruby_string(const TagLib::String & string) {
55
- if (string.isNull()) {
56
- return Qnil;
57
- } else {
58
- VALUE result = rb_str_new2(string.toCString(true));
59
- ASSOCIATE_UTF8_ENCODING(result);
60
- return result;
61
- }
52
+ VALUE result = rb_str_new2(string.toCString(true));
53
+ ASSOCIATE_UTF8_ENCODING(result);
54
+ return result;
62
55
  }
63
56
 
64
57
  TagLib::String ruby_string_to_taglib_string(VALUE s) {
65
58
  if (NIL_P(s)) {
66
- return TagLib::String::null;
59
+ return TagLib::String();
67
60
  } else {
68
61
  return TagLib::String(RSTRING_PTR(CONVERT_TO_UTF8(StringValue(s))), TagLib::String::UTF8);
69
62
  }
@@ -152,6 +145,13 @@ TagLib::FileName ruby_string_to_taglib_filename(VALUE s) {
152
145
  #endif
153
146
  }
154
147
 
148
+ VALUE taglib_offset_t_to_ruby_int(TagLib::offset_t off) {
149
+ #ifdef _WIN32
150
+ return LL2NUM(off);
151
+ #else
152
+ return OFFT2NUM(off);
153
+ #endif
154
+ }
155
155
  %}
156
156
 
157
157
  // vim: set filetype=cpp sw=2 ts=2 expandtab:
@@ -26,6 +26,7 @@ namespace TagLib {
26
26
  typedef unsigned char uchar;
27
27
  typedef unsigned int uint;
28
28
  typedef unsigned long ulong;
29
+ using offset_t = long long;
29
30
  }
30
31
 
31
32
  %constant int TAGLIB_MAJOR_VERSION = TAGLIB_MAJOR_VERSION;
@@ -34,13 +35,25 @@ namespace TagLib {
34
35
 
35
36
  // Rename setters to Ruby convention (combining SWIG rename functions
36
37
  // does not seem to be possible, thus resort to some magic)
38
+ // We used to do this with one "command" filter, but support for that was
39
+ // removed in SWIG 4.1.0. This is a bit uglier because we need one filter for
40
+ // setOne, one for setOneTwo, and one for setOneTwoThree. Looks like we don't
41
+ // need one for 4 yet.
37
42
  // setFoo -> foo=
38
- %rename("%(command: perl -e \"print lc(join('_', split(/(?=[A-Z])/, substr(@ARGV[0], 3)))), '='\" )s",
39
- regexmatch$name="^set[A-Z]") "";
43
+ %rename("%(regex:/set([A-Z][a-z]*)([A-Z][a-z]*)([A-Z][a-z]*)/\\L\\1_\\2_\\3=/)s",
44
+ regexmatch$name="^set([A-Z][a-z]*){3}$") "";
45
+ %rename("%(regex:/set([A-Z][a-z]*)([A-Z][a-z]*)/\\L\\1_\\2=/)s",
46
+ regexmatch$name="^set([A-Z][a-z]*){2}$") "";
47
+ %rename("%(regex:/set([A-Z][a-z]*)/\\L\\1=/)s",
48
+ regexmatch$name="^set([A-Z][a-z]*)$") "";
40
49
 
41
50
  // isFoo -> foo?
42
- %rename("%(command: perl -e \"print lc(join('_', split(/(?=[A-Z])/, substr(@ARGV[0], 2)))), '?'\" )s",
43
- regexmatch$name="^is[A-Z]") "";
51
+ %rename("%(regex:/is([A-Z][a-z]*)([A-Z][a-z]*)([A-Z][a-z]*)/\\L\\1_\\2_\\3?/)s",
52
+ regexmatch$name="^is([A-Z][a-z]*){3}$") "";
53
+ %rename("%(regex:/is([A-Z][a-z]*)([A-Z][a-z]*)/\\L\\1_\\2?/)s",
54
+ regexmatch$name="^is([A-Z][a-z]*){2}$") "";
55
+ %rename("%(regex:/is([A-Z][a-z]*)/\\L\\1?/)s",
56
+ regexmatch$name="^is([A-Z][a-z]*)$") "";
44
57
 
45
58
  // ByteVector
46
59
  %typemap(out) TagLib::ByteVector {
@@ -113,6 +126,10 @@ namespace TagLib {
113
126
  %typemap(typecheck) TagLib::FileName = char *;
114
127
  %feature("valuewrapper") TagLib::FileName;
115
128
 
129
+ %typemap(out) TagLib::offset_t {
130
+ $result = taglib_offset_t_to_ruby_int($1);
131
+ }
132
+
116
133
  %ignore TagLib::List::operator[];
117
134
  %ignore TagLib::List::operator=;
118
135
  %ignore TagLib::List::operator!=;
@@ -123,6 +140,10 @@ namespace TagLib {
123
140
  %ignore TagLib::Tag::setProperties;
124
141
  %ignore TagLib::Tag::removeUnsupportedProperties;
125
142
 
143
+ %ignore TagLib::Tag::complexProperties;
144
+ %ignore TagLib::Tag::setComplexProperties;
145
+ %ignore TagLib::Tag::complexPropertyKeys;
146
+
126
147
  %include <taglib/tag.h>
127
148
 
128
149
  %ignore TagLib::AudioProperties::length; // Deprecated.
@@ -135,8 +156,20 @@ namespace TagLib {
135
156
  %ignore TagLib::File::setProperties;
136
157
  %ignore TagLib::File::removeUnsupportedProperties;
137
158
 
159
+ %ignore TagLib::File::complexProperties;
160
+ %ignore TagLib::File::setComplexProperties;
161
+ %ignore TagLib::File::complexPropertyKeys;
162
+
138
163
  %include <taglib/tfile.h>
139
164
 
165
+ %ignore TagLib::FileRef::properties;
166
+ %ignore TagLib::FileRef::setProperties;
167
+ %ignore TagLib::FileRef::removeUnsupportedProperties;
168
+
169
+ %ignore TagLib::FileRef::complexProperties;
170
+ %ignore TagLib::FileRef::setComplexProperties;
171
+ %ignore TagLib::FileRef::complexPropertyKeys;
172
+
140
173
  // Ignore IOStream and all the constructors using it.
141
174
  %ignore IOStream;
142
175
  %ignore TagLib::FileRef::FileRef(IOStream*, bool, AudioProperties::ReadStyle);