Skip to content

Commit 881d2ff

Browse files
committed
TagLib-1.11.1 support
TagLib 1.11 introduced a new API to access and edit pictures of Ogg files. This patch bring support for this new API, dropping support for older versions of TagLib. Methods flagged as deprecated in TagLib-1.11.1 have been removed. Some APIs have been purposely ignored: - the new "Unified property interface" API, which allow to edit some file types by 1/exporting the properties as a map, 2/ editing the map, 3/ reimporting the whole map. - various TagLib::*::File constructors reading from a C++ IOStream - APIs that appear to only be useful internally Unit-tests have been updated/added for most of the new stuff. Yard documentation have been updated. The cxx files have been generated using Swig-3.0.7.
1 parent dfae569 commit 881d2ff

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+7701
-1995
lines changed

.travis.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,9 @@ env:
66
matrix:
77
include:
88
- rvm: 2.2.7
9-
env: TAGLIB_VERSION=1.7.2 TAGLIB_DIR=$TRAVIS_BUILD_DIR/tmp/x86_64-linux-gnu/taglib-1.7.2 LD_LIBRARY_PATH=$TRAVIS_BUILD_DIR/tmp/x86_64-linux-gnu/taglib-1.7.2/lib:$LD_LIBRARY_PATH
10-
- rvm: 2.2.7
11-
env: TAGLIB_VERSION=1.8 TAGLIB_DIR=$TRAVIS_BUILD_DIR/tmp/x86_64-linux-gnu/taglib-1.8 LD_LIBRARY_PATH=$TRAVIS_BUILD_DIR/tmp/x86_64-linux-gnu/taglib-1.8/lib:$LD_LIBRARY_PATH
9+
env: TAGLIB_VERSION=1.11.1 TAGLIB_DIR=$TRAVIS_BUILD_DIR/tmp/x86_64-linux-gnu/taglib-1.11.1 LD_LIBRARY_PATH=$TRAVIS_BUILD_DIR/tmp/x86_64-linux-gnu/taglib-1.11.1/lib:$LD_LIBRARY_PATH
1210
- rvm: 2.3.4
13-
env: TAGLIB_VERSION=1.9.1 TAGLIB_DIR=$TRAVIS_BUILD_DIR/tmp/x86_64-linux-gnu/taglib-1.9.1 LD_LIBRARY_PATH=$TRAVIS_BUILD_DIR/tmp/x86_64-linux-gnu/taglib-1.9.1/lib:$LD_LIBRARY_PATH
14-
- rvm: 2.4.1
15-
env: TAGLIB_VERSION=1.10 TAGLIB_DIR=$TRAVIS_BUILD_DIR/tmp/x86_64-linux-gnu/taglib-1.10 LD_LIBRARY_PATH=$TRAVIS_BUILD_DIR/tmp/x86_64-linux-gnu/taglib-1.10/lib:$LD_LIBRARY_PATH
11+
env: TAGLIB_VERSION=1.11.1 TAGLIB_DIR=$TRAVIS_BUILD_DIR/tmp/x86_64-linux-gnu/taglib-1.11.1 LD_LIBRARY_PATH=$TRAVIS_BUILD_DIR/tmp/x86_64-linux-gnu/taglib-1.11.1/lib:$LD_LIBRARY_PATH
1612
- rvm: 2.4.1
1713
env: TAGLIB_VERSION=1.11.1 TAGLIB_DIR=$TRAVIS_BUILD_DIR/tmp/x86_64-linux-gnu/taglib-1.11.1 LD_LIBRARY_PATH=$TRAVIS_BUILD_DIR/tmp/x86_64-linux-gnu/taglib-1.11.1/lib:$LD_LIBRARY_PATH
1814
before_script: bundle exec rake vendor

README.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Contributions for more coverage of the library are very welcome.
2626
Installation
2727
------------
2828

29-
Before you install the gem, make sure to have [taglib][taglib] installed
29+
Before you install the gem, make sure to have [taglib 1.11.1 or higher][taglib] installed
3030
with header files (and a C++ compiler of course):
3131

3232
* Debian/Ubuntu: `sudo apt-get install libtag1-dev`
@@ -69,8 +69,7 @@ if you don't have it):
6969

7070
bundle install
7171

72-
Regenerate SWIG wrappers if you made changes in `.i` files (use at least
73-
version 2.0.5 of SWIG):
72+
Regenerate SWIG wrappers if you made changes in `.i` files (use version 3.0.7 of SWIG):
7473

7574
rake swig
7675

@@ -97,17 +96,17 @@ Build and install gem into system gems:
9796

9897
Build a specific version of Taglib:
9998

100-
PLATFORM=x86_64-linux TAGLIB_VERSION=1.9.1 rake vendor
99+
PLATFORM=x86_64-linux TAGLIB_VERSION=1.11.1 rake vendor
101100

102-
The above command will automatically download Taglig 1.9.1, build it and install it in `tmp/x86_64-linux/taglib-1.9.1`.
101+
The above command will automatically download Taglib 1.11.1, build it and install it in `tmp/x86_64-linux/taglib-1.11.1`.
103102

104-
The `swig` and `compile` tasks can then be executed against that specific version of Taglib by setting the `TAGLIB_DIR` environment variable to `$PWD/tmp/x86_64-linux/taglib-1.9.1` (it is assumed that taglib headers are located at `$TAGLIB_DIR/include` and taglib libraries at `$TAGLIB_DIR/lib`).
103+
The `swig` and `compile` tasks can then be executed against that specific version of Taglib by setting the `TAGLIB_DIR` environment variable to `$PWD/tmp/x86_64-linux/taglib-1.11.1` (it is assumed that taglib headers are located at `$TAGLIB_DIR/include` and taglib libraries at `$TAGLIB_DIR/lib`).
105104

106-
The `test` task can then be run for that version of Taglib by adding `$PWD/tmp/x86_64-linux/taglib-1.9.1/lib` to the `LD_LIBRARY_PATH` environment variable.
105+
The `test` task can then be run for that version of Taglib by adding `$PWD/tmp/x86_64-linux/taglib-1.11.1/lib` to the `LD_LIBRARY_PATH` environment variable.
107106

108107
To do everything in one command:
109108

110-
PLATFORM=x86_64-linux TAGLIB_VERSION=1.7.2 TAGLIB_DIR=$PWD/tmp/x86_64-linux/taglib-1.7.2 LD_LIBRARY_PATH=$PWD/tmp/x86_64-linux/taglib-1.7.2/lib rake vendor compile test
109+
PLATFORM=x86_64-linux TAGLIB_VERSION=1.11.1 TAGLIB_DIR=$PWD/tmp/x86_64-linux/taglib-1.11.1 LD_LIBRARY_PATH=$PWD/tmp/x86_64-linux/taglib-1.11.1/lib rake vendor compile test
111110

112111
### Workflow
113112

docs/taglib/aiff.rb

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,43 @@ def tag
5353
def audio_properties
5454
end
5555

56+
# @return [Boolean] Whether or not the file on disk actually has an ID3v2 tag.
57+
#
58+
# @since 1.0.0
59+
def id3v2_tag?
60+
end
61+
5662
end
5763

5864
class Properties < TagLib::AudioProperties
59-
# @return [Integer] Sample width
60-
attr_reader :sample_width
65+
# @return [Integer] Number of bits per audio sample.
66+
#
67+
# @since 1.0.0
68+
attr_reader :bits_per_sample
69+
70+
# @return [Integer] Number of sample frames.
71+
#
72+
# @since 1.0.0
73+
attr_reader :sample_frames
74+
75+
# @return [String] The compression type of the AIFF-C file.
76+
# For example, "NONE" for not compressed, "ACE2" for ACE 2-to-1.
77+
# If the file is in AIFF format, always returns an empty string.
78+
#
79+
# @since 1.0.0
80+
attr_reader :compression_type
81+
82+
# @return [String] Returns the concrete compression name of the AIFF-C file.
83+
# If the file is in AIFF format, always returns an empty string.
84+
#
85+
# @since 1.0.0
86+
attr_reader :compression_name
87+
88+
# @return [Boolean] True if the file is in AIFF-C format, false if AIFF format.
89+
#
90+
# @since 1.0.0
91+
def aiff_c?
92+
end
6193
end
6294

6395
end

docs/taglib/base.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,14 @@ class AudioProperties
247247
Accurate = 2
248248

249249
# @return [Integer] length of the file in seconds
250-
attr_reader :length
250+
#
251+
# @since 1.0.0
252+
attr_reader :length_in_seconds
253+
254+
# @return [Integer] length of the file in milliseconds
255+
#
256+
# @since 1.0.0
257+
attr_reader :length_in_milliseconds
251258

252259
# @return [Integer] bit rate in kb/s (kilobit per second)
253260
attr_reader :bitrate

docs/taglib/flac.rb

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ module TagLib::FLAC
3030
# file.save
3131
# end
3232
class File < TagLib::File
33+
34+
NoTags = 0x0000
35+
XiphComment = 0x0001
36+
ID3v1 = 0x0002
37+
ID3v2 = 0x0004
38+
AllTags = 0xffff
39+
3340
# {include:::TagLib::FileRef.open}
3441
#
3542
# @param (see #initialize)
@@ -82,6 +89,14 @@ def audio_properties
8289
def picture_list
8390
end
8491

92+
# Remove the specified picture.
93+
#
94+
# @param [TagLib::FLAC::Picture] picture
95+
#
96+
# @since 1.0.0
97+
def remove_picture(picture)
98+
end
99+
85100
# Remove all pictures.
86101
#
87102
# @return [void]
@@ -94,12 +109,46 @@ def remove_pictures
94109
# @return [void]
95110
def add_picture(picture)
96111
end
112+
113+
# Remove the tags matching the specified OR-ed types.
114+
#
115+
# @param [int] tags The types of tags to remove.
116+
# @return [void]
117+
#
118+
# @since 1.0.0
119+
def strip(tags=TagLib::FLAC::File::AllTags)
120+
end
121+
122+
# @return [Boolean] Whether or not the file on disk actually has a XiphComment.
123+
#
124+
# @since 1.0.0
125+
def xiph_comment?
126+
end
127+
128+
# @return [Boolean] Whether or not the file on disk actually has an ID3v1 tag.
129+
#
130+
# @since 1.0.0
131+
def id3v1_tag?
132+
end
133+
134+
# @return [Boolean] Whether or not the file on disk actually has an ID3v2 tag.
135+
#
136+
# @since 1.0.0
137+
def id3v2_tag?
138+
end
97139
end
98140

99141
# FLAC audio properties.
100142
class Properties < TagLib::AudioProperties
101-
# @return [Integer] Sample width
102-
attr_reader :sample_width
143+
# @return [Integer] Number of bits per audio sample.
144+
#
145+
# @since 1.0.0
146+
attr_reader :bits_per_sample
147+
148+
# @return [Integer] Number of sample frames.
149+
#
150+
# @since 1.0.0
151+
attr_reader :sample_frames
103152

104153
# @return [binary String] MD5 signature of uncompressed audio stream
105154
# (binary data)
@@ -172,5 +221,12 @@ def initialize()
172221
#
173222
# @return [binary String]
174223
attr_accessor :data
224+
225+
# Parse the picture data in the FLAC picture block format.
226+
# @return [Boolean] True if the data have been successfully been parsed, false otherwise.
227+
#
228+
# @since 1.0.0
229+
def parse(rawdata)
230+
end
175231
end
176232
end

docs/taglib/id3v1.rb

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,34 @@
11
module TagLib::ID3v1
22
# An ID3v1 tag.
33
class Tag < TagLib::Tag
4+
# @return [Integer] the genre as a number
5+
# @return [255] if not present
6+
#
7+
# @since 1.0.0
8+
attr_accessor :genre_number
9+
end
10+
11+
# @return [Array<String>] the ID3v1 genre list.
12+
#
13+
# @since 1.0.0
14+
def genre_list
15+
end
16+
17+
# @return [Map<String, int>] the map associating a genre to its index.
18+
#
19+
# @since 1.0.0
20+
def genre_map
21+
end
22+
23+
# @return [String] the name of genre at `index` in the ID3v1 genre list.
24+
#
25+
# @since 1.0.0
26+
def genre(index)
27+
end
28+
29+
# @return [String] the genre index for the (case sensitive) genre `name`.
30+
#
31+
# @since 1.0.0
32+
def genre_index(name)
433
end
534
end

0 commit comments

Comments
 (0)