1807 Commits
v1.5 ... v1.12

Author SHA1 Message Date
Urs Fleisch
c8b39449c3 Version 1.12 2021-02-15 12:23:07 +01:00
Urs Fleisch
bd254654bc Update documentation for version 1.12.0 2021-02-15 10:37:11 +01:00
Urs Fleisch
fbc3f9bbec Fix doxygen warnings 2021-02-14 18:20:29 +01:00
Urs Fleisch
99ad01e12f Fix file name resolver on Windows
The change from "fileref: Use user defined resolvers on streams"
does not work with the Windows FileName implementation, and
TestFileRef::testFileResolver fails.
2021-02-14 18:20:29 +01:00
Urs Fleisch
83aa01c6af Ogg: Set granule position to -1 if no packets finish on page (#864) 2021-02-14 10:04:03 +01:00
Urs Fleisch
4c14571647 Update version to 1.12.0 2021-01-23 09:15:32 +01:00
Urs Fleisch
f4b476a620 Add more unit tests 2021-01-18 20:31:52 +01:00
Urs Fleisch
f8d78a61f7 Merge pull request #990 from ufleisch/ufleisch/more-tests
More unit tests and bug fixes
2021-01-12 18:07:23 +01:00
Urs Fleisch
cf6c68bafc Support a consistent set of MusicBrainz properties where possible
The support for MusicBrainz properties is enhanced with "ARTISTS", "ASIN",
"RELEASECOUNTRY", "RELEASESTATUS", "RELEASETYPE", "MUSICBRAINZ_RELEASETRACKID",
"ORIGINALDATE" on APE, ASF, MP4, ID3v2, and Xiph tags.
2021-01-10 15:19:10 +01:00
Urs Fleisch
f7c24930cd Add missing iTunes properties for MP4 tags 2021-01-10 15:18:59 +01:00
Urs Fleisch
310c3bc043 Add missing 'COMPOSERSORT' property for ID3v2 tags 2021-01-10 15:18:43 +01:00
Urs Fleisch
e6c03c6de8 Create an APE tag when reading a WavPack file without tags
Now it is handled in the same way as for other tags with a
TagUnion. Without this patch, WavPack files without tags cannot
be edited via a FileRef.
2021-01-03 19:06:59 +01:00
Urs Fleisch
2c29fbeabb Use mapped roles instead of property keys for TIPL roles
For an ID3v2 "DJMIXER" property, the "DJ-MIX" TIPL role must be used.
For an ID3v2 "MIXER" property, the "MIX" TIPL role must be used.
Otherwise it will not work when reading the tag and creating
properties from the wrong TIPL roles.
2021-01-03 19:06:59 +01:00
Urs Fleisch
4828a3b925 Do not crash when removing non existing TableOfContentsFrame child 2021-01-03 19:06:59 +01:00
Urs Fleisch
794a2a0b2b Correctly construct PrivateFrame from frame data
Frame::setData() has to be used instead of PrivateFrame::setData().
2021-01-03 19:06:59 +01:00
Urs Fleisch
f32d27973f Use PCST and not TXXX:PODCAST frame for ID3v2 'PODCAST' property 2021-01-03 19:06:59 +01:00
Urs Fleisch
f74b166435 Add missing extensions to FileRef::defaultFileExtensions() 2021-01-03 19:06:59 +01:00
Urs Fleisch
c28dc78060 Add more unit tests
This not only increased the test coverage but also revealed some
bugs which are fixed in the following commits.
2021-01-03 19:06:59 +01:00
Urs Fleisch
89fb62cfb1 Update NEWS 2021-01-02 10:50:52 +01:00
Urs Fleisch
59a2994f4e Fix spelling and typos 2021-01-02 10:50:52 +01:00
Urs Fleisch
f3bdd416da Remove some DSF and DSDIFF leftovers
These can be merged back into master from the branch
add_dsf_and_dsdiff_file_formats.
2021-01-02 10:50:52 +01:00
Urs Fleisch
39f86d02e7 Merge pull request #989 from ufleisch/ufleisch/id3v2-genres
Correctly read and write multiple ID3v2.3.0 genres (#988)
2021-01-01 11:48:35 +01:00
Urs Fleisch
1a2e1d08ac Merge pull request #986 from ufleisch/ufleisch/wav-extensible-subformat
WAV: Support subformat in WAVE_FORMAT_EXTENSIBLE (#850)
2021-01-01 11:48:06 +01:00
Urs Fleisch
3f3b48353c Merge pull request #983 from ufleisch/ufleisch/flac-comment-before-picture
FLAC: Store comment block before picture block (#954)
2021-01-01 11:45:14 +01:00
Urs Fleisch
54f5c66b65 Merge pull request #981 from ufleisch/ufleisch/alac-without-bitrate
Calculate bitrate for ALAC files without it (#961)
2021-01-01 11:45:12 +01:00
Urs Fleisch
3749dd7b75 Write ID3v2.3 genres with multiple references to ID3v1 genres (#988)
As described in id3v2.3.0.txt (4.2.1, TCON), multiple genres are
only possible as references to ID3v1 genres with an optional
refinement as a text. When downgrading multiple genres from
ID3v2.4.0, they are now converted to numbers when possible and
the first genre text without ID3v1 reference is added as a
refinement. The keywords RX and CR are supported too.
2020-12-30 17:38:04 +01:00
Urs Fleisch
d602ae483e Read ID3v2.3 genres with multiple references to ID3v1 genres (#988)
As described in id3v2.3.0.txt (4.2.1, TCON), now multiple genres
are possible, e.g. "(51)(39)". Additionally, support the keywords
RX and CR.
2020-12-30 17:37:54 +01:00
Urs Fleisch
5374cb1ac4 Merge pull request #980 from ufleisch/ufleisch/wav-float-without-fact
Calculate bitrate for IEEE Float WAV files without fact chunk (#959)
2020-12-28 09:16:44 +01:00
Urs Fleisch
8a461ccedc Merge pull request #978 from ufleisch/ufleisch/wavs-with-garbage
Accept WAV files with garbage appended (#973)
2020-12-28 09:07:39 +01:00
Urs Fleisch
17c2220588 Merge pull request #963 from dbry/wavpack-fixes
WavPack fixes with test file verifying issue #962
2020-12-28 09:07:37 +01:00
Urs Fleisch
271c004b30 Merge pull request #942 from uqs/master
Fix spelling of Bebop and update Fusion and Hardcore to match Wikipedia
2020-12-28 09:07:34 +01:00
Urs Fleisch
25d9bd1814 Merge pull request #935 from jiblime/static-config
taglib-config.cmake has static libdir and includedir variables
2020-12-28 09:07:32 +01:00
Urs Fleisch
b0bb7f8c0f Merge pull request #888 from chouquette/use_resolvers_on_streams
fileref: Use user defined resolvers on streams
2020-12-28 09:07:30 +01:00
Urs Fleisch
4d3ab73d2e Merge pull request #855 from shaforostoff/broken_mp3
fix reading audioproperties for broken mp3 files
2020-12-28 09:05:31 +01:00
Urs Fleisch
ae867cbd8c ID3v1: Improve compatibility by mapping renamed genre names to codes
Also added a test to check if the renamed genre names are used and
check if using the old names still works.
2020-12-27 19:53:11 +01:00
Urs Fleisch
563fbaf82a Handle the case when MP4 file header has zero bitrate
This incorporates [6ca536b5] (mp4 properties: handle the case when
mp4 file header has zero bitrate) from PR #899 with a more accurate
bitrate calculation and a unit test.
2020-12-27 10:17:34 +01:00
Urs Fleisch
e5ad041e42 A few more corrections to genre names 2020-12-24 10:08:47 +01:00
Hugo Beauzée-Luyssen
9ca7b0c33a fileref: Use user defined resolvers on streams
Since the resolve only use the filename, there is no reason not to probe
them, as a filename might be available through the IOStream interface.
When using a ByteVectorStream, the filename will be empty and user
defined resolvers won't be probed.
2020-12-23 12:34:54 +01:00
Urs Fleisch
a00b3499b4 WavPack: Add test with non-standard sample rate 2020-12-23 07:04:51 +01:00
Urs Fleisch
d84e86da9c Clean up code to better match the TagLib style 2020-12-23 07:04:51 +01:00
Urs Fleisch
741ed4e4bf Add test for IEEE Float WAV file without fact chunk 2020-12-22 16:02:01 +01:00
Urs Fleisch
e4813f4996 Calculate bitrate for IEEE Float WAV files without fact chunk (#959)
When a WAV file with float format without a fact chunk containing
a totalSamples value is encountered, the bitrate is not calculated.
However, since all samples have the same number of bits, the
number of samples can be calculated from the size of the data chunk
and number of channels and bits per sample, as it is done in the
PCM case.
2020-12-22 15:46:48 +01:00
Urs Fleisch
1332d44ff6 WAV: Test properties of file with WAVE_FORMAT_EXTENSIBLE
uint8we.wav: http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/Samples/AFsp/M1F1-uint8WE-AFsp.wav
2020-12-21 15:42:13 +01:00
Urs Fleisch
3d71ea1ad2 ALAC: Test properties of file without bitrate 2020-12-21 13:31:24 +01:00
Urs Fleisch
02c8995273 Calculate bitrate for ALAC files without it (#961)
If the "alac" atom of an MP4 file has a zero bitrate, it is calculated.
2020-12-21 12:22:25 +01:00
Urs Fleisch
7e92af6e8b FLAC: Test if picture is stored after comment 2020-12-21 11:46:10 +01:00
Urs Fleisch
7ec1127f3e FLAC: Store comment block before picture block (#954)
When the picture block is large and comes before the comment block,
Windows will no longer display the tags. This can be fixed by
storing the comment block before the picture block instead of
appending it at the end.
2020-12-21 11:09:15 +01:00
Urs Fleisch
30d839538d Make PlainFile available to all tests 2020-12-21 08:44:32 +01:00
Scott Wheeler
8f6b6ac055 Don't pull in C++11+ for one class 2020-12-20 18:38:05 +01:00
Scott Wheeler
a5f11697f7 Get things building again with C++98 2020-12-20 18:12:14 +01:00
Scott Wheeler
1721354627 Explicitly set C98 for this target
Sometime I'd like to get the lib over to C++1x, but for now, enforce
the currently in-use standard.
2020-12-20 14:22:20 +00:00
Scott Wheeler
ac7e5303a6 Merge pull request #969 from ujjwalsh/master
Adding support for Linux on power
2020-12-20 15:17:40 +01:00
Scott Wheeler
8ba246cdbe Merge pull request #984 from ufleisch/ufleisch/m4a-empty-strings-remove-items
MP4: Remove item when empty string is set (#929)
2020-12-20 15:13:58 +01:00
Scott Wheeler
6656528f18 Also allow #include <taglib/foo.h> with taglib.pc and friends
Closes #495
2020-12-20 14:09:49 +00:00
Urs Fleisch
bad2cea122 WAV: Support subformat in WAVE_FORMAT_EXTENSIBLE (#850) 2020-12-20 11:47:04 +01:00
Urs Fleisch
61d5bcfd5b MP4: Remove item when empty string is set (#929)
This will make the behavior for MP4 tags compliant to the API
documentation and consistent with other tag formats.
2020-12-13 12:37:20 +01:00
Urs Fleisch
2dd6931eee Accept WAV files with garbage appended (#973)
This will allow editing the tags of WAV files which have data
appended at the end. The corresponding unit test checks that the
original contents are still available after editing the metadata
of such files.
2020-12-06 08:56:35 +01:00
Scott Wheeler
91b00b17b2 Missing const here 2020-10-12 16:52:09 +02:00
Scott Wheeler
e116824380 Downgrade numerical genres back to ID3v2.3 format
Closes #631
2020-10-12 08:46:51 +02:00
Scott Wheeler
2db13ad8cf Add a little sanity to the formatting here 2020-10-12 08:36:57 +02:00
ujjwalsh
cd767738fc adding support for linux on power 2020-09-01 16:55:07 +00:00
David Bryant
43bc11541d correctly read very high sample rates from WavPack files 2020-07-02 17:22:03 -07:00
David Bryant
6806dc4cf2 make WavPack seekFinalIndex() more robust to false triggers 2020-07-02 16:15:51 -07:00
David Bryant
ec9c49b964 add test for WavPack DSD (issue #962) 2020-07-01 08:35:20 -07:00
David Bryant
872cafb0b9 Several fixes for WavPack files, including issue #962
Fixes to properly handle WavPack files with leading and
trailing non-audio blocks, non-standard sampling rates,
and DSD audio (introduced in WavPack 5).
2020-06-30 22:19:38 -07:00
Scott Wheeler
47342f6974 Prefer COMM frames with no description for setComment()
This creates symetry with ID3v2::Tag::comment() in preferring frames with no description
when choosing which COMM frame should be updated.  (Previously setComment() simply updated
the first COMM frame.)

Fixes #950
2020-03-27 12:14:51 +01:00
Ulrich Spörlein
5763d042a6 Fix spelling of Bebop and update Fusion and Hardcore to match Wikipedia
Source: https://en.wikipedia.org/wiki/List_of_ID3v1_Genres

Similar patches will be sent to libid3tag and ffmpeg to harmonize the
genre names and spellings.
2019-12-19 14:53:57 +01:00
jiblime
cd9e6b7502 Changed libdir/includedir variables to change based on a user's system and match syntax 2019-10-19 15:13:28 -07:00
Scott Wheeler
54508df30b Needs to be defined to nothing if none of the #if blocks match 2019-09-20 10:32:33 +02:00
Scott Wheeler
dcf0331eb1 Use newer function signatures 2019-09-19 15:23:34 +02:00
Scott Wheeler
96155f35fa Use new method signatures 2019-09-19 15:19:17 +02:00
Scott Wheeler
ebd3373d6d Correctly decode signed values
In SV7 these are a mix of signed and unsigned shorts; in SV8 they're all
signed.  Storing them as an int is fine for signed or unsigned shorts as
it's wide enough to contain either of them.

Unfortunately there are no explicit tests for SV7 at the moment; that
would be ideal to add before the next release.

CC @carewolf
2019-09-12 12:13:24 +02:00
Scott Wheeler
f3ecfa11bb Completely remove StripAll from the API
I'd imagined it being useful for calls to `strip()`, but it's not
actually used there since that's an OR-ed together set of flags 
representing which tags to strip.
2019-09-12 11:19:57 +02:00
Scott Wheeler
7082b9f66b Unsaved (and incorrect looking) field 2019-09-12 10:46:11 +02:00
Scott Wheeler
de25bc6111 StripAll should be treated as equivalent to StripOthers in save() 2019-09-12 07:57:16 +02:00
Scott Wheeler
074f30e3fa Remove DSF and DSDIFF from master to a feature branch
These can be merged back into master once they're in a more mature state.
2019-09-12 07:55:34 +02:00
Scott Wheeler
f1b40de66b Unify File::save(...) APIs between file formats that support ID3v2
Closes #922
2019-09-11 06:48:27 +02:00
Scott Wheeler
0b99cd9bac Revert switch to other static size method
This was based on a misread of the header:  at present there is no
non-static size() method, so removing the argument makes the behavior
incorrect.
2019-09-11 00:58:18 +02:00
Scott Wheeler
4668cf0f93 Missing header that should have been added in b8dc105 2019-09-11 00:42:15 +02:00
Scott Wheeler
c05fa78406 Mark deprected methods and remove internal usage
This does not put the deprecated marker on methods that will or could resolve
to the same overload, e.g.:

void foo(bool bar = true); // <-- not marked
void foo(Bar bar) // <-- since this will have a default argument in the new version
2019-09-11 00:39:37 +02:00
Scott Wheeler
b8dc105ae3 Deprecate calls to MPEG::File::save(...) that use boolean params
This uses explicit enums for e.g. the ID3v2 version, making calls more
readable:

  file.save(ID3v1 | ID3v2, StripOthers, ID3v2::v4, Duplicate);

Instead of:

  file.save(ID3v1 | ID3v2, true, 4, true);

Needs to be ported to other types, per #922
2019-09-10 22:59:07 +02:00
Scott Wheeler
fced0f46e9 Add docs for this method 2019-09-10 13:31:44 +02:00
Scott Wheeler
dc0f667a4c No tabs in TagLib 2019-09-10 13:08:11 +02:00
Scott Wheeler
085180e9a4 Require at least CMake 3 2019-09-10 12:45:36 +02:00
Scott Wheeler
ef1312d622 Add -lz to taglib.pc and taglib-config when built with zlib
Closes #872
2019-09-10 12:41:11 +02:00
StefanBruens
86c0428475 Clear valid flag for invalid Speex files
This matches the corresponding code in vorbisfile.cpp, opusfile.cpp and flagfile.cpp, and fixes taglib/taglib#902.
2019-09-10 11:44:21 +02:00
Scott Wheeler
3c78c4cfc9 Merge pull request #883 from ufleisch/riff-padding
Do not ignore non zero RIFF padding if leading to parse error (#882)
2019-09-10 11:25:46 +02:00
Scott Wheeler
c8bb6271e5 Merge pull request #917 from ufleisch/ogg-bitrate
Calculate Ogg bitrate without comment size (#874)
2019-09-10 11:14:15 +02:00
Scott Wheeler
84f7462526 Tests need C++11 2019-09-05 17:29:40 +02:00
Urs Fleisch
2f23892182 Calculate Ogg bitrate without overhead size (#874) 2019-09-02 22:14:41 +02:00
Scott Wheeler
2918602ad0 Merge pull request #910 from joerg-krause/patch-1
Drop CMAKE_SYSROOT from taglib-config
2019-08-26 23:37:24 +02:00
Scott Wheeler
c146cd7e92 Merge pull request #909 from williamjcm/patch-1
Make TagLib seach in its source dir for utf8-cpp.
2019-08-26 23:34:47 +02:00
Scott Wheeler
b124e621fe Merge pull request #912 from whatdoineed2do/m4a-track-year-equal0-bugfix
MP4 - setTrack()/setYear() accepts 0 to remove the tag
2019-08-26 23:32:44 +02:00
Scott Wheeler
044fba2921 Merge pull request #919 from jonaski/spelling
Fix spelling and typos
2019-08-26 23:26:55 +02:00
Jonas Kvinge
e72a98903f Fix spelling and typos 2019-08-26 23:23:33 +02:00
whatdoineed2do
79bc9ccf8e Call fflush() before ftruncate() to drop all buffered data (#914)
This avoids stale data presented to caller via a fread()

Current bug due to the buffered data can be seen in stripping mp3s of tags

    f.strip(ID3v1);
    f.strip(APE);

The ID3v1 tag sits at the end of file (strip calls ftruncate()) and the APE
strip performs a readFile() that would return the stream buffered/truncated data
and reinsert
2019-07-25 07:27:49 +04:30
whatdoineed2do/Ray
850a3565a4 setTrack()/setYear() accepts 0 to remove the tag as per
documentation/functionality across other tpyes (mp3/flac/...); m4a do not honour
this and instead sets the underlying value to 0.

This commit fixes this issue (#911)
2019-07-13 16:03:51 +01:00
Jörg Krause
18d424995f Drop CMAKE_SYSROOT from taglib-config
Commit d4c938cbc7 is about fixing taglib-config for proper cross-compilation. The fix is right in principle, but wrong about adding `CMAKE_SYSROOT`. The correct prefix path should be set outside of the config file as some embedded Linux distros like OpenWrt or OpenEmbedded install with a different DESTDIR, and dependent packages see a different sysroot.
2019-06-16 15:33:52 +02:00
Guillaume Jacquemin
d04db70bc6 Make TagLib seach in its source dir for utf8-cpp.
Without this change, TagLib is unusable as part of CMake projects that rely on `add_subdirectory()` for dependencies.
2019-06-01 10:19:27 +02:00
StefanBruens
ba7adc2bc2 Respect atom type when converting rate tag (#896)
* Respect atom type when converting rate tag

TagLib prior to #818 (commit ff28cf276c) read and wrote the "rate" tag as
text, and switched to reading it as integer value even when the atom class
is a text type. This breaks reading existing files, and can be avoided by
taking the atom type into account.

This fixes issue #885.

* Respect MP4::Item type when writing the rate tag

TagLib prior to #818 (commit ff28cf276c) read and wrote the "rate" tag
as text, and switched to writing the integer value of the MP4::Item.
This breaks writing from applications which supply the value as
StringList, which was the previously implemented API. Applications using
an MP4::Item(UInt) are still supported without changes on the application
side.

This is the complementary writing part for issue #885.
2019-05-31 15:51:16 +04:30
Urs Fleisch
79bb1428c0 Support ID3v2 GRP1 frame introduced with iTunes 12.5.4.42, #903. (#904) 2019-05-17 15:45:48 +04:30
Jörg Krause
7470f92a67 fix taglib-config file for cross compiling (#906) 2019-05-17 15:43:35 +04:30
Tim Malseed
6455671ece Update mp4properties.cpp (#893)
When parsing mp4 media header version 1 (mdhd) atoms, the timescale (unit) is parsed as a `LongLong` (8 bytes), but instead should be a `UInt` (4 bytes). This results in an incorrect timescale, and also pushes the offset of the duration (length) off by 4 bytes.

The end result being that the AudioProperties track length for mp4's with mdhd v1 comes back as 0.

See: https://wiki.multimedia.cx/index.php/QuickTime_container

|  Entry | Bytes (v0) | Bytes (v1) |
| :---         |     :---:      | :---: |
| size  | 4  | 4 |
| type  | 4  | 4 |
| version | 1 | 1 |
| flags | 3 | 3 |
| creation time* | 4 | **8** |
| modification time* | 4 | **8** |
| time scale | 4 | 4 |
| duration* | 4 | **8** |
| language | 2 | 2 |
| quality | 2 | 2 |
2019-03-17 08:22:19 -05:00
Tim Malseed
660748210f Minor fix for mp4 media header v0 minimum size check (#895)
Mp4 media header (mdhd) v0 atoms are a minimum of 8 bytes for size & type information, plus 24 bytes for remaining entries (`24 +8`) bytes in total, rather than (`24 + 4`).

See https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-25615
2019-03-17 08:20:43 -05:00
Urs Fleisch
1cf176af61 Do not ignore non zero RIFF padding if leading to parse error (#882) 2019-02-10 08:40:20 +01:00
Stephen F. Booth
5cb589a5b8 Updated NEWS for the latest changes 2018-10-28 08:43:45 -05:00
Stephen F. Booth
a4d04e0c40 Added APE, DSF, and DFF formats to the list 2018-10-28 08:42:19 -05:00
Stephen F. Booth
4ab0891646 Added DSF and DSDIFF authors 2018-10-28 08:35:15 -05:00
Jonas Kvinge
d71398c953 Add DSF and DSDIFF file types management (#878)
* Add DSF and DSDIFF file types management

* Fixes for some build chains

* unit64_t replaced by unsigned long long, warning fixes

* Remove C++11 extension incompatible with some build chains (enumeration in a nested name specifier)

* Change typedef types (uint, ulong, ...) to standard types
remove BUILD_FRAMEWORK changes from this pull request

* Replace deprecated String::null and ByteVector::null by String() and ByteVector()
Styling update, thanks to FestusHagen

* Restyling

* Restyling to reduce length of excessively long lines

* Add to detectByExtension

* Added `isSupported(IOStream *stream)` to `DSF::File` and `DSDIFF::File`
2018-10-26 19:45:49 -05:00
evpobr
bfed3797a0 Improve CMake VISIBILITY_HIDDEN option handling (#810)
Use standard CMake's CXX_VISIBILITY_PRESET property.
2018-10-26 19:26:53 -05:00
Ola Nordstrom
e435372146 added OS X built files to .gitignore (#828) 2018-10-26 19:23:44 -05:00
Bert Wesarg
c2f544c9d1 Fill TableOfContentsFrame::toString(). (#852) 2018-10-26 19:21:18 -05:00
Scott Wheeler
8ca75f03b5 Follow TagLib's brace style 2018-10-10 19:24:44 +02:00
safu9
036a0317b9 Add support for file descriptor to FileStream (#832)
Add support for file descriptor
2018-10-10 12:25:02 -04:00
Bert Wesarg
8f6fe0b16c Don't list the description twice in UserTextIdentificationFrame::toString() (#853) 2018-10-09 18:55:02 -05:00
Scott Gayou
2c4ae870ec Fixed OOB read when loading invalid ogg flac file. (#868) (#869)
CVE-2018-11439 is caused by a failure to check the minimum length
of a ogg flac header. This header is detailed in full at:
https://xiph.org/flac/ogg_mapping.html. Added more strict checking
for entire header.
2018-10-09 18:46:55 -05:00
Urs Fleisch
d8d56d3937 Add support for cmID, purl, egid MP4 atoms (#862). (#863) 2018-04-09 08:32:05 -05:00
Nick Shaforostov
2d90d938fe fix reading audioproperties for broken mp3 files 2018-03-02 16:18:10 +01:00
Scott Wheeler
a80093167f Update links 2017-11-20 00:03:52 +01:00
Xijian Yan
249f892455 Fix crash when loading an empty mpeg file (#830)
When loading an empty file (empty.txt -> empty.mp3 ), TagLib will crash.
buffer.size() is 0, then buffer.size() - 1 is undefined (unsigned int)
2017-11-06 09:48:17 -06:00
Stephen F. Booth
cb9f07d9dc Don't assume TDRC is an instance of TextIdentificationFrame (#831)
If TDRC is encrypted, FrameFactory::createFrame() returns UnknownFrame
which causes problems in rebuildAggregateFrames() when it is assumed
that TDRC is a TextIdentificationFrame
2017-09-30 10:15:41 -05:00
Sergei Trofimovich
0b583bafd0 taglib: fix test build failure on powerpc/c++11 (#834)
powerpc is a platform with 'char' == 'unsigned char'.
As a result '-1' is not expressible in char and build fails as:

```
    # '-funsigned-char' to force test build failure on other platforms
    $ cmake .. -DBUILD_TESTS=YES -DCMAKE_CXX_FLAGS="-O2 -funsigned-char" -DCMAKE_C_FLAGS="-O2 -funsigned-char"
    ...
    $ make check
    tests/test_synchdata.cpp: In member function 'void TestID3v2SynchData::testToUIntBroken()':
    tests/test_synchdata.cpp:78:33: error: narrowing conversion of '-1' from 'int' to 'char' inside { } [-Wnarrowing]
     char data[] = { 0, 0, 0, -1 };
                                 ^
```

The fix is to expliticly cast -1 to 'char'.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2017-09-18 20:06:55 -05:00
Tsuda Kageyu
4648394841 Check if mandatory header objects are present when opening ASF files.
Also removes some assignments of "this".
It feels too tricky when it is not absolutely necessary.
2017-06-13 17:22:00 +09:00
Tsuda Kageyu
e026d797e0 Use a macro to pretend virtual functions. 2017-06-13 17:01:53 +09:00
Tsuda Kageyu
eeb2f5de09 Fix some typos in debug messages. 2017-06-13 15:05:25 +09:00
Tsuda Kageyu
1792ee9db8 Update NEWS. 2017-06-12 13:07:21 +09:00
Tsuda Kageyu
1fb310ec1f Merge pull request #799 from TsudaKageyu/filetype-detection
Enable FileRef to detect file types by the actual content of a stream.
2017-06-12 13:04:15 +09:00
Tsuda Kageyu
c8bcd153fe TableOfContentsFrame depends on ByteVectorList. 2017-06-09 17:52:56 +09:00
Tsuda Kageyu
662f340f93 Merge pull request #824 from evpobr/fix-createfile2
Fix WinRT configuring
2017-06-09 08:53:25 +09:00
Tsuda Kageyu
48d8c0a808 Merge pull request #823 from TsudaKageyu/isolate-3rdparty-lib
Isolate 3rdparty library for easier maintenance.
2017-06-09 08:53:10 +09:00
evpobr
5ebd3d5276 Fix WinRT configuring
Don't rely on _WIN32_WINNT value to enable WinRT support.

if _WIN32_WINNT is not set manually, it is defaulted to SDK version. So
if you use SDK > 8 you cannot use TagLib under Win7 and lower because of
CreateFile2 function dependency.

PLATFORM_WINRT option (OFF by default) was introduced to enable WinRT
build.

Related issues: https://github.com/Microsoft/vcpkg/issues/1240
2017-06-08 19:00:37 +05:00
Tsuda Kageyu
14af861d24 Isolate 3rdparty library for easier maintenance. 2017-06-07 12:51:44 +09:00
Tsuda Kageyu
3795f277fb Update UTF8-CPP to v2.3.5. 2017-06-07 12:12:31 +09:00
Tsuda Kageyu
6045995e65 Remove an unused include directory from taglib/CMakeLists.txt. 2017-06-07 11:38:46 +09:00
Tsuda Kageyu
c2fe93c12b Restore FileRef::create() in order not to change the previous behavior. 2017-06-06 09:17:34 +09:00
Michael Helmling
ea9202d9ee Update INSTALL.md
Added a note that with MS Visual Studio 2017 one can directly open the CMake project.
2017-06-05 14:49:09 +02:00
Stephen F. Booth
3c657d1a44 Merge pull request #821 from supermihi/master
Fix Markdown syntax of INSTALL file and rename it to *.md
2017-06-05 07:37:12 -04:00
Michael Helmling
adf0f76360 Fix Markdown syntax of INSTALL file and rename it to *.md
This enables proper formatted display of the file on e.g. GitHub, increasing readability.
2017-06-05 11:09:16 +02:00
Tsuda Kageyu
682ea77c2b Mention that FileRef::create no longer works. 2017-05-31 09:41:41 +09:00
Tsuda Kageyu
15c3c756ca Update NEWS. 2017-05-31 09:28:30 +09:00
Tsuda Kageyu
4801fbb927 Merge pull request #818 from LindyBalboa/add_rate_atom_support
Add direct support for "rate" atom
2017-05-31 09:20:27 +09:00
Tsuda Kageyu
22de22b701 Fix memory leaks in a test. 2017-05-26 16:49:36 +09:00
Tsuda Kageyu
48a1a05a88 Fix MSVC warnings about unreferenced variables. 2017-05-23 17:46:16 +09:00
Tsuda Kageyu
6000a19f70 Fix the Travis-CI testing on OS X.
AppleClang 7.3 doesn't get along with CppUnit by default.
2017-05-23 17:33:22 +09:00
Conner R. Phillips
ff28cf276c Add direct support for "rate" atom
Resolves #817
2017-04-22 07:45:29 +02:00
Tsuda Kageyu
4891ee729d Remove an useless UTF-8 BOM. 2017-02-24 15:47:30 +09:00
Tsuda Kageyu
9419dab51b Allow SYLT frames to have a timestamp with no text.
Thanks to lemonboy999.
2017-02-24 15:40:30 +09:00
Tsuda Kageyu
45ee18e206 FilePrivate is responsible to delete a stream pointer instead of File.
Generally, TagLib leaves the Private classes to delete their members.
2017-02-08 17:49:48 +09:00
Tsuda Kageyu
bf7ee62dc6 Merge branch 'filetype-detection' of https://github.com/TsudaKageyu/taglib into filetype-detection 2017-02-07 22:37:13 +09:00
Tsuda Kageyu
f76b1e5429 Rename the functions 'isValidStream' to 'isSupported'.
The name 'isValidStream' is a little misleading because it doesn't check if the stream is really valid. Additionally, 'isSupported' can be naturally overloaded.
2017-02-07 22:36:56 +09:00
Tsuda Kageyu
f7b15fad20 Remove some redundant code. 2017-02-06 10:35:49 +09:00
Tsuda Kageyu
dd4adf94ce Fix wrong endian of boolean values when saving ASF files. 2017-02-06 10:06:10 +09:00
Tsuda Kageyu
d4d8410c08 Restore the layout of the copyright header of test_fileref.cpp. 2017-02-04 23:45:15 +09:00
Tsuda Kageyu
931bb042c3 Enable FileRef to detect file types by the actual content of a stream.
FileRef doesn't work with ByteVectorStream as reported at #796, since ByteVectorStream is not associated with a file name and FileRef detects file types based on file extensions.
This commit makes FileRef to work with ByteVectorStream by enabling it to detect file types based on the actual content of a stream.
2017-02-04 23:31:08 +09:00
Tsuda Kageyu
a5d9e49c49 Remove obsolete comments.
The bug mentioned in the comments are already fixed.
2017-02-04 01:31:20 +09:00
Scott Wheeler
179c175a6c Ignore warnings about OSAtomicIncrement32Barrier
The warnings suggest moving to std::atomic functions, but those are only
available in C++11.  It would be possible to switch to the C versions of
those functions, which are now provided in stdatoic.h (in C11), but
let's wait until we actually hit problems with this function and are a
few more OS versions into C11 headers being included by default.
2017-02-03 13:56:02 +00:00
Tsuda Kageyu
ba98628919 Avoid searching the same area twice in MPEG::File::previousFrameOffset(). 2017-02-01 14:23:03 +09:00
Tsuda Kageyu
87fc4012f4 Add some test cases for invalid UTF-8 sequences. 2017-01-31 14:27:23 +09:00
Tsuda Kageyu
dd5ab2a08f Fix and add some test cases for invalid surrogate pairs. 2017-01-31 14:19:30 +09:00
Tsuda Kageyu
b74ffba4b5 Update NEWS. 2017-01-31 00:21:41 +09:00
Tsuda Kageyu
4552f2c2eb Remove redundant functions in tstring.cpp.
Two versions of copyFromUTF16() are almost the same.
2017-01-30 22:38:08 +09:00
Tsuda Kageyu
6398796f95 Remove function bodies of some non-specialized template functions.
The code won't link when a wrong version is used. It's better than showing a debug message.
2017-01-30 16:11:59 +09:00
Tsuda Kageyu
2c7ac6d6a9 Add a few more test cases for invalid UTF-8 sequences. 2017-01-30 12:56:53 +09:00
Tsuda Kageyu
6a61f02f85 Merge pull request #794 from TsudaKageyu/utf8-library
Replace unicode.h/unicode.cpp by the UTF8-CPP library.
2017-01-30 12:54:43 +09:00
Tsuda Kageyu
038b52ae01 Check an invalid UTF-8 sequence consists of single char.
Single char can be an invalid UTF sequence. For example, { 0x80 } is invalid.
2017-01-30 11:35:39 +09:00
Tsuda Kageyu
598ab752bc Stop assuming that std::wstring has a contiguous and null-terminated buffer. 2017-01-30 00:36:38 +09:00
Tsuda Kageyu
922fd611ae Reduce useless memory reallocation in String::upper(). 2017-01-28 01:17:21 +09:00
Tsuda Kageyu
3d14ff74b1 Remove a duplicate test file. 2017-01-27 22:10:02 +09:00
Tsuda Kageyu
978b822774 Remove some redundant code in tstring.cpp. 2017-01-27 15:11:08 +09:00
Tsuda Kageyu
0c45c63943 Replace unicode.h/unicode.cpp by the UTF8-CPP library.
unicode.h/unicode.cpp are no longer maintained and incompatible with Debian's guideline.
UTF8-CPP is maintained on GitHub and published under the Boost Software License which is compatible with either LGPL or MPL and should go along with Debian's guideline.
2017-01-27 14:47:55 +09:00
Tsuda Kageyu
586c9bd962 Add a test for unpaired surrogate characters in a UTF-16 string. 2017-01-26 17:33:54 +09:00
Tsuda Kageyu
fc38a0e401 Remove some redundant code.
TagUnion::access() does the same thing as FLAC::File::ID3v2Tag().
2017-01-22 00:43:32 +09:00
Tsuda Kageyu
5fc5a2e81a Prefer isEmpty()/empty() to size() == 0. 2017-01-21 19:10:32 +09:00
Tsuda Kageyu
a358e87cc4 Revert useless changes accidentally committed. 2017-01-21 11:13:49 +09:00
Tsuda Kageyu
5ba8b740f9 Add missing consts. 2017-01-21 11:09:05 +09:00
Tsuda Kageyu
c4a3c3ab97 Combine two internal functions which are always used together. 2017-01-21 01:34:50 +09:00
Tsuda Kageyu
6bb92c34fa Ignore fake MPEG frame headers when seeking them. 2017-01-20 22:38:25 +09:00
Tsuda Kageyu
d2e0e55223 Efficient lookup for an ID3v2 tag in MPEG files with garbage.
This looks for an ID3v2 tag until reaching the first valid MPEG frame in O(n) time.
2017-01-20 21:14:38 +09:00
Tsuda Kageyu
d64c833359 Update NEWS. 2017-01-16 01:14:35 +09:00
Tsuda Kageyu
c9c757e0ff Merge pull request #791 from TsudaKageyu/flac-empty-seektable
Be tolerant of empty FLAC seektable blocks.
2017-01-16 01:12:07 +09:00
Tsuda Kageyu
9b548260f5 Initialize d-pointers in class member initializer list. 2017-01-16 01:05:30 +09:00
Tsuda Kageyu
406e872ac3 Always use parentheses with new. It's a bit safer. 2017-01-16 01:00:28 +09:00
Tsuda Kageyu
193cbe3b6b Initialize all the data members of ASF::Attribute. 2017-01-14 23:29:46 +09:00
Tsuda Kageyu
13be28a52c Be tolerant of empty FLAC seektable blocks. 2017-01-10 00:11:13 +09:00
Tsuda Kageyu
56a7656c2e Remove some TODO comments which are no longer necessary. 2017-01-08 01:43:04 +09:00
Michael Helmling
c97be6630e Fix #789 (typo in member doc) 2017-01-06 09:08:02 +01:00
Stephen F. Booth
6fcc690233 Merge pull request #787 from rshanmu/master
Renamed unsupported-extension.xxx and modified test
2016-12-22 12:17:12 -05:00
Ramesh Shanmugasundaram
83c72518ab Renamed unsupported-extension.xxx and modified test
The file name unsupported-extension.xxx causes issue when unpacked
taglib-xxx.gz over an NFS partition. The file extension ".xxx" is the
one NFS uses for its own purpose and hence it will not allow creation
of this file.

Hence renamed the file and modified the test cases that checks for this
file.

Signed-off-by: Ramesh Shanmugasundaram <ramesh.shanmugasundaram@bp.renesas.com>
2016-12-22 15:19:45 +00:00
Tsuda Kageyu
de87cd7736 Remove the CMake check for Boost I missed out on. 2016-12-20 12:06:21 +09:00
Tsuda Kageyu
14c3ce5737 Remove all the optional dependencies on Boost. 2016-12-20 11:54:06 +09:00
Tsuda Kageyu
ffa32b19a7 Fix the CMake check for std::atomic_int.
std::atomic_int of Visual C++ 2012 cannot be constructed with integer.
2016-12-20 11:48:14 +09:00
Tsuda Kageyu
8905e7095a Safer conversion of boolean values in ASF attributes.
Technically, boolean values in Extended Content Description Object is not necessarily be 0 or 1.
2016-12-19 10:37:10 +09:00
Tsuda Kageyu
a19a623d4b Make use of increment/decrement operators of std::atomic. 2016-12-09 10:09:31 +09:00
Tsuda Kageyu
250c59f783 Remove optional dependencies on Boost's dynamic libraries.
Using precompiled Boost libraries can lead to depending on external dynamic libraries.
2016-12-09 09:42:29 +09:00
Tsuda Kageyu
8eda5d5053 Merge pull request #784 from haoxi911/master
Fix #667: Compiled TagLib framework for OS X fails at codesign.
2016-12-09 09:00:04 +09:00
Hao Xi
b5115e3497 Fix #667: Compiled TagLib framework for OS X fails at codesign. 2016-12-08 12:53:40 +08:00
Tsuda Kageyu
36ccad2bd4 Rewrite ByteVector::replace() to run in O(n) time. 2016-12-05 11:02:59 +09:00
Tsuda Kageyu
b00a5c1aab Add a test to check if ByteVector is detached correctly when being replaced. 2016-12-05 10:15:26 +09:00
Tsuda Kageyu
f6a604f54b #include guards in CMake generated headers. 2016-12-02 17:26:43 +09:00
Tsuda Kageyu
489e2e6cbb Update NEWS. 2016-12-01 15:25:30 +09:00
Tsuda Kageyu
9336c82da3 Fix possible Ogg packet losses. 2016-12-01 11:32:01 +09:00
Tsuda Kageyu
cfbaf34597 Prevent the segment table of Ogg pages from exceeding the size limit. 2016-12-01 10:51:59 +09:00
Tsuda Kageyu
046c98230f Remove Utils::floatByteOrder() and use systemByteOrder() instead.
We can safely assume that the integer and float byte orders are the same on IEEE754 compliant systems.
2016-11-29 14:58:39 +09:00
Tsuda Kageyu
4381bd75f3 Add a test for #743/#779. 2016-11-29 10:53:33 +09:00
Tsuda Kageyu
6df61cf2af Small fix in style. 2016-11-29 10:38:11 +09:00
Tsuda Kageyu
e9ef40fe7f Merge pull request #779 from supermihi/master
Fixes #743 by not overwriting existing Xiph comment in FLAC::File::save
2016-11-28 21:03:39 +09:00
Michael Helmling
2786aa7463 Fixes #743 by not overwriting existing Xiph comment in FLAC::File::save 2016-11-27 19:17:13 +01:00
Tsuda Kageyu
d3062f3af4 A bit more tolerant check to return itself in String::substr(). 2016-11-26 13:05:14 +09:00
Stephen F. Booth
7871afec37 Merge pull request #778 from martin-flaska/optimization
String::substr optimization
2016-11-25 16:38:32 -05:00
Martin Flaska
c9a0754e3b tstring: String::substr optimization when returning itself as a substring
Use copy ctor to return in a case whole string is being returned.

The intention was to optimize String::stripWhiteSpace for no-strip case
(without any leading or trailing white space removal).

copyFromUTF16 was used in any case previously and allocated duplicate
buffer for the same string - no implicit sharing.

Signed-off-by: Martin Flaska <martin.flaska@legrand.us>
2016-11-25 15:32:26 +01:00
Martin Flaska
6cfb11bb12 test_string: Make 'stripWhiteSpace' test more complex
No string without leading/trailing spaces was used in the test.

Signed-off-by: Martin Flaska <martin.flaska@legrand.us>
2016-11-25 13:56:39 +01:00
Tsuda Kageyu
ad075a56f9 Suppress MSVC warnings in test. 2016-11-24 14:45:22 +09:00
Stephen F. Booth
f80a7c0d83 Merge pull request #776 from mathbunnyru/small_improvements
Small improvements
2016-11-23 23:31:49 -05:00
mathbunnyru
5e1d9fad31 Small fixes 2016-11-24 02:05:19 +03:00
mathbunnyru
eff28c55bf Increment fixes 2016-11-22 01:10:28 +03:00
Tsuda Kageyu
d5b9d7b8a7 Update NEWS. 2016-11-18 13:55:43 +09:00
Tsuda Kageyu
ce77fbb0e7 Merge pull request #772 from TsudaKageyu/vorbis-fields
Fix handling of lowercase 'metadata_block_picture' field
2016-11-18 13:52:38 +09:00
Tsuda Kageyu
b98a984b66 Fix handling of lowercase 'metadata_block_picture' fields in Vorbis comments.
Also refactored some redundant code for parsing pictures.
2016-11-11 00:07:32 +09:00
Tsuda Kageyu
f9a747dceb Avoid adding fields with invalid keys to Vorbis Comments.
According to the spec, '\x7F' is not allowed.
2016-11-10 23:35:14 +09:00
Tsuda Kageyu
7b8d576bde Don't decode redundant UTF-8 sequences in Win32.
Linux and OS X are working well and won't be affected.
2016-11-10 17:12:58 +09:00
Tsuda Kageyu
2651372291 Separate some tests to make them more specific. 2016-11-09 15:51:33 +09:00
Tsuda Kageyu
499f6db977 Check invalid Unicode APE keys properly. 2016-11-09 00:29:03 +09:00
Tsuda Kageyu
9d58e9f8e8 Removed a utility function which is used only at one place. 2016-11-08 23:27:55 +09:00
Tsuda Kageyu
56cd3695f7 Add README.md. 2016-11-08 22:56:42 +09:00
Tsuda Kageyu
d81d894d41 tolower() depends on the current locale.
It's much easier to write our own function than to use locales properly.
2016-11-08 21:39:53 +09:00
Tsuda Kageyu
e390cbac52 Update NEWS. 2016-11-08 21:17:00 +09:00
Tsuda Kageyu
253c61e37d Merge pull request #765 from TsudaKageyu/zero-length-atom
Proper handling of MP4 atoms with zero length.
2016-11-08 21:12:47 +09:00
Tsuda Kageyu
1848b3bc6f Merge pull request #759 from ufleisch/mp4_classical
Support new classical music frames introduced with iTunes 12.5, #758.
2016-11-08 21:12:31 +09:00
Tsuda Kageyu
aae23f3c07 Initialize all the data members of ID3v2::ChapterFrame. 2016-11-07 14:12:38 +09:00
Tsuda Kageyu
da9df1b2a8 Values of FILE_* macros are guaranteed in Win32. 2016-11-07 00:42:12 +09:00
Tsuda Kageyu
70334edd19 Add List::swap() and Map::swap(). 2016-11-04 16:43:14 +09:00
Tsuda Kageyu
f5ca097379 Proper handling of MP4 atoms with zero length.
If the size of an atom is 0, it designates the last atom which extends to the end of the file.
2016-11-02 15:44:50 +09:00
Tsuda Kageyu
eb6d058ab9 Remove a useless branch.
longLength <= LONG_MAX is always true if sizeof(long) == sizeof(long long).
2016-11-01 16:03:15 +09:00
Tsuda Kageyu
e6a69e24bc Add a common function to generate a long string to test. 2016-10-31 20:01:52 +09:00
Tsuda Kageyu
dcab8ed90e Allow ScopedFileCopy to be const. 2016-10-31 10:29:13 +09:00
Tsuda Kageyu
f5ce498182 Suppress MSVC warnings about narrowing conversions. 2016-10-30 23:51:35 +09:00
Tsuda Kageyu
ee7fa78011 Update NEWS. 2016-10-30 22:51:15 +09:00
Tsuda Kageyu
873c917081 Assume that SetFilePointerEx() and GetFileSizeEx() are always available.
This drops support for Windows 9x and NT 4.0 or older.
2016-10-30 22:36:18 +09:00
Tsuda Kageyu
d3bd8fb7ff Assume that CreateFileW() is always available.
This drops support for Windows 9x.
2016-10-30 22:25:34 +09:00
Tsuda Kageyu
005441faaa Prevent overflows, just in case. 2016-10-28 15:25:50 +09:00
Tsuda Kageyu
935534aa53 Backport a test from taglib2 branch. 2016-10-28 15:19:35 +09:00
Tsuda Kageyu
65a24bbc51 Remove some useless seek()/tell() from RIFF::File. 2016-10-28 14:22:50 +09:00
Tsuda Kageyu
711b35cc6e Encourage compilers to optimize out debug() and debugData().
It's sort of like a throwback, but I found that debug(const String &s) {} doesn't prevent a String from being constructed and the error messages from being embedded.
2016-10-28 11:19:51 +09:00
Tsuda Kageyu
d53ca6f736 Update NEWS. 2016-10-27 15:40:14 +09:00
Tsuda Kageyu
aa5f9bb221 Suppress some warnings in test. 2016-10-27 15:23:24 +09:00
Tsuda Kageyu
d2b3547254 Add a test for File::truncate(). 2016-10-27 15:15:22 +09:00
Tsuda Kageyu
06ca9a099d Check if file size <= LONG_MAX. 2016-10-27 15:10:34 +09:00
Tsuda Kageyu
8d873e4e3e Merge pull request #761 from albertofustinoni/master
WinRT compatibility
2016-10-24 22:06:35 +09:00
Alberto Fustinoni
b2fa124451 formatting 2016-10-24 21:24:53 +09:00
Alberto Fustinoni
ff5b2dc96f Whitespace 2016-10-24 21:22:57 +09:00
Alberto Fustinoni
757f5ebc96 Refactoring 2016-10-24 21:19:31 +09:00
Tsuda Kageyu
e36a9cabb9 Update NEWS. 2016-10-24 12:03:23 +09:00
Alberto Fustinoni
606f6c0e74 Better define guards 2016-10-23 23:25:16 +09:00
Alberto Fustinoni
1cc047c953 Styling 2016-10-23 20:17:49 +09:00
Alberto Fustinoni
cae4f1b804 Merge branch 'master' of https://github.com/albertofustinoni/taglib.git 2016-10-23 20:13:26 +09:00
Alberto Fustinoni
deffe83fd0 Use newer file system calls when in Windows 8+ to allow compilation as WinRT asembly 2016-10-23 12:32:16 +09:00
Tsuda Kageyu
597dcde72a Update the version to v1.11.1. 2016-10-22 02:45:52 +09:00
Tsuda Kageyu
6a96a6426a Replace a possibly non-free file in the test suite. 2016-10-22 02:11:16 +09:00
Tsuda Kageyu
69c65284a5 Update NEWS. 2016-10-22 01:06:57 +09:00
Tsuda Kageyu
97aaa0f979 Restore the ABI breakage by bringing back a removed private static variable. 2016-10-19 15:57:28 +09:00
Urs Fleisch
1b64bb0cb7 Support new classical music frames introduced with iTunes 12.5, #758.
M4A:
    ©wrk: Work (string)
    ©mvn: Movement Name (string)
    ©mvi: Movement Number (number)
    ©mvc: Movement Count (number)
    shwm: Show Work & Movement (0/1)

ID3 (2.3, 2.4; MVN, MVI for 2.2):
    MVNM: Movement Name
    MVIN: Movement Number/Count
2016-10-18 20:45:54 +02:00
Tsuda Kageyu
0dac721ce2 Update NEWS. 2016-09-26 17:48:44 +09:00
Stephen F. Booth
bbeeca6fdb Merge pull request #754 from hyperquantum/master
Fix defect in ByteVectorStream::seek when Position==End.
2016-09-15 21:11:08 -04:00
Kevin André
7e90313690 Fix defect in ByteVectorStream::seek when Position==End. 2016-09-15 16:30:16 +02:00
Tsuda Kageyu
1d3c95f692 Merge pull request #752 from evpobr/cmake-ver
Move cmake_minimum_required at the top
2016-09-12 15:56:45 +09:00
Tsuda Kageyu
8c3801f18d Merge pull request #753 from FestusHagen/fh1.m_AddBuildSharedLibsOption
Add BUILD_SHARED_LIBS option for CMake GUI.
2016-09-12 15:56:33 +09:00
Festus Hagen
c9bdd416ef Add BUILD_SHARED_LIBS option for CMake GUI. 2016-08-25 15:03:44 -04:00
evpobr
9f28e037fe Move cmake_minimum_required at the top 2016-08-20 22:37:53 +05:00
Stephen F. Booth
92c070ba9e Merge pull request #749 from jwelton/fix-typo
Fix Typo
2016-08-14 17:10:18 -04:00
Jake Welton
75e3ec73aa Change string to end offset 2016-08-14 22:02:33 +01:00
Tsuda Kageyu
3e47a036fb Update NEWS. 2016-05-14 10:46:42 +09:00
Tsuda Kageyu
9b995544e4 Fix reading table of contents frames with a lot of children. 2016-05-14 09:58:19 +09:00
Tsuda Kageyu
d8e5077961 Update NEWS. 2016-04-29 17:26:33 +09:00
Tsuda Kageyu
6422054540 Merge pull request #739 from frgm/master
c: fix a typo
2016-04-23 06:54:59 +09:00
Svyatoslav Mishyn
1b878102f0 c: fix a typo
readble => readable
2016-04-22 16:46:15 +03:00
Tsuda Kageyu
0a85f9b227 Revert "Hide a private static variable."
This reverts commit 25ffbcb4b9.

# Conflicts:
#	taglib/mpeg/id3v2/id3v2framefactory.cpp
#	taglib/mpeg/id3v2/id3v2framefactory.h
2016-04-22 09:27:04 +09:00
Stephen F. Booth
31f3109b47 Merge pull request #732 from dirkvdb/master
Also ignore the virtual destructor warning when compiling with clang
2016-04-02 13:21:39 -04:00
Dirk Vanden Boer
76f8ff388f Also ignore the virtual destructor warning when compiling with clang 2016-03-20 20:33:04 +01:00
Tsuda Kageyu
7627ae48ed Change some static_casts to dynamic_casts in test_id3v2.cpp.
static_casts are unsafe and some of following tests doesn't work well with them.
2016-03-17 22:50:34 +09:00
Tsuda Kageyu
b2a6768704 Don't stop parsing an ID3v2 SYLT frame when its description is empty. 2016-03-14 20:35:09 +09:00
Tsuda Kageyu
7d270a7e20 Update NEWS. 2016-03-10 21:38:08 +09:00
Tsuda Kageyu
bf53dc6131 Merge pull request #726 from amethystAnt/ape-keys-bug
Fixed bug #725 - changed the maximum length of an APE key to 255
2016-03-07 06:41:21 +09:00
Karel Patlejch
ff8b6a91e7 Fixed bug #725 - changed the maximum length of an APE key to 255 2016-03-06 21:15:18 +01:00
Tsuda Kageyu
1a82419872 Add myself to maintainers. 2016-03-03 10:06:51 +09:00
Tsuda Kageyu
5a3265d031 Update NEWS for v1.11 BETA 2. 2016-03-03 05:02:14 +09:00
Tsuda Kageyu
a27199b772 Support Boost iostreams library to decode compressed ID3v2 frames in additiion to zlib.
This will help Windows users build TagLib without zlib source.
2016-03-02 11:14:11 +09:00
Tsuda Kageyu
6c27a32de8 Skip a useless debug message. 2016-02-24 21:32:25 +09:00
Tsuda Kageyu
11abffc0f6 Update NEWS. 2016-02-22 23:27:46 +09:00
Tsuda Kageyu
2aea23aed2 Add some debug messages to RIFF::File, just in case. 2016-02-22 23:17:17 +09:00
Tsuda Kageyu
e8ef0e0a4b Improve the padding handling of RIFF files a bit. 2016-02-22 23:12:34 +09:00
Tsuda Kageyu
520da50bc5 Always update the global RIFF size when updating RIFF files. 2016-02-22 22:27:18 +09:00
Tsuda Kageyu
c0a909b709 Fix a broken indent. 2016-02-22 01:39:40 +09:00
Tsuda Kageyu
8d09f12847 Remove some #ifdefs and #includes no longer used. 2016-02-22 00:35:11 +09:00
Tsuda Kageyu
710166e32d Separate zlib related code rather than having several #ifdef blocks. 2016-02-21 23:16:48 +09:00
Tsuda Kageyu
01054009ac Make the code in ByteVector::append() a bit more clearer. 2016-02-21 00:43:33 +09:00
Tsuda Kageyu
7d8aa7b8bd ByteVector::append() can't take the vector itself. 2016-02-20 19:42:46 +09:00
Tsuda Kageyu
98a57744c3 Add some tests for ByteVector::replace(). 2016-02-20 11:50:47 +09:00
Tsuda Kageyu
8c4b484e67 Fix a possible out-of-bounds access in SynchData::decode().
This also avoids an extra memory copy.
2016-02-19 20:58:09 +09:00
Tsuda Kageyu
2166d703e0 Small fix in style. 2016-02-18 14:34:16 +09:00
Tsuda Kageyu
887f3b28e5 Add a TODO comment in ByteVector::replace(). 2016-02-18 14:29:17 +09:00
Tsuda Kageyu
6a9db50c03 Revert "Remove more useless inline specifiers."
This reverts commit dadfe79799.
2016-02-18 03:51:42 +09:00
Tsuda Kageyu
07d95e0dc0 Add an overload of ByteVector::replace() which takes chars.
Currently, this is only way of using ByteVector::replace().
2016-02-18 03:47:02 +09:00
Tsuda Kageyu
a9acca5d81 Decode unsynchronized ID3v2 frames efficiently.
It makes a great difference when decoding huge unsynchronized ID3v2 frames.
2016-02-18 03:07:38 +09:00
Tsuda Kageyu
dadfe79799 Remove more useless inline specifiers.
They are no longer needed since the unnamed namespaces have solved the ODR violation.
2016-02-17 22:06:36 +09:00
Tsuda Kageyu
552185a8b8 Cast the parameters of boost::endian::endian_reverse(), just in case. 2016-02-16 20:35:27 +09:00
Tsuda Kageyu
46eacaeba4 Inline functions had better have internal linkages.
This also removes useless inline specifiers.
2016-02-15 20:53:27 +09:00
Tsuda Kageyu
455e827e1e Explicitly set a false flag in ConfigureChecks.cmake. 2016-02-15 02:18:42 +09:00
Tsuda Kageyu
c08e0b1357 Reorganize some redundant or missing tests. 2016-02-15 01:49:23 +09:00
Tsuda Kageyu
f3016c0892 Enable Boost Endian library again.
It should be detected properly now.
2016-02-15 01:36:17 +09:00
Tsuda Kageyu
f8f7cb0904 Update NEWS. 2016-02-15 00:26:41 +09:00
Tsuda Kageyu
d037b8c908 Make sure we don't write UTF8 or UTF16BE to ID3v2.3 tags. 2016-02-15 00:22:18 +09:00
Tsuda Kageyu
c349ba3a31 Add OS X settings to travis.yml. 2016-02-14 03:29:03 +09:00
Tsuda Kageyu
bb006e41d7 Disable Boost Endian library for now.
It's not detected properly depending on the environment.
2016-02-14 03:17:37 +09:00
Tsuda Kageyu
ab2267f9aa Find Boost properly.
check_cxx_source_compiles() depends on the Visual Studio settings.
2016-02-14 01:53:02 +09:00
Tsuda Kageyu
73662037eb Merge branch 'master' of https://github.com/taglib/taglib 2016-02-11 20:53:22 +09:00
Tsuda Kageyu
aa339eba87 Fix a wrong test for base64 decoding. 2016-02-11 20:47:55 +09:00
Scott Wheeler
45a3bdb695 Properly mark functions as virtual 2016-02-10 11:08:46 +00:00
Tsuda Kageyu
5a155ef4ce Fix memory leaks when saving Ogg files. 2016-02-07 04:46:40 +09:00
Tsuda Kageyu
184a151d41 Add some missing FileRef tests. 2016-02-06 21:56:51 +09:00
Tsuda Kageyu
cc2ccbc20c Test if FileRef chooses a correct File type. 2016-02-06 21:32:03 +09:00
Tsuda Kageyu
fa46185ca4 Add a supplementary note to a comment. 2016-02-06 21:14:12 +09:00
Tsuda Kageyu
fffff35ca5 Correct the license information. 2016-02-06 01:27:36 +09:00
Tsuda Kageyu
31894f47f6 Fix another typo in NEWS. 2016-02-05 19:57:09 +09:00
Tsuda Kageyu
c1e3d65b68 Fix a typo in NEWS 2016-02-05 10:53:56 +09:00
Tsuda Kageyu
a8ecbbaef4 Update NEWS. 2016-02-03 20:33:13 +09:00
Tsuda Kageyu
24575aab23 Remove strnlen() since some compilers lack it. 2016-02-03 20:21:04 +09:00
Tsuda Kageyu
c04b24a2f5 More efficient handling of broken APE item keys.
This also improves the performance when handling intact APE items.
2016-02-03 01:08:16 +09:00
Tsuda Kageyu
013fbbf22c APE::Tag::addValue() may append a string to non-text items. 2016-02-02 00:42:08 +09:00
Tsuda Kageyu
5350bc8501 Oops! We already have a function to check APE item keys. 2016-02-01 22:46:08 +09:00
Tsuda Kageyu
92a1a00624 APE item keys should be ASCII between 0x20 and 0x7E, not UTF-8. 2016-02-01 22:19:43 +09:00
Tsuda Kageyu
8afbf6c92a Update NEWS. 2016-01-30 11:13:32 +09:00
Tsuda Kageyu
9976155aa9 Ignore 'fact' chunk of WAV files if their format is PCM.
TagLib reports wrong length of some PCM files with a 'fact' chunk.
2016-01-30 00:51:28 +09:00
Tsuda Kageyu
c2cb9ab8b0 Update NEWS with the specific release date. 2016-01-28 13:31:22 +09:00
Tsuda Kageyu
758b7e39ce Update the version to v1.11. 2016-01-28 13:17:56 +09:00
Tsuda Kageyu
4ba7bb5a8a Reorganize NEWS to put new features first. 2016-01-28 12:13:18 +09:00
Tsuda Kageyu
0b62ba1530 Remove the body of deprecated function Ogg::Page::getCopyWithNewPageSequenceNumber(). 2016-01-28 12:00:27 +09:00
Tsuda Kageyu
fe92f3dffe Add a test for broken MPEG audio frames. 2016-01-09 13:30:00 +09:00
Tsuda Kageyu
b8e82a7775 Amend an outdated comment. 2016-01-09 10:15:42 +09:00
Tsuda Kageyu
3dc873b7d0 Check if two consecutive MPEG audio frames are consistent.
This fixes reading the audio properties of some MP3 files reported by a Kodi user.
This is basically the same check as FFmpeg does.
2016-01-08 20:08:04 +09:00
Tsuda Kageyu
1254534ed4 Another workaround for broken MPEG headers. 2016-01-08 02:30:17 +09:00
Tsuda Kageyu
7a5fb7d672 Revert some unnecessary changes. 2016-01-08 02:22:44 +09:00
Tsuda Kageyu
5b7ee5bc1a Initialize all the private data members. 2016-01-08 01:57:18 +09:00
Tsuda Kageyu
815d1583e9 Avoid repeating insert() operations in Ogg::File. 2016-01-06 17:57:37 +09:00
Tsuda Kageyu
6c183a7df8 Update NEWS. 2016-01-06 17:43:32 +09:00
Tsuda Kageyu
8d5f821b16 Merge pull request #689 from TsudaKageyu/save-ogg
Fix a segfault when saving an Ogg file repeatedly.
2016-01-06 09:46:35 +09:00
Tsuda Kageyu
0611744171 Merge pull request #706 from TwoFX/master
Remove "FORCE" in CMake path specifications to allow installation to a non-standard directory structure
2016-01-05 13:20:28 +09:00
Markus Himmel
c25e0c6ead Remove "FORCE" in CMake path specifications to allow installation to a
non-standard directory structure.
2015-12-29 10:29:58 +01:00
Tsuda Kageyu
45762d20f1 Fix a silly mistake. 2015-12-25 16:52:26 +09:00
Tsuda Kageyu
67434aa7b4 Merge pull request #705 from TsudaKageyu/mpeg-invalid-frame
More robust checks for invalid MPEG frame headers. (again)
2015-12-25 08:58:06 +09:00
Tsuda Kageyu
cb23f91c98 Merge branch 'master' of https://github.com/dukeyin/taglib into dukeyin-master
# Conflicts:
#	tests/test_id3v2.cpp
2015-12-24 13:47:55 +09:00
Tsuda Kageyu
37c4d0b11d Update NEWS. 2015-12-24 09:43:21 +09:00
Tsuda Kageyu
626d13467e Merge pull request #701 from TsudaKageyu/flac-strip
Enable FLAC::File to remove non-standard tags.
2015-12-24 09:41:48 +09:00
Tsuda Kageyu
02eac18d00 Fix a segfault when saving an Ogg file repeatedly.
This also reduces memory usage when reading/writing Ogg files.
Especially, it stops holding an entire file when renumbering Ogg pages.
2015-12-24 08:58:56 +09:00
Tsuda Kageyu
4064b34eff A bit more tolerant check for the MPEG frame length. 2015-12-22 20:39:58 +09:00
Tsuda Kageyu
22708a0af6 Add some supplementary comments. 2015-12-22 17:06:40 +09:00
Tsuda Kageyu
12da0ebd6d Amend a vague comment and debug message. 2015-12-22 15:18:53 +09:00
Tsuda Kageyu
d13a3e3e16 Update NEWS. 2015-12-22 15:11:21 +09:00
Tsuda Kageyu
e8b28a0466 Merge pull request #703 from inizan-yannick/master
Fix .pc file configuration.
2015-12-22 15:07:27 +09:00
Tsuda Kageyu
081d6eaf76 More robust checks for invalid MPEG frame headers. (again) 2015-12-22 14:57:23 +09:00
Tsuda Kageyu
ac361c7692 Unify some duplicate internal functions. 2015-12-22 11:49:55 +09:00
Yannick Inizan
d7de3983d9 Fix .pc file configuration. 2015-12-21 22:25:49 +01:00
Tsuda Kageyu
1aca1f64fe Enable FLAC::File to remove non-standard tags. 2015-12-21 15:42:41 +09:00
Tsuda Kageyu
5a1f44d166 Avoid the risk of subtracting between signed and unsigned types. 2015-12-21 14:29:59 +09:00
Tsuda Kageyu
130654316b Backport some comments from tablib2 branch. 2015-12-21 13:54:02 +09:00
Tsuda Kageyu
5cd139a578 Small fix in style. 2015-12-21 13:34:48 +09:00
Tsuda Kageyu
dd2ed47703 Avoid an implicit const cast. 2015-12-21 13:06:43 +09:00
Tsuda Kageyu
d0238ba82f Avoid the risk of subtracting between signed and unsigned types. 2015-12-21 11:44:25 +09:00
Tsuda Kageyu
cf5d431d77 Remove an unused private data member. 2015-12-21 10:49:46 +09:00
Tsuda Kageyu
4ec264b6a1 Update NEWS. 2015-12-21 10:05:05 +09:00
Tsuda Kageyu
ef92ee223f Merge pull request #699 from TsudaKageyu/flac-duplicate-comments
Remove duplicate Vorbis comment blocks when saving a FLAC file.
2015-12-21 10:03:14 +09:00
Tsuda Kageyu
8b6bcf411a Update NEWS. 2015-12-18 13:54:47 +09:00
Tsuda Kageyu
aa66b0651d Merge pull request #688 from TsudaKageyu/save-wv
Fix saving WavPack files.
2015-12-18 13:52:54 +09:00
Tsuda Kageyu
7c5d1e02de Update NEWS. 2015-12-18 09:03:31 +09:00
Tsuda Kageyu
6d27a1013d Merge pull request #687 from TsudaKageyu/save-mpc
Fix saving MPC files.
2015-12-18 09:00:45 +09:00
Tsuda Kageyu
50711f4758 Update NEWS. 2015-12-17 16:59:28 +09:00
Tsuda Kageyu
6998be94f6 Merge pull request #686 from TsudaKageyu/save-ape
Fix saving APE files.
2015-12-17 16:57:24 +09:00
Tsuda Kageyu
862952bdcc Remove unnecessary private data members from TrueAudio::File. 2015-12-17 11:43:11 +09:00
Tsuda Kageyu
f0b0b736e3 Update NEWS. 2015-12-17 11:26:45 +09:00
Tsuda Kageyu
546870d83a Merge pull request #684 from TsudaKageyu/save-mpeg
Fix saving MPEG files.
2015-12-17 11:24:25 +09:00
Tsuda Kageyu
581e58585a Amend a comment that refers to a deprecated function. 2015-12-16 13:39:22 +09:00
Tsuda Kageyu
36b905670c Replace TagLib::uint with unsinged int. 2015-12-16 12:59:43 +09:00
Tsuda Kageyu
42459fe457 Update NEWS. 2015-12-16 11:49:55 +09:00
Tsuda Kageyu
fc571e5150 Merge pull request #683 from TsudaKageyu/save-mp4
Fix saving MP4 files.
2015-12-16 11:48:52 +09:00
Tsuda Kageyu
5480458dfc Change a method name of XiphComment to make it consistent with other method. 2015-12-16 11:00:13 +09:00
Tsuda Kageyu
9950fca3c2 Remove duplicate Vorbis comment blocks when saving a FLAC file. 2015-12-16 10:00:08 +09:00
Tsuda Kageyu
63e838f831 Make use of List iterators and setAutoDelete() in FLAC::File. 2015-12-15 15:31:33 +09:00
Tsuda Kageyu
94f28b4fa1 Update NEWS. 2015-12-15 15:18:07 +09:00
Tsuda Kageyu
680784c7b7 Merge pull request #682 from TsudaKageyu/save-flac
Fix saving FLAC files.
2015-12-15 15:08:14 +09:00
Tsuda Kageyu
5d517127ae Merge pull request #698 from TsudaKageyu/mpeg-header-check
More robust checks for invalid MPEG frame headers.
2015-12-15 10:11:13 +09:00
Tsuda Kageyu
be9b5cc93a More robust checks for invalid MPEG frame headers. 2015-12-08 11:20:51 +09:00
Tsuda Kageyu
847eec23cf Fix careless copy-and-paste code. 2015-12-04 14:29:26 +09:00
Tsuda Kageyu
9dfb3fe452 Update NEWS. 2015-12-04 14:15:51 +09:00
Tsuda Kageyu
a013c7c4c2 Merge pull request #694 from FestusHagen/fh1.m_NoSharedLibTests
Disable tests with a shared library.
2015-12-04 11:41:44 +09:00
Festus Hagen
62ec63b039 Disable tests with a shared library. 2015-12-03 15:04:37 -05:00
Tsuda Kageyu
52d3122e9e Remove some unused private data members. 2015-12-03 16:55:05 +09:00
Tsuda Kageyu
24f220224d Move a test to the proper place.
The test is actually for XiphComment, not Vorbis::File.
2015-12-03 13:05:18 +09:00
Tsuda Kageyu
a1ac23530e Simpler conversion from bits to bytes. 2015-12-03 12:34:54 +09:00
Tsuda Kageyu
e99910dd74 Revert some ABI breaking changes. 2015-12-03 10:06:04 +09:00
Tsuda Kageyu
88ad2843f4 Small cosmetic fixes. 2015-12-03 02:25:16 +09:00
Tsuda Kageyu
a0b8683656 Use a standard type rather than TagLib::uint.
This won't break the ABI compatibility.
2015-12-03 02:15:41 +09:00
Tsuda Kageyu
085a0ef298 Use a standard type rather than TagLib::ulong.
This won't break the ABI compatibility.
2015-12-03 00:03:06 +09:00
Tsuda Kageyu
363c471a2d Small cosmetic fixes. 2015-12-02 23:21:23 +09:00
Tsuda Kageyu
7f8efec4d4 Merge pull request #545 from FestusHagen/fh1.m_TDRC
Append TIME to TDRC, adjusted test_id3v2.cpp as appropriate.
2015-12-02 21:11:53 +09:00
Tsuda Kageyu
dcc0fe553c Use a standard type rather than TagLib::ushort.
This won't break the ABI compatibility.
2015-12-02 18:59:45 +09:00
Tsuda Kageyu
8bdddaabce Use a standard type rather than TagLib::uchar.
This won't break the ABI compatibility.
2015-12-02 18:11:52 +09:00
Tsuda Kageyu
2cb89b85c9 Make use of List iterators and setAutoDelete() in XiphComment. 2015-12-02 17:33:11 +09:00
Tsuda Kageyu
e6e9ba6094 Fix saving FLAC files.
This fixes all the issues reported at #622.
2015-12-02 17:21:12 +09:00
Tsuda Kageyu
7b854c5434 Update NEWS. 2015-12-02 15:01:10 +09:00
Tsuda Kageyu
1529af7a12 Merge branch 'xiph-picture' of https://github.com/gogglesmm/taglib into gogglesmm-xiph-picture
# Conflicts:
#	tests/test_bytevector.cpp
#	tests/test_ogg.cpp
2015-12-02 14:59:50 +09:00
Tsuda Kageyu
e475e31e0d Update NEWS. 2015-12-02 14:28:41 +09:00
Tsuda Kageyu
ea55c8b5c1 Merge branch 'cmake-allow-BUILD_SHARED_LIBS-to-drive-ENABLE_STATIC' of https://github.com/tSed/taglib into tSed-cmake-allow-BUILD_SHARED_LIBS-to-drive-ENABLE_STATIC
# Conflicts:
#	CMakeLists.txt
#	examples/CMakeLists.txt
2015-12-02 14:21:58 +09:00
Tsuda Kageyu
bc8b60ea46 Remove an unreachable statement. 2015-12-02 14:08:20 +09:00
Tsuda Kageyu
83ffc87598 Surround some internal stuff by anonymous namespaces. 2015-12-02 12:00:43 +09:00
Tsuda Kageyu
d97292c593 Amend some comments refer to the 'offset_t' type. It no longer exists. 2015-12-02 11:36:54 +09:00
Tsuda Kageyu
060a50ab11 Use a standard type rather than TagLib::wchar.
This won't break the ABI compatibility.
2015-12-02 11:30:29 +09:00
Tsuda Kageyu
6966be4292 Use a standard type rather than TagLib::ulonglong.
TagLib::ulonglong is not used in the public headers, so the changes are trivial.
2015-12-02 09:13:10 +09:00
Lukáš Lalinský
f38749aacf Merge pull request #690 from stefansaraev/pkgconfig
fix pkgconfig file for cross compiling
2015-12-01 16:47:47 +01:00
Tsuda Kageyu
b4b16fd7e0 Merge pull request #691 from FestusHagen/fh1.m_ushortAmbiguities
Silence ushort ambiguity errors
2015-12-01 00:02:25 +09:00
Festus Hagen
b1c67fc5dc Silence ushort ambiguity errors 2015-11-30 08:09:08 -05:00
Stefan Saraev
90f1f03163 fix pkgconfig file for cross compiling 2015-11-30 14:14:10 +02:00
Tsuda Kageyu
101a330d55 The new test wasn't called. 2015-11-30 18:32:49 +09:00
Tsuda Kageyu
59088096e6 Add some tests for M4V files. 2015-11-30 17:18:50 +09:00
Tsuda Kageyu
d1ceffd1f0 Merge branch 'm4v' of https://github.com/videolabs/taglib into videolabs-m4v
# Conflicts:
#	taglib/fileref.cpp
2015-11-30 17:12:03 +09:00
Tsuda Kageyu
eb6542bc8b Unify some duplicate internal functions. 2015-11-30 16:35:37 +09:00
Tsuda Kageyu
bccd57a470 Add const to an unchanged data member. 2015-11-30 16:21:58 +09:00
Tsuda Kageyu
a6701ddcda Remove some private data members not needed to belong to private classes. 2015-11-30 15:43:18 +09:00
Tsuda Kageyu
31d1f11969 Use a const pointer to initialize a const pointer. 2015-11-30 15:00:32 +09:00
Tsuda Kageyu
f9e558eef5 Avoid trying to remove tag chunks when an AIFF file doesn't have an ID3v2 tag. 2015-11-30 14:17:26 +09:00
Tsuda Kageyu
fcdf7c2ae2 Add some tests to check if the internal flags are updated when writing WAV files. 2015-11-30 13:46:43 +09:00
Tsuda Kageyu
8c424badad Avoid writing an empty ID3v2 tag in an AIFF file. 2015-11-30 13:42:25 +09:00
Tsuda Kageyu
f1b683b582 Remove some private data members not needed to be carried. 2015-11-30 13:09:11 +09:00
Tsuda Kageyu
5e37f0101d Remove some private data members not needed to be carried. 2015-11-30 12:53:52 +09:00
Tsuda Kageyu
b541ec8b68 Remove some private data members not needed to be carried. 2015-11-30 12:35:29 +09:00
Tsuda Kageyu
1fa677e2ef Add some tests about splitting/merging Ogg pages. 2015-11-29 01:57:15 +09:00
Festus Hagen
463e8f313a Append TIME to TDRC, adjusted test_id3v2.cpp as appropriate. 2015-11-27 17:54:20 -05:00
Tsuda Kageyu
8130b30397 Close temporary files regardless if the tests are successful or not.
delete statements are skipped when assertions fail.
2015-11-27 15:20:16 +09:00
Tsuda Kageyu
6b836c6ba7 Add ENABLE_CCACHE build option to allow users opt in to use ccache. 2015-11-27 12:15:03 +09:00
Tsuda Kageyu
f5a3f2b6c1 Update NEWS. 2015-11-27 09:37:29 +09:00
Tsuda Kageyu
4b8e39e8f0 Merge branch 'fh1.m_AddBuildBindingsOption' of https://github.com/FestusHagen/taglib into FestusHagen-fh1.m_AddBuildBindingsOption
# Conflicts:
#	CMakeLists.txt
2015-11-27 09:35:13 +09:00
Tsuda Kageyu
905bf89e66 Fix saving WavPack files.
This fixes the issue reported at #624.
2015-11-27 09:30:03 +09:00
Tsuda Kageyu
67cbf2c0a8 Silence a GCC warning in tests about ignoring a return value. 2015-11-27 02:45:33 +09:00
Tsuda Kageyu
3f84621d58 Small cleanups in CMakeLists.txt. 2015-11-27 02:27:24 +09:00
Tsuda Kageyu
083eadec60 Fix saving MPC files.
This fixes the issue reported at #624.
2015-11-27 00:53:03 +09:00
Tsuda Kageyu
f180445be5 Fix saving APE files.
This fixes the issue reported at #624.
2015-11-27 00:22:07 +09:00
Tsuda Kageyu
cbc279b899 Merge pull request #685 from g-coder/patch-2
Added ccache support for faster compilation
2015-11-26 20:03:17 +09:00
g-coder
e1bcb101f0 Update CMakeLists.txt 2015-11-26 15:51:42 +05:30
g-coder
14f3b6c928 Added ccache support for faster compilation
ccache is a compiler cache. It speeds up recompilation by caching previous compilations and detecting when the same compilation is being done again. It provides support for C/C++ languages.
It makes compilation fast if it is available on the machine.
https://ccache.samba.org/
2015-11-26 15:12:23 +05:30
Tsuda Kageyu
b6361ddde5 Fix saving MPEG files.
This fixes all the issues reported at #618.
2015-11-25 01:56:07 +09:00
Tsuda Kageyu
66dd0b8a6f Small cosmetic fixes. 2015-11-25 00:12:18 +09:00
Tsuda Kageyu
94b7828990 Fix saving MP4 files.
This fixes the issue reported at #619.
2015-11-24 23:41:10 +09:00
Tsuda Kageyu
fa4289e044 Fix instance references to a static member function. 2015-11-24 16:36:50 +09:00
Tsuda Kageyu
3612c2cc24 Small cosmetic fix. 2015-11-24 15:45:38 +09:00
Tsuda Kageyu
477aba9465 Merge pull request #676 from TsudaKageyu/string-hide-private
Hide private things from a public header.
2015-11-23 17:48:06 +09:00
Tsuda Kageyu
a640074a21 Hide some private functions from a public header. 2015-11-23 03:26:38 +09:00
Tsuda Kageyu
25ffbcb4b9 Hide a private static variable.
This is so-called Scott Mayers' singleton pattern.
2015-11-23 01:32:12 +09:00
Tsuda Kageyu
e44de9f37f Remove duplicate tags when saving AIFF files.
Just the same way as WAV already does.
2015-11-22 21:03:33 +09:00
Tsuda Kageyu
2b7d6fef47 Reduce redundant ref()/deref() operations. 2015-11-22 20:11:08 +09:00
Tsuda Kageyu
ae633105d6 Fix an instance reference to a static data member. 2015-11-22 19:43:17 +09:00
Tsuda Kageyu
6978131d22 Silence some GCC warnings about no return statement. 2015-11-22 18:42:49 +09:00
Tsuda Kageyu
83a0bc3710 Avoid using obsolete XiphComment::removeField(). 2015-11-22 18:30:56 +09:00
Tsuda Kageyu
6477132301 Update NEWS. 2015-11-22 16:23:53 +09:00
Tsuda Kageyu
559c6b28c9 Merge pull request #681 from TsudaKageyu/xiph-remove-fields
Add alternative methods to XiphComment::removeField() that may cause …
2015-11-22 16:19:15 +09:00
Tsuda Kageyu
e9f70a59b2 Merge branch 'genversion' of https://github.com/ufleisch/taglib into ufleisch-genversion
# Conflicts:
#	CMakeLists.txt
2015-11-22 10:38:35 +09:00
Tsuda Kageyu
f34d73d319 Make FileRef::FileTypeResolver work properly. 2015-11-21 18:29:41 +09:00
Tsuda Kageyu
ef3ce1e38a Style fixes in fileref.cpp. 2015-11-21 17:06:26 +09:00
Tsuda Kageyu
8724184d56 Fix a typo in a comment. 2015-11-21 10:32:32 +09:00
Tsuda Kageyu
61dabe61a7 Update NEWS. 2015-11-21 10:30:48 +09:00
Tsuda Kageyu
de0fc83066 Style fixes in fileref.cpp. 2015-11-21 10:29:37 +09:00
Tsuda Kageyu
c3807e59cd Merge pull request #528 from chouquette/master
FileRef: Allow an IOStream to be used
2015-11-21 09:51:03 +09:00
Tsuda Kageyu
b592f78238 Unify common functions for finding tags.
Several classes have exactly identical functions for finding tags.
This also hides the functions from public headers.
2015-11-21 09:30:04 +09:00
Tsuda Kageyu
84e3582332 Add alternative methods to XiphComment::removeField().
Using XiphComment::removeField() may lead to a linkage error, however we can't fix the method itself without breaking the ABI or changing its behavior.
So we added some alternative method and marked the old one deprecated.
2015-11-20 23:28:32 +09:00
Tsuda Kageyu
ce1c03faa3 Update NEWS. 2015-11-20 23:08:43 +09:00
Tsuda Kageyu
94c941928a Merge pull request #654 from TsudaKageyu/xiph-setcomment
Fix XiphComment::setComment() for the case that a Vorbis comment has …
2015-11-20 23:02:51 +09:00
Tsuda Kageyu
8c6fe45453 Avoid using String::null where an empty string is required.
String::null is not necessarily be empty or remains the same instance.
Using it in a public header may lead to a linkage error.
2015-11-20 22:21:47 +09:00
Tsuda Kageyu
c4fe65787c Avoid using String::isNull() where it is considered to be confused with isEmpty(). 2015-11-20 20:59:13 +09:00
Tsuda Kageyu
29b0568dec Revert "Add a test about handing "COMMENT" and "DESCIPRION" fields in XiphComment."
This reverts commit 8f147034d6.
2015-11-20 14:18:40 +09:00
Tsuda Kageyu
7d0a651f3e Revert "Use always "COMMENT" field when updating XiphComment."
This reverts commit ba5137bf2d.
2015-11-20 14:18:23 +09:00
Tsuda Kageyu
224f133d65 Merge pull request #643 from TsudaKageyu/save-asf
Avoid writing duplicate tags when saving ASF files.
2015-11-20 13:52:33 +09:00
Tsuda Kageyu
f956c89141 Remove a warning from a comment and update NEWS. 2015-11-20 13:48:51 +09:00
Tsuda Kageyu
6dc8d701a8 Avoid writing duplicate tags when saving ASF files.
Reduce memory reallocations and copies when saving ASF files.
2015-11-20 13:48:25 +09:00
Tsuda Kageyu
779f904940 Update NEWS. 2015-11-20 13:35:07 +09:00
Tsuda Kageyu
4161746d89 Update NEWS. 2015-11-20 13:25:28 +09:00
Tsuda Kageyu
6d5654028a Merge pull request #642 from TsudaKageyu/strip-and-properties
Fix segfaults when calling File::properties() after strip().
2015-11-20 13:24:01 +09:00
Tsuda Kageyu
93d55dafd6 Update NEWS. 2015-11-20 10:50:21 +09:00
Tsuda Kageyu
e1e1b6c60c Merge pull request #623 from TsudaKageyu/erase-duplicate-id3v2
Skip duplicate ID3v2 tags and treat them as an extra blank of the first one.
2015-11-20 10:49:11 +09:00
Tsuda Kageyu
1cc3e4cc57 Consistent rounding when calculating the MP4 audio length. 2015-11-19 18:24:20 +09:00
Tsuda Kageyu
f310b1810d Update NEWS. 2015-11-19 17:55:18 +09:00
Tsuda Kageyu
e10684312e Efficient lookup for an ID3v2 tag in a MPEG file.
An ID3v2 tag or MPEG frame is most likely be at the beginning of the file.
2015-11-19 17:31:51 +09:00
Tsuda Kageyu
a3564d8c68 Efficient lookup for the MP4/ASF field name and ID3v1 genre tables.
Linear lookup is much faster and memory efficient when an array is very small.
2015-11-19 16:35:55 +09:00
Tsuda Kageyu
95ef0e7882 Add some tests for String::toInt() with too large values. 2015-11-19 14:52:02 +09:00
Tsuda Kageyu
13a258d9ed Backport shorter versions of some functions from taglib2. 2015-11-19 14:45:36 +09:00
Tsuda Kageyu
72a807def1 Fix a string conversion bug in tag_c.cpp. 2015-11-19 11:50:39 +09:00
Tsuda Kageyu
539d951277 Avoid using ByteVector::null where an empty vector is required.
ByteVector::null is not necessarily be empty or remains the same instance.
Using it in a public header may lead to a linkage error.
2015-11-19 10:52:46 +09:00
Tsuda Kageyu
21788f4a26 Efficient lookup for the ID3v2 frame ID table.
Linear lookup is much faster and memory efficient when an array is very small.
2015-11-19 10:07:10 +09:00
Tsuda Kageyu
74cb6f3fc7 Merge pull request #493 from TsudaKageyu/nested-refcounter
Simplify overly complicated ByteVector::mid() implementation.
2015-11-19 09:37:40 +09:00
Tsuda Kageyu
e0f1151c5c Resolve some conflicts before merging. 2015-11-19 09:27:15 +09:00
Tsuda Kageyu
10e1fcd686 Consistent notations between ByteVector::data() and at(). 2015-11-19 09:23:20 +09:00
Tsuda Kageyu
3bce77a359 Use linear search instead of the Knuth-Morris-Pratt algorithm in ByteVector::find().
In almost all cases, it handles too small data for KMP to work effectively.
2015-11-19 09:23:19 +09:00
Tsuda Kageyu
0ffd2e8ab9 Replace DATA macro with more straightforward notations. 2015-11-19 09:23:19 +09:00
Tsuda Kageyu
7e85d9b202 Simplify overly complicated ByteVector::mid() implementation.
Especially remove the useless nested RefCounters.
2015-11-19 09:23:19 +09:00
Tsuda Kageyu
c6443dabc6 Use the same type name between a List and its iterator. 2015-11-18 17:58:13 +09:00
Tsuda Kageyu
c5db39fbf4 Merge pull request #661 from ufleisch/podcast-frames
Support for Apple podcast frames
2015-11-18 17:48:14 +09:00
Tsuda Kageyu
b6469bda1a Merge pull request #628 from RyanLucchese/rl-ConstReverseIterator-solaris-bug
return const correct reverse iterator for newer Sun compiler
2015-11-18 17:23:16 +09:00
Tsuda Kageyu
978a5f0a27 Merge pull request #629 from RyanLucchese/rl-fix-class-instantiation-solstudio
check SUNPRO_CC version before using Map workaround
2015-11-18 17:22:25 +09:00
Tsuda Kageyu
8203ccf04c Merge pull request #608 from TsudaKageyu/mp4-has-tags
Add a method to check if an MP4 file on disk actually has a tag.
2015-11-18 17:14:26 +09:00
Tsuda Kageyu
47860c20f4 Make use of List iterators. 2015-11-18 17:06:49 +09:00
Tsuda Kageyu
6e6e11f21a Use List::isEmpty() rather than size() to check if the list is empty.
std::list::empty() is guaranteed to be an O(1) operation.
2015-11-18 16:57:41 +09:00
Tsuda Kageyu
288e97ad44 Make use of List iterators. 2015-11-18 16:38:30 +09:00
Tsuda Kageyu
07b26ab3e4 Make use of List iterators and setAutoDelete(). 2015-11-18 15:29:04 +09:00
Tsuda Kageyu
0f00dfc778 Add a comment to List::isEmpty(). 2015-11-18 15:14:50 +09:00
Tsuda Kageyu
b01fecd280 Separate some tests for MP4::File::hasMP4Tag(). 2015-11-18 14:25:22 +09:00
Tsuda Kageyu
69921b8090 Amend the comment on MP4::File::hasMP4Tag(). 2015-11-18 14:17:29 +09:00
Tsuda Kageyu
1caaa8a020 Reduce duplicate code between String::ctor() and operator=().
It's safer to have only one pair of ref()/deref() than to have a several pairs.
2015-11-18 14:03:45 +09:00
Tsuda Kageyu
4f3844114a Mark some variables and functions deprecated.
ByteVector::null, ByteVector::isNull(), String::null, String::isNull() have got marked deprecated.
It's dangerous to use them, and they will be removed in taglib2.
2015-11-18 10:29:25 +09:00
Tsuda Kageyu
76de4234a1 Add a test for the CRC checksum of Ogg pages. 2015-11-17 15:05:43 +09:00
Tsuda Kageyu
4bac99e3da Add some notes about ByteVector::isNull() and ByteVector::null. 2015-11-17 13:06:03 +09:00
Tsuda Kageyu
6b7a2c4cf7 Add some notes about String::isNull() and String::null. 2015-11-17 11:41:13 +09:00
Tsuda Kageyu
1a942627bf Add String::clear() method to clear the string. 2015-11-17 11:29:52 +09:00
Tsuda Kageyu
3128f425b8 vsnprintf()/vsprintf() does not necessarily return -1 when failed. 2015-11-17 11:06:19 +09:00
Tsuda Kageyu
3f968933f4 Use std::wstring::empty() rather than size() == 0.
Depending on the implementation, empty() can be more efficient than size().
2015-11-17 10:49:30 +09:00
Tsuda Kageyu
67f44071cd Fix the usage of boost::endian::endian_reverse(). 2015-11-14 14:49:59 +09:00
Tsuda Kageyu
11fbf394a3 Skip duplicate ID3v2 tags and treat them as an extra blank of the first one.
This enables all the file formats to handle duplicate ID3v2 tags properly and erase them automatically.
2015-11-13 11:55:56 +09:00
Tsuda Kageyu
a25e1e9f90 Correct the ID3v2 padding size calculation. 2015-11-13 11:44:12 +09:00
Tsuda Kageyu
091ab9dee0 Reduce memory reallocation when rendering an ID3v2 tag.
Prevent an ID3v2 padding from being ridiculously large.
2015-11-13 11:35:37 +09:00
Tsuda Kageyu
c353a71ce5 Remove an unused private data member. 2015-11-13 11:23:27 +09:00
Tsuda Kageyu
762581fe3f Add a method to check if an MP4 file on disk actually has a tag. 2015-11-13 11:14:12 +09:00
Tsuda Kageyu
8f147034d6 Add a test about handing "COMMENT" and "DESCIPRION" fields in XiphComment. 2015-11-13 11:07:50 +09:00
Tsuda Kageyu
6775cef651 Make use of the Boost Endian library for byte swapping.
It's likely to be better at choosing the most efficient method than our CMake tests.
2015-11-13 10:58:23 +09:00
Tsuda Kageyu
86c7e905ba Silence some MSVC security warnings by replacing strdup() with _strdup().
Backported from taglib2.
2015-11-13 10:06:01 +09:00
Sander Jansen
2184aa476f xiph: preserve any picture data we can't decode in the text comments 2015-11-12 08:50:34 -06:00
Sander Jansen
3e8eff16b8 another style fix 2015-11-12 08:50:34 -06:00
Sander Jansen
41a44f4ab2 Support reading deprecated COVERART xiphcomment 2015-11-12 08:50:34 -06:00
Sander Jansen
70e471f1d1 Check if saved picture can be read back correctly 2015-11-12 08:50:34 -06:00
Sander Jansen
f836cb4dea Two more spaces 2015-11-12 08:50:34 -06:00
Sander Jansen
47bd01ecda Minor style fixes 2015-11-12 08:50:34 -06:00
Sander Jansen
90ad17b4c5 Additional unit tests for base64 encoder/decoder 2015-11-12 08:50:34 -06:00
Sander Jansen
f4c1beb161 Make fromBase64 more strict and update code to follow taglib coding style 2015-11-12 08:50:34 -06:00
Sander Jansen
c963d3ba04 correctly filter out invalid base64 characters 2015-11-12 08:50:34 -06:00
Sander Jansen
c4a02a1799 remove redundant size specificier in mid usage 2015-11-12 08:50:34 -06:00
Sander Jansen
59a1b7a491 add forgotten const cast 2015-11-12 08:50:34 -06:00
Sander Jansen
62bb3c95c8 Make ByteVector::fromBase64 as static member function 2015-11-12 08:50:34 -06:00
Sander Jansen
d3351a0012 Delete pictures in XiphComment destructor 2015-11-12 08:50:34 -06:00
Sander Jansen
0c14bd0ed0 Add FLAC::Picture support to Xiph Comment 2015-11-12 08:50:34 -06:00
Sander Jansen
7bbf5a2e79 add base64 encoder/decoder to bytevector 2015-11-12 08:48:00 -06:00
Tsuda Kageyu
ba5137bf2d Use always "COMMENT" field when updating XiphComment.
The recommended field name for additional comments is "COMMENT".
It's the same behavior as "DATE" or "TRACKNUMBER" field.
2015-11-12 17:37:22 +09:00
Tsuda Kageyu
b3cea6cca7 Fix XiphComment::setComment() for the case that a Vorbis comment has the "COMMENT" field. 2015-11-12 17:16:47 +09:00
Tsuda Kageyu
a533b9c665 Hide private things from a public header.
Some functions and a variable in tstring.h are not needed to be exposed in a public header.
2015-11-12 15:36:02 +09:00
Tsuda Kageyu
ec8e611909 Fix an instance reference to a static data member. 2015-11-12 14:48:24 +09:00
Tsuda Kageyu
c66e6b27d9 Small cleanups in CMakeLists.txt. 2015-11-12 14:41:15 +09:00
Tsuda Kageyu
1d379fdb2f Small cleanups in audioproperties.cpp. 2015-11-12 14:24:04 +09:00
Tsuda Kageyu
47813c5a7f A bit more accurate calculation of the AIFF audio length.
Actually, it's unlikely to improve the accuracy, but prevents a useless round-trip conversion between double and int.
2015-11-12 14:10:09 +09:00
Tsuda Kageyu
94ff9124c7 Skip both ID3v1 and APE tags when seeking the last MPEG frame. 2015-11-12 13:52:46 +09:00
Lukáš Lalinský
9f697fce8e 1.10 2015-11-11 22:41:59 +01:00
Tsuda Kageyu
320d0f5ad7 Use List::isEmpty() than size() > 0.
Small revision of pokowaka's fix. isEmpty() is a little better than size() > 0, since std::list::empty() is guaranteed to be an O(1) operation.
2015-11-06 16:13:43 +09:00
Tsuda Kageyu
77087cf865 Merge pull request #675 from garima-g/patch-1
Add self-assignment check in operator=
2015-11-05 15:43:03 +09:00
garima-g
8b4a27beb4 Add self-assignment check in operator=
Method 'operator=' should check its argument with 'this' pointer.
2015-11-05 11:19:44 +05:30
garima-g
998ebf4ce6 Add self-assignment check in operator=
Method 'operator=' should check its argument with 'this' pointer.
2015-11-05 11:16:34 +05:30
garima-g
ccaf650214 Add self-assignment check in operator=
Method 'operator=' should check its argument with 'this' pointer.
2015-11-05 11:12:24 +05:30
garima-g
9fad0b28a5 Add self-assignment check in operator=
Method 'operator=' should check its argument with 'this' pointer.
2015-11-05 11:09:20 +05:30
Lukáš Lalinský
153820bf12 Merge pull request #669 from pokowaka/bad_access
Fixes access violation
2015-10-12 14:30:00 +02:00
Erwin Jansen
29be00dc59 Fixes access violation
- Fixes access violation when setting empty stringlist on integer
  properties in mp4 tag
- Add a unit test that validates the fix.
2015-10-09 22:11:27 -07:00
Stephen F. Booth
ab30ec3a6f Merge pull request #664 from pbhd/master
add options R, I, D for replace/insert/delete of arbitrary tags
2015-09-23 23:09:55 -04:00
Peter Bauer
0a90687805 add options R, I, D for replace/insert/delete of arbitrary tags 2015-09-23 14:11:40 +02:00
Hugo Beauzée-Luyssen
e750cb491d FileRef: Allow an IOStream to be used 2015-09-15 15:01:40 +02:00
Steve Lhomme
1f7715a5da Add support for M4V tag parsing 2015-09-15 13:15:51 +02:00
Urs Fleisch
8e7504a66f Add support for ID2v2 PCST frames (podcast). 2015-09-08 20:42:30 +02:00
Hasso Tepper
9ad5bb1d62 Support for proprietary frames Apple iTunes uses to tag podcast files. 2015-09-07 20:25:34 +02:00
Tsuda Kageyu
5ca4cd2f52 Revert "Small cleanups in audioproperties.cpp."
This reverts commit b49e3e5620.
2015-08-31 16:29:13 +09:00
Tsuda Kageyu
70f8fb1bae Revert "Add and fix some comments in ConfigureChecks.cmake."
This reverts commit fa6f33e552.
2015-08-31 16:28:24 +09:00
Tsuda Kageyu
030e177640 Revert "Small cleanups in CMakeLists.txt."
This reverts commit 021c539002.
2015-08-31 16:28:12 +09:00
Tsuda Kageyu
3bb0b11bff Revert "Fix an instance reference to a static data member."
This reverts commit 9666b64f28.
2015-08-31 16:21:26 +09:00
Tsuda Kageyu
60558d6a4a Revert "A bit more accurate calculation of the AIFF audio length."
This reverts commit 15a1505880.
2015-08-31 16:20:58 +09:00
Tsuda Kageyu
12f59d774e Revert "Hide an internal variable from a public header."
This reverts commit fbd3b71690.
2015-08-31 16:20:41 +09:00
Tsuda Kageyu
e2466a72f8 Revert "Skip both ID3v1 and APE tags when seeking the last MPEG frame."
This reverts commit 6d925da75e.
2015-08-31 16:20:15 +09:00
Tsuda Kageyu
9666b64f28 Fix an instance reference to a static data member. 2015-08-31 10:34:12 +09:00
Tsuda Kageyu
15a1505880 A bit more accurate calculation of the AIFF audio length. 2015-08-31 01:48:29 +09:00
Tsuda Kageyu
fbd3b71690 Hide an internal variable from a public header. 2015-08-30 01:01:34 +09:00
Tsuda Kageyu
6a76f491f8 Merge pull request #579 from TsudaKageyu/frameoffset2
Skip both ID3v1 and APE tags when seeking the last MPEG frame.
2015-08-29 00:09:14 +09:00
Tsuda Kageyu
6d925da75e Skip both ID3v1 and APE tags when seeking the last MPEG frame. 2015-08-28 17:04:15 +09:00
Tsuda Kageyu
e178875b40 Mention that String::toWString()/toCWString() doesn't return UTF-32 string. 2015-08-28 13:38:22 +09:00
Tsuda Kageyu
bf45cfd84a Check if QT_VERSION macro is defined. 2015-08-28 01:38:09 +09:00
Tsuda Kageyu
b49e3e5620 Small cleanups in audioproperties.cpp. 2015-08-27 11:29:40 +09:00
Tsuda Kageyu
fa6f33e552 Add and fix some comments in ConfigureChecks.cmake. 2015-08-26 15:05:34 +09:00
Tsuda Kageyu
021c539002 Small cleanups in CMakeLists.txt. 2015-08-26 08:14:31 +09:00
Lukáš Lalinský
aedfeba66b Missed the full version string in taglib-config.cmd.cmake 2015-08-25 20:46:11 +02:00
Lukáš Lalinský
29ed265281 Skip the patch version if it's 0 2015-08-25 17:04:34 +02:00
Tsuda Kageyu
b6adb1f108 Remove a private data member not needed to carry. 2015-08-25 11:03:00 +09:00
Tsuda Kageyu
c7231c58a3 Improve a test about handling duplicate tags in WAV files. 2015-08-25 11:03:00 +09:00
Tsuda Kageyu
c5cf9b93bc Fix segfaults when calling File::properties() after strip().
Backport TagUnion::properties() and TagUnion::removeUnsupportedProperties() from taglib2.
2015-08-25 11:03:00 +09:00
Tsuda Kageyu
1bb06b1f7a Add RIFF::WAV::File::strip() function.
Avoid saving an empty tag.
2015-08-25 11:03:00 +09:00
Lukáš Lalinský
35aa6c4e84 Update date in NEWS 2015-08-23 20:09:22 +02:00
Lukáš Lalinský
54cea3edc3 Reorganize NEWS to put new features first 2015-08-23 12:20:25 +02:00
Lukáš Lalinský
0178d47c85 Don't use const ref to an integer in ChapterFrame 2015-08-23 12:20:25 +02:00
Lukáš Lalinský
71bc17b5e6 Lalala 2015-08-23 12:20:25 +02:00
Tsuda Kageyu
ac38f4ade1 Remove an unused private data member. 2015-08-23 18:25:17 +09:00
Tsuda Kageyu
b9f898698d Revert "Remove some private data members not needed to carry."
This reverts commit 7c17d32b3a.
2015-08-23 18:21:51 +09:00
Tsuda Kageyu
bd564546f4 Fix some typos in comments. 2015-08-14 00:10:19 +09:00
Tsuda Kageyu
d90617959b Fix some typos in comments. 2015-08-11 09:45:32 +09:00
Tsuda Kageyu
bc106ad81e Separate two variable initializations. 2015-08-10 00:50:13 +09:00
Tsuda Kageyu
a23f808627 Remove an useless #include. 2015-08-09 13:26:51 +09:00
Tsuda Kageyu
e4cd963b12 Improve a test about splitting OGG pages.
Check for #529.
2015-08-08 15:18:16 +09:00
Tsuda Kageyu
eff92fed98 Improve a test about splitting OGG pages.
Check for #529.
2015-08-07 16:47:13 +09:00
Tsuda Kageyu
80441ff754 Remove a workaround for an older version of GCC.
GLIBC's byte swap functions are a good fallback option.
2015-08-07 08:59:16 +09:00
Festus Hagen
35d5ba4eff Add BUILD_BINDINGS option, moved if(BUILD_EXAMPLES) to taglib/CMakeLists, plus some cleanup. 2015-08-06 17:26:37 -04:00
Tsuda Kageyu
edbafdbd88 Remove some redundant code from trefcounter.cpp. 2015-08-07 02:10:56 +09:00
Tsuda Kageyu
98ac8ba569 Add a comment about unused constants. 2015-08-07 02:03:03 +09:00
Tsuda Kageyu
173c58cf49 Merge pull request #580 from TsudaKageyu/negative-seek
Fix inconsistent negative seek behavior between Linux and Windows.
2015-08-07 01:32:26 +09:00
Tsuda Kageyu
ec3d050adc Merge pull request #644 from petrows/master
Install target should be checked to avoid conflicts
2015-08-07 01:20:03 +09:00
Tsuda Kageyu
19a7e45997 Merge pull request #639 from TsudaKageyu/remove-cmake-check-float
Run-time check for byte order rather than CMake check.
2015-08-07 01:17:27 +09:00
Tsuda Kageyu
49563a9cd0 Merge pull request #640 from TsudaKageyu/cmake-vsprintf
CMake check for vsprintf_s/vsnprintf rather than sprintf_s/snprintf.
2015-08-07 01:14:12 +09:00
Tsuda Kageyu
1abe61640a Merge pull request #645 from FestusHagen/fh1.m_UintAmbiguities_WavePackProperties
Silence uint ambiguity error in wavepackproperties.
2015-08-06 16:35:45 +09:00
Festus Hagen
65a6572299 Silence uint ambiguity errors in wavepackproperties. 2015-08-06 03:22:03 -04:00
Peter Petrovich
46e74c9391 Install target check fix 2015-08-05 08:45:27 +03:00
Tsuda Kageyu
7c17d32b3a Remove some private data members not needed to carry. 2015-08-05 11:54:30 +09:00
Tsuda Kageyu
bfe4ec5df5 Update NEWS.
Added support for reading the encoder information of WMA files.
Added support for reading the codec of WAV files.
Added support for multi channel WavPack files.
Added support for reading the nominal bitrate of Ogg Speex files.
Added support for VBR headers in MPEG files.
2015-08-05 02:58:45 +09:00
Tsuda Kageyu
81b7d0046e Merge branch 'master' of https://github.com/TsudaKageyu/taglib 2015-08-04 23:34:01 +09:00
Tsuda Kageyu
5990c72a01 Fix a typo in NEWS. 2015-08-04 23:27:28 +09:00
Tsuda Kageyu
018e969026 Add warnings about calling File::save() repeatedly. 2015-08-04 15:47:18 +09:00
Tsuda Kageyu
04ec7eae25 Add some supplementary comments. 2015-08-03 22:31:16 +09:00
Tsuda Kageyu
b6e7bb2c84 Update version to 1.10.0. 2015-08-03 16:14:48 +09:00
Tsuda Kageyu
f112d538ea Merge pull request #612 from TsudaKageyu/flac-id3v1
Avoid overwriting the audio stream when adding an ID3v1 tag to a FLAC…
2015-08-03 15:54:16 +09:00
Tsuda Kageyu
ac5ef0291c Update NEWS.
Fixed possible file corruptions when adding an ID3v1 tag to FLAC files.
2015-08-03 15:51:50 +09:00
Tsuda Kageyu
8fa86162c7 Add a test to check if the FLAC audio stream remains intact after adding an ID3v1 tag. 2015-08-03 15:40:30 +09:00
Tsuda Kageyu
fa17b4da6b Avoid overwriting the audio stream when adding an ID3v1 tag to a FLAC file. 2015-08-03 15:39:27 +09:00
Tsuda Kageyu
076e845912 Run-time check for integer byte order rather than CMake check.
It will easily be optimized out.
2015-08-03 13:08:58 +09:00
Tsuda Kageyu
f830177b3b Correct the order of #includes in tests. 2015-08-03 11:41:55 +09:00
Tsuda Kageyu
0650dc77a1 Fix some comments. 2015-08-02 03:24:25 +09:00
Tsuda Kageyu
c0f537a155 Merge pull request #581 from FestusHagen/fh2.m_FixUintAmbiguitiesInTests
Silence uint ambiguity errors in tests.
2015-08-02 02:40:20 +09:00
Tsuda Kageyu
44d9f2bf25 Run-time check for floating point byte order rather than CMake check.
It's safer not to use an unofficial CMake script.
2015-08-01 23:40:23 +09:00
Tsuda Kageyu
89e6ad96a4 Check for vsnprintf first. 2015-08-01 23:38:50 +09:00
Tsuda Kageyu
aa1dd0278d CMake check for vsprintf_s/vsnprintf rather than sprintf_s/snprintf. 2015-08-01 23:38:50 +09:00
Tsuda Kageyu
13dab99af0 Remove unused includes from ConfigureChecks.cmake. 2015-08-01 23:34:36 +09:00
Tsuda Kageyu
03ec83ecca Add AudioProperties::lengthInSeconds() and lengthInMilliseconds() functions to emulate virtual abstract functions. 2015-08-01 02:23:18 +09:00
Tsuda Kageyu
ce02910c6b Update NEWS.
Marked FLAC::File::streamInfoData() deprecated. It returns an empty ByteVector.
Marked FLAC::File::streamLength() deprecated. It returns zero.
2015-08-01 02:06:35 +09:00
Tsuda Kageyu
f25e30d33f Revert "Reorder CMake checks for sprintf() variants."
This reverts commit c69364d831.
2015-08-01 01:59:36 +09:00
Tsuda Kageyu
4dcccfbd6a Update NEWS.
New API for the audio length in milliseconds.
2015-08-01 01:46:35 +09:00
Tsuda Kageyu
7ca1b0c4d3 Merge pull request #575 from TsudaKageyu/chunk-offset
Stop calculating the offset in RIFF::File::chunkData().
2015-08-01 01:31:17 +09:00
Tsuda Kageyu
11f4e4e1ca Merge pull request #567 from TsudaKageyu/audioprop-wv
(wishlist) WavPack: AudioProperties improvements
2015-08-01 01:30:19 +09:00
Tsuda Kageyu
9759bd2dd7 Merge pull request #566 from TsudaKageyu/audioprop-tta
(wishlist) TrueAudio: AudioProperties improvements
2015-08-01 01:30:12 +09:00
Tsuda Kageyu
b28784538a Merge pull request #565 from TsudaKageyu/audioprop-wav
(wishlist) WAV: AudioProperties improvements
2015-08-01 01:30:03 +09:00
Tsuda Kageyu
fdea096c8d Merge pull request #564 from TsudaKageyu/audioprop-aiff
(wishlist) AIFF: AudioProperties improvements
2015-08-01 01:29:46 +09:00
Tsuda Kageyu
a9d030544a Merge pull request #563 from TsudaKageyu/audioprop-vorbis
(wishlist) Ogg Vorbis: AudioProperties improvements
2015-08-01 01:29:35 +09:00
Tsuda Kageyu
8344c4d7f8 Merge pull request #562 from TsudaKageyu/audioprop-speex
(wishlist) Ogg Speex: AudioProperties improvements
2015-08-01 01:29:22 +09:00
Tsuda Kageyu
8b1e872f81 Merge pull request #561 from TsudaKageyu/audioprop-opus
(wishlist) Ogg Opus: AudioProperties improvements
2015-08-01 01:29:13 +09:00
Tsuda Kageyu
6a778751ee Merge pull request #560 from TsudaKageyu/audioprop-mpeg
(wishlist) MPEG: AudioProperties improvements
2015-08-01 01:29:06 +09:00
Tsuda Kageyu
4328a830f9 Merge pull request #559 from TsudaKageyu/audioprop-mpc
(wishlist) MusePak: AudioProperties improvements
2015-08-01 01:27:20 +09:00
Tsuda Kageyu
ae99cbe64e Merge pull request #558 from TsudaKageyu/audioprop-mp4
(wishlist) MP4: AudioProperties improvements
2015-08-01 01:27:15 +09:00
Tsuda Kageyu
692ce897cb Merge pull request #557 from TsudaKageyu/audioprop-flac
(wishlist) FLAC: AudioProperties improvements
2015-08-01 01:27:06 +09:00
Tsuda Kageyu
0ed1c29acc Merge pull request #556 from TsudaKageyu/audioprop-asf
(wishlist) ASF: AudioProperties improvements
2015-08-01 01:26:52 +09:00
Tsuda Kageyu
3c59b7858a Merge pull request #555 from TsudaKageyu/audioprop-ape
(wishlist) APE: AudioProperties improvements
2015-08-01 01:21:59 +09:00
Tsuda Kageyu
2c9f63d9b0 Merge pull request #568 from TsudaKageyu/audioprop-mod
(wishlist) MOD: AudioProperties improvements
2015-08-01 01:04:34 +09:00
Tsuda Kageyu
0b43b7136d FLAC: Remove unused formal parameters. 2015-08-01 00:49:25 +09:00
Tsuda Kageyu
1e752a1e8f FLAC: Add debug messages to tell some functions are obsolete. 2015-08-01 00:49:23 +09:00
Tsuda Kageyu
29a31859ff FLAC: Move some public functions to above private ones. 2015-08-01 00:49:22 +09:00
Tsuda Kageyu
0b01461d50 FLAC: Avoid using deprecated functions. 2015-08-01 00:49:22 +09:00
Tsuda Kageyu
a77abedf63 Remove some more data members not needed to carry. 2015-08-01 00:49:22 +09:00
Tsuda Kageyu
21412e2ba2 FLAC: AudioProperties improvements
Add lengthInSeconds(), lengthInMilliseconds() properties. (#503)
Add bitsPerSample() property besides sampleWidth(). (#360)
Remove some data members which are not needed to carry.
Add some tests for audio properties.
Add some supplementary comments.
2015-08-01 00:49:21 +09:00
Tsuda Kageyu
dbf9644c8d WavPack: Remove unused formal parameters. 2015-08-01 00:44:41 +09:00
Tsuda Kageyu
592e14f950 TrueAudio: Remove unused formal parameters. 2015-08-01 00:41:42 +09:00
Tsuda Kageyu
1fb3727c4c WAV: Remove unused formal parameters. 2015-08-01 00:37:31 +09:00
Tsuda Kageyu
0501fbdd72 AIFF: Remove unused formal parameters. 2015-08-01 00:33:56 +09:00
Tsuda Kageyu
5235abc498 Vorbis: Remove unused formal parameters. 2015-08-01 00:30:13 +09:00
Tsuda Kageyu
d944009904 Speex: Remove unused formal parameters. 2015-08-01 00:22:09 +09:00
Tsuda Kageyu
f729f863cd Opus: Remove unused formal parameters. 2015-08-01 00:19:20 +09:00
Tsuda Kageyu
c715ec09e4 MPEG: Hide an internal function from the public header. 2015-08-01 00:15:51 +09:00
Tsuda Kageyu
4f621140ce MPEG: Remove unused formal parameters. 2015-08-01 00:09:59 +09:00
Tsuda Kageyu
bd251aed37 MusePak: Remove unused formal parameters. 2015-08-01 00:04:27 +09:00
Tsuda Kageyu
34ab65aa57 MP4: Hide an internal function from the public header. 2015-07-31 23:59:22 +09:00
Tsuda Kageyu
7f0c547ba6 MP4: Remove unused formal parameters. 2015-07-31 23:55:30 +09:00
Tsuda Kageyu
0ff38ed52b ASF: Remove unused formal parameters. 2015-07-31 23:39:58 +09:00
Tsuda Kageyu
2b1116cec1 APE: Remove unused formal parameters. 2015-07-31 23:18:50 +09:00
Tsuda Kageyu
88947e7a48 Silence some MSVC specific warnings in tests. 2015-07-31 20:55:23 +09:00
Tsuda Kageyu
5ad69a81dc Silence some MSVC2015 specific warnings. 2015-07-31 12:23:01 +09:00
Tsuda Kageyu
c9963af848 MP4 atom length is limited up to 31 bits.
32-bit value will be negative.
2015-07-31 11:24:36 +09:00
Tsuda Kageyu
f38e32163e Add some comments to tutils.h. 2015-07-31 10:27:16 +09:00
Tsuda Kageyu
c69364d831 Reorder CMake checks for sprintf() variants.
VS2015 has snprintf(), however sprintf_s() is still recommended.
2015-07-31 10:11:01 +09:00
Tsuda Kageyu
3142330bee Remove sudo from .travis.yml.
This allows our tests to run faster on the container-based infrastructure.
2015-07-31 09:06:24 +09:00
Tsuda Kageyu
9b849c5da8 Merge pull request #554 from FestusHagen/fh1.m_FriendlyCppUnitSearch
Don't look for CppUnit unless BUILD_TESTS, general cleanup.
2015-07-30 23:55:16 +09:00
Tsuda Kageyu
a197f45ca8 Merge pull request #595 from TsudaKageyu/gcc-warning-test
Silence a GCC warning about ignoring a return value in test.
2015-07-30 23:39:04 +09:00
Tsuda Kageyu
6dcecf0e71 Fix a typo in a debug message. 2015-07-30 23:36:44 +09:00
Tsuda Kageyu
47800d1000 Merge pull request #625 from TsudaKageyu/checksum-comment
(minor, comment only) Add a supplementary comment to ByteVector::checksum().
2015-07-30 23:30:43 +09:00
Tsuda Kageyu
cc8c3cd1fd Merge pull request #617 from TsudaKageyu/useless-call
Remove an useless function call.
2015-07-30 23:30:18 +09:00
Tsuda Kageyu
58994e330e Update NEWS.
Fixed reading FLAC files with zero-sized padding blocks.
2015-07-30 22:03:02 +09:00
Tsuda Kageyu
572afd437d Merge pull request #638 from TsudaKageyu/update-news
Update NEWS.
2015-07-30 22:00:00 +09:00
Tsuda Kageyu
1eef4177e7 Merge pull request #637 from TsudaKageyu/flac-zero-sized-padding
Make FLAC::File tolerant to zero-sized padding blocks.
2015-07-30 21:58:42 +09:00
Tsuda Kageyu
64fac517ed Update NEWS. 2015-07-30 10:03:47 +09:00
Tsuda Kageyu
f79c766ba4 Avoid creating zero-sized padding blocks. 2015-07-29 23:05:17 +09:00
Tsuda Kageyu
6f944b0291 Make FLAC::File tolerant to zero-sized padding blocks. 2015-07-29 20:52:56 +09:00
Ryan Lucchese
04bee3faec added comments explaining ByteVector::rbegin() const and ByteVector::rend() const 2015-07-06 16:25:57 -06:00
Ryan Lucchese
e8c1a11730 better const correctness for ByteVector::rbegin() const and ByteVector::rend() const 2015-07-01 15:47:21 -06:00
Ryan Lucchese
d8e8ec69fe changed SUNPRO_CC version check to first check if SUNPRO_CC is defined 2015-06-30 13:41:09 -06:00
Ryan Lucchese
6d0712c8df changed SUNPRO_CC version check to first check if SUNPRO_CC is defined 2015-06-30 13:23:25 -06:00
Ryan Lucchese
00b2f6a386 check SUNPRO_CC version before defining WANT_CLASS_INSTANTIATION_OF_MAP in apetag.cpp - causes problems on newer Solaris Studio compiler 2015-06-30 12:50:03 -06:00
Ryan Lucchese
a3dccdc7a3 added sun compiler version check before changing constness of ConstReverseIterator in ByteVector 2015-06-30 12:46:25 -06:00
Ryan Lucchese
b698c73690 return const correct reverse iterator to prevent Solaris compiler from choking on const conversion 2015-06-30 12:18:12 -06:00
Tsuda Kageyu
801c9db810 WAV: Avoid using a magic number. 2015-06-30 15:59:01 +09:00
Tsuda Kageyu
409b135dd5 MPEG: Fix warnings about signed/unsigned mismatch on some compilers. 2015-06-30 11:58:07 +09:00
Tsuda Kageyu
4dd14d4d73 Add a supplementary comment to ByteVector::checksum(). 2015-06-27 01:29:16 +09:00
Tsuda Kageyu
44e6419644 ASF: Hide some internal functions from the public header. 2015-06-23 18:22:31 +09:00
Tsuda Kageyu
467658e463 ASF: Make use of List iterators and setAutoDelete(). 2015-06-23 17:43:50 +09:00
Tsuda Kageyu
3fcb21642c ASF: Hide internal class declarations from the public header. 2015-06-23 17:34:33 +09:00
Tsuda Kageyu
472ce9f42c ASF: Use CodecType enum instead of a magic number. 2015-06-23 11:48:25 +09:00
Tsuda Kageyu
be33340383 Remove an useless function call. 2015-06-22 09:54:17 +09:00
Tsuda Kageyu
91ed3548f1 ASF: Enable ASF::Properties to get the audio codec information. 2015-06-21 02:42:47 +09:00
Tsuda Kageyu
b56f4c4372 APE: Reduce useless File::Find() operations. 2015-06-20 20:41:02 +09:00
Tsuda Kageyu
2155b4fd50 TrueAudio: A bit more accurate calculation of the stream length. 2015-06-20 17:36:00 +09:00
Tsuda Kageyu
e605e96835 MusePak: Avoid seeking a file when not needed. 2015-06-20 17:30:25 +09:00
Tsuda Kageyu
dfee7020da APE: Find an ID3v2 tag and calculate the stream length in APE::File. 2015-06-20 04:34:34 +09:00
Scott Wheeler
e90b5e5f2f Merge pull request #614 from TsudaKageyu/win32-pkg-config
Enable pkg-config on Windows.
2015-06-19 09:12:32 +02:00
Tsuda Kageyu
642baca4ed Fix inconsistent negative seek behavior between Linux and Windows. 2015-06-19 02:42:18 +09:00
Tsuda Kageyu
da01fa5745 Enable pkg-config on Windows. 2015-06-19 01:26:12 +09:00
Tsuda Kageyu
78c70cf5bb MOD: AudioProperties improvements
Add lengthInSeconds(), lengthInMilliseconds() properties. (always return 0)
2015-06-18 18:03:53 +09:00
Tsuda Kageyu
8f6af3f020 WavPack: A bit more accurate calculation of the stream length. 2015-06-18 18:00:03 +09:00
Tsuda Kageyu
22f250eaa4 WavPack: AudioProperties improvements
Add lengthInSeconds(), lengthInMilliseconds() properties. (#503)
Add isLossless() property.
Support multi channel. (#92)
Remove some data members which are not needed to carry.
Add some tests for audio properties.
Add some supplementary comments.
2015-06-18 17:59:06 +09:00
Tsuda Kageyu
eb73612a2b TrueAudio: AudioProperties improvements
Add lengthInSeconds(), lengthInMilliseconds() properties. (#503)
Avoid possible arithmetic overflows. (#520)
Remove some data members which are not needed to carry.
Add some tests for audio properties.
Add some supplementary comments.
2015-06-18 17:52:36 +09:00
Tsuda Kageyu
9c8e36d3be WAV: Move property parsing code to Properties.
Make use of 'fact' chunk to get the number of total samples.
2015-06-18 17:47:39 +09:00
Tsuda Kageyu
ed25204d75 WAV: AudioProperties improvements
Add lengthInSeconds(), lengthInMilliseconds() properties. (#503)
Add bitsPerSample() property besides sampleWidth(). (#360)
Add format() property. (#360)
Add some tests for audio properties.
Add some supplementary comments.
2015-06-18 17:43:09 +09:00
Tsuda Kageyu
03fd0a3ead AIFF: Calculate the actual average bitrate even if a file is compressed.
Move property parsing code to Properties.
2015-06-18 17:38:41 +09:00
Tsuda Kageyu
aede4ac851 AIFF: AudioProperties improvements
Add lengthInSeconds(), lengthInMilliseconds() properties. (#503)
Add bitsPerSample() property besides sampleWidth(). (#360)
Add some tests for audio properties.
Add some supplementary comments.
2015-06-18 17:30:58 +09:00
Tsuda Kageyu
3823afcc87 Ogg Vorbis: AudioProperties improvements
Add lengthInSeconds(), lengthInMilliseconds() properties. (#503)
Remove some data members which are not needed to carry.
Add some tests for audio properties.
Add some supplementary comments.
2015-06-18 17:24:31 +09:00
Tsuda Kageyu
4dba88fa31 Ogg Speex: AudioProperties improvements
Add lengthInSeconds(), lengthInMilliseconds() properties. (#503)
Add bitrateNominal() property.
Remove some data members which are not needed to carry.
Add some tests for audio properties.
Add some supplementary comments.
2015-06-18 17:23:03 +09:00
Tsuda Kageyu
f3d8100c7b Ogg Opus: AudioProperties improvements
Add lengthInSeconds(), lengthInMilliseconds() properties. (#503)
Remove some data members which are not needed to carry.
Add some tests for audio properties.
Add some supplementary comments.
2015-06-18 17:19:23 +09:00
Tsuda Kageyu
b2c79bc084 MPEG: No need to get the length of an ID3v2 tag twice. 2015-06-18 17:14:12 +09:00
Tsuda Kageyu
f82be353b4 MPEG: Properties::xingHeader() should return null if a VBR header is not found. 2015-06-18 17:14:12 +09:00
Tsuda Kageyu
9ec6d28239 MPEG: AudioProperties improvements
Add lengthInSeconds(), lengthInMilliseconds() properties. (#503)
Support VBRI header in addition to Xing. (#136)
Fix MPEG frame seeker functions. (maybe #190)
Calculate MPEG frame length accurately.
Remove some data members which are not needed to carry.
Add some tests for audio properties.
Add some supplementary comments.
2015-06-18 17:14:04 +09:00
Tsuda Kageyu
3a1c784eec MusePak: A bit more accurate calculation of the stream length. 2015-06-18 17:05:58 +09:00
Tsuda Kageyu
4a014c8113 MusePak: AudioProperties improvements
Add lengthInSeconds(), lengthInMilliseconds() properties. (#503)
Remove some data members which are not needed to carry.
Add some tests for audio properties.
Add some supplementary comments.
2015-06-18 17:05:58 +09:00
Tsuda Kageyu
5d77553759 MP4: Remove useless ByteVector::mid() operations. 2015-06-18 17:00:10 +09:00
Tsuda Kageyu
da14f67e2c MP4: Do rounding when calculating the bit rate. 2015-06-18 17:00:10 +09:00
Tsuda Kageyu
9226fa76b3 MP4: AudioProperties improvements
Add lengthInSeconds(), lengthInMilliseconds() properties. (#503)
Add some tests for audio properties.
Add some supplementary comments.
Move parsing code to read() for consistency with other classes.
2015-06-18 17:00:10 +09:00
Tsuda Kageyu
ff36648e92 ASF: AudioProperties improvements
Add lengthInSeconds(), lengthInMilliseconds() properties. (#503)
Add bitsPerSample() property. (#360)
Add some tests for audio properties.
Add some supplementary comments.
2015-06-18 16:33:56 +09:00
Scott Wheeler
447a4739c5 Merge pull request #611 from TsudaKageyu/fix-bufsize
Fix mismatched file I/O buffer sizes.
2015-06-18 08:22:59 +02:00
Tsuda Kageyu
f15fe869a5 Add a test for APE files with an ID3v2 tag. 2015-06-18 14:41:37 +09:00
Tsuda Kageyu
125d887b85 APE: Use the audio stream length in calculating the bit rate. 2015-06-18 14:41:37 +09:00
Tsuda Kageyu
9a8e41b9d6 APE: AudioProperties improvements
Add lengthInSeconds(), lengthInMilliseconds() properties. (#503)
Enable to read bit depth from older version files. (#360)
Remove some data members which are not needed to carry.
Add some tests for audio properties.
Add some supplementary comments.
2015-06-18 14:41:37 +09:00
Tsuda Kageyu
68ef160dbc Fix mismatched file I/O buffer sizes. 2015-06-18 11:23:31 +09:00
Scott Wheeler
6d71bdf8b7 Merge pull request #607 from TsudaKageyu/unused-function
Remove some unused private function prototypes.
2015-06-15 21:15:08 +02:00
Tsuda Kageyu
b37eaace15 Removed an unused data member from MPE::File.
It seems to be related to scan().
2015-06-12 14:07:52 +09:00
Tsuda Kageyu
c1c70edb76 Remove some unused private function prototypes. 2015-06-12 11:50:38 +09:00
Tsuda Kageyu
75159d5d8a Silence a GCC warning about ignoring a return value in test. 2015-06-10 03:44:30 +09:00
Stephen F. Booth
46862bf537 Merge pull request #594 from TsudaKageyu/typos-in-comment
Fix some typos in comments.
2015-06-08 22:19:27 -04:00
Tsuda Kageyu
2b260fd2e8 Fix some typos in comments. 2015-06-09 10:33:32 +09:00
Scott Wheeler
b1a35a8b31 Add const to docs 2015-06-03 01:21:12 +02:00
Stephen F. Booth
88ef556d4e Merge pull request #591 from TsudaKageyu/wmemcpy
Use wmemcpy() rather than memcpy() and sizeof(wchar_t).
2015-06-02 08:19:33 -04:00
Samuel Martin
00c6e7ea79 cmake: use BUILD_SHARED_LIBS instead of ENABLE_STATIC to drive the shared object build
In case ENABLE_STATIC is still set on the CMake command line, this
change will makes CMake bail out becaus e this option is no longer
supported.

This patch makes taglib more compliant with the distro package framework
that uses the standards CMake options.

Signed-off-by: Samuel Martin <s.martin49@gmail.com>
2015-06-01 19:27:05 +02:00
Tsuda Kageyu
0c0f123a08 Use wmemcpy() rather than memcpy() and sizeof(wchar_t). 2015-06-01 13:52:55 +09:00
Festus Hagen
48311cca14 Undo comment stacking. 2015-05-31 22:12:18 -04:00
Michael Helmling
db90f4b358 Prefix #ifndef with TAGLIB_ in tpropertymap.h 2015-05-29 19:53:42 +02:00
Festus Hagen
b5d65edab7 Silence uint ambiguity errors in tests. 2015-05-27 14:07:53 -04:00
Scott Wheeler
a06d55ae6f Merge pull request #577 from TsudaKageyu/frameoffset
Fix MPEG::File::firstFrameOffset() and lastFrameOffset(). (#190)
2015-05-26 17:53:24 +02:00
Stephen F. Booth
c5f2e9342d Merge pull request #578 from TsudaKageyu/test-temp
A lot of zero-sized temporary files are left after a test session on …
2015-05-25 08:41:37 -04:00
Tsuda Kageyu
2d778d5a0a A lot of zero-sized temporary files are left after a test session on Windows. 2015-05-25 15:51:19 +09:00
Stephen F. Booth
0aa75b2e8d Merge pull request #574 from TsudaKageyu/skip-dup-chunks
Skip duplicate chunks when reading AIFF/WAV files.
2015-05-24 14:38:50 -04:00
Tsuda Kageyu
618a939c56 Fix MPEG::File::firstFrameOffset() and lastFrameOffset(). (#190) 2015-05-25 02:41:27 +09:00
Tsuda Kageyu
2337fbcfc6 Stop calculating the offset in RIFF::File::chunkData(). 2015-05-25 00:43:36 +09:00
Tsuda Kageyu
9da20a8a52 Skip duplicate chunks when reading AIFF/WAV files.
Similar to #492.
There is no good reason to use the last chunk rather than the first one.
2015-05-25 00:40:13 +09:00
Stephen F. Booth
4129b919c1 Merge pull request #572 from TsudaKageyu/map-erase2
Map::erase() can take a key directly so no need to call find() before…
2015-05-23 08:21:58 -04:00
Tsuda Kageyu
6d6f544010 Map::erase() can take a key directly so no need to call find() beforehand. 2015-05-23 18:12:01 +09:00
Stephen F. Booth
93da3ba6d9 Merge pull request #571 from TsudaKageyu/fuzzed-wv
Avoid an infinite loop when reading fuzzed WavPack files. (#482)
2015-05-22 07:44:41 -04:00
Stephen F. Booth
e064b88049 Merge pull request #570 from TsudaKageyu/audioprop-typo
Fix a typo in comment.
2015-05-22 07:41:46 -04:00
Tsuda Kageyu
3094540a4b Avoid an infinite loop when reading fuzzed WavPack files. (#482) 2015-05-22 14:15:10 +09:00
Tsuda Kageyu
8e21dcc3d4 Fix a typo in comment. 2015-05-22 12:06:01 +09:00
Stephen F. Booth
0ea22348cb Merge pull request #569 from TsudaKageyu/map-erase
std::map::erase() can take a key directly and has no-throw guarantee.
2015-05-21 22:46:15 -04:00
Stephen F. Booth
48ca54de1f Merge pull request #484 from TsudaKageyu/fix-rfind
Fix File::rfind() for small files.
2015-05-21 22:44:10 -04:00
Tsuda Kageyu
54de66f275 std::map::erase() can take a key directly and has no-throw guarantee. 2015-05-22 01:26:56 +09:00
Lukáš Lalinský
d4b0ba2a7a TagLib::XM::Properties is a public class that should be exported 2015-05-20 15:18:01 -07:00
Festus Hagen
abc5743222 Removed missed unnecessary BUILD_TESTS check. 2015-05-20 15:34:05 -04:00
Scott Wheeler
525396d9c2 Merge pull request #550 from TsudaKageyu/fix-test
Fix test code to work on some environments.
2015-05-20 19:24:52 +02:00
Tsuda Kageyu
bb9679b51a Fix test code to work on some environments.
const char * is more preferable than string for ifstream constructor.
2015-05-21 02:03:06 +09:00
Festus Hagen
e44cba56b5 Don't look for CppUnit unless BUILD_TESTS, general cleanup. 2015-05-20 11:11:55 -04:00
Scott Wheeler
e4cf012522 Bring the API more in line with the rest of TagLib
Like in #255, this also makes it possible to read values from the
tag in a const function.
2015-05-20 14:26:53 +02:00
Scott Wheeler
a37d423ea8 Merge pull request #549 from TsudaKageyu/win32-test
Modify the test code to work on MSVC/Windows.
2015-05-20 13:50:49 +02:00
Tsuda Kageyu
88a4cf34b8 Modify the test code to work on MSVC/Windows. 2015-05-20 20:19:20 +09:00
Scott Wheeler
81261dd128 This should also work Windows and has less duplicated code 2015-05-20 11:53:32 +02:00
Scott Wheeler
3bea9f6bee Don't use tempnam on UNIX
This silences the huge stream of warnings when building the tests.

I think I didn't break the Windows version in the process (though
it may make sense to use the built in Windows functions there
instead), but I don't have a Windows build environment here, so
I can't test.
2015-05-20 11:45:32 +02:00
Scott Wheeler
9cc2d7cfee Merge pull request #546 from TsudaKageyu/test-surrogate-pair
Add a test for strings that contains surrogate pairs.
2015-05-19 19:57:47 +02:00
Scott Wheeler
fe1bf015bb Merge pull request #548 from TsudaKageyu/render-twice
No need to call ID3v2::Frame::render() twice when saving an ID3v2 tag.
2015-05-19 11:28:50 +02:00
Tsuda Kageyu
287078566f No need to call ID3v2::Frame::render() twice when saving an ID3v2 tag. 2015-05-19 17:39:37 +09:00
Scott Wheeler
60966518e2 Quote path names including user-provided variables
This should make these work even if the value contains spaces

Closes #344
2015-05-19 10:15:15 +02:00
Tsuda Kageyu
2268efb49e Add a test for strings that contains surrogate pairs. 2015-05-19 09:01:47 +09:00
Scott Wheeler
29f535dc8d Remove *file argument to private members
This is already covered by d->file, so there's no reason to pass a pointer
to the member dozens of times.
2015-05-18 23:11:51 +02:00
Scott Wheeler
592522d34c Moar const fixes 2015-05-18 23:00:16 +02:00
Scott Wheeler
6b9e4e4403 1001 Const fixes (plus iterator rename) 2015-05-18 22:48:55 +02:00
Scott Wheeler
089e44f3db Remove unnecessary checks for null before delete
Closes #343
2015-05-18 21:40:21 +02:00
Scott Wheeler
bd3c4dc1b2 Merge pull request #515 from TsudaKageyu/empty-id3v2-frame
Skip empty ID3v2 frames when saving an ID3v2 tag.
2015-05-18 21:36:37 +02:00
Scott Wheeler
bba562b557 Add accessors to manipulate MP4 tags without modifying the internal structure
This brings the MP4 API in line closer to other tag formats and makes it
possible to access the tag data from const functions.

"ItemListMap" has been renamed to "ItemMap" (with the old version
deprecated).  It seems that the "ListMap" notion was copied probably
from Allan's ApeTag implementation, which incorrectly copied the term
from the XiphTag.  Notably, in XiphTag, because a field can have multiple
values, the "ListMap" is a map of lists.  Calling things a "ListMap" where
there can be only one value doesn't fit.

Closes #255
2015-05-18 21:18:33 +02:00
Scott Wheeler
451d23ca37 Add isEmpty() to MP4
Closes #457
2015-05-18 20:30:19 +02:00
Scott Wheeler
d248f77ab9 Show something useful for ChapterFrame::toString()
Closes #517
2015-05-18 19:51:18 +02:00
Tsuda Kageyu
727a11573a Fix File::rfind() for small files to work just like ByteVector::rfind(). 2015-05-19 01:24:37 +09:00
Scott Wheeler
34da0c0dab Update signature and docs
Specifically this allows the frame to be constructed and then to have
the children and embedded frames set later.
2015-05-18 18:19:43 +02:00
Scott Wheeler
7316cd331d Remove the null termination stuff from the ToC frames too 2015-05-18 18:17:10 +02:00
Scott Wheeler
3a977c55c4 We've moved away from including the null byte in the returned value
This does change previous behavior, but the previous behavior was
particularly stupid and inconsistent with everything else in TagLib.

It should be possible to mitigate this by putting the same safety
guards in the TableOfContents
2015-05-18 17:29:52 +02:00
Scott Wheeler
a094ce7dd2 Don't underflow if there are no embedded frames
Closes #513
2015-05-18 17:11:18 +02:00
Scott Wheeler
941efcba18 This isn't tracked as part of the elementID anymore 2015-05-18 16:53:12 +02:00
Scott Wheeler
ffb543acbb Split chapter data and embedded frame data
This will allow us to test parsing them separately
2015-05-18 16:45:57 +02:00
Scott Wheeler
fc24b3d22b Don't require users to include a padding byte explicitly
This makes it where the natural construction can be used of something
like:

new ChapterFrame("ID", ... )

Closes #514
2015-05-18 16:41:30 +02:00
Scott Wheeler
a9e064c58e Also test second constructor 2015-05-18 16:30:37 +02:00
Scott Wheeler
1a5d89d29e Update signature and docs to be more in-line with TagLib's style 2015-05-18 16:00:47 +02:00
Scott Wheeler
650b581f9e Merge pull request #544 from TsudaKageyu/advance
Use std::advance rather than a loop and increment.
2015-05-18 15:09:28 +02:00
Scott Wheeler
0739dd232a It doesn't make sense to set the factory after construction
Closes #259
2015-05-18 14:21:55 +02:00
Scott Wheeler
41a250a15d Make this macro work with current Qt versions
Closes #499
2015-05-18 12:42:24 +02:00
Tsuda Kageyu
8da0013482 Add a test to check if an empty ID3v2 frame is really skipped. 2015-05-18 19:03:20 +09:00
Scott Wheeler
0288059495 Add astylerc 2015-05-18 11:31:55 +02:00
Tsuda Kageyu
6e40361c0e Use std::advance rather than a loop and increment. 2015-05-18 09:31:43 +09:00
Lukáš Lalinský
c2570fe115 Merge pull request #521 from TsudaKageyu/gcc-warning
Fix a GCC/Clang warning about singed/unsigned comparison.
2015-05-17 10:06:10 -07:00
Lukáš Lalinský
bd91da55ba Merge pull request #542 from TsudaKageyu/comment-typos
Fix some typos in comment.
2015-05-17 10:05:43 -07:00
Tsuda Kageyu
3a3a6a6fda Fix some typos in comment. 2015-05-18 00:31:46 +09:00
Lukáš Lalinský
64c43b0d3f Merge pull request #535 from FestusHagen/fh1.m_UintAmbiguity
Silenced uint ambiguity error.
2015-05-16 17:03:53 -07:00
Lukáš Lalinský
db2dfa9515 Merge pull request #538 from gogglesmm/optimize-mid-to-uint
bytevector.mid(pos,4).toUInt() => bytevector.toUInt(pos)
2015-05-15 20:06:24 -07:00
Lukáš Lalinský
0069debf0c Merge pull request #536 from FestusHagen/fh1.m_CMakeSubProjectFix
Fix for using Taglib as a CMake sub directory project.
2015-05-15 19:48:43 -07:00
Lukáš Lalinský
69563d83a0 Merge pull request #533 from TsudaKageyu/bytevector-resize
Fix the wrong padding of ByteVector::resize().
2015-05-15 19:43:38 -07:00
Sander Jansen
60775306ea Fix code styling 2015-05-15 21:39:34 -05:00
Sander Jansen
4f77420248 replace use of bytevector.mid(pos,4).toUInt() with more optimized bytevector.toUInt(pos) 2015-05-15 21:25:44 -05:00
Tsuda Kageyu
b021ed44e9 Revert the last two commits.
But leave the tests unchanged, and add some comments.
2015-05-16 11:16:00 +09:00
Tsuda Kageyu
1f99c93a61 Reduce redundant memset when resizing ByteVector. 2015-05-16 03:46:34 +09:00
Tsuda Kageyu
a924ca0db7 Expand the internal buffer of ByteVector only if really needed.
Add tests for all execution paths of ByteVector::resize().
2015-05-14 11:20:35 +09:00
Urs Fleisch
b5c0ab58ba Get version information from taglib.h.
This avoids duplication of the version information in both
CMakeLists.txt and taglib.h while keeping the possibility to
use something different from CMake.
2015-05-10 10:30:51 +02:00
Festus Hagen
e43c1a3c09 Fix for using Taglib as a CMake sub directory project. 2015-05-09 20:29:52 -04:00
Festus Hagen
1e9529380d Silenced uint ambiguity error. 2015-05-09 14:19:33 -04:00
Tsuda Kageyu
ff8443f33a Fix the wrong padding of ByteVector::resize().
The expanded area will be filled with garbage instead of correct padding in some corner cases.
2015-05-02 02:43:08 +09:00
Lukáš Lalinský
62ab41fa07 Merge pull request #532 from TsudaKageyu/bytevector-detach-test
A little robuster tests for ByteVector iterators after detaching.
2015-04-29 10:14:16 -07:00
Tsuda Kageyu
00e3504264 A little robuster tests for ByteVector iterators after detaching. 2015-04-29 17:15:13 +09:00
Lukáš Lalinský
852da79899 Merge pull request #531 from TsudaKageyu/bytevector-detach
Fix ByteVector to return correct iterators after detached.
2015-04-28 20:34:53 -07:00
Tsuda Kageyu
ab047f6054 Fix ByteVector to return correct iterators after detached. 2015-04-29 10:28:08 +09:00
Lukáš Lalinský
5bad35c4cb Merge pull request #527 from TsudaKageyu/wma-guid
Fix saving WMA files with some GUID fields.
2015-04-28 10:42:06 -07:00
Tsuda Kageyu
8d708c03e1 Store any GUID fields in Metadata Library Object. 2015-04-28 16:40:24 +09:00
Tsuda Kageyu
f9a0b50830 Fix saving WMA files with some GUID fields. 2015-04-28 12:06:24 +09:00
Tsuda Kageyu
8491266b12 Fix a GCC/Clang warning about singed/unsigned comparison. 2015-04-17 09:38:21 +09:00
Stephen F. Booth
066b5aa57e Merge pull request #492 from TsudaKageyu/duplicate-id3v2-aiff-wav
Check AIFF/WAV files for duplicate tags.
2015-03-25 08:16:41 -04:00
Tsuda Kageyu
5f0a7da481 Take into account the frame header version when skipping an empty frame. 2015-03-24 10:41:39 +09:00
Tsuda Kageyu
d33d684fab Discard empty ID3v2 frames instead of adding a dummy null byte. 2015-03-24 10:31:52 +09:00
Tsuda Kageyu
4c4be0a263 Add a dummy byte to an empty ID3v2 frame to stick to the ID3v2 spec. 2015-03-22 22:14:21 +09:00
Michael Helmling
f476cf2b45 Merge pull request #511 from TsudaKageyu/tag-prop
Fix a bug that Tag::setProperties() clears the date instead of the track number
2015-03-20 10:28:20 +01:00
Tsuda Kageyu
68c0b0591b Fix a bug that Tag::setProperties() clears the date instead of the track number. 2015-03-20 13:33:13 +09:00
Stephen F. Booth
8fccaf30d2 Merge pull request #479 from TsudaKageyu/fuzzed-mp4
Fix an infinite loop when parsing MP4 files.
2015-02-18 08:15:50 -05:00
Tsuda Kageyu
b69973bcf2 Fix infinite loops when parsing MP4 files. 2015-02-18 11:33:10 +09:00
Tsuda Kageyu
30eac7569f Check AIFF/WAV files for duplicate tags.
AIFF/WAV files can have duplicate tags and it leads to memory leak.
2015-02-18 11:31:55 +09:00
Lukáš Lalinský
f6081ed32e Merge pull request #505 from TsudaKageyu/fuzzed-ape-tests
Separate the tests for fuzzed APE files.
2015-02-17 09:22:35 +01:00
Tsuda Kageyu
0839a23902 Separate the tests for fuzzed APE files. 2015-02-17 12:36:57 +09:00
Lukáš Lalinský
f35a279dd1 Merge pull request #496 from TsudaKageyu/fuzzed-mpc
Some fixes for fuzzed MPC files.
2015-02-16 19:26:57 +01:00
Tsuda Kageyu
e463d14f2e Check for EOF to fix a segfault while parsing fuzzed MPC files. 2015-02-17 01:22:39 +09:00
Tsuda Kageyu
829ae2112a Check the packet size to fix a segfault error while parsing fuzzed MPC files. 2015-02-17 01:22:39 +09:00
Tsuda Kageyu
65664e6855 Check for EOF to fix an infinite loop while parsing fuzzed MPC files. 2015-02-17 01:22:39 +09:00
Tsuda Kageyu
2193d6dd84 Fix an out-of-bounds access and consequent errors while parsing fuzzed MPC files.
Consequent errors may vary: segfault, zerodiv and so forth.
2015-02-17 01:22:38 +09:00
Stephen F. Booth
ef786188ad Merge pull request #502 from TsudaKageyu/fix-save-wav
Fix saving ID3v2/INFO tags of WAV files.
2015-01-31 14:12:18 -05:00
Tsuda Kageyu
2b5ee8deb9 Fix saving ID3v2/INFO tags of WAV files.
The old tag won't be removed when the new tag is empty.
2015-01-30 14:51:28 +09:00
Scott Wheeler
ed09c9cf87 Merge pull request #494 from TsudaKageyu/fix-zlib
Fix a wrong parameter for zlib.
2015-01-06 17:06:10 +01:00
Tsuda Kageyu
9d91610fc0 Fix a wrong parameter for zlib.
z_stream.avail_in has to be the length of the input buffer.
It will fail when frameDataLength is smaller than the actual compressed data size.
2015-01-06 18:45:42 +09:00
Stephen F. Booth
aed689c145 Merge pull request #491 from TsudaKageyu/aiff-hasid3v2
Implement missing AIFF::File::hasID3v2Tag().
2015-01-05 08:17:21 -05:00
Tsuda Kageyu
c6a63a3a2f Implement missing AIFF::File::hasID3v2Tag(). 2015-01-05 18:20:31 +09:00
Stephen F. Booth
2b0a540228 Merge pull request #490 from TsudaKageyu/remove-uncompr
Remove an unused file from taglib/CMakeLists.txt.
2015-01-04 22:31:42 -05:00
Tsuda Kageyu
2685ec1842 Remove an unused file from taglib/CMakeLists.txt.
uncompr.c is no longer used since caa53e8
2015-01-05 11:00:47 +09:00
Scott Wheeler
fdea6dcd40 Merge pull request #489 from TsudaKageyu/frame-flag-tests
Add some tests for huge memory allocation due to bad ID3v2 frame header ...
2015-01-05 02:03:06 +01:00
Tsuda Kageyu
ed253d3691 Add some tests for huge memory allocation due to bad ID3v2 frame header flags.
The tests covers #466 and #486.
Also fixes a compilation error on some compilers.
2015-01-05 09:34:30 +09:00
Scott Wheeler
57729b834a Show a debugging message when we have an error reading 2015-01-04 20:13:24 +01:00
Scott Wheeler
caa53e8de5 Read the compressed data as a stream
This avoids allocating the complete buffer at first based solely
on the value read from the frame header.  This then does a sanity
check at the end of reading to make sure that the two values match.
At present, it just prints a debugging message if the values do not
match.

Fixes #466
2015-01-04 19:58:18 +01:00
Lukáš Lalinský
31982660c8 Merge pull request #485 from TsudaKageyu/oga-segfault
Fix a segfault when reading faulty Ogg/FLAC files.
2015-01-01 19:48:23 +01:00
Lukáš Lalinský
bd7b8cc36a Merge pull request #473 from TsudaKageyu/fix-infotag
Fix an infinite loop when parsing an INFO tag.
2015-01-01 19:46:53 +01:00
Tsuda Kageyu
bc9bbfe3fa Add a check for faulty Ogg/FLAC files. 2015-01-02 00:10:51 +09:00
Tsuda Kageyu
7adea3df22 Separate tests for fuzzed WAV files. 2015-01-01 23:18:43 +09:00
Tsuda Kageyu
5ebb2ece80 Fix a segfault when reading faulty Ogg/FLAC files. 2015-01-01 19:59:30 +09:00
Tsuda Kageyu
0d2e01df61 Fix a segfault when parsing WAV properties. 2014-12-31 01:46:30 +09:00
Tsuda Kageyu
695fb5ec16 Add a test for fuzzed WAV files. 2014-12-31 01:44:25 +09:00
Tsuda Kageyu
3170d47ec3 Fix an infinite loop when parsing an INFO tag. 2014-12-31 01:44:25 +09:00
Stephen F. Booth
79b7c14129 Merge pull request #481 from TsudaKageyu/aiff-c
Add support for AIFF-C files.
2014-12-30 10:51:17 -05:00
Tsuda Kageyu
977fb2aeb0 Fix compilation errors on Clang. 2014-12-31 00:41:22 +09:00
Tsuda Kageyu
3b8c7d4e3a Add support for AIFF-C files. 2014-12-30 23:53:40 +09:00
Lukáš Lalinský
be33389884 Merge pull request #476 from TsudaKageyu/fuzzed-ape
Some fixes for fuzzed APE files.
2014-12-29 09:47:10 +01:00
Lukáš Lalinský
59ae61de6e Merge pull request #456 from TsudaKageyu/id3v2-padding
ID3v2 padding won't increase beyond 1% of the file size.
2014-12-29 09:26:55 +01:00
Tsuda Kageyu
16ac2cd240 Added some tests for fuzzed APE files. 2014-12-23 21:02:00 +09:00
Tsuda Kageyu
61543432c0 Fix an excessive loop when parsing an APE file. 2014-12-23 20:58:36 +09:00
Tsuda Kageyu
4a9614bfc3 Fix a division by zero error when parsing an APE file. 2014-12-23 20:54:20 +09:00
Tsuda Kageyu
1a917a38cd Fix ID3v2 padding size calculation. 2014-12-09 10:54:21 +09:00
Lukáš Lalinský
735e17f504 Merge remote-tracking branch 'TsudaKageyu/64bit-atom'
Conflicts:
	ConfigureChecks.cmake
2014-12-08 16:52:33 -08:00
Tsuda Kageyu
0731bc7b2e Remove CMake check for sizeof(long). 2014-12-09 08:55:46 +09:00
Bart van der Velden
fb1c744daf Compile without warnings with MSVC 2014-12-08 09:42:04 -08:00
Lukáš Lalinský
1bc5acd7a7 Merge pull request #424 from TsudaKageyu/format
Unified redundant string format functions. (backport from taglib2)
2014-12-08 09:38:03 -08:00
Lukáš Lalinský
f30f5ccce5 Merge pull request #441 from xhochy/tests-fix-vectorsize
Fix ByteVector sizes in some test cases
2014-12-08 09:36:28 -08:00
Lukáš Lalinský
421eb5e97e Merge pull request #420 from TsudaKageyu/remove-codecvt
Replaced codecvt with Win32 API.
2014-12-08 09:14:00 -08:00
Lukáš Lalinský
5e60ec48e9 Merge pull request #454 from TsudaKageyu/duplicate-id3v2
Skip duplicate ID3v2 tags in MPEG files.
2014-12-08 09:09:28 -08:00
Lukáš Lalinský
68eca440c9 Merge pull request #458 from achalddave/fix-gcc-errors
Fix more uint/TagLib::uint ambiguities
2014-12-08 08:54:27 -08:00
Achal Dave
7b03403791 Fix more uint/TagLib::uint ambiguities 2014-11-18 15:06:10 -08:00
Tsuda Kageyu
d80c4c96c3 ID3v2 padding won't increase beyond 1% of the file size. 2014-10-23 12:38:38 +09:00
Tsuda Kageyu
73b9b9b58d Avoid reading an entire ID3v2 tag when skipping it. 2014-10-23 08:14:10 +09:00
Lukáš Lalinský
072851869a Merge pull request #453 from TsudaKageyu/editorconfig
Suggestion: Use EditorConfig to help us stick to our coding style.
2014-10-22 19:31:14 +02:00
Tsuda Kageyu
269e78f1a0 Add a test for duplicate ID3v2 tags. 2014-10-21 00:16:43 +09:00
Tsuda Kageyu
71acf3b6f7 Comment on a weird workaround for duplicate ID3v2 tags. 2014-10-20 23:13:15 +09:00
Tsuda Kageyu
e41dc68a6b Skip duplicate ID3v2 tags in MPEG files. 2014-10-20 21:21:32 +09:00
Tsuda Kageyu
cfad951442 Use EditorConfig to help us stick to our coding style.
http://editorconfig.org/
2014-10-20 11:27:30 +09:00
Lukáš Lalinský
23ffb24472 Merge pull request #448 from TsudaKageyu/msvc-error
Fix a compilation error on MSVC.
2014-10-16 10:15:51 +02:00
Tsuda Kageyu
a8bfcd81be Fix a compilation error on MSVC. 2014-10-16 07:19:31 +09:00
Scott Wheeler
bd7419f0bd Rebuild TRDC from v2.3 fields
This fixes an issue that was reported to me via email with the recording
date being thrown away from v2.3 tags.
2014-09-25 23:07:09 +02:00
Scott Wheeler
71c1ce375f Don't leak 2014-09-25 20:46:47 +02:00
Scott Wheeler
cff8d22818 Missing assignment 2014-09-25 20:46:47 +02:00
Scott Wheeler
0051351ebb TableOfContents and ChapterFrame can be added to v2.3 or v2.4 tags 2014-09-25 20:01:00 +02:00
Scott Wheeler
82315276db Take ownership of embedded frames, as documented
Previously embedded frames that were created automatically were
never deleted.

Fixes #440
2014-09-18 16:23:28 +02:00
Scott Wheeler
8ea07be47e Merge branch 'master' of https://github.com/taglib/taglib 2014-09-18 16:12:34 +02:00
Scott Wheeler
eae4605e6e Merge pull request #439 from xhochy/test-memleaks
Fix various memleaks in the tests
2014-09-18 16:11:12 +02:00
Scott Wheeler
b6289c64dd Break up the mega-lines 2014-09-18 11:21:18 +02:00
Scott Wheeler
e6d7dd08f2 No reason to store this in the d-pointer 2014-09-18 10:24:48 +02:00
Uwe L. Korn
ee283789b7 Fix ByteVector sizes in some test cases 2014-09-14 20:08:31 +01:00
Uwe L. Korn
205569c8d2 Fix various memleaks in the tests 2014-09-14 18:03:27 +01:00
Lukáš Lalinský
4b67beffc8 Merge pull request #434 from DidierMalenfant/master
Ignoring files generated when creating an Xcode project via cmake.
2014-08-25 14:09:44 +02:00
Didier Malenfant
b7a514886d Ignoring files generated when creating an Xcode project via cmake. 2014-08-23 20:37:32 -07:00
Tsuda Kageyu
0e6d8617ae Revert "Removed an ambiguous cast from FileNameHandle to FileName."
This reverts commit 9af7601bae.
2014-08-23 00:04:33 +09:00
Tsuda Kageyu
dfbaee4103 Removed an ambiguous cast from FileNameHandle to FileName. 2014-08-23 00:04:33 +09:00
Tsuda Kageyu
f29c5f45f8 Workaround for 64-bit MP4 atoms. 2014-08-23 00:04:33 +09:00
Lukáš Lalinský
b1a8205561 Merge pull request #430 from TsudaKageyu/const-iterator
Reduce useless detach operations by making some non-const iterators cons...
2014-08-21 09:47:36 +02:00
Tsuda Kageyu
2971891c69 Reduce useless detach operations by making some non-const iterators const. 2014-08-21 16:35:35 +09:00
Lukáš Lalinský
d5e3d6ea7c Merge pull request #421 from TsudaKageyu/fix-wav-strip
Fixed a bug on stripping tags when saving .WAV files.
2014-08-20 10:12:43 +02:00
Lukáš Lalinský
20ce66f98b Merge pull request #422 from TsudaKageyu/detach
Added some missing detach()s to List<T>, ByteVector and String.
2014-08-20 10:09:08 +02:00
Stephen F. Booth
aff3351a25 Merge pull request #427 from TsudaKageyu/linebreak
Small fixes in line breaking.
2014-08-17 09:01:47 -04:00
Tsuda Kageyu
387890d956 Small fixes in line breaking. 2014-08-16 15:33:39 +09:00
Lukáš Lalinský
8765d40c2c Merge pull request #426 from TsudaKageyu/string-cmp
Added some operators to compare String to string literals.
2014-08-12 18:15:37 +02:00
Tsuda Kageyu
9bb0eb7ee9 Added some operators to compare String to string literals. 2014-08-12 23:58:45 +09:00
Lukáš Lalinský
d34c922c75 Merge pull request #425 from TsudaKageyu/fix-cmake
Removed a useless line from ConfigureChecks.cmake.
2014-08-12 09:42:19 +02:00
Tsuda Kageyu
3c727e091e Removed a useless line from ConfigureChecks.cmake. 2014-08-12 13:42:44 +09:00
Tsuda Kageyu
a055933e10 Unified the same debug messages. 2014-08-12 13:33:25 +09:00
Tsuda Kageyu
20c0aac309 Unified redundant string format functions. (backport from taglib2) 2014-08-11 01:09:07 +09:00
Tsuda Kageyu
929829b2b5 Removed useless strlen() and wcslen(). 2014-08-10 01:13:25 +09:00
Tsuda Kageyu
1944588595 Added some missing detach()s to List<T>, ByteVector and String. 2014-08-08 13:12:14 +09:00
Tsuda Kageyu
31a74927e4 Fixed a bug on stripping tags when saving .WAV files. 2014-08-07 18:49:53 +09:00
Tsuda Kageyu
972aa1feef Replaced codecvt with Win32 API. 2014-08-07 17:35:42 +09:00
Lukáš Lalinský
c23ee5331f Merge pull request #418 from TsudaKageyu/debug-msg
Fixed some debug messages.
2014-08-07 00:37:17 +02:00
Lukáš Lalinský
0f605be198 Merge pull request #414 from TsudaKageyu/fix-floattest
Fixed some mistakes in the CMake module for float types.
2014-08-07 00:36:59 +02:00
Tsuda Kageyu
590cb29f99 Improved the CMake check for float/double format. (Intel compiler support) 2014-08-06 20:57:04 +09:00
Tsuda Kageyu
286fd2abec Fixed some debug messages. 2014-08-06 16:13:15 +09:00
Tsuda Kageyu
f76d76728d Fixed some mistakes in the CMake module for float types. 2014-08-04 17:51:05 +09:00
Lukáš Lalinský
80f5436370 Merge pull request #413 from TsudaKageyu/msvc-tests3
Fixed a test to work with MSVC.
2014-08-04 09:09:20 +02:00
Tsuda Kageyu
043d2bbef5 Fixed a test to work with MSVC. 2014-08-04 15:11:50 +09:00
Lukáš Lalinský
cf59d51d93 Merge pull request #406 from TsudaKageyu/utf16-byteorder
Fixed handling UTF-16 byte order.
2014-07-23 10:21:37 +02:00
Lukáš Lalinský
9569b99e4c Merge pull request #405 from TsudaKageyu/missing-include
Added a missing #include.
2014-07-23 10:20:38 +02:00
Tsuda Kageyu
590405d878 Fixed handling UTF-16 byte order. 2014-07-23 15:36:16 +09:00
Tsuda Kageyu
c03b91aed3 Added a missing #include. 2014-07-23 14:56:18 +09:00
Lukáš Lalinský
ee2908a6cf Merge pull request #399 from TsudaKageyu/float-conv
Added float conversion functions to ByteVector.
2014-07-22 12:10:54 +02:00
Tsuda Kageyu
e29f1d39e7 Added float conversion functions to ByteVector.
Added CMake checks about IEEE754 compliance.
2014-07-17 12:09:14 +09:00
Lukáš Lalinský
b509106031 Merge pull request #398 from TsudaKageyu/fix-chap
Fixed some compilation error on MSVC in CHAP and CTOC frames support.
2014-07-16 22:30:10 +02:00
Tsuda Kageyu
47cd6fad4f Fixed some compilation error on MSVC in CHAP and CTOC frames support. 2014-07-17 01:43:56 +09:00
Lukáš Lalinský
fb24dfe7cf Merge pull request #393 from TsudaKageyu/msvc-tests
Modified some tests to work with MSVC.
2014-07-16 16:02:10 +02:00
Lukáš Lalinský
f42263e04a Merge pull request #392 from TsudaKageyu/zlib-source
Added a Windows-friendly build option ZLIB_SOURCE.
2014-07-16 15:58:52 +02:00
Lukáš Lalinský
43872f362d Merge pull request #390 from TsudaKageyu/vector-bounds
Fixed out-of-bounds access in findVector().
2014-07-16 15:57:55 +02:00
Lukáš Lalinský
73d3436570 Merge pull request #391 from TsudaKageyu/setlasterror
Added some SetLastError()s to get correct error codes in Win32.
2014-07-16 15:56:59 +02:00
Lukáš Lalinský
1e50b8dc25 Merge pull request #394 from ufleisch/master
Add genres 148 to 191 to list of ID3v1 genres.
2014-07-16 15:54:03 +02:00
Lukáš Lalinský
4a585c5258 Merge remote-tracking branch 'krejclu6/krejclu6_chapters' 2014-07-16 15:52:41 +02:00
Tsuda Kageyu
5f738a9819 Changed to skip the ZLib check when ZLIB_SOURCE is set. 2014-07-09 09:52:08 +09:00
Tsuda Kageyu
d7995b807f Fixed the tests to work with MSVC when UNICODE is set. 2014-06-24 01:29:15 +09:00
Urs Fleisch
3e60e339a4 Add genres 148 to 191 to list of ID3v1 genres.
This genres were added for Winamp version 5.6, see
<http://en.wikipedia.org/wiki/ID3#List_of_genres>.
2014-06-21 12:34:42 +02:00
Tsuda Kageyu
5feabe0988 Updated INSTALL. 2014-06-20 10:36:09 +09:00
Tsuda Kageyu
29a5129096 Modified some tests to work with MSVC. 2014-06-20 09:06:26 +09:00
Tsuda Kageyu
fadb57e4cd Added a Windows-friendly build option ZLIB_SOURCE. 2014-06-19 19:54:12 +09:00
Tsuda Kageyu
653b631aea Added a check for patternSize and removed a useless check. 2014-06-19 16:57:36 +09:00
Tsuda Kageyu
cb3abf15ad Added a test for out-of-bounds access in findVector(). 2014-06-19 13:22:50 +09:00
Tsuda Kageyu
29377fc8f1 Added some SetLastError()s to get correct error codes in Win32. 2014-06-19 12:58:07 +09:00
Tsuda Kageyu
663f10d51d Fixed out-of-bounds access in findVector(). 2014-06-19 12:19:18 +09:00
Lukas Krejci
a192db07c0 Code clean-up. 2014-06-11 17:52:05 +02:00
Lukas Krejci
459adc69ad Merge branch 'krejclu6_chapters' of https://github.com/krejclu6/taglib into krejclu6_chapters
Conflicts:
	taglib/mpeg/id3v2/id3v2framefactory.cpp
	tests/test_id3v2.cpp
2014-05-18 16:29:54 +02:00
Lukas Krejci
500b3e630b Uncommenting unit test. 2014-05-18 16:15:35 +02:00
Lukas Krejci
5c5c89e8d9 Added functions for work with embedded frames.
Added embedded frames parsing.

Added embedded frames rendering.
Modified constructor of CHAP and CTOC frame, so it can accept list of embedded frames.

Added unit tests for CHAP and CTOC frames parsing and rendering (with support of embedded frames).
Fixed bugs in rendering of CTOC frames.
Added functions for adding and removing child elements in CTOC frames.
2014-05-18 16:15:35 +02:00
Lukáš Krejčí
140fb2b3f6 Removed duplicated CHAP frame testing funtion. 2014-05-18 16:15:35 +02:00
Lukáš Krejčí
98ed58f910 Changed copyright and e-mail in modified files. 2014-05-18 16:15:35 +02:00
Lukáš Krejčí
7d99b8276a Fixed errors in ChapterFrame constructor.
Fixed errors in ChapterFrame method renderFields.
Fixed errors in TableOfContentsFrame method parseFields.
Added ChapterFrame and TableOfContentsFrame headers and sources to CMakeLists.txt.
Added some basic testing of CHAP and CTOC frames parsing.
2014-05-18 16:15:35 +02:00
Lukáš Krejčí
17841e89ae Fixed error in childElements function. 2014-05-18 16:14:00 +02:00
Lukáš Krejčí
c5f9258462 Finished parseFields, renderFields and asProperty methods of ChapterFrame and TableOfContentsFrame classes.
Methods setElementID of ChapterFrame and TableOfContentsFrame classes now automatically terminates new element ID with null.
2014-05-18 16:14:00 +02:00
Lukáš Krejčí
3a1040d55b Added basic members of ChapterFrame and TableOfContentsFrame classes.
Fixed minor bugs in ChapterFrame and TableOfContentsFrame headers.
2014-05-18 16:11:55 +02:00
Lukáš Krejčí
0864634ea6 Created CPP and H files for CTOC and CHAP frames. 2014-05-18 16:11:55 +02:00
Stephen F. Booth
f27e0aaecf Merge pull request #370 from supermihi/fix162v2
Fix #162: Xiph and APE generic getters return space-concatenated values
2014-04-24 21:35:50 -04:00
Lukáš Lalinský
ecc768d459 Merge pull request #380 from TsudaKageyu/fix-comment
Removed a wrong note from a comment in tstring.h.
2014-04-11 10:33:56 +02:00
Tsuda Kageyu
fabc411cb9 Removed a wrong note from a comment in tstring.h. 2014-04-11 17:16:55 +09:00
Lukáš Lalinský
2d528d844a Merge pull request #356 from TsudaKageyu/string-comment
Added some comment about UTF-16 encoding to String::data().
2014-04-10 20:05:55 +02:00
Lukáš Lalinský
c65753c766 Add ALBUMARTIST property mapping for WMA 2014-04-10 20:05:14 +02:00
Lukáš Lalinský
7e10b13962 Merge pull request #372 from TsudaKageyu/cmake-warning
Suppressed the warning "Policy CMP0022 is not set" on CMake 2.8.12.
2014-04-10 20:04:17 +02:00
Lukáš Lalinský
05e26119f7 Merge pull request #377 from amigadave/master
Add ALBUMARTIST property mapping for MP4
2014-04-10 20:01:36 +02:00
David King
95a59c416b Add ALBUMARTIST property mapping for MP4
https://code.google.com/p/mp4v2/wiki/iTunesMetadata
2014-04-10 17:33:29 +01:00
Tsuda Kageyu
3f557be608 Suppressed the warning "Policy CMP0022 is not set" on CMake 2.8.12. 2014-04-05 21:08:21 +09:00
Lukáš Lalinský
9ca7877587 Merge pull request #371 from TsudaKageyu/cmake-ver
Changed cmake_minimum_required from 2.6.0 to 2.8.0.
2014-04-05 13:07:58 +02:00
Tsuda Kageyu
a93ee10134 Changed cmake_minimum_required from 2.6.0 to 2.8.0. 2014-04-05 19:44:47 +09:00
Michael Helmling
1723e9b18a Fix #162: Xiph and APE generic getters return space-concatenated values 2014-04-03 21:07:29 +02:00
Lukáš Lalinský
16b8688c1a Merge pull request #362 from ufleisch/master
Add support for synchronized lyrics (SYLT) and event timing codes (ETCO) for ID3v2
2014-03-30 19:21:47 +02:00
Urs Fleisch
3b60af2c0b Add support for ID3v2 ETCO frames (event timing codes). 2014-03-30 09:28:14 +02:00
Urs Fleisch
eba99c3a70 Add support for ID3v2 SYLT frames (synchronized lyrics). 2014-03-30 09:26:03 +02:00
Tsuda Kageyu
6bcd422afa Small fix of a comment 2014-03-14 15:12:03 +09:00
Tsuda Kageyu
c357d293a1 Added some comment about UTF-16 encoding to String::data(). 2014-03-13 14:38:03 +09:00
Stephen F. Booth
cfb43223dc Merge pull request #354 from TsudaKageyu/opus-bitrate
opus: Estimate the bitrate if possible
2014-03-09 21:37:50 -04:00
Tsuda Kageyu
72cd379f30 opus: Estimate the bitrate if possible 2014-03-10 09:37:10 +09:00
Lukáš Lalinský
a3d724af27 Merge pull request #352 from TsudaKageyu/tagreader-sprintf
Avoid using sprintf() in tagreader.cpp to fix an MSVC warning.
2014-02-19 16:34:42 +01:00
Tsuda Kageyu
05e0081414 Avoid using sprintf() in tagreader.cpp to fix an MSVC warning. 2014-02-19 23:35:23 +09:00
Lukáš Lalinský
b658f95e06 Merge pull request #338 from funman/master
Also build/install taglib_c.pc when targetting windows
2014-02-17 08:46:13 +01:00
Lukáš Lalinský
2758aed34d Merge pull request #348 from TsudaKageyu/string-memcpy
Reduced a useless memory copy in tstring.cpp.
2014-02-17 08:45:49 +01:00
Lukáš Lalinský
12b25868b7 Merge pull request #349 from TsudaKageyu/install-typo
Fixed a typo in INSTALL.
2014-02-17 08:44:54 +01:00
Tsuda Kageyu
1deff52d95 Fixed a typo in INSTALL. 2014-02-17 11:22:40 +09:00
Tsuda Kageyu
69eaa75f64 Reduced a useless memory copy in tstring.cpp. 2014-02-15 20:25:00 +09:00
Lukáš Lalinský
3e0c73bdbc Merge pull request #347 from TsudaKageyu/xm-seek
Changed XM::File::save() to use seek() properly.
2014-02-14 17:21:49 +01:00
Tsuda Kageyu
9e94f8bb6c Changed XM::File::save() to use seek() properly. 2014-02-14 19:22:53 +09:00
Lukáš Lalinský
aa49723b48 Merge pull request #330 from TsudaKageyu/fix-emptystring
Fixed a bug reported at #328
2014-02-05 00:02:47 -08:00
Tsuda Kageyu
167513ae57 Avoid using &d->data[0] when d->data is empty. 2014-02-05 10:35:07 +09:00
Tsuda Kageyu
d0f3e9b186 Use std::string::c_str() rather than &s[0] where a const pointer is required. 2014-01-24 09:48:39 +09:00
Stephen F. Booth
4fc020e0d3 Merge pull request #340 from mineo/patch-1
Remove a superfluos 'x'
2014-01-18 13:12:21 -08:00
Wieland Hoffmann
db147e672e Remove a superfluos 'x' 2014-01-18 18:11:31 +01:00
Rafaël Carré
c45a0694f9 Also build/install taglib.pc when targetting windows
.pc file is notably used when cross-compiling windows software
2014-01-13 22:49:17 +01:00
Tsuda Kageyu
584bbc7c78 Fixed conversion from empty String to ByteVector 2013-12-04 09:37:59 +09:00
Lukáš Lalinský
10b804e0ae Merge pull request #322 from TsudaKageyu/mailaddress
Fixed a mail address
2013-11-24 23:25:19 -08:00
Tsuda Kageyu
4f8ab4b63f Fixed a mail address 2013-11-25 14:12:34 +09:00
Stephen F. Booth
5593c251c8 Merge pull request #321 from TsudaKageyu/nominmax
Fixed warnings in MinGW
2013-11-23 19:24:55 -08:00
Tsuda Kageyu
7d7a7be115 Fixed warnings in MinGW 2013-11-23 23:42:20 +09:00
Stephen F. Booth
f733077917 Merge pull request #307 from TsudaKageyu/string-abi
Fixed the ABI breakage in TagLib::String
2013-11-15 15:04:30 -08:00
Stephen F. Booth
670493f97f Merge pull request #310 from TsudaKageyu/backslash
Replaced wrongly used slashes with backslashes in some comments
2013-11-15 03:55:04 -08:00
Tsuda Kageyu
d4adc22922 Replaced wrongly used slashes with backslashes in some comments 2013-11-15 15:31:23 +09:00
Stephen F. Booth
34f8cd8a90 Merge pull request #309 from TsudaKageyu/fix-replace
Rewrote ByteVector::replace() simpler (fix for the issue #308)
2013-11-14 07:01:29 -08:00
Tsuda Kageyu
4a7d31c87b Rewrote ByteVector::replace() simpler 2013-11-14 14:58:14 +09:00
Tsuda Kageyu
3bf30af66c Fixed ABI breakage in TagLib::String 2013-11-06 17:01:21 +09:00
Lukáš Lalinský
ee9720a997 Merge pull request #304 from funman/master
Win32: avoid symbol lookup if UNICODE is defined
2013-10-28 01:12:48 -07:00
Rafaël Carré
69e58b5f3f Win32: avoid symbol lookup if UNICODE is defined 2013-10-28 04:39:04 +01:00
Duke Yin
de17843d8c Update tests 2013-10-17 15:14:29 -04:00
Duke Yin
944143a91b Handle iTunes ID3v2.3 hacks
iTunes writes the 2.4 frames TSOA, TSOT, TSOP to 2.3 files.  (It
additionally defines TSO2 and TSOC for both 2.3 and 2.4.)  TagLib should
not delete these frames.
2013-10-16 18:48:49 -04:00
Lukas Krejci
1ce5385e30 Uncommenting unit test. 2013-10-13 18:38:54 +02:00
Lukas Krejci
5ed2d88f78 Added functions for work with embedded frames.
Added embedded frames parsing.

Added embedded frames rendering.
Modified constructor of CHAP and CTOC frame, so it can accept list of embedded frames.

Added unit tests for CHAP and CTOC frames parsing and rendering (with support of embedded frames).
Fixed bugs in rendering of CTOC frames.
Added functions for adding and removing child elements in CTOC frames.
2013-10-13 18:27:43 +02:00
Lukáš Lalinský
aa61823432 Fix the length of the TXXX translation mapping (closes #283) 2013-10-08 17:50:01 +02:00
Lukáš Lalinský
2f7af42092 Update version to 1.9.1 2013-10-08 17:46:34 +02:00
Lukáš Lalinský
2d5abd46d2 Added TagLib::MP4::PropertyMap::codec() 2013-10-08 17:41:09 +02:00
Lukáš Lalinský
9b5869ea37 Merge remote-tracking branch 'TsudaKageyu/chunksize' 2013-10-08 16:18:43 +02:00
Lukáš Lalinský
02ebd0bcbe Change log for 1.9.1 2013-10-08 16:18:30 +02:00
Lukáš Lalinský
5693ab0403 Merge remote-tracking branch 'TsudaKageyu/fix-string' 2013-10-08 16:12:49 +02:00
Lukáš Lalinský
27000438f5 Merge remote-tracking branch 'TsudaKageyu/msvc_wchar_t' 2013-10-08 16:09:01 +02:00
Lukáš Lalinský
a6f759cc9a These shouldn't be executable either 2013-10-08 16:06:58 +02:00
Lukáš Lalinský
a175b8356b Reintroduce the old RefCounter from 1.8, which is needed by TagLib::Map<> and TagLib::List<> (closes #296) 2013-10-08 16:06:03 +02:00
Tsuda Kageyu
873df184fe Workaround for when MSVC doesn't have wchar_t as a built-in type 2013-10-08 19:55:44 +09:00
Tsuda Kageyu
079e3e0b87 Fixed detecting RIFF files with invalid chunk sizes 2013-10-07 17:04:55 +09:00
Lukáš Lalinský
95776b5905 These files should not be marked as executable 2013-10-06 17:11:01 +02:00
Lukáš Lalinský
dcfb71bcb4 Update version number to 1.9 2013-10-05 10:53:15 +02:00
Lukáš Lalinský
f2c9ed4f36 Update NEWS 2013-10-05 10:09:09 +02:00
Lukáš Lalinský
2407933087 Merge remote-tracking branch 'TsudaKageyu/wavpack-samplerate' 2013-10-05 09:53:49 +02:00
Stephen F. Booth
2af43ec8bf Merge pull request #290 from FestusHagen/m_WinInstallNotes
Update Windows INSTALL notes.
2013-10-01 19:51:11 -07:00
Festus Hagen
85d76a2428 Update Windows INSTALL notes. 2013-09-30 18:06:55 -04:00
Stephen F. Booth
5a4a05d9bc Merge pull request #280 from TsudaKageyu/info-fieldlist
Added a missing fieldListmap() method to RIFF::Info::Tag
2013-09-28 18:07:26 -07:00
Stephen F. Booth
a2188e6cf9 Merge pull request #285 from TsudaKageyu/algorithm
Added missing #include <algorithm> for std::min() and std::max()
2013-09-20 04:59:27 -07:00
Tsuda Kageyu
e6f9a06894 Added missing #include <algorithm> for std::min() and std::max() 2013-09-20 08:26:37 +09:00
Tsuda Kageyu
e125bcb78b Fixed a possible out-of-bound access when reading WavPack files 2013-09-19 04:09:28 +09:00
Tsuda Kageyu
23b418b4e9 Added a missing fieldListmap() method to RIFF::Info::Tag 2013-09-17 14:59:19 +09:00
Tsuda Kageyu
cf892f2cb8 Fixed a bug in creating String from ByteVector 2013-09-13 03:47:03 +09:00
Lukáš Lalinský
c12b6697f9 Merge remote-tracking branch 'TsudaKageyu/byteorder-detection' 2013-07-21 14:42:50 +02:00
Tsuda Kageyu
89fcab5669 Fixed an MSVC specific runtime error only in debug mode 2013-07-17 23:35:41 +09:00
Tsuda Kageyu
35ca010df6 Introduced the runtime byte order detection when config.h is missing 2013-07-17 15:02:02 +09:00
Tsuda Kageyu
0f58646bfb Added a test for APE::Item 2013-07-14 11:35:10 +09:00
Tsuda Kageyu
4d126c49e9 Fixed a crash of APE::Item::toString() when the data type is binary 2013-07-14 02:47:48 +09:00
Lukáš Lalinský
3a636c752b Merge remote-tracking branch 'TsudaKageyu/string-api-master' 2013-07-11 10:08:05 +02:00
Lukáš Lalinský
ff5ab030c5 Merge remote-tracking branch 'TsudaKageyu/fix-opus' 2013-07-11 10:06:35 +02:00
Lukáš Lalinský
ff3b1466e1 Merge remote-tracking branch 'TsudaKageyu/comment-update' 2013-07-11 10:05:29 +02:00
Lukáš Lalinský
89cb785f22 Merge remote-tracking branch 'TsudaKageyu/has-tags' 2013-07-11 10:03:28 +02:00
Tsuda Kageyu
30f62ba887 Updated the relevant comments 2013-07-04 22:14:42 +09:00
Tsuda Kageyu
1503909824 Added the methods to check which kind of tags the file actually has. 2013-07-04 18:11:33 +09:00
Tsuda Kageyu
75b685fa53 Updated the related comments 2013-06-24 01:29:33 +09:00
Tsuda Kageyu
62d55223b2 Added conversion from String to const wchar_t* 2013-06-24 01:13:25 +09:00
Tsuda Kageyu
418a6c79cb Comment update: Added some supplementary explanations and fixed some spellings. 2013-06-23 02:08:10 +09:00
Tsuda Kageyu
ab417fd9e3 Changed the style to follow TagLib's one 2013-06-22 18:06:40 +09:00
Tsuda Kageyu
35cdcd3b95 Added a missing check if an Opus file is open 2013-06-22 16:12:57 +09:00
Tsuda Kageyu
a845f70c49 Added some test cases for FileRef about unsupported files 2013-06-21 15:29:00 +09:00
Lukáš Lalinský
7e866e11ad Merge remote-tracking branch 'FestusHagen/sw_initorder' 2013-06-21 08:01:50 +02:00
Festus Hagen
6acbcfc68a Fix file modes 2. 2013-06-20 18:50:14 -04:00
Festus Hagen
02c81aaac2 Fix file modes. 2013-06-20 18:37:06 -04:00
Festus Hagen
550510ff3f Silence Initialization Order Warnings 2. 2013-06-20 16:40:05 -04:00
Lukáš Lalinský
5051010835 Move byteSwap to a (private) shared include file, rather than having the same code in tstring.cpp and tbytevector.cpp 2013-06-20 15:22:06 +02:00
Lukáš Lalinský
fdb8a6b065 Reintroduce HAVE_CONFIG_H so that TagLib can be built without CMake 2013-06-20 15:07:25 +02:00
Lukáš Lalinský
6d4299ea94 Merge remote-tracking branch 'TsudaKageyu/debug-msg3' 2013-06-20 13:40:26 +02:00
Tsuda Kageyu
b84b3afc9c Making use of std::bitset::to_string() 2013-06-15 13:21:07 +09:00
Festus Hagen
451616f99a Silence Initialization Order Warnings. 2013-06-11 17:20:46 -04:00
Tsuda Kageyu
496b58e0c9 Updated the comment for DebugListener class 2013-06-11 19:23:46 +09:00
Tsuda Kageyu
886236b978 Removed getDebugListener() 2013-06-10 16:29:33 +09:00
Tsuda Kageyu
6d2e0e8050 Moved a macro from taglib_config.h to config.h 2013-06-10 01:19:47 +09:00
Tsuda Kageyu
2f29ed003c Added a CMake option that allows to show debug messages in release mode 2013-06-09 23:52:05 +09:00
Tsuda Kageyu
12953b3fdc Removed TAGLIB_EXPORT from getDebugListener 2013-06-08 22:26:13 +09:00
Tsuda Kageyu
448648d61b Simplified DebugListener class 2013-06-08 21:40:30 +09:00
Lukáš Lalinský
241465eaac Merge branch 'revert-changes' of https://github.com/TsudaKageyu/taglib 2013-06-08 12:58:53 +02:00
Tsuda Kageyu
dce00b96b8 Revert "Fixed some MSVC specific warnings"
This reverts commit 93f304a91d.
2013-06-08 13:14:06 +09:00
Tsuda Kageyu
3b2d620671 Enabled users to define custom debug message listeners 2013-06-08 09:59:36 +09:00
Tsuda Kageyu
e18546560e Enabled users to define custom debug message listeners 2013-06-08 03:05:50 +09:00
naiar
fc9abc7a33 fixed build failure 2013-06-07 20:00:13 +09:00
Tsuda Kageyu
98d010f460 Merge pull request #232 from TsudaKageyu/remove-shlwapi
Removed the dependency on shlwapi.dll in Win32
2013-06-05 21:59:11 -07:00
Tsuda Kageyu
36d7f9ba32 Removed the dependency on shlwapi.dll in Win32 2013-06-06 13:45:23 +09:00
Tsuda Kageyu
c4c5b06643 Merge pull request #231 from TsudaKageyu/containsat
Fixed behavior change of ByteVector::containsAt()
2013-06-01 12:03:34 -07:00
Tsuda Kageyu
767a6ec4a2 Added some tests for containsAt() 2013-06-02 04:00:34 +09:00
Tsuda Kageyu
860a605c8d Fixed behavior change of ByteVector::containsAt() 2013-06-02 03:45:13 +09:00
Tsuda Kageyu
df5bf232eb Merge pull request #230 from TsudaKageyu/gcc42-3
Fixed compilation error with GCC4.2
2013-06-01 10:49:07 -07:00
Tsuda Kageyu
90a4bae6cc Fixed compilation error with GCC4.2 2013-06-02 02:37:15 +09:00
Tsuda Kageyu
3ae452ee2a Merge pull request #229 from TsudaKageyu/gcc42-2
Fixed compilation error with GCC4.2
2013-06-01 10:11:52 -07:00
Tsuda Kageyu
bc2d3ea72e Fixed compilation error with GCC4.2 2013-06-02 02:05:11 +09:00
Tsuda Kageyu
9ccc4878d0 Merge pull request #228 from TsudaKageyu/gcc42
Fixed compilation error with GCC4.2
2013-06-01 08:05:29 -07:00
Tsuda Kageyu
6365f36c75 Fixed compilation error with GCC4.2 2013-06-01 23:55:52 +09:00
Tsuda Kageyu
da3d9b1c55 Merge pull request #226 from TsudaKageyu/file-comments
Fixed comments for File constructors
2013-05-30 22:34:21 -07:00
Tsuda Kageyu
f77a84486e Fixed comments for File constructors 2013-05-30 02:04:10 +09:00
Tsuda Kageyu
cf9f2a436b Merge pull request #224 from TsudaKageyu/memoryleak
Fixed memory leak of ByteVector
2013-05-27 08:20:38 -07:00
Tsuda Kageyu
e73afa3325 Fixed memory leak of ByteVector 2013-05-28 00:02:09 +09:00
Tsuda Kageyu
dfee045d46 Merge pull request #222 from TsudaKageyu/vc-filename
Fixed some MSVC specific warnings
2013-05-26 06:03:49 -07:00
Tsuda Kageyu
93f304a91d Fixed some MSVC specific warnings 2013-05-26 14:38:36 +09:00
Tsuda Kageyu
ddabffc7ef Merge pull request #221 from TsudaKageyu/fix-shlwapi
Fixed shlwapi.h and shlwapi.lib detection for MSVC
2013-05-25 12:20:57 -07:00
Tsuda Kageyu
42d268c2c9 Fixed shlwapi.h and shlwapi.lib detection for MSVC 2013-05-26 04:17:18 +09:00
Tsuda Kageyu
e7c0f3322d Merge pull request #220 from FestusHagen/cmake_shlwapi
Added FindShlwapi.cmake in lieu of pragma comment() in fileref.h.
2013-05-25 12:04:08 -07:00
Festus Hagen
b3f3eeeec7 Added FindShlwapi.cmake in lieu of pragma comment() in fileref.h. 2013-05-25 01:58:49 -04:00
Tsuda Kageyu
54fbe15611 Merge pull request #219 from joelverhagen/master
Windows build fails on master (due to RefCounter not being exported)
2013-05-23 18:44:15 -07:00
Joel Verhagen
d7523d7843 Added TAGLIB_EXPORT to RefCounter for Windows build 2013-05-23 13:42:51 -04:00
Tsuda Kageyu
ca801c5411 Merge pull request #215 from TsudaKageyu/smallfile
Fixed bugs on manipulating small files
2013-05-23 02:22:48 -07:00
Tsuda Kageyu
4667ba02e5 Fixed bugs on manipulating small files 2013-05-23 17:45:16 +09:00
Tsuda Kageyu
3151336050 Merge pull request #209 from TsudaKageyu/bytevector
Changed behavior of ByteVector::toNumber() when overrun
2013-05-20 13:50:59 -07:00
Tsuda Kageyu
848f8c316e Changed behavior of ByteVector::toNumber() when overrun 2013-05-21 05:36:01 +09:00
Tsuda Kageyu
2303da48a2 Merge pull request #204 from TsudaKageyu/number
Changed String::number() to use a standard function
2013-05-18 22:59:02 -07:00
Tsuda Kageyu
bbec1c7f81 Changed String::number() to use a standard function 2013-05-19 14:39:45 +09:00
Tsuda Kageyu
79f3edebc0 Added myself to AUTHORS 2013-05-19 11:59:37 +09:00
Tsuda Kageyu
d49d0a6888 Merge pull request #203 from TsudaKageyu/fix-filestream
Fixed initialization of FileStream
2013-05-18 19:21:36 -07:00
Tsuda Kageyu
5c3f096fe4 Fixed initialization of FileStream 2013-05-19 11:09:43 +09:00
Tsuda Kageyu
7060d53cf3 Merge pull request #202 from TsudaKageyu/fix-filestream
Small refactoring of FileStream
2013-05-18 10:49:31 -07:00
Tsuda Kageyu
dcf11b9586 Small refactoring of FileStream 2013-05-19 02:33:17 +09:00
Tsuda Kageyu
229d69864d Merge pull request #201 from TsudaKageyu/unicodefile
Small change in Win9x support
2013-05-18 07:41:07 -07:00
Tsuda Kageyu
36d9fc1973 Small change in Win9x support 2013-05-18 23:30:15 +09:00
Tsuda Kageyu
d06f480f82 Merge pull request #199 from TsudaKageyu/fix-zlib
Fixed the test for ID3V2's compressed frame
2013-05-16 04:38:24 -07:00
Tsuda Kageyu
f9efcfb8d6 Fixed the test for ID3V2's compressed frame 2013-05-16 20:29:58 +09:00
Lukáš Krejčí
cbd6f73431 Removed duplicated CHAP frame testing funtion. 2013-05-04 21:25:55 +02:00
Tsuda Kageyu
db06166330 Merge pull request #187 from TsudaKageyu/config
Removed config.h and moved macros into taglib_config.h
2013-05-03 08:03:51 -07:00
Tsuda Kageyu
5d8f781467 Fixed mismatched macro names 2013-05-03 21:05:55 +09:00
Tsuda Kageyu
03adafbfd9 Removed TAGLIB_HAVE_STD_WSTRING macro that affects the public ABI 2013-05-03 18:28:28 +09:00
Tsuda Kageyu
198530547d Removed RefCounter implementation from a public header 2013-05-03 13:53:32 +09:00
Tsuda Kageyu
4b6745b59b Merge pull request #188 from TsudaKageyu/string-comment
Fixed comments in tstring.h
2013-05-02 21:10:26 -07:00
Tsuda Kageyu
6f0bf734d5 Fixed comments in tstring.h 2013-05-03 13:03:38 +09:00
Tsuda Kageyu
23bd3784a1 Separated public and private config.h 2013-05-03 11:44:36 +09:00
Tsuda Kageyu
8f8ef3788f Prefixed public variables 2013-05-02 23:26:06 +09:00
Tsuda Kageyu
b0938a3cf1 Removed config.h and moved macros into taglib_config.h 2013-05-02 20:41:59 +09:00
Tsuda Kageyu
a2688a1ff0 Merge pull request #180 from TsudaKageyu/master
Fixed possible memory leak
2013-04-30 09:39:23 -07:00
Tsuda Kageyu
d6fc2ef4aa Fixed possible memory leak 2013-05-01 01:32:48 +09:00
Tsuda Kageyu
9f29804f60 Merge pull request #178 from rakuco/clear-mbstate_t-correctly
Correctly initialize std::mbstate_t.
2013-04-29 15:06:57 -07:00
Raphael Kubo da Costa
289b6abb43 Correctly initialize std::mbstate_t.
mbstate_t is an opaque type that is often a union or a struct, so setting it
directly to 0 is incorrect and causes build failures with some compilers
such as clang.
2013-04-29 23:56:07 +03:00
Tsuda Kageyu
55f1224d6e Merge pull request #176 from TsudaKageyu/master
Add some error handling to tfilestream.cpp
2013-04-27 17:37:17 -07:00
Tsuda Kageyu
395743eb49 Add some error handling to tfilestream.cpp 2013-04-28 09:14:37 +09:00
Tsuda Kageyu
62827269b6 Merge pull request #175 from TsudaKageyu/master
Comment update
2013-04-27 11:10:37 -07:00
Tsuda Kageyu
d2273a7218 Comment update 2013-04-28 03:06:59 +09:00
Tsuda Kageyu
bd85cf8928 Merge pull request #174 from TsudaKageyu/alignment
Fixed detection of alignment-tolerant CPUs
2013-04-27 11:02:31 -07:00
Tsuda Kageyu
f3cbb883f2 Fixed detection of alignment-tolerant CPUs 2013-04-28 02:57:51 +09:00
Lukáš Krejčí
65006952f3 Changed copyright and e-mail in modified files. 2013-04-27 16:09:15 +02:00
Lukáš Krejčí
4815dbba68 Fixed errors in ChapterFrame constructor.
Fixed errors in ChapterFrame method renderFields.
Fixed errors in TableOfContentsFrame method parseFields.
Added ChapterFrame and TableOfContentsFrame headers and sources to CMakeLists.txt.
Added some basic testing of CHAP and CTOC frames parsing.
2013-04-27 15:42:23 +02:00
Lukáš Krejčí
bcad792e75 Fixed error in childElements function. 2013-04-26 23:16:06 +02:00
Tsuda Kageyu
a80222efa5 Merge pull request #171 from TsudaKageyu/string-test
Add some tests for String
2013-04-26 04:35:57 -07:00
Tsuda Kageyu
5e13e0c838 Add some tests for String 2013-04-26 19:43:10 +09:00
Tsuda Kageyu
58765ac40a Merge pull request #170 from TsudaKageyu/master
Small bug fix in tstring.cpp
2013-04-26 01:52:15 -07:00
Tsuda Kageyu
6e35e56d7f Small bug fix in tstring.cpp 2013-04-26 17:32:39 +09:00
Tsuda Kageyu
a9cdbb7e75 Merge pull request #166 from TsudaKageyu/cmake_test
Refactor out some stuff to CMake tests
2013-04-25 18:54:37 -07:00
Tsuda Kageyu
8c71428d4f Add missing HAVE_WIN_ATOMIC block 2013-04-23 16:25:18 +09:00
Tsuda Kageyu
2c85b4d178 Fix mistaken preprocessor conditionals 2013-04-23 10:42:45 +09:00
Tsuda Kageyu
3293cee11e Skip unnecessary CMake tests 2013-04-23 08:47:48 +09:00
Tsuda Kageyu
27990d0623 Merge pull request #169 from TsudaKageyu/win9x-unicode
Improve Unicode file name handling in Win9x
2013-04-22 10:10:14 -07:00
Tsuda Kageyu
986ee3c44a Improve Unicode file name handling in Win9x 2013-04-23 01:59:02 +09:00
Tsuda Kageyu
dfb3962511 Merge pull request #168 from TsudaKageyu/fix-win9x
Fix a change breaks compatibility with Win9x
2013-04-22 08:28:34 -07:00
Tsuda Kageyu
3e89f7cb40 Fix a change breaks compatibility with Win9x 2013-04-23 00:15:54 +09:00
Tsuda Kageyu
8c233f4552 Merge pull request #167 from TsudaKageyu/filesize
Improve getting file size in Win32
2013-04-21 16:29:26 -07:00
Tsuda Kageyu
c2896fd629 Improve getting file size in Win32 2013-04-22 08:01:25 +09:00
Lukáš Krejčí
fcfd9f59fe Finished parseFields, renderFields and asProperty methods of ChapterFrame and TableOfContentsFrame classes.
Methods setElementID of ChapterFrame and TableOfContentsFrame classes now automatically terminates new element ID with null.
2013-04-21 16:16:57 +02:00
Tsuda kageyu
49b07a2662 Refactor out some stuff to CMake tests 2013-04-21 22:24:12 +09:00
Tsuda Kageyu
529d78f54b Merge pull request #165 from TsudaKageyu/sign-ext
Fix unexpected sign extension
2013-04-21 00:15:02 -07:00
Tsuda kageyu
dc89bdd3f0 Fix unexpected sign extension 2013-04-21 16:06:12 +09:00
Lukáš Krejčí
4be1279430 Added basic members of ChapterFrame and TableOfContentsFrame classes.
Fixed minor bugs in ChapterFrame and TableOfContentsFrame headers.
2013-04-20 16:49:57 +02:00
Lukáš Krejčí
08ae0e8c63 Created CPP and H files for CTOC and CHAP frames. 2013-04-20 15:52:52 +02:00
Tsuda Kageyu
81a9f0474d Merge pull request #161 from TsudaKageyu/fix-syncdata
Fix reading corrupted ID3v2 syncdata
2013-04-19 17:43:16 -07:00
Tsuda kageyu
8a7d1dd796 Fix reading corrupted ID3v2 syncdata 2013-04-20 09:40:01 +09:00
Tsuda Kageyu
457b1abac8 Merge pull request #160 from TsudaKageyu/fix-cast-align
Fix -Wcast-align violation
2013-04-19 14:43:42 -07:00
Tsuda kageyu
e8498b9264 Fix -Wcast-align violation 2013-04-20 05:54:06 +09:00
Tsuda Kageyu
3eeff8b933 Merge pull request #158 from TsudaKageyu/fix-errmsg
Fix an error message in Win32
2013-04-18 14:30:37 -07:00
Tsuda kageyu
d959ab89f1 Fix an error message in Win32 2013-04-19 06:13:27 +09:00
Tsuda Kageyu
b081fb2833 Merge pull request #157 from TsudaKageyu/file-win32
Fix improper file handling in Win32
2013-04-18 06:38:48 -07:00
Tsuda kageyu
e0805b039c Fix improper file handling in Win32 2013-04-18 22:16:59 +09:00
Tsuda Kageyu
c352b5e0c7 Merge pull request #155 from TsudaKageyu/gcc-warnings
Fix some GCC specific warnings
2013-04-18 04:09:30 -07:00
Tsuda kageyu
a71749a6b5 Fix some GCC specific warnings 2013-04-18 19:52:52 +09:00
Tsuda Kageyu
a188778eb8 Merge pull request #154 from TsudaKageyu/tonumber
ByteVector::toUInt() takes offset and length
2013-04-18 03:26:21 -07:00
Tsuda kageyu
439f27640a ByteVector::toUInt() takes offset and length 2013-04-18 18:36:19 +09:00
Tsuda Kageyu
c9209cc99e Merge pull request #150 from TsudaKageyu/detect-codecvt
Detect <codecvt> header automatically
2013-04-17 08:42:14 -07:00
Tsuda kageyu
1370a1cc83 Detect <codecvt> header automatically 2013-04-18 00:32:14 +09:00
Tsuda Kageyu
266e8f5ae4 Merge pull request #149 from TsudaKageyu/fileref-string
Fix improper string handling
2013-04-17 07:55:33 -07:00
Tsuda kageyu
ccaac6c336 Fix improper string handling 2013-04-17 23:47:09 +09:00
Tsuda Kageyu
88005640d5 Merge pull request #148 from TsudaKageyu/reset-smart-pointer
Revert changes concerning the smart pointer
2013-04-17 07:08:36 -07:00
Tsuda kageyu
1f4e06ea7c Revert changes concerning the smart pointer 2013-04-17 22:54:56 +09:00
Tsuda Kageyu
b6c9fb2da1 Merge pull request #147 from TsudaKageyu/shared_ptr
Use shared_ptr if possible regardless of C++11 support
2013-04-17 06:03:28 -07:00
Tsuda kageyu
66f5f396ff Use shared_ptr if possible regardless of C++11 support 2013-04-17 21:41:23 +09:00
Tsuda Kageyu
c9628aae49 Merge pull request #145 from TsudaKageyu/classname
Changed some class names
2013-04-16 20:51:33 -07:00
Tsuda kageyu
bb5d3f0600 Changed some class names 2013-04-17 12:45:14 +09:00
Tsuda Kageyu
1f819ce2c5 Merge pull request #144 from TsudaKageyu/restore-abi2
Restore ABI changed in pull request #60
2013-04-16 20:38:29 -07:00
Tsuda kageyu
593eda7d9d Restore ABI changed in pull request #60 2013-04-17 12:28:00 +09:00
Tsuda Kageyu
14dab7c649 Merge pull request #143 from TsudaKageyu/restore-abi
Restore ABI breaking change
2013-04-16 19:41:55 -07:00
Tsuda kageyu
94a07fa39a Restore ABI breaking change 2013-04-17 11:33:01 +09:00
Tsuda Kageyu
492a0f8199 Merge pull request #142 from TsudaKageyu/shared_ptr
Use std::shared_ptr<T> if C++11 is available
2013-04-16 19:27:42 -07:00
Tsuda kageyu
24736b919a Use std::shared_ptr<T> if C++11 is available 2013-04-17 11:12:42 +09:00
Tsuda Kageyu
38220a57ce Merge pull request #141 from TsudaKageyu/smart-ptr
Replace RefCounter with a smart pointer
2013-04-16 18:38:41 -07:00
Tsuda kageyu
b14dc1572d Replace RefCounter with a smart pointer 2013-04-17 10:10:25 +09:00
Tsuda Kageyu
21964f3cbc Merge pull request #139 from TsudaKageyu/refactor-string
Small refactoring of tstring.cpp
2013-04-16 06:47:28 -07:00
Tsuda kageyu
c13921b7c7 Small refactoring of tstring.cpp 2013-04-16 21:47:12 +09:00
Tsuda Kageyu
39fef2705c Merge pull request #138 from TsudaKageyu/refector-bytevector
Small refactoring of tbytevector.cpp
2013-04-16 05:34:59 -07:00
Tsuda kageyu
8c427c7de9 Small refactoring of tbytevector.cpp 2013-04-16 19:57:04 +09:00
Tsuda Kageyu
0bb995abd0 Merge pull request #137 from TsudaKageyu/refactor-bytevector
Small refactoring of tbytevector.cpp
2013-04-15 22:55:22 -07:00
Tsuda kageyu
0195eef865 Small refactoring of tbytevector.cpp 2013-04-16 14:35:47 +09:00
Tsuda Kageyu
cc3dbd84ce Merge pull request #134 from TsudaKageyu/fix-byteswap
Bug fix for #132
2013-04-15 14:02:17 -07:00
Tsuda kageyu
5e6285afab Bug fix for #132 2013-04-16 05:53:36 +09:00
Tsuda Kageyu
df28a1335a Merge pull request #133 from TsudaKageyu/fix-byteswap
Bug fix for #132
2013-04-15 12:22:37 -07:00
Tsuda kageyu
88a0871784 Bug fix for #132 2013-04-16 04:06:29 +09:00
Tsuda Kageyu
f0edca2f8c Merge pull request #132 from TsudaKageyu/byteswap
Add cross-platform byte order conversions
2013-04-15 08:26:32 -07:00
Tsuda Kageyu
f5462e3e19 Add cross-platform byte order conversions 2013-04-16 00:12:37 +09:00
Lukáš Lalinský
53c5a97b4c Add tests for newline handling in String (#125) 2013-04-15 10:47:43 +02:00
Lukáš Lalinský
a3352fd899 Use the first instance of a MP4 atom (#126)
When a file contains multiple MP4 atoms with the same name, use the first
one. This is consistent with iTunes and other popular software.
2013-04-15 10:13:47 +02:00
Jingmin Wei
4a85e1e1ca Allow the second byte of MPEG header to contain 0xFF
0xFF in the second byte means MPEG Version 1, Layer I, no CRC protection.

http://mpgedit.org/mpgedit/mpeg_format/MP3Format.html
2013-04-15 09:46:08 +02:00
Lukáš Lalinský
94efe5c187 Merge pull request #116 from ufleisch/tagduplication
Parameter to disable duplication between ID3v1 and ID3v2 tags, #115.
2013-04-14 23:47:59 -07:00
Tsuda Kageyu
bef59a0b9a Merge pull request #131 from TsudaKageyu/vc-warning
Fix VC++ specific warnings
2013-04-14 13:29:29 -07:00
Tsuda Kageyu
86142343ee Fix VC++ specific warnings 2013-04-15 05:23:39 +09:00
Tsuda Kageyu
5b2458ed66 Merge pull request #130 from TsudaKageyu/improve-string
Some improvements of String
2013-04-14 13:17:31 -07:00
Tsuda Kageyu
b52cd44c25 Some improvements of String 2013-04-15 05:03:54 +09:00
Tsuda Kageyu
40997e7fc9 Merge pull request #122 from TsudaKageyu/reduce-copy
Reduce unnecessary memory copies by ByteVector
2013-04-06 06:32:26 -07:00
Tsuda Kageyu
a4e68a0304 Reduce unnecessary memory copies by ByteVector 2013-04-05 22:07:58 +09:00
Urs Fleisch
703736fbcb Parameter to disable duplication between ID3v1 and ID3v2 tags, #115. 2013-03-23 13:56:31 +01:00
Tsuda Kageyu
fd45808555 Merge pull request #104 from TsudaKageyu/test-warnings
Fix warnings in test_flacpicture.cpp
2013-03-19 06:03:23 -07:00
Tsuda Kageyu
e9fec47411 Fix warnings in test_flacpicture.cpp 2013-03-19 21:54:56 +09:00
Stephen F. Booth
6029352c09 Merge pull request #96 from nightingale-media-player/master
Make textual lyric frames use UTF8
2013-01-20 07:56:30 -08:00
rsjtdrjgfuzkfg
077208d17a Create UTF8-Lyrics per default. 2013-01-18 17:21:35 +01:00
Michael Helmling
08863dec0b Found and fixed more missing property interface forwarders.
Probably due to a copy-and-paste error the implementation of
File::removeUnsupportedProperties() contained cases for several type
which do not reimplement this method; for others the implementation was
missing and is now included.

In addition, the formats Speex and Opus suffered from the same bug as
OggFLAC in the commit before, which is now fixed.
2013-01-03 23:20:15 +01:00
Michael Helmling
80af92a715 Add forwarders for the property interface to Ogg::FLAC::File.
Fixes an infinite method resolution recursion in File::properties() and
File::setProperties(). Thanks to Sebastian Rachuj for pointing out this bug.
2013-01-03 23:00:17 +01:00
Lukáš Lalinský
237e0ec23c Merge pull request #93 from magcius/master
c: Add support for TAGLIB_STATIC to the C bindings
2013-01-01 03:00:27 -08:00
Jasper St. Pierre
d52e97dfcd c: Add support for TAGLIB_STATIC to the C bindings
Otherwise, we'll fail with dllimport/dllexport linking errors on
Windows.
2013-01-01 04:28:00 -05:00
Michael Helmling
8329d6ac1a Update documentation of the property map interface in TagLib::File. 2012-12-27 11:38:01 +01:00
Michael Helmling
f1d723077f Consistently handle invalid and deprecated tags in setProperties()
This commit reverts the use of strip() in setProperties() because the
latter function should not change the file before save() is called.
Instead, the following policy is now consistently applied for file formats
with multiple tag types:
- the recommended tag type is created, if it does not exist
- deprecated tags are updated, if they exist, but not created
- illegal tag types are ignored by setProperties(), but used in properties()
  if no others exist.

The only tag types considered "illegal" so far are APEv2 in MPEG and ID3 in FLAC.
2012-12-26 22:46:37 +01:00
Michael Helmling
a095c468b2 Revert "Add a test to show a problem with properties() and duplication."
This reverts commit 6e3391a846. The "problem" demonstrated in there won't be fixed due to lack of significance.
2012-12-20 17:30:19 +01:00
Michael Helmling
b14e6a3570 Update for pull request #89: Change how setProperties() updates tags.
For file types supporting more than one tag format, setProperties() now always creates the most modern one. Deprecated tags are stripped.
2012-12-20 17:28:50 +01:00
Michael Helmling
6e3391a846 Add a test to show a problem with properties() and duplication. 2012-12-10 21:22:11 +01:00
Michael Helmling
c0ca5c97d5 Fix issue #88 by changing the behavior of setProperties().
For file types that support multiple tag standards (for example, FLAC
files can have ID3v1, ID3v2, and Vorbis comments) setProperties is now
called for all existing tags instead of only for the most recommended
one.
This fixes the problem that under some circumstances it was not possible
to delete a value using setProperties() because upon save() the call to
Tag::duplicate recovered that value from the ID3v1 tag.
2012-12-10 20:56:16 +01:00
Michael Helmling
d5cf6d72e2 Merge remote-tracking branch 'official/master' 2012-12-10 19:55:29 +01:00
Michael Helmling
9eb0f2941f Add a test case for the return value of setProperties() 2012-12-10 19:55:23 +01:00
naota
3fa295d99d Include sys/stat.h to define S_* properly
Without including sys/stat.h, this file failed to build on FreeBSD with the following error.

In file included from /var/tmp/portage/media-libs/taglib-1.8/work/taglib-1.8/tests/test_trueaudio.cpp:5:0:
/var/tmp/portage/media-libs/taglib-1.8/work/taglib-1.8/tests/utils.h: In function 'std::string copyFile(const string&, const string&)':
/var/tmp/portage/media-libs/taglib-1.8/work/taglib-1.8/tests/utils.h:36:62: error: 'S_IRUSR' was not declared in this scope
/var/tmp/portage/media-libs/taglib-1.8/work/taglib-1.8/tests/utils.h:36:72: error: 'S_IWUSR' was not declared in this scope
In file included from /var/tmp/portage/media-libs/taglib-1.8/work/taglib-1.8/tests/test_mpeg.cpp:6:0:
/var/tmp/portage/media-libs/taglib-1.8/work/taglib-1.8/tests/utils.h: In function 'std::string copyFile(const string&, const string&)':
/var/tmp/portage/media-libs/taglib-1.8/work/taglib-1.8/tests/utils.h:36:62: error: 'S_IRUSR' was not declared in this scope
/var/tmp/portage/media-libs/taglib-1.8/work/taglib-1.8/tests/utils.h:36:72: error: 'S_IWUSR' was not declared in this scope
gmake[2]: *** [tests/CMakeFiles/test_runner.dir/test_mpeg.cpp.o] Error 1
2012-11-28 07:54:08 +09:00
Lukáš Lalinský
812f63502b Implement the PropertyMap interface for WMA 2012-11-23 09:32:00 +01:00
Lukáš Lalinský
353eb9f00f Implement the PropertyMap interface for MP4 2012-11-22 10:40:22 +01:00
Lukáš Lalinský
1b813d9d6c Document sort names 2012-11-21 17:26:17 +01:00
Lukáš Lalinský
c5dade5ee7 Use names that are consistent with Vorbis Comments 2012-11-21 17:24:32 +01:00
Lukáš Lalinský
e75d6f616c Add support for reading MusicBrainz IDs from ID3v2 tags to PropertyMap 2012-11-21 17:21:30 +01:00
Lukáš Lalinský
15b601f053 Use PropertyMap in tagreader 2012-11-21 14:40:26 +01:00
Lukáš Lalinský
45317ef7f2 Revert "Fix opening of read-only files on Windows"
This reverts commit ade8dc1a21.
2012-11-20 18:34:51 +01:00
Lukáš Lalinský
3da792152a Merge pull request #85 from TsudaKageyu/fix-readonly
Fix reading read-only files in Win32
2012-11-20 09:23:16 -08:00
Tsuda Kageyu
3f6da779d2 Fix compilation in non-Win32 2012-11-20 22:46:03 +09:00
Tsuda Kageyu
57b8ae6e1c Fix reading read-only files in Win32 2012-11-20 22:20:34 +09:00
Lukáš Lalinský
ade8dc1a21 Fix opening of read-only files on Windows
The CreateFile* functions return INVALID_HANDLE_VALUE on error, not NULL.

http://article.gmane.org/gmane.comp.kde.devel.taglib/2346
2012-11-20 14:15:16 +01:00
Lukáš Lalinský
c6f7ad3e83 Revert "Add a tool to inspect audio files, only MP4 is implemented for now"
This reverts commit 45b0279b41.
2012-11-12 16:14:32 +01:00
Lukáš Lalinský
dbe6be778b Build also examples 2012-11-11 16:44:01 +01:00
Lukáš Lalinský
45b0279b41 Add a tool to inspect audio files, only MP4 is implemented for now 2012-11-11 16:43:36 +01:00
Lukáš Lalinský
3a5aeb4573 Parse covr atoms with type 0 (fixes issue #84) 2012-11-11 16:04:08 +01:00
Lukáš Lalinský
72745846f4 Update NEWS 2012-11-11 14:49:31 +01:00
Lukáš Lalinský
9e788bb8c2 Fix tests when compiled with clang on Linux 2012-11-11 14:26:10 +01:00
Lukáš Lalinský
56fbe7e14d Make travis run tests also with clang 2012-11-10 20:51:17 +01:00
Lukáš Lalinský
44155f6771 Merge pull request #79 from gonemad/master
Check if file is open before reading tags
2012-11-04 01:27:43 -07:00
Lukáš Lalinský
341711c04b Merge pull request #83 from jmarshallnz/more_itunes_hacks
A small fix, and some additional iTunes hacks (v2.2 frames in v2.3 tag)
2012-11-04 01:26:26 -07:00
Jonathan Marshall
be6187e893 adds new iTunes hack for v2.2 frames stored in a v2.3 tag (iTunes v8.1.1.10 for example) 2012-11-04 19:54:28 +13:00
Jonathan Marshall
c42bdeab43 fixes noop frame id size check in ID3v2::FrameFactory::createFrame 2012-11-04 19:52:10 +13:00
gonemad
7d7c58cb8e Merge branch 'master' of https://github.com/taglib/taglib 2012-10-18 20:17:35 -04:00
Lukáš Lalinský
044da877e6 Make sure we build the tests 2012-10-13 13:38:35 +02:00
Lukáš Lalinský
2d7686b5fa Actually run the tests 2012-10-13 13:36:33 +02:00
Lukáš Lalinský
074f6db6d8 Needs sudo 2012-10-13 13:34:44 +02:00
Lukáš Lalinský
7a884af0ef Experimenting with Travis CI 2012-10-13 13:33:36 +02:00
Lukáš Lalinský
e568e1019d Remove useless debug print 2012-10-13 09:11:20 +02:00
Lukáš Lalinský
ca543039a5 Include Opus in docs 2012-10-13 09:06:09 +02:00
Lukáš Lalinský
5e7b1da632 Add support for Ogg Opus 2012-10-13 08:55:23 +02:00
gonemad
6b9ef6421f Fixed indents 2012-10-11 22:10:19 -04:00
gonemad
d15c8453ac Added check if file is open before attempting to read tags 2012-10-11 21:20:03 -04:00
Lukáš Lalinský
1e660dda71 Partial changelog for 1.9 2012-10-10 17:09:03 +02:00
Lukáš Lalinský
2a77afc593 Merge remote-tracking branch 'nightingale/master' 2012-10-10 16:45:36 +02:00
Tsuda Kageyu
a9df3e48f7 Fix a bug in updating MP4 tags 2012-10-10 21:17:05 +09:00
rsjtdrjgfuzkfg
c8994ede3f Restrict url frame generation to W??? Frames to prevent known non-text non-url frameIDs to be handled as url when containing only one String. No longer describe the default comment as "COMMENT". 2012-10-08 20:19:12 +02:00
Lukáš Lalinský
7e255733e0 Merge remote-tracking branch 'TsudaKageyu/id3v1-genrenumber' 2012-10-08 13:23:17 +02:00
Julien Ramseier
72f9a96cce Fix missing CppUnit include directive 2012-10-07 15:41:40 +02:00
Stephen F. Booth
1308ff6479 Merge pull request #73 from ArnaudBienner/master
Corrupted FLAC files scan can result in heavy CPU consumption: fix
2012-10-07 05:29:02 -07:00
Arnaud Bienner
b7a15092d8 Faster FLAC::FilePrivate destructor 2012-10-07 03:07:53 +02:00
Arnaud Bienner
ad9ffc62e6 Consider FLAC file as being invalid if a 0 length block is found 2012-10-07 03:04:02 +02:00
Tsuda Kageyu
46e613dcca Add reading/writing ID3v1 genre in number 2012-10-04 19:23:10 +09:00
Urs Fleisch
2d7414733e Crash when saving xm files (fixes #68) 2012-09-30 15:42:16 +02:00
Lukáš Lalinský
9f597bab1b Change some variables to follow the TagLib naming convention 2012-09-30 10:50:19 +02:00
Lukáš Lalinský
321b9b5a8b Merge remote-tracking branch 'TsudaKageyu/filestream' 2012-09-30 10:43:58 +02:00
Lukáš Lalinský
60a3a4e455 Various uint fixes
We really need to get rid of TagLib::uint...
2012-09-30 10:22:10 +02:00
Lukáš Lalinský
57e5cc8c17 Merge remote-tracking branch 'TsudaKageyu/infotag-patch' 2012-09-30 10:15:56 +02:00
Lukáš Lalinský
5250673fa0 Merge pull request #70 from FestusHagen/taglib-config_cmd
Win32 taglib-config.cmd support.
2012-09-30 01:06:49 -07:00
Lukáš Lalinský
ab5e19a016 Merge pull request #69 from FestusHagen/SW_MinGW
Silence warnings with MinGW 4.6.3.
2012-09-29 06:54:36 -07:00
Festus Hagen
8790e9de01 Silence warnings with MinGW 4.6.3. 2012-09-29 09:01:44 -04:00
Festus Hagen
1086d4476d Win32 taglib-config.cmd support. 2012-09-28 21:41:45 -04:00
Lukáš Lalinský
7b80418122 Fix the version number 2012-09-26 20:30:53 +02:00
Stephen F. Booth
02d034f53f Merge pull request #65 from TsudaKageyu/tagsondisk
Add MPEG::FILE::Has*Tag functions
2012-09-08 05:14:30 -07:00
Tsuda Kageyu
e7126db97c Add MPEG::FILE::Has*Tag functions 2012-09-08 14:13:20 +09:00
Tsuda Kageyu
4582ea3b27 Fixed CMakeLists.txt 2012-09-08 01:17:15 +09:00
Tsuda Kageyu
43e100fd37 FileStream improvement in Win32 2012-09-07 23:48:06 +09:00
Tsuda Kageyu
071a1477b5 Fixed an API change 2012-09-07 08:16:30 +09:00
Tsuda Kageyu
61c8013f2c Added missing comments 2012-09-07 08:16:28 +09:00
Tsuda Kageyu
9c8c215c30 Support INFO tags of RIFF wave files. 2012-09-07 08:16:26 +09:00
Lukáš Lalinský
aa34afda79 Merge remote-tracking branch 'TsudaKageyu/substr-bug' 2012-09-06 20:03:15 +02:00
Lukáš Lalinský
942ec58de5 Add tests for String::substr 2012-09-06 20:03:08 +02:00
Lukáš Lalinský
082a36147b Add change log, update SOVERSION 2012-09-06 19:57:10 +02:00
Lukáš Lalinský
f11b206fe8 Do not delete the IOStream object in TagLib::File 2012-09-06 19:43:52 +02:00
Lukáš Lalinský
e37f6ed752 Update CMakeLists.txt 2012-09-06 19:30:45 +02:00
Lukáš Lalinský
d2f20e8d2a Merge branch 'master' of https://github.com/moeeka/taglib 2012-09-06 19:24:22 +02:00
Rupert Daniel
f194a55c0f Updated OWNE implementaion with minor changes after pull review 2012-09-06 12:11:20 +01:00
Rupert Daniel
719187794e Implementation of the ID3v2.4 OWNE frame. 2012-09-05 16:37:46 +01:00
Tsuda Kageyu
74b94613a0 Bug fix in String::substr() 2012-09-05 19:46:52 +09:00
Lukáš Lalinský
33d0be110b Fix ambiguous reference to uint in tests 2012-09-03 19:55:55 +02:00
Tsuda Kageyu
df12b4ffc6 Refectored the FileStream constructor. 2012-09-03 01:45:28 +09:00
Tsuda Kageyu
d16c24ae21 Merge branch 'master' of https://github.com/taglib/taglib into security-warnings 2012-09-02 23:40:11 +09:00
Lukáš Lalinský
1c35918834 Merge remote-tracking branch 'TsudaKageyu/warnings' 2012-09-02 15:25:41 +02:00
Tsuda Kageyu
d163f36d35 Fix Visual C++ specific warnings about security 2012-08-23 21:57:12 +09:00
Tsuda Kageyu
590cd4c9f6 Fix warnings with VS2010 2012-08-23 20:54:18 +09:00
Tsuda Kageyu
6c0227ee13 Fix compilation errors with Visual Studio 2010 2012-08-23 19:58:21 +09:00
Lukáš Lalinský
9bb57fe0a7 Merge remote-tracking branch 'TsudaKageyu/id3v2-comment-update' 2012-08-23 11:00:32 +02:00
tsuda.kageyu@gmail.com
3fecdbf428 Comment update for ID3v2::Tag::setLatin1StringHandler() 2012-08-23 17:57:00 +09:00
Lukáš Lalinský
356c7a5d6e Merge remote-tracking branch 'TsudaKageyu/cross-border-delete' 2012-08-23 10:51:47 +02:00
tsuda.kageyu@gmail.com
4b4f70253b Comment update for ID3v1::Tag::setStringHandler() 2012-08-23 17:45:25 +09:00
Lukáš Lalinský
8b61a06fda Merge remote-tracking branch 'TsudaKageyu/id3v2-brokenlatin1-patch' 2012-08-23 10:22:43 +02:00
Lukáš Lalinský
6801ac2515 Merge remote-tracking branch 'poiru/master' 2012-08-23 10:19:08 +02:00
Lukáš Lalinský
29d17bb8e9 Merge remote-tracking branch 'supermihi/master' 2012-08-23 10:17:05 +02:00
tsuda.kageyu@gmail.com
fe8053c7d5 Support broken Latin-1 encodings in ID3V2 2012-08-23 12:19:51 +09:00
tsuda.kageyu@gmail.com
eb63ee8ec6 Remove possible cross binary boundary delete 2012-08-23 11:09:22 +09:00
Lukáš Lalinský
e86e5f906b ID3 frame IDs with 0 should be recognized as valid
http://article.gmane.org/gmane.comp.kde.devel.taglib/2275
2012-08-17 07:50:48 +02:00
Lukáš Lalinský
60e82e6694 Ignore additional files 2012-08-17 07:34:44 +02:00
Birunthan Mohanathas
fc6e02da35 Update header comments to reflect c4163a2 2012-08-02 17:25:20 +03:00
Michael Helmling
4140c5f2eb Check PropertyMap keys format-specifically instead of globally.
Instead of statically forbidding certain keys in PropertyMap, now the
setProperties() implementations of the different formats check if the
keys are valid for that particular specification and include them in
the returned PropertyMap otherwise.
This should remove an unneccessary complification for programmers since
now there's only one step, namely calling setProperties(), where
problems might occur.
Also the previous implementation leads to problems with invalid keys:
because taglib doesn't use exceptions, something like

  map.insert("FORBIDDEN KEY", "some value");

would lead to the value being inserted under String::null, which
smells like the source of strange bugs.
2012-07-30 20:52:30 +02:00
Michael Helmling
fc3fc10f60 add id3v2 frame delete test 2012-07-23 20:53:25 +02:00
BSDKaffee
3bc123aed6 - Disambiguate uint and ushort references 2012-07-15 01:57:53 -04:00
Lukáš Lalinský
3b392f2402 Changelog for 1.8 beta 2012-07-14 21:53:09 +02:00
Lukáš Lalinský
8ff0feb28e Cast to long 2012-07-14 21:21:03 +02:00
Lukáš Lalinský
61ed295af8 Merge remote-tracking branch 'poiru/master' 2012-07-14 21:09:54 +02:00
Lukáš Lalinský
09af2a7b57 Merge remote-tracking branch 'robinst/mpeg-file-id3vxtag-docs-inexistent-tags' 2012-07-14 21:08:59 +02:00
Lukáš Lalinský
050ff3835d Revert "Install examples if built."
This reverts commit 52e96e48c5.
2012-07-14 21:06:53 +02:00
Lukáš Lalinský
674ae0fa6d Merge remote-tracking branch 'kensington/master' 2012-07-14 21:06:08 +02:00
Lukáš Lalinský
411d318f34 Merge remote-tracking branch 'robinst/dont-copy-from-id3v1-when-only-saving-id3v2' 2012-07-14 21:03:16 +02:00
Lukáš Lalinský
fbb1c7e554 Merge branch 'mpc_sv8' 2012-07-11 14:15:37 +02:00
Lukáš Lalinský
fd818857e0 More Musepack tests 2012-07-11 14:15:12 +02:00
Lukáš Lalinský
930168f990 Refactoring of the Musepack SV8 properties code 2012-07-11 14:13:41 +02:00
Alex Novichkov
291d925fc1 MPC v8 audio properties 2012-07-11 13:08:10 +02:00
Scott Wheeler
7c4c455a40 Use '0' here instead of 'NULL'
0 is used throughout the rest of the TagLib source, and generally
preferred in C++:

http://www2.research.att.com/~bs/bs_faq2.html#null
2012-07-03 12:26:20 +02:00
Stephen F. Booth
f429d6f406 Merge pull request #41 from EliaCereda/master
Properly initialize frame
2012-06-30 07:33:25 -07:00
Elia Cereda
c68fe9ad7b Fixed error "Branch condition evaluates to a garbage value" (from Xcode 4.3.3 Static Analyzer, mpeg/id3v2/id3v2tag.cpp:377)
This error occurs when the frame variable is left uninitialized because its id doesn't match any of the ids in the if and else-id cases. Initializing it on declaration fixes this issue.
2012-06-30 16:25:33 +02:00
Stephen F. Booth
81aac3a590 Merge pull request #39 from robinst/install-build-tests-option
Mention -DBUILD_TESTS=on in "Unit Tests" of INSTALL
2012-06-11 04:57:04 -07:00
Robin Stocker
7279b4fb7b Don't duplicate from ID3v1 to ID3v2 when saving only ID3v2
When saving only v2 with stripOthers (which means stripping v1), the
data from v1 would still be duplicated to v2. Likewise for the other way
around.

This is not the expected outcome when e.g. a frame was removed in v2,
because it would be added again on save from the v1 data. The test shows
that.

This changes save to only duplicate the data when the other tag type
will not be stripped.
2012-06-10 18:53:25 +02:00
Robin Stocker
b0ac79c60e Mention -DBUILD_TESTS=on in "Unit Tests" of INSTALL 2012-06-10 18:26:06 +02:00
Robin Stocker
382aec46f7 Fix docs of MPEG::File::ID3v(1|2)Tag for inexistent tag
Since 37e2d629, the ID3v1 and ID3v2 tags are always created at the end
of MPEG::File::read. So contrary to what the documentation said, a null
pointer is never returned.

To check if a tag contains data, refer to isEmpty() in the
documentation.
2012-06-10 15:27:54 +02:00
Michael Palimaka
b5ad68d64b Add custom 'check' target that depends on the test_runner target for backwards compatibility. 2012-05-17 03:42:36 +10:00
Michael Palimaka
52e96e48c5 Install examples if built. 2012-05-16 04:37:25 +10:00
Michael Palimaka
5bcfecb6cc Use ctest instead of custom target. 2012-05-16 04:00:22 +10:00
Lukáš Lalinský
2c2a486313 Merge branch 'stable'
Conflicts:
	CMakeLists.txt
	NEWS
2012-04-20 18:30:07 +02:00
Lukáš Lalinský
059f2243b3 Prepare 1.7.2 release 2012-04-20 17:57:13 +02:00
Lukáš Lalinský
cce6ad46c9 Reverse the version check, similarly to what mp4v2 does 2012-04-20 17:52:12 +02:00
Birunthan Mohanathas
06597123b8 Remove trailing whitespace 2012-04-19 13:09:45 +03:00
Birunthan Mohanathas
e5ede410bc Tabs to spaces 2012-04-19 13:04:42 +03:00
Vinnie Falco
dafb3af742 Remove 'using namespace std' in tmap.h 2012-04-17 22:05:09 -07:00
Lukáš Lalinský
089643f115 Merge remote-tracking branch 'vinniefalco/rename_enums' 2012-04-17 08:49:02 +02:00
Vinnie Falco
26f458b87f Resolve scope resolution for APE::Footer definitions in apefooter.cpp 2012-04-15 07:58:50 -07:00
Vinnie Falco
c22791318c Resolve ambiguous File symbol in apetag.cpp 2012-04-15 07:57:02 -07:00
Vinnie Falco
5081e3cf4f Rename anonymous enumeration symbols to be unique trueaudiofile.cpp 2012-04-15 02:41:27 -07:00
Vinnie Falco
1bde4cea09 Rename anonymous enumeration symbols to be unique in wavpackfile.cpp 2012-04-15 02:40:46 -07:00
Vinnie Falco
0907e86a94 Rename anonymous enumeration symbols to be unique in apefile.cpp 2012-04-15 02:40:23 -07:00
Vinnie Falco
742a3a1dbb Rename anonymous enumeration symbols to be unique in mpcfile.cpp 2012-04-15 02:39:19 -07:00
Vinnie Falco
04a4a6b8d4 Rename anonymous enumeration symbols to be unique in flacfile.cpp 2012-04-15 02:38:15 -07:00
Jeff Mitchell
b216b448c5 Fix compilation 2012-04-12 18:41:40 -04:00
Stephen F. Booth
4f8a6fdfaf Verify that an APE text item isn't empty before use 2012-04-12 10:53:32 -04:00
Stephen F. Booth
32a4ac6599 Preserve source code backward compatibility 2012-04-10 18:06:58 -04:00
Stephen F. Booth
ca26a9ad3e Added support for APE tag binary items 2012-04-10 07:24:12 -04:00
Stephen F. Booth
bd03e352cc Allow tag items to be replaced 2012-04-07 08:54:22 -04:00
Stephen F. Booth
69ac59f5f0 Added sampleFrames() to audio properties 2012-04-06 18:30:13 -04:00
Stephen F. Booth
2297a6d531 Added missing tmap.h 2012-04-06 18:29:56 -04:00
Lukáš Lalinský
2a4850f211 Merge branch 'stable'
Conflicts:
	CMakeLists.txt
2012-03-18 09:22:53 +01:00
scottmc
288c6e4a3f Include <iostream> instead of <ostream> to fix compilation on Haiku 2012-03-18 09:20:26 +01:00
Lukáš Lalinský
606edf8171 Increment the version number 2012-03-17 11:02:24 +01:00
Lukáš Lalinský
3c7b05a900 Merge branch 'stable'
Conflicts:
	NEWS
2012-03-17 10:59:34 +01:00
Lukáš Lalinský
009c43952f Changelog 2012-03-17 10:58:22 +01:00
Birunthan Mohnathas
9c1668f28b Fixed (huge) memory leak with ASF. 2012-03-17 10:48:57 +01:00
Lukáš Lalinský
8e67b40bdc Fix compilation errors 2012-03-17 10:45:52 +01:00
Lukáš Lalinský
76222cb1eb Merge branch 'master' of https://github.com/supermihi/taglib 2012-03-17 10:41:02 +01:00
Birunthan Mohnathas
138dfca682 Additional change to previous fix. 2012-03-12 22:13:58 +02:00
Birunthan Mohnathas
c4163a26e8 Fixed memory leak of FrameFactory singleton. 2012-03-12 18:56:08 +02:00
Birunthan Mohnathas
4496efe33b Fixed (huge) memory leak with ASF. 2012-03-12 18:44:08 +02:00
Lukáš Lalinský
3a760b060c Merge branch 'stable'
Conflicts:
	taglib/riff/aiff/aiffproperties.cpp
	taglib/trueaudio/trueaudioproperties.cpp
	tests/test_wav.cpp
2012-03-10 09:16:37 +01:00
Lukáš Lalinský
110cac8429 Avoid uint overflow in case the length + index is over UINT_MAX 2012-03-10 09:13:04 +01:00
Lukáš Lalinský
258ae751b5 Don't store the output of ByteVector::toUInt() in int, use uint instead 2012-03-10 09:12:32 +01:00
Lukáš Lalinský
df1d3e028e Make sure to not try dividing by zero 2012-03-10 09:12:19 +01:00
Stephen F. Booth
23c86cf27d Check if the header is TTA1 before parsing 2012-03-10 09:11:51 +01:00
Lukáš Lalinský
f59c3b67aa Detect RIFF files with invalid chunk sizes
The bug report has a WAVE file with zero-sized 'data' chunk, which causes
TagLib to iterate over the file, 8 bytes in each iteration. The new code
adds a check for the chunk name, which forces it to mark the file as
invalid if the chunk name doesn't contain ASCII characters.

https://bugs.kde.org/show_bug.cgi?id=283412
2012-03-10 09:06:55 +01:00
Stephen F. Booth
294cb22241 Don't crash when wav files have a 0 for bit per channel (sampleWidth)
I've seen this in a wav that has an audio format of MP3 (0x55)
2012-03-10 08:58:45 +01:00
Frank Lai
b7ec0d26ab Be more careful when parsing Vorbis Comments 2012-03-10 08:52:59 +01:00
Scott Wheeler
934ce51790 Don't lead the scanned blocks on save 2012-03-10 08:52:17 +01:00
Lukáš Lalinský
dcdf4fd954 Avoid uint overflow in case the length + index is over UINT_MAX 2012-03-10 08:46:20 +01:00
Lukáš Lalinský
ab8a0ee893 Don't store the output of ByteVector::toUInt() in int, use uint instead 2012-03-04 12:01:21 +01:00
Lukáš Lalinský
77d61c6eca Make sure to not try dividing by zero 2012-03-04 11:51:05 +01:00
Michael Helmling
f5a2518273 Fixed handling of UnknownFrames in ID3v2.
- If an unknown frame with id "XXXX" occurs, an entry
"UNKNOWN/XXXX" is added to unsupportedData().
The removeUnsupportedProperties() method in turn
removes all unknown frames with id "XXXX" if it
encounters a string "UNKNOWN/XXXX" in the given list.

- Implemented findByDescription() to UnsynchronizedLyricsFrame
in order to support removal of lyrics frames with unsupported
keys.

- Adapted id3v2 test case to new QuodLibet policy.
2012-02-26 19:21:57 +01:00
Michael Helmling
6e6d823992 Removed quodlibet special case handling 2012-02-26 18:38:03 +01:00
Michael Helmling
f859fcf82a Add support for Unknown TXXX frames. 2012-02-26 18:07:02 +01:00
Michael Helmling
37c87e0317 Fixed identation 2012-02-26 10:56:18 +01:00
Michael Helmling
0a3b998ca5 Fix USLT frame creation in Frame::createTextualFrame() 2012-02-26 10:43:08 +01:00
Michael Helmling
fa0656e3c6 remove Tests/Examples build from CMakeLists 2012-02-26 10:37:59 +01:00
Michael Helmling
b05c3161c7 Added ID3v2 PropertyMap interface documentation. 2012-02-25 19:11:31 +01:00
Michael Helmling
79670beca1 some cosmetic changes 2012-02-25 18:59:53 +01:00
Michael Helmling
9fd22023cd Merge remote-tracking branch 'official/master' 2012-02-25 18:51:30 +01:00
Michael Helmling
b8d5246f88 Moved APE test to correct place; added MOD tag test. 2012-02-25 18:46:19 +01:00
Michael Helmling
05b5e06928 added APE tag PropertyMap test 2012-02-25 18:32:00 +01:00
Michael Helmling
d28cc83fb4 Added another test for ID3v2 PropertyMap interface; fixed various bugs 2012-02-25 18:22:17 +01:00
Michael Helmling
495a028da3 removed debug messages 2012-02-19 15:15:25 +01:00
Michael Helmling
23d303a896 fixed bugs preventing tests from running 2012-02-19 15:13:31 +01:00
Michael Helmling
6c054af3ed Added some functions, started to fix bugs. 2012-02-19 12:15:28 +01:00
Michael Helmling
70c3264279 fixed tests 2012-02-15 22:09:28 +01:00
Michael Helmling
cfa5ac6569 Fixed id3v2 test 2012-02-15 21:56:02 +01:00
Michael Helmling
de51307de7 Added lots of missing includes 2012-02-15 21:54:19 +01:00
Michael Helmling
140f4a57e2 fixed lots of bugs found by 'make' 2012-02-14 22:11:30 +01:00
Michael Helmling
8a8e9b702c Ported xm. 2012-02-14 21:35:50 +01:00
Michael Helmling
d6215365a1 Ported wavpack. 2012-02-14 21:34:43 +01:00
Michael Helmling
2185d52f56 Ported trueaudio. 2012-02-14 21:32:36 +01:00
Michael Helmling
48aaaf8dc4 Ported s3m; removed old id3v2dicttools. 2012-02-14 21:29:30 +01:00
Michael Helmling
d2c43d7174 ID3 interface complete; vorbis done; wav done 2012-02-14 21:27:14 +01:00
Lukáš Lalinský
cdfb447042 Add explicitly declared default constructor to StringHandler 2012-02-04 21:22:52 +01:00
Lukáš Lalinský
2d00b690de Merge branch 'master' of https://github.com/poiru/taglib 2012-02-04 20:38:14 +01:00
Stephen F. Booth
51675f3399 Added sampleFrames to FLACProperties 2012-02-04 11:34:40 -05:00
Stephen F. Booth
fa662a23db Check if the header is TTA1 before parsing 2012-02-04 08:39:45 -05:00
Stephen F. Booth
dc628204c0 Added sampleFrames() for TTA files 2012-02-04 08:30:34 -05:00
Birunthan Mohanathas
9564956a7f Removed space. 2012-02-02 18:12:37 +02:00
Birunthan Mohnathas
1f2248d24b Additional change to previous fix. 2012-02-02 17:50:58 +02:00
Birunthan Mohnathas
06424598bb Fixed memory leak. 2012-02-02 15:03:41 +02:00
Stephen F. Booth
7b3f279294 Correctly handle non-integral bit depths 2012-01-30 22:31:15 -05:00
Michael Helmling
a8632f710f More progress in ID3 ... setProperties() will get messy :( 2012-01-22 22:06:24 +01:00
Michael Helmling
0c8e5bbec8 Implemented asProperties() in all relevant textual frames. 2012-01-22 17:08:02 +01:00
Michael Helmling
a5e45f196b Started to work on ID3v2. 2012-01-21 23:05:59 +01:00
Michael Helmling
e4d955d6ef Migration to new PropertyMap ... done ape to mod. 2012-01-21 14:52:24 +01:00
Michael Helmling
18ae797df4 Add unsupportedData() to PropertyMap, simplified [] behavior. 2012-01-17 18:09:30 +01:00
Michael Helmling
d11189b975 Basic implementation of a PropertyMap.
Implemented key/valuelist property map with
case-insensitive ASCII keys and StringList values.

Todo:
- subclass StringList to add flags indicating whether a value could
be written to the specific file format
- add member attribute indicating list of frames that could not be
parsed into the PropertyMap representation.
2012-01-16 22:37:30 +01:00
Michael Helmling
67d896e6a7 Implemented the most easy comments on the pull request. 2012-01-14 22:02:17 +01:00
Michael Helmling
ea41cd8903 Merge remote-tracking branch 'official/master' 2012-01-14 20:57:15 +01:00
Lukáš Lalinský
d904281c6b Make it possible to generate an XML report 2012-01-14 10:16:54 +01:00
Lukáš Lalinský
40bf52e70f Reverse the version check, similarly to what mp4v2 does 2012-01-10 17:18:20 +01:00
Lukáš Lalinský
b981b6dde7 Check also for the deprecated GIF type 2012-01-08 15:54:15 +01:00
Lukáš Lalinský
c237998983 Support non-UTF8 free-form atoms 2012-01-08 13:17:42 +01:00
Urs Fleisch
5ff810e98d Support for ID3v2.2 frames used by iTunes (TCP, TS2, TSA, TSC, TSP, TST)
https://bugs.kde.org/show_bug.cgi?id=290330
2012-01-05 16:33:29 +01:00
Michael Helmling
7875d02a8f Merge remote-tracking branch 'official/master' 2012-01-04 19:49:50 +01:00
Scott Wheeler
baafb3e290 Funny that there managed to be no operator!= for String for so long. 2012-01-01 16:01:18 +01:00
Michael Helmling
c4cef55158 Added tests and information about ignored id3 frames.
The ID3v2::toDict() function now has an optional
StringList* argument which will contain information
about frames that could not be converted to the dict
interface.
There are some dict tests for APE and FLAC now, and the
ID3v2 test was enlarged.
2012-01-01 14:42:48 +01:00
Michael Helmling
0eaf3a3fbd Implemented dict interface for more formats.
Now supported: MOD files (IT, MOD, S3M, XM), RIFF files
(AIFF, WAV), TrueAudio, WavPack.
2011-11-02 21:02:35 +01:00
Michael Helmling
292a377d1e Merge remote-tracking branch 'official/master' 2011-10-30 18:28:52 +01:00
Lukáš Lalinský
6ea8599313 Detect RIFF files with invalid chunk sizes
The bug report has a WAVE file with zero-sized 'data' chunk, which causes
TagLib to iterate over the file, 8 bytes in each iteration. The new code
adds a check for the chunk name, which forces it to mark the file as
invalid if the chunk name doesn't contain ASCII characters.

https://bugs.kde.org/show_bug.cgi?id=283412
2011-10-08 18:41:15 +02:00
Michael Helmling
772bc9f7c4 Further cleanup and simplification in id3v2dicttools 2011-09-12 21:52:11 +02:00
Michael Helmling
0c2ca20ec2 Restructured and simplified ID3v2Tag::fromDict(). 2011-09-11 22:07:49 +02:00
Michael Helmling
2d31075047 Splitted ID3v2Tag::toDict() into several functions.
This should simplify future transition to virtual functions.
2011-09-11 18:22:15 +02:00
Graham Perks
837c9ef288 Add cmake option for visibility=hidden 2011-09-09 10:17:54 -05:00
Michael Helmling
0356249368 Merge remote-tracking branch 'official/master' 2011-09-01 16:33:39 +02:00
Michael Helmling
5647b2e293 Made im/export functions nonvirtual. Added similar functions to File and
its subclasses. TagLib::File contains a bunch of dynamic_casts to call
the correct specializations.
2011-08-28 22:58:40 +02:00
Lukáš Lalinský
686bcf55a9 Add support for iPhone ringtones 2011-08-28 11:02:34 +02:00
Michael Helmling
fa8159a9d0 Added toDict and fromDict methods for APE tags. 2011-08-27 22:30:20 +02:00
Michael Helmling
58db919e43 More support for the unified dictionary interface.
Addded fromDict() function to ID3v2Tag. Added fromDict() and
toDict() functions to the TagUnion class (uses the first non-empty tag).
Added fromDict() and toDict() functions for the generic Tag class, only
handling common tags without duplicates. Addded preliminary mp3 test
case. Python3 bindings now available on my github site.
2011-08-27 01:18:21 +02:00
Michael Helmling
b262180857 Some preliminary work for unified dictionary tag interface support.
- toDict() and fromDict() for XiphComments
- toDict() for ID3v2 Tags
2011-08-26 21:48:40 +02:00
Tim De Baets
bec3875b94 Added removePicture() to FLAC::File 2011-08-16 01:57:01 +02:00
Urs Fleisch
ce53d13af1 Add suport for more MP4 metadata atoms
https://bugs.kde.org/show_bug.cgi?id=275784
2011-08-13 17:07:41 +02:00
Mathias Panzenböck
4868bb5690 ByteVector::replace: test shrinking 2011-08-06 19:43:17 +02:00
Jonathan Liu
7cc36db760 Use the default frame factory when it's necessary to parse ID3v2 tags in APE files
https://bugs.kde.org/show_bug.cgi?id=278773
2011-08-06 11:05:20 +02:00
Lukáš Lalinský
028f831417 Basic tests for ByteVector::replace() 2011-08-05 18:47:53 +02:00
Lukáš Lalinský
303af305db Merge remote branch 'panzi/master' 2011-08-05 18:35:24 +02:00
Johannes Pfau
22b57f4463 Add taglib_free function to C binding 2011-08-05 13:17:42 +02:00
Mathias Panzenböck
11c993e9f0 use DATA() macro 2011-08-01 15:33:27 +02:00
Mathias Panzenböck
3b14dc3e94 ByteVector::replace: forgot detach() and opt. when pattern not found 2011-08-01 15:14:58 +02:00
Mathias Panzenböck
ad7645f8e9 ByteVector::replace performance improvements 2011-08-01 04:13:55 +02:00
Lukáš Lalinský
fb2decb7de Reformatting 2011-07-28 19:16:32 +02:00
Lukáš Lalinský
3a837e7fc7 Reformatting 2011-07-28 19:06:35 +02:00
Lukáš Lalinský
0730076a0f Merge remote-tracking branch 'gperks/master'
Conflicts:
	taglib/asf/asfpicture.cpp
	taglib/it/itproperties.h
2011-07-28 19:03:46 +02:00
Lukáš Lalinský
364a840d83 Merge remote-tracking branch 'setosha/ASFPicture_warning_fix' 2011-07-28 18:53:57 +02:00
Scott Wheeler
e9cd383139 Merge pull request #14 from sbooth/master
Some non-PCM wave files can cause SIG_ARITHMETIC
2011-07-28 05:45:11 -07:00
Stephen F. Booth
a41b32bbb2 Don't crash when wav files have a 0 for bit per channel (sampleWidth)
I've seen this in a wav that has an audio format of MP3 (0x55)
2011-07-28 08:36:14 -04:00
Scott Wheeler
98d6b97798 Fix warning 2011-07-27 23:22:23 +02:00
Scott Wheeler
019fe4843f ByteVector works on chars, not unsigned chars, so there needs to be a cast before the comparison 2011-07-27 23:14:54 +02:00
Scott Wheeler
bb25953767 These methods can't be protected since they're called from IT::File
In general this code could use a fair bit of tidying up both stylistically and semantically.
2011-07-27 23:07:38 +02:00
Scott Wheeler
4795831b4a Fix spelling / formatting in comments. 2011-07-27 23:06:06 +02:00
Graham Perks
19484c059d Document ENABLE_STATIC_RUNTIME 2011-07-27 14:35:24 -05:00
Graham Perks
10ea76ff11 Add build option for Visual Studio to link with the static runtime (/MT vs /MD), pass -DENABLE_STATIC_RUNTIME=ON to cmake 2011-07-27 14:25:26 -05:00
Graham Perks
5f84bbf61a Correction to OS X build; include basic Windows build instructions 2011-07-27 10:54:33 -05:00
Graham Perks
8b647e5fa7 Fix for VS2010 which had been throwing out "cannot access protected member declared in class 'TagLib::Mod::Properties'" errors. 2011-07-26 21:45:32 -05:00
Graham Perks
0341079b92 Misc typo corrections 2011-07-26 21:45:28 -05:00
Graham Perks
1a53bfd71a Example cmake for OS X to build a static library 2011-07-26 11:12:27 -05:00
Graham Perks
6aa41d8180 Updated OS X build instructions 2011-07-25 17:56:42 -05:00
Scott Wheeler
101a624c46 Merge branch 'master' of github.com:taglib/taglib 2011-07-21 00:06:50 +02:00
Lukáš Lalinský
3b4e4357e6 Only include config.h if HAVE_CONFIG_H is defined 2011-07-20 22:06:28 +02:00
Scott Wheeler
3baf0a413d Missing const 2011-07-18 21:27:59 +02:00
Anton Sergunov
68c6a7da7a ASFPicture fix warning
class/struct thing

Signed-off-by: Anton Sergunov <setosha@gmail.com>
2011-07-01 16:12:04 +07:00
Mathias Panzenböck
2fd10b5fd5 corrected comments 2011-06-28 02:55:03 +02:00
Mathias Panzenböck
a50886c3c7 Merge branch 'master' of https://github.com/taglib/taglib 2011-06-28 01:37:48 +02:00
Mathias Panzenböck
2119494cd1 added uninstall target 2011-06-26 21:58:51 +02:00
Scott Wheeler
843070ba18 Tabs be gone 2011-06-26 21:37:01 +02:00
Mathias Panzenböck
57bf96d169 Merge branch 'master' of https://github.com/taglib/taglib 2011-06-26 20:58:32 +02:00
Lukáš Lalinský
937d69f91d Fix indentation 2011-06-25 12:17:31 +02:00
Mathias Panzenböck
f3447ae38d style fixes for enum value names 2011-06-25 01:54:22 +02:00
Mathias Panzenböck
89861cf77a style fixes: { on same line with if/else/for 2011-06-25 01:10:19 +02:00
Mathias Panzenböck
a04d7d0bbc Merge branch 'master' of https://github.com/taglib/taglib
Conflicts:
	taglib/CMakeLists.txt
	tests/CMakeLists.txt
2011-06-24 23:59:11 +02:00
Stephen F. Booth
39e8cbbefb Added sampleFrames() to AIFFProperties and WAVProperties 2011-06-24 10:43:13 -04:00
Lukáš Lalinský
6b063862c3 Remove the old qmake project file, you can use CMake to build a framework now 2011-06-24 09:00:23 +02:00
Lukáš Lalinský
aec8880592 Update INSTALL to not mention the optional file formats and add info about building a framework 2011-06-24 08:59:38 +02:00
Lukáš Lalinský
dd846904cb Remove the options to disable MP4/ASF support 2011-06-24 08:49:50 +02:00
Mathias Panzenböck
c7fd4cd2fc IT: the max. 8000 bytes msg. length have to include the NUL 2011-06-24 01:53:20 +02:00
Mathias Panzenböck
57526c6c37 IT: add term. NUL to messages 2011-06-24 01:50:43 +02:00
Mathias Panzenböck
af92db9dc0 IT: unit tests 2011-06-24 01:31:15 +02:00
Mathias Panzenböck
2d6274a36a Test FLAC: cleanup copied file 2011-06-24 01:21:17 +02:00
Mathias Panzenböck
9c27c45eb8 IT: strings require term. NUL. mod files: tableLength -> lengthInPatterns
Also added enums for S3M/IT/XM flags.
2011-06-24 01:11:10 +02:00
Mathias Panzenböck
e71806b6df IT: volume is only a byte in size 2011-06-23 20:48:04 +02:00
Lukáš Lalinský
0b34d4f8ee Enable MP4/ASF by default 2011-06-23 20:18:38 +02:00
Mathias Panzenböck
26613473cf forgot to remove debug code 2011-06-23 20:17:54 +02:00
Mathias Panzenböck
561cfdb0ec S3M: unit tests and bug fixes (NUL char. is not optional in S3M strings) 2011-06-23 20:08:05 +02:00
Mathias Panzenböck
e810f2f61f Merge branch 'master' of https://github.com/taglib/taglib 2011-06-23 17:40:36 +02:00
Mathias Panzenböck
7236ef4d0f S3M+IT: fix reading, IT: untested support for message writing
IT: reading was off starting with global volume because of wrong read size.
S3M+IT: correctly read the number of used patterns.
IT: fixed reading of message tag and implemented writing of message tag
(not tested yet).

I also added S3M+IT test files. TODO: Unit tests using them.
2011-06-23 05:41:23 +02:00
Anton Sergunov
b2517aa4a0 default constructor MP4::Tag::Tag() 2011-06-21 00:54:39 +07:00
Mathias Panzenböck
e202c658f0 Merge branch 'master' of https://github.com/taglib/taglib 2011-06-20 14:31:09 +02:00
Wolfgang Plaschg
7448bb353b Include of "tag_c.h" after system libraries. 2011-06-20 03:08:24 +02:00
Mathias Panzenböck
aeb528ade2 XM: forgot smaple count 2011-06-20 02:31:17 +02:00
Mathias Panzenböck
d1cb8ae09d IT: support channels property 2011-06-20 02:19:16 +02:00
Mathias Panzenböck
4b44f25048 comments++ 2011-06-20 01:05:12 +02:00
Mathias Panzenböck
4b754b1bc6 more correct IT parsing and property naming 2011-06-20 00:43:42 +02:00
Mathias Panzenböck
b3d44394bf more correct S3M parsing and property naming 2011-06-19 22:46:33 +02:00
Mathias Panzenböck
5477ede3ea updated comments 2011-06-19 19:37:45 +02:00
Mathias Panzenböck
03534170fa comments++ 2011-06-19 19:35:27 +02:00
Mathias Panzenböck
b30b8c4ab5 IT: no longer allow wrong sample/instrument magic 2011-06-19 06:03:09 +02:00
Mathias Panzenböck
e09c2c5a19 untested(!) comment write support for s3m and it files 2011-06-19 05:42:16 +02:00
Mathias Panzenböck
6afb7c04b3 comment writing support and more tests for mod and xm 2011-06-19 04:27:51 +02:00
Mathias Panzenböck
0143c3ee63 comments++ 2011-06-18 04:28:48 +02:00
Mathias Panzenböck
a31b0bcf8c xm: no \n too much in comment if there are no samples 2011-06-18 03:38:18 +02:00
Mathias Panzenböck
5ad69f6f2a fixed mod property names and added unit test for xm 2011-06-18 03:31:49 +02:00
Lukáš Lalinský
b63508ec3e We still need these includes 2011-06-17 15:09:37 +04:00
Mathias Panzenböck
fe356c31b4 added unit test for one flavour of .mod files 2011-06-17 05:18:49 +02:00
Mathias Panzenböck
eec5e33e0d added check for readOnly in save methods 2011-06-14 15:34:16 +02:00
Mathias Panzenböck
868ce3dd21 added myself to AUTHORS 2011-06-14 15:23:11 +02:00
Mathias Panzenböck
1e6d645ce9 fixed a comment 2011-06-14 03:56:32 +02:00
Mathias Panzenböck
65fb9733b9 added mod (+aliases) to defaultFileExtensions 2011-06-14 03:49:33 +02:00
Mathias Panzenböck
f75f5ac9bb added .mod file support 2011-06-14 03:47:08 +02:00
Mathias Panzenböck
812826fe3a Mod::File -> Mod::FileBase 2011-06-14 01:47:07 +02:00
Mathias Panzenböck
3192334006 more indentation fixes 2011-06-14 01:30:54 +02:00
Mathias Panzenböck
9b2bb4af34 code formatting fixes 2011-06-14 01:18:38 +02:00
Mathias Panzenböck
54e9656474 converted tabs to spaces 2011-06-14 01:09:55 +02:00
Mathias Panzenböck
f6dbd32ed3 refactored for ABI compat and write support of some tags of s3m/it/xm files
tags that can be written:
 * s3m: title
 * it: title
 * xm: title, trackerName
2011-06-14 00:46:23 +02:00
Mathias Panzenböck
5332fb5cf8 added read-only support for s3m, it and xm 2011-06-13 03:19:21 +02:00
Lukáš Lalinský
c3c88b4f55 Merge remote branch 'lalinsky/abstract-io' 2011-06-09 18:58:45 +02:00
Lukáš Lalinský
8eb32577bd Merge branch 'abstract-io' 2011-06-09 18:58:05 +02:00
Lukáš Lalinský
0ed2477dfa Add an empty default implementation of IOStream::clear() 2011-06-09 18:52:48 +02:00
Frank Lai
b3646a0734 Be more careful when parsing Vorbis Comments 2011-06-09 18:44:54 +02:00
Frank Lai
8ed9b0da2c Support for reading ALAC audio properties 2011-06-09 18:41:43 +02:00
Frank Lai
93564a2daa ALAC file encoded by iTunes 2011-06-09 18:40:22 +02:00
Lukáš Lalinský
0a790f0017 Add a (failing) test for reading ALAC audio properties 2011-06-08 19:03:43 +02:00
Lukáš Lalinský
a224e7cd6d Install the new headers 2011-05-28 22:06:41 +02:00
Lukáš Lalinský
088dbfa832 Merge remote branch 'taglib/master' into abstract-io 2011-05-28 22:04:07 +02:00
Stephen F. Booth
a04da3f159 Added read-only support to FileStream 2011-05-28 13:29:06 -04:00
Lukáš Lalinský
dc062a0844 Make RefCounter compile on OS X with the 10.4 SDK
The 10.4 SDK defines OSAtomic functions as int32_t, while 10.5 and newer SDKs
define them as volatile int32_t. This caused a compilation error when
compiling against the 10.4 SDK.

I'd have prefered a preprocessor-based solution, but I couldn't find any
macro that says the SDK version, so I copied this cast solution from
Apple's WebKit. I assume then know what they are doing if they have to
workaround their own API. :)
2011-05-15 00:07:29 +02:00
Scott Wheeler
efeccbf726 Don't lead the scanned blocks on save 2011-05-09 19:06:08 +02:00
Lukáš Lalinský
6b7ed4a5d5 Merge pull request #2 from wplaschg/master
Added ignore rules for MSVC 2008 build results
2011-05-09 10:02:21 -07:00
Wolfgang Plaschg
adb0984c87 Adding ignore rules for MSVC 2008 build results 2011-05-09 16:23:38 +02:00
Lukáš Lalinský
a38d2b2995 Simplify static builds 2011-05-08 15:57:34 +02:00
Lukáš Lalinský
b5b8387aee Don't install pkg-config files when building a framework 2011-05-08 15:50:44 +02:00
Lukáš Lalinský
c337694165 Make it possible to build an OS X framework 2011-05-08 15:46:19 +02:00
Lukáš Lalinský
b2e3a477e9 Always make a copy of the ID3v1 genre name strings
http://thread.gmane.org/gmane.comp.kde.devel.taglib/1876
2011-05-02 22:41:01 +02:00
Lukáš Lalinský
81734919d2 Add info about BUILD_EXAMPLES to the INSTALL file 2011-04-19 12:45:11 +02:00
Lukáš Lalinský
d03ef3c312 Use the PUBLIC_HEADER property to prepare for building an OS X framework 2011-04-18 16:52:47 +02:00
Lukáš Lalinský
e92ed0a830 Remove unnecessary code from tfile.cpp 2011-04-12 14:35:31 +02:00
Lukáš Lalinský
65ca29b3e2 Add a ByteVector-backed stream class 2011-04-12 14:28:02 +02:00
Lukáš Lalinský
26c130c387 Duplicate contructors of File subclasses to accept IOStream* 2011-04-11 23:31:44 +02:00
Lukáš Lalinský
8b59bb5957 Make it possible to actually pass a IOStream instance to File 2011-04-11 23:15:46 +02:00
Lukáš Lalinský
b53a577e38 Add FileStream as a copy of File's methods 2011-04-11 23:12:58 +02:00
Lukáš Lalinský
0b0cbc2e34 Add an abstract IOStream class 2011-04-11 22:46:56 +02:00
Lukáš Lalinský
4cda0eeb7b Make it possible to run the test suite out of the source tree 2011-04-11 18:32:40 +02:00
Lukáš Lalinský
2fa8c93776 The website has more up-to-date links 2011-04-09 20:15:00 +02:00
Lukáš Lalinský
266200d77e Add myself to the AUTHORS file 2011-04-09 20:09:51 +02:00
Lukáš Lalinský
aa84b8b674 Obsolete comment now that we are not in kdesupport 2011-04-09 20:07:15 +02:00
Lukáš Lalinský
ee920a461c Clean up the library CMakeLists.txt file 2011-04-09 20:05:50 +02:00
Lukáš Lalinský
1596dc7c69 Clean up the main CMakeLists.txt file 2011-04-09 19:51:23 +02:00
Lukáš Lalinský
f3d3af9355 Don't set unnecessary compiler options 2011-04-09 19:42:56 +02:00
Lukáš Lalinský
9653796640 Merge branch 'master' of github.com:taglib/taglib 2011-04-09 19:19:49 +02:00
Lukáš Lalinský
a4a097d2f8 Merge branch 'stable' 2011-04-09 19:16:01 +02:00
Modestas Vainius
d112a68193 Support building documentation out-of-source-dir 2011-04-09 19:15:46 +02:00
Lukáš Lalinský
5eda17aa96 NEWS entries 2011-04-06 00:08:42 +02:00
Lukáš Lalinský
8878c9158c Upgrade IPLS (2.3) to TIPL (2.4) 2011-04-05 17:08:25 +02:00
Lukáš Lalinský
3715b96477 Protect against incorrect ID3v2 version parameter 2011-04-05 15:36:23 +02:00
Lukáš Lalinský
aa57db3a39 Convert frames TIPL and TMCL (2.4) to IPLS (2.3) 2011-04-05 15:16:17 +02:00
Lukáš Lalinský
f9d38129b8 Merge branch 'master' into id3v23 2011-04-05 14:37:36 +02:00
Lukáš Lalinský
0c6e2a0aa9 NEWS entry 2011-03-30 09:19:25 +02:00
Martijn van Rheenen
e16829190a Fix DRM detection in WMA files 2011-03-30 09:15:28 +02:00
Lukáš Lalinský
7a6647cb99 Untested version of DRM checking in WMA files 2011-03-29 15:49:24 +02:00
Lukáš Lalinský
97cd58bc65 Check for the presence of the drms atom in MP4 files 2011-03-29 15:41:17 +02:00
M.A. Brand Consulting
8f42d5b594 Make it possible to build a static version of the C bindings
https://bugs.kde.org/show_bug.cgi?id=268441
2011-03-19 08:28:35 +01:00
Lukáš Lalinský
158152cb46 Use the same SO versioning as we had with automake/libtool
http://article.gmane.org/gmane.comp.kde.devel.taglib/1826
2011-03-19 08:18:34 +01:00
Lukáš Lalinský
f624d6e2af Don't overwrite fields that already exist
We can have multiple fields in the Vorbis Comment (e.g. two artist names),
but TagUnion only takes the first one, so it will effectively strip the
extra fields.

https://bugs.kde.org/show_bug.cgi?id=268854
2011-03-19 07:42:47 +01:00
Lukáš Lalinský
d3e79ddc38 Partial protection against broken WMA files
This fixes the problem on the reported file, but in general this code
needs a lot more checks.

https://bugs.kde.org/show_bug.cgi?id=268401
2011-03-19 07:42:23 +01:00
Lukáš Lalinský
71e224fed8 Don't overwrite fields that already exist
We can have multiple fields in the Vorbis Comment (e.g. two artist names),
but TagUnion only takes the first one, so it will effectively strip the
extra fields.

https://bugs.kde.org/show_bug.cgi?id=268854
2011-03-19 07:37:28 +01:00
Lukáš Lalinský
80decd737d Define NOMINMAX so that windows.h doesn't define it's own versions
http://article.gmane.org/gmane.comp.kde.devel.taglib/1833
http://www.devx.com/tips/Tip/14540
2011-03-19 07:26:55 +01:00
Lukáš Lalinský
d169a670e0 Merge branch 'master' into id3v23 2011-03-17 09:16:29 +01:00
Scott Wheeler
a6cb74ad5d Ignore docs and OS X dylibs 2011-03-17 08:01:33 +01:00
Scott Wheeler
27aa8cc293 These aren't needed anymore now that we're not in kdesupport 2011-03-17 07:57:24 +01:00
Lukáš Lalinský
d3df66f196 Convert TDRC to TYER+TDAT+TIME 2011-03-16 22:54:58 +01:00
Lukáš Lalinský
1453a7b157 Clean-up temporary files 2011-03-16 17:19:11 +01:00
Lukáš Lalinský
e8d0551c9a Simple ID3v2.4 => ID3v2.3 frame migration 2011-03-16 17:14:36 +01:00
Lukáš Lalinský
061b381ea8 Make sure we don't write UTF8 or UTF16BE to ID3v2.3 tags 2011-03-15 21:57:49 +01:00
Lukáš Lalinský
1802237c75 Support for writing structuraly correct ID3v2.3 tags
We don't use the tag footer, extended header or unsynchronization, so we
only need to change the frame size format.

Note that this doesn't write correct ID3v2.3 tags, just tags that have
the correct structure. The content is sill incorrect, unless you add
the right frames manually to the tag instance.
2011-03-15 20:50:47 +01:00
Lukáš Lalinský
4bdcc9662e Partial protection against broken WMA files
This fixes the problem on the reported file, but in general this code
needs a lot more checks.

https://bugs.kde.org/show_bug.cgi?id=268401
2011-03-13 21:33:57 +01:00
Lukáš Lalinský
41f1828719 Use the memory barrier variants on OS X 2011-03-12 23:21:54 +01:00
Lukáš Lalinský
223b85d345 Use GCC automic builtins where possible 2011-03-12 23:19:01 +01:00
Lukáš Lalinský
ee49b781eb Add .gitignore 2011-03-11 15:16:05 +01:00
Lukáš Lalinský
065fcd5077 Merge branch 'release-1.7' 2011-03-11 14:16:11 +01:00
Lukáš Lalinský
b3ae839a38 Add release date 2011-03-11 14:15:38 +01:00
Lukáš Lalinský
cce88b7005 News for 1.7 2011-03-11 13:21:54 +01:00
Lukáš Lalinský
311be56432 Merge commit 'eee860f9c6' into release-1.7 2011-03-11 13:19:35 +01:00
Lukáš Lalinský
5685dd078f Fix memory leaks in the FLAC parsing code
Thanks to Daniel Schaack for reporting these.
2011-03-11 10:29:27 +01:00
Nick Shaforostoff
38219b88b3 ups, revert my accidentally commited debug output
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1224409 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2011-03-10 17:30:22 +00:00
Nick Shaforostoff
0cdfa793e9 use atomic refcounting on mac and win32, todo for linux
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1224407 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2011-03-10 17:29:30 +00:00
Raphael Kubo da Costa
eee860f9c6 Fix build when the 'uint' typedef is already defined.
Using uint in those structs gave me the following error:

  /home/rakuco/kde4/src/kdesupport/taglib/taglib/riff/rifffile.cpp:38:
error: reference to 'uint' is ambiguous
  /usr/include/sys/types.h:56: error: candidates are: typedef unsigned
int uint

Is it really necessary to have those typedefs in taglib.h? It'd be
nice to at least check if they are not being redefined.

CCMAIL: lalinsky@gmail.com



git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1223282 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2011-03-02 03:05:28 +00:00
Lukáš Lalinský
10fff6d797 Update the AIFF test
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1222753 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2011-02-25 19:43:25 +00:00
Lukáš Lalinský
7cc1ce1c36 Fix the patch from r1222376
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1222752 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2011-02-25 19:42:49 +00:00
Nick Shaforostoff
272719e666 a formal change: convert rifffile.cpp to use vector of structs instead of several vectors of simple types
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1222376 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2011-02-23 09:16:25 +00:00
Nick Shaforostoff
d21ff8be54 divide by 1000 instead of 1024 when calculating riff bitrate to get standard 1411 kbps bitrate on AudioCD wavs
CCMAIL:taglib-devel@kde.org



git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1222375 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2011-02-23 08:58:17 +00:00
Lukáš Lalinský
f89c16cd65 More news
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1220247 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2011-02-13 12:47:52 +00:00
Lukáš Lalinský
be8fff3768 Automatically generate the version number in taglib-config
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1220246 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2011-02-13 12:45:24 +00:00
Lukáš Lalinský
263832cf6a CMake-specific INSTALL file
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1220241 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2011-02-13 12:36:04 +00:00
Lukáš Lalinský
95c09d232d Add svn:ignore
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1220239 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2011-02-13 12:25:39 +00:00
Lukáš Lalinský
378fd15b54 Move docs building to CMake
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1220238 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2011-02-13 12:22:42 +00:00
Lukáš Lalinský
2f9838a440 *poof*
I've warned people about removing autoconf/automake support for a long time,
so let's make it happen for 1.7. CMake is now the only supported build system.
I'll update build docs in a following commit.

CCMAIL:taglib-devel@kde.org


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1220235 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2011-02-13 11:50:25 +00:00
Lukáš Lalinský
4b00ef4acb Set the version number to 1.7
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1220230 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2011-02-13 10:59:33 +00:00
Lukáš Lalinský
c21fd955ff Fix writing of new RIFF chunks at even positions
If the last chunk had an odd size, the new chunk would have been written at
odd position, which is incorrect.

This is based on the patch by Jens Dyffort, but I ended up changing the
implementation to correctly handle subsequential updates to the file.

The whole RIFF code really needs to be rewritten in a different way...

BUG:243954


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1220223 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2011-02-13 10:27:56 +00:00
Nick Shaforostoff
ad0494bb7e formal change: combine if-conditions for identical bodies
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1218105 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2011-01-31 12:24:30 +00:00
Lukáš Lalinský
7c776935e4 Revert r1217775
Please see my post in the mailing list. This can be done, but in a different way.

CCMAIL:shafff@ukr.net


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1218000 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2011-01-30 12:50:38 +00:00
Nick Shaforostoff
a4f53d9b4a disable creation of unknown objects for wma files, because we've seen the cases when it could be as large as whole file, and we are greedy for the ram
CCMAIL:lalinsky@gmail.com


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1217775 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2011-01-28 15:14:04 +00:00
Nick Shaforostoff
c56c0a3d0c fix crash on wma file parsing, add clarifications to API docs
CCMAIL: wheeler@kde.org



git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1217766 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2011-01-28 13:18:36 +00:00
Lukáš Lalinský
299e3f0ad6 Define a macro to properly construct std::bitset
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1216679 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2011-01-24 07:32:31 +00:00
Lukáš Lalinský
df86f45dad Back to unsigned long, it breaks compilation on Solaris
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1216598 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2011-01-24 06:02:15 +00:00
Lukáš Lalinský
b051df0062 Fix compilation on MSVC 2010 with the C++0x version of std::bitset
Hopefuly it doesn't break anything on older compilers...


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1216365 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2011-01-22 21:07:16 +00:00
Lukáš Lalinský
0087895206 News
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1214792 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2011-01-16 12:06:21 +00:00
Lukáš Lalinský
735e52392b Fixed copyright headers
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1214790 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2011-01-16 12:03:37 +00:00
Lukáš Lalinský
1352a4e0c3 Consistency with the rest of TagLib
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1214789 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2011-01-16 12:00:52 +00:00
Lukáš Lalinský
fb3cca2c44 Support for ASF embedded pictures
Patch by Anton Sergunov <setosha@gmail.com>

CCMAIL: setosha@gmail.com


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1214788 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2011-01-16 11:57:12 +00:00
Lukáš Lalinský
393e9c5572 Fix FSF address
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1212872 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2011-01-08 11:20:09 +00:00
Lukáš Lalinský
6f68c30db3 Fix memory leak in AttachedPictureFrameV22
BUG:257007


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1212871 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2011-01-08 11:14:47 +00:00
Lukáš Lalinský
085a54b67d Fix FLAC tests
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1212870 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2011-01-08 11:13:46 +00:00
Lukáš Lalinský
b43c149138 Documentation fix
CCBUG:209252


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1212867 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2011-01-08 11:00:36 +00:00
Lukáš Lalinský
3741c39295 Full read/write support for FLAC pictures
NEEDS MORE TESTING

BUG:218696


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1212863 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2011-01-08 10:36:26 +00:00
Scott Wheeler
d16be3fa98 Generate docs for ASF / MP4 as well
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1202935 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2010-12-02 20:08:43 +00:00
Andreas Hartmetz
fad0724bff Install flacmetadatablock.h. Required to make Amarok compile.
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1201859 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2010-11-28 22:06:34 +00:00
Lukáš Lalinský
5c930a6a8c Work-in-progress support for writing FLAC picture
This will enable the possibility to add support for accessing the Seektable
and Cuesheet blocks, but I'm not planning on implementing that right now.

CCBUG:218696


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1201717 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2010-11-28 12:54:52 +00:00
Lukáš Lalinský
d21d8f9f3c More tests for WavPack audio properties
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1201478 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2010-11-27 21:12:14 +00:00
Lukáš Lalinský
56343767ce Fix reading of WavPack streams without a length information in the header
When the WavPack's total_samples header fiels contains -1, try to find
the final block and get the number of samples from there as
block_index + block_samples.

BUG:258016


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1201476 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2010-11-27 20:58:57 +00:00
Lukáš Lalinský
15d139e271 Docs
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1201208 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2010-11-27 07:32:32 +00:00
Lukáš Lalinský
259a9a1a14 Explicitly check for -1 in WavPack length
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1201207 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2010-11-27 07:32:16 +00:00
Lukáš Lalinský
874d495b29 Accept both "ID3 " and "id3 " as valid ID3 chunk IDs in RIFF files
Patch by Stephen F. Booth


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1191982 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2010-11-01 16:32:37 +00:00
Scott Wheeler
306aee3e7d Different LGPL version than was referenced in headers
CCMAIL:groot@kde.org

git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1178016 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2010-09-22 00:07:26 +00:00
Lukáš Lalinský
32a10b53d5 Fix Automake build
Patch by Stephen F. Booth


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1167433 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2010-08-24 15:50:35 +00:00
Lukáš Lalinský
1c225ed37a Added information about the number of bits per sample in WAVE and AIFF files
Patch by Stephen F. Booth


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1167432 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2010-08-24 15:49:47 +00:00
Lukáš Lalinský
f887f5eec3 Make sure TAGLIB_EXPORT is empty when TAGLIB_STATIC is defined
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1160977 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2010-08-09 12:17:30 +00:00
Lukáš Lalinský
dcef0fbad2 Read-only support for FLAC picture blocks
CCBUG:218696


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1154376 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2010-07-25 11:06:36 +00:00
Lukáš Lalinský
0f979667be Don't unnecessarily include whole <iostream>
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1153989 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2010-07-24 13:17:01 +00:00
Lukáš Lalinský
5aed3681fb Missing file
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1148734 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2010-07-11 17:45:47 +00:00
David Faure
3cca3f17c5 I think you forgot a file :)
CCMAIL: lalinsky@gmail.com


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1148727 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2010-07-11 17:34:23 +00:00
Lukáš Lalinský
7426a64d2b Added FLAC::Properties::signature()
BUG:160172


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1148630 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2010-07-11 10:26:35 +00:00
Lukáš Lalinský
1d10bde500 Added reading of WAV audio length
BUG:116033


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1148614 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2010-07-11 09:47:58 +00:00
Lukáš Lalinský
49631a3013 Implemented a specialized version of APE::Tag::isEmpty()
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1148318 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2010-07-10 09:22:53 +00:00
Lukáš Lalinský
ab7e997bc6 Don't try to save read-only MP4 files
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1145556 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2010-07-03 11:36:08 +00:00
Lukáš Lalinský
a33f161999 Unused private attributes
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1145555 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2010-07-03 11:34:29 +00:00
Lukáš Lalinský
ab1bc06172 Support for reading/writing tags from Monkey's Audio files
Patch by Alex Novichkov, slightly modified by me (code formatting + tests).


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1145554 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2010-07-03 11:32:27 +00:00
Lukáš Lalinský
8792f8df82 Final changes
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1115755 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2010-04-17 11:31:35 +00:00
Lukáš Lalinský
9dcdecc810 Fix parsing of regular 32-bit integers in SynchData::toUInt()
BUG:231075


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1115275 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2010-04-15 20:22:21 +00:00
Lukáš Lalinský
f6478a4172 Add a BIC comment about merging String::toInt
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1114105 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2010-04-12 18:53:27 +00:00
Lukáš Lalinský
91f94f593b Info about the new toInt method
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1114094 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2010-04-12 18:41:10 +00:00
Lukáš Lalinský
10e4350410 Updated NEWS
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1114093 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2010-04-12 18:35:41 +00:00
Lukáš Lalinský
414a49cc16 Include taglib_config.h by default
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1114090 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2010-04-12 18:32:04 +00:00
Lukáš Lalinský
19b2341411 Fix upgrading of ID3v2.3 genre with number 0 (Blues)
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1114089 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2010-04-12 18:27:59 +00:00
Lukáš Lalinský
d5eb51e452 Update all version numbers to 1.6.3
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1114073 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2010-04-12 17:43:03 +00:00
Scott Wheeler
2811d24efa Update to current automake
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1113098 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2010-04-09 22:51:26 +00:00
Lukáš Lalinský
f7f46b2320 Fix release date
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1112833 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2010-04-09 09:37:51 +00:00
Scott Wheeler
c823c21eb2 Forward declarations don't need exports.
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1111035 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2010-04-04 17:33:01 +00:00
Lukáš Lalinský
aee204df54 Ok, actually change the API version
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1110990 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2010-04-04 15:31:23 +00:00
Lukáš Lalinský
7f860790ec There is actually one new function, so the API version needs to be different
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1110988 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2010-04-04 15:20:46 +00:00
Lukáš Lalinský
b1cac7175f Increment version number
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1110983 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2010-04-04 15:01:21 +00:00
Lukáš Lalinský
e76466097b Don't upgrade ID3v2.2 TDA frame when upgrading to TRCD
We already do this for TDAT. Using both parts, the year and the date,
would be better we the code currently doesn't have enough context to
do that.

BUG:228968


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1110552 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2010-04-03 16:58:03 +00:00
Lukáš Lalinský
6612abce72 Changelog for 1.6.2
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1110546 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2010-04-03 16:16:51 +00:00
Lukáš Lalinský
3943668603 Ignore trailing non-data atoms when parsing MP4 covr atoms
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1110209 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2010-04-02 12:14:32 +00:00
Lukáš Lalinský
2ef8fc5118 Save ASF attributes larger than 64k to the metadata library object
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1110205 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2010-04-02 11:53:28 +00:00
Scott Wheeler
4202ce3ec9 Update .pro file
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1100537 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2010-03-07 19:03:35 +00:00
Lukáš Lalinský
0d16255d09 Fix compilation fo the test runner on Windows
Patch by Stephen Hewitt


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1078612 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2010-01-22 13:30:05 +00:00
Lukáš Lalinský
d394317767 MP4 int pair atoms should have flags set to 0
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1078611 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2010-01-22 13:28:14 +00:00
Lukáš Lalinský
9e9077d1e0 Be more paranoid about checking MP4 files
To consider something a valid MP4 file, it must have a 'moov' atom. Otherwise
it's marked as invalid and we won't try to read/write tags.

CCBUG:216819


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1062426 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-12-14 18:42:40 +00:00
Urs Wolfer
b11d2e8b56 optimizegraphics: Losslessly optimized PNG and SVGZ files with "optipng -o5" and "advdef -z -4".
Reduced disk space: 10144KB (9MB)

git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1062098 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-12-13 19:51:03 +00:00
Lukáš Lalinský
74c3c282c4 Handle WM/TrackNumber with DWORD content
The default type for this attribute is String, but even MSDN suggests to
support also DWORD, because some applications write such files.

BUG:218526


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1062026 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-12-13 15:32:55 +00:00
Lukáš Lalinský
004551faec Fix tagreader_c.c to not try to access invalid pointers
BUG:218334


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1061671 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-12-12 16:44:34 +00:00
Scott Wheeler
5df7692aa1 pedantry++
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1057066 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-12-01 12:01:43 +00:00
Peter van Hardenberg
85df71ea2e When decoding syncsafe integers, assume non-syncsafe integers are written by buggy software and treat them as normal integers.
From Songbird bug 12964, original author Mike Smith (msmith@songbirdnest.com)

git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1056922 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-12-01 09:11:21 +00:00
Alexander Neundorf
1b6ab18080 this patch should make taglib build with the Sun Studio compiler (http://bugs.kde.org/show_bug.cgi?id=215225)
Alex




git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1054212 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-11-25 18:45:13 +00:00
Lukáš Lalinský
0f0f2f7288 Explicitly say that we are using TagLib::File (CCBUG:213544)
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1046111 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-11-07 15:05:25 +00:00
Lukáš Lalinský
4c70372fe4 Fixed a memory leak in FileRef's OGA format detection
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1044769 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-11-04 15:37:21 +00:00
Lukáš Lalinský
d81af82ec4 Add test_flac.cpp to Makefile.am
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1043989 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-11-02 19:54:10 +00:00
Lukáš Lalinský
44c08b8ca2 New utility class to make sure temporary files are always deleted
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1043988 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-11-02 19:53:15 +00:00
Lukáš Lalinský
c962d78a57 Always read tags from the first Vorbis Comment block in FLAC files
Prevously TagLib saved tags to the first block, but read them from the
last one. Having multiple VC blocks is a non-standard situation, but
this is the best we can do (libFLAC also uses the first block in the
case of multiple VC blocks). 

BUG:211089


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1043985 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-11-02 19:41:12 +00:00
Scott Wheeler
2039c725f4 Missing "not" in docs.
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1042978 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-10-31 11:32:31 +00:00
Lukáš Lalinský
dcf4c7458b A few more version numbers. We really need a way to automate this :(
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1042960 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-10-31 09:57:13 +00:00
Lukáš Lalinský
de162a9734 Update version in API docs
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1042958 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-10-31 09:43:51 +00:00
Lukáš Lalinský
d685cd6e47 Bump version numbers
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1042955 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-10-31 09:23:58 +00:00
Lukáš Lalinský
f1abbf33f2 A little more complex checking for broken files
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1042948 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-10-31 08:59:40 +00:00
Lukáš Lalinský
5a40a45cc5 Make sure we are not trying to read a file where MP4 atom header != 8 bytes
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1042945 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-10-31 08:36:26 +00:00
Lukáš Lalinský
76b6d4fc9e Fixed ID3v1-style genre to string conversion in MP4 files
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1042312 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-10-29 15:53:20 +00:00
Lukáš Lalinský
e8281e1b9f Support for MP4 cover art
CCMAIL:martin.trashbox@gmail.com


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1039809 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-10-24 16:55:54 +00:00
Lukáš Lalinský
bffd4da8b6 Return NULL/false rather than crash when accessing file attributes in FileRef
BUG:209417


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1039724 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-10-24 12:45:58 +00:00
Lukáš Lalinský
fa1a23fe5c Changelog for 1.6.1
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1039711 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-10-24 12:22:10 +00:00
Lukáš Lalinský
4e9b41f540 Proper .oga file handling in FileRef
This fixes a problem introduced in r983337. OGA files are mostly likely going
to be Ogg::FLAC, if applications are following the Xiph recommendation. But
they can be using any Ogg codec, so we must check multiple formats (Sound Juicer
on Ubuntu used to produce .oga files for Ogg Vorbis, I believe it doesn't do that
anymore).


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1039708 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-10-24 12:17:08 +00:00
Lukáš Lalinský
724a68c79c Don't wrote the Vorbis framing bit to OggFLAC files
https://bugs.launchpad.net/maxosx/+bug/445970
http://www.hydrogenaudio.org/forums/index.php?showtopic=75263

CCMAIL:me@sbooth.org


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1039704 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-10-24 12:01:40 +00:00
Lukáš Lalinský
03c63a11a5 Set visibility("default") for GCC on exported symbols
This does nothing with the current configuration, but it's useful if you compile the library with -fvisibility=hidden

Patch by Modestas Vainius


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1039693 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-10-24 11:07:41 +00:00
Lukáš Lalinský
ea9dbfd7ae Add missing exports for a few public ID3v1 functions
Patch by Modestas Vainius


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1038114 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-10-20 16:45:10 +00:00
Lukáš Lalinský
af65fefef7 Fix typo in taglib_c.pc
Patch by Modestas Vainius to fix a bug reported in Debian - http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=524696


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1038111 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-10-20 16:41:59 +00:00
Jeff Mitchell
752a21edc9 Fix copy+paste typos
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1035209 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-10-14 14:44:15 +00:00
Lukáš Lalinský
18c621cdc2 Always use #include "XXX" in TagLib's code
Patch by Stephen F. Booth, thanks!


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1033289 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-10-09 21:03:59 +00:00
Lukáš Lalinský
be2f9ad6e5 This value should be bool, not int
Since bool and int have the same size on x86 architectures, this worked for
me, but since they have a different size on ppc64, it caused the test to
fail. See http://marc.info/?l=taglib-devel&m=125291701231305&w=2 for details.

We should store the type in MP4::Item and do some type checking to avoid
mistakes like this...


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1023246 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-09-14 10:25:34 +00:00
Lukáš Lalinský
f6083f327f Remove extra commas from configure.in.in
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1022859 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-09-13 11:30:19 +00:00
Lukáš Lalinský
8b43367eb4 Update libtool version-info
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1022852 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-09-13 11:17:49 +00:00
Lukáš Lalinský
639b604a55 Changelog
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1022849 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-09-13 11:15:54 +00:00
Christophe Giboudeaux
482431286e Remove a non-existing dir.
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1022837 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-09-13 10:19:34 +00:00
Lukáš Lalinský
cc7c66bf86 Upgrade obsolete gnre MP4 atoms to ©gen
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1021692 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-09-09 20:11:29 +00:00
Lukáš Lalinský
db3db34e21 Fix building of examples with ENABLE_STATIC
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1021651 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-09-09 18:16:38 +00:00
Lukáš Lalinský
9b17ca219c Add option for building a static version of taglib
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1021124 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-09-08 08:52:57 +00:00
Lukáš Lalinský
f644bafa44 Use the internal config names
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1021106 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-09-08 07:26:12 +00:00
Lukáš Lalinský
06f405f719 Add support for a global, installable config header
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1019671 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-09-04 09:29:59 +00:00
Lukáš Lalinský
cf83551c93 Define MAKE_TAGLIB_LIB from the automake build system
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1019659 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-09-04 09:07:27 +00:00
Lukáš Lalinský
0adea10728 Fix compilation warnings
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1019655 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-09-04 08:50:24 +00:00
Lukáš Lalinský
b26f8bf5a8 Autoconf options for enabling MP4 and ASF support
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1019514 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-09-03 19:14:12 +00:00
Lukáš Lalinský
92391e38e8 Fix version in configure.in.in
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1019491 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-09-03 18:32:16 +00:00
Lukáš Lalinský
41fd27a5d2 Update docs and version numbers
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1019481 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-09-03 18:05:58 +00:00
Lukáš Lalinský
67bdd5b8d1 Split Ogg packets larger than 64kb into multiple pages
The implementation is not very efficient, but the current Ogg
code makes it hard to write it properly. :(

Patch by Marc Halbruegge
BUG:171957


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1019459 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-09-03 17:20:29 +00:00
David Faure
ee7703d29b svn is weird, I have deleted this external in 1010855 already
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1012887 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-08-18 10:06:44 +00:00
David Faure
624b8594ca another tool which is not necessary in this copy
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1010859 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-08-13 14:48:07 +00:00
David Faure
52fba4ec09 replace external with a copy of the admin dir, as suggested by Jeff Mitchell
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1010858 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-08-13 14:46:52 +00:00
David Faure
3ffe65c5f4 replace external with a copy of the admin dir, as suggested by Jeff Mitchell
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1010855 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-08-13 14:44:55 +00:00
Lukáš Lalinský
9b7463225a Add a check to not crash on corrupted files
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1005918 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-08-02 15:17:36 +00:00
Lukáš Lalinský
93272b4181 Add missing tests to Makefile.am
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1003760 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-07-28 19:08:40 +00:00
Lukáš Lalinský
d10c9e9166 Add a changelog
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1003757 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-07-28 18:57:49 +00:00
Lukáš Lalinský
8636eb749a Handle RIFF chunk padding and ignore trailing garbage
This is based on patches by Marc Halbruegge, but those only deal with
read-only cases. The code now also correctly adds padding to RIFF
chunks, and calculates offsets in chunkData taking the padding into
account.

BUG:171957
BUG:175781


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1003745 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-07-28 18:29:39 +00:00
Lukáš Lalinský
834d9d6b23 Partial support for 64-bit atoms
We still can't handle actual 64-bit atoms, but we can handle 32-bit sizes
stored in 64 bits.

CCBUG:198730


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1001897 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-07-24 13:08:51 +00:00
Scott Wheeler
097ae0d785 Use flac padding.
Updated patch from Toby Dickenson

BUG:107659


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@995518 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-07-12 21:53:18 +00:00
Scott Wheeler
7f0f90b4ea Make docs consistant with behavior.
BUG:178174


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@995471 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-07-12 19:54:46 +00:00
Lukáš Lalinský
f7fc585665 Don't save ID3v2.2 frames.
Patch by Marc Halbruegge
BUG:176373


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@994842 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-07-11 14:43:58 +00:00
Lukáš Lalinský
0f11c5ab0c Support for ID3v2.2 PIC frames
Patch by Marc Halbruegge
BUG:167786


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@994836 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-07-11 14:27:17 +00:00
Lukáš Lalinský
39e6891c92 Fix off-by-one error in ByteVectorList::split
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@994815 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-07-11 13:24:21 +00:00
Lukáš Lalinský
5e1eb18df9 Try to read track also from TRACKNUM and year from YEAR.
Patch by David Bishop
BUG:144396


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@994811 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-07-11 13:17:06 +00:00
Lukáš Lalinský
59e35efc1b TCON parsing fixes
* Don't join multiple 2.4 TCON fields together
 * Don't add duplicate fields for 2.3 genres where the refinement matches the ID3v1 genre

Patch by Michael Smith
BUG:188578


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@994805 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-07-11 12:55:36 +00:00
Lukáš Lalinský
c92a02b0d7 One more check for invalid frame in AttachedPictureFrame::parseFields
Patch by Mook
BUG:168382


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@994361 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-07-10 14:43:15 +00:00
Lukáš Lalinský
b70e3b2304 Use floting point length to calculate bitrate from the Xing header information
Patch by Mook
BUG:172556


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@994337 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-07-10 14:34:04 +00:00
Tom Albers
bed793f703 Move external to anonsvn (http://svn.kde.org -> svn://anonsvn.kde.org)
BUG:195492


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@991290 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-07-04 15:41:38 +00:00
Scott Wheeler
be640ed19f Build on Haiku
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@990628 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-07-02 20:54:32 +00:00
Médéric Boquien
b19a4cf81c .oga files were not processed. Fix this. The problem was that even if the extension was defined in defaultFileExtensions(), it was not defined in create() so the file was never processed. As a
nice side effect, it also fixes the Amarok bug that caused .oga files not to be picked up by the collection scanner.

BUG:178602


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@983337 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-06-18 02:15:19 +00:00
Jeff Mitchell
901a427d1f Fix typo
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@982404 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-06-15 19:40:33 +00:00
Laurent Montel
c6e7812d37 not generate it on win32
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@980173 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-06-11 11:13:48 +00:00
Tanguy Krotoff
98a9b850cf Compilation fix for Visual C++ .NET 2003 (msvc71)
Explanations:
/Zc:wchar_t is recognized by msvc71, /Zc:wchar_t- is not (the - is important and was introduced only with msvc >= msvc80)
Thus /Zc:wchar_t- is recognized as /Zc:wchar_t and this is not what we want :)
Default behavior of msvc71 is already /Zc:wchar_t-

Solution:
Test the msvc version and add the compiler flag only if compiler >= msvc80 (e.g MSVC_VERSION >= 1400)
Same for /D_CRT_SECURE_NO_DEPRECATE and /D_CRT_NONSTDC_NO_DEPRECATE, there were introduced with msvc >= msvc80

git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@978720 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-06-07 23:07:32 +00:00
Tanguy Krotoff
fd20da2ef8 Fix a stupid crash inside mp4file.cpp (variable not initialized)
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@978719 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-06-07 23:05:11 +00:00
Lukáš Lalinský
0974882ecd Simplify extension checking in FileRef
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@961189 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-04-29 16:00:39 +00:00
Lukáš Lalinský
a9bce47f96 Add String:rfind
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@961188 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-04-29 15:57:05 +00:00
Lukáš Lalinský
321997c399 Make FileRef handle the .mp4 extension, too
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@961181 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-04-29 15:46:23 +00:00
Lukáš Lalinský
94a402395b Fix off-by-one error in MP4::Tag when looking for free padding to use
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@961160 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-04-29 15:12:19 +00:00
Jeff Mitchell
f1a16bcf0f Style and safety fixes backported from taglib-extras
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@961000 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-04-29 12:55:33 +00:00
Jeff Mitchell
40bdaedb71 This commit adds support for building taglib-extras against taglib during kdesupport build time. If kdesupport is not what is being built, the normal system taglib is used.
This adds forward includes to taglib; these may be very useful to other projects as well, since taglib's includes are rather spread out.  The README file in the include folder has instructions for regenerating them.


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@952369 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-04-11 17:13:24 +00:00
Lukáš Lalinský
33b939c76f Don't build ASF/MP4 FileRef tests if WITH_ASF/WITH_MP4 are undefined
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@945359 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-03-27 10:45:00 +00:00
Lukáš Lalinský
1eace99153 Detach before appending a character
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@944552 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-03-25 17:52:23 +00:00
Andreas Hartmetz
98d2808c17 this modified version has the advantage that it compiles
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@942892 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-03-22 20:48:27 +00:00
Scott Wheeler
fad967ae0b Less of The Big Ugly in the middle of the classes.
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@942880 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-03-22 19:27:38 +00:00
Andrew Coles
56e8766126 Added GCC pragma to suppress non-virtual dtor warning which is being preserved
to maintain BIC.



git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@942876 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-03-22 19:06:05 +00:00
Jeff Mitchell
36a398a156 Finish making .asf readable, thanks Lukas
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@937985 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-03-10 22:33:13 +00:00
Jeff Mitchell
f1fd227fce Several of us have seen .asf WMA files in the wild.
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@937972 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-03-10 22:02:20 +00:00
David Faure
c918150b72 Generate config.h in builddir again, and fix compilation when compiling taglib alone
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@937935 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-03-10 20:27:59 +00:00
Jeff Mitchell
3ec42c7b84 Re-add building things depending on config.h by having it generate in the source tree instead of the build tree, so that when cmake uses a non-source build dir (as it's supposed to) it can actually find the file. I think this is messy, as AFAIK cmake shouldn't be modifying the contents of the source tree...any cmake gurus out there, feel free to let me know if there's a better way.
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@937552 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-03-09 22:20:50 +00:00
Jeff Mitchell
f024f9ab1b This is surely an oversight; fix documentation
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@937541 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-03-09 21:53:46 +00:00
Scott Wheeler
66b3a1a184 Patch from Josef Radinger fixing typo in debug message.
BUG:30212
CCMAIL:taglib-devel@kde.org


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@911772 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-01-16 05:16:48 +00:00
Scott Wheeler
4fbd7c5d93 revert last
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@909079 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-01-10 23:15:33 +00:00
Scott Wheeler
3a390a11d0 Also counts as being empty.
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@909060 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-01-10 22:21:45 +00:00
Scott Wheeler
16a7efcd1c remove debug line from mac os framework build file
CCMAIL:taglib-devel@kde.org


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@907136 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2009-01-07 14:14:14 +00:00
Michael Jansen
fc80167a4f Fix build by copying strigis FindCppUnit.cmake to taglib. Build failed because CPPUNIT_LIBRARIES didn't
contain cppunits dependencies reported by cppunit-config.

git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@899928 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-12-21 21:46:41 +00:00
Michael Jansen
df3eb22060 Suppress warning about this check missing. if someone has a lower cmake version please check
and decrease the required version if successfull.

git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@899927 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-12-21 21:46:37 +00:00
Scott Wheeler
27e3643d19 Should fix the build.
CCMAIL:tbscope@gmail.com


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@892977 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-12-05 16:43:38 +00:00
Scott Wheeler
977ec6d41f warnings--
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@892694 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-12-05 00:37:39 +00:00
Scott Wheeler
e989d7ad1d fix warnings
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@892447 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-12-04 12:37:36 +00:00
Alexander Neundorf
e2c76396dd -INSTALL_DIR_NAME doesn't have to be set in the toplevel CMakeLists.txt, since it is already set as target property
-remove some unnecessary code
-use BIN_INSTALL_DIR for the RUNTIME destination

Alex




git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@891512 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-12-02 12:06:49 +00:00
Jeff Mitchell
5c0eb1d698 config.h doesn't exist, at least in my checkout, so explicitly defining HAVE_CONFIG_H was breaking build. I'm guessing this was a mistake, and should either be taken out, or
something needs to be fixed.

CCMAIL: lalinsky@gmail.com


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@883891 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-11-13 19:23:56 +00:00
Jeff Mitchell
1bcb9a6cc7 Add default case switch to fix compiler warnings when ASF or MP4 are not defined.
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@883884 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-11-13 19:19:39 +00:00
Lukáš Lalinský
5df6ef092b Add my old WMA and MP4 code. It is disabled by default, must be explicitly enabled to be compiled.
Scott: If you think this is really a bad idea, please revert.


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@883108 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-11-12 08:17:11 +00:00
Scott Wheeler
fa31fa29d7 typo
BUG:170036


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@854564 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-08-29 19:59:26 +00:00
Scott Wheeler
13fddc3974 Don't try to access the string list if the item type is a locator.
Allan, does this look correct?  (It at least fixes the crash...)

BUG:169810
CCMAIL:kde@carewolf.com


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@852712 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-08-26 12:19:47 +00:00
Scott Wheeler
d2a1cfa32d detach when using non-const operator[]
BUG:169389


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@850657 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-08-21 22:56:44 +00:00
Scott Wheeler
8434d19928 remove exec bit
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@824940 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-06-26 22:11:11 +00:00
Scott Wheeler
9947f45b31 Add support for private frames.
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@824701 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-06-26 15:06:20 +00:00
Scott Wheeler
07a6c86a31 If the genre string is empty don't treat it as a number.
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@823961 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-06-24 14:08:03 +00:00
Andy Goossens
bd90f1b9d4 SVN_SILENT: fix typo
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@822327 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-06-19 20:44:39 +00:00
Scott Wheeler
50fe14f4b7 add files here
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@822217 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-06-19 14:19:31 +00:00
Scott Wheeler
75579dc0dd Provisional .wav support. Tag writing will probably be disabled by default...
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@822160 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-06-19 11:15:39 +00:00
Scott Wheeler
1d86a684b2 wrong copyright
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@821783 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-06-18 13:21:35 +00:00
Scott Wheeler
be99222f29 Add a warning here so that it's clear that this constructor is not to be used for setting the
object's data.


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@821128 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-06-16 14:21:03 +00:00
Lukáš Lalinský
9ce4c72995 Fix reading of POPM rating -- it's unsigned char, not just char
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@811387 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-05-22 20:40:14 +00:00
Lukáš Lalinský
f6994ec26c Support for POPM ID3 frame
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@811137 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-05-22 12:06:45 +00:00
Benjamin Reed
51ca869f65 fix install_name RPATH stuff on OSX
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@810378 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-05-20 15:17:15 +00:00
Adriaan de Groot
55c788b608 Previous was me being stupid and too-quick on the commit button. Need unistd as well for read, write.
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@810229 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-05-20 09:29:09 +00:00
Adriaan de Groot
3fe0895f62 Need plain <fcntl.h> for open and its flags, not necessarily sys/fcntl.h
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@810223 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-05-20 09:20:19 +00:00
Adriaan de Groot
388d0f353d ldexp is a c99-ism, which is not available in strict C++; use math.h as well to pull it in and hope for the best.
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@808578 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-05-16 22:59:07 +00:00
Scott Wheeler
aec136f119 SVN_SILENT this isn't needed anymore
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@808293 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-05-16 09:47:19 +00:00
Scott Wheeler
08b6514420 Get all of the basic AIFF properties working.
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@808275 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-05-16 08:50:17 +00:00
Scott Wheeler
c52f3a4974 Add a skeleton (unimplemented) AIFF properties class.
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@808255 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-05-16 07:09:20 +00:00
Scott Wheeler
918366adcf Uff. Tabs-be-gone!
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@808250 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-05-16 07:05:55 +00:00
Scott Wheeler
5175ed952b Add AIFF here too.
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@808247 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-05-16 06:47:29 +00:00
Scott Wheeler
ea839c286a update cmake files
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@808246 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-05-16 06:46:03 +00:00
Scott Wheeler
123aa8a775 And now make it work for non-existing RIFF chunks.
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@808241 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-05-16 06:28:35 +00:00
Scott Wheeler
1d1fab1122 Now working for replacing an existing riff chunk.
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@808240 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-05-16 06:22:36 +00:00
Scott Wheeler
b2778ed715 Untested chunk writing code.
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@808237 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-05-16 06:01:52 +00:00
Scott Wheeler
d302b299d1 Add some docs.
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@808236 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-05-16 05:29:38 +00:00
Scott Wheeler
a2aaf8a8e1 Make reading an ID3v2 tag out of a RIFF chunk possible.
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@808235 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-05-16 05:08:51 +00:00
Scott Wheeler
0d10ae449c Groovy. Chunk parser worked on first try.
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@808232 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-05-16 04:35:59 +00:00
Scott Wheeler
d367a2f429 Add the skeleton of an AIFF implementation.
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@808225 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-05-16 04:20:50 +00:00
Scott Wheeler
efdcc7b01f Untested implementation of RIFF chunk parsing.
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@808221 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-05-16 03:49:44 +00:00
Scott Wheeler
40da982936 Add outline for RIFF files.
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@808211 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-05-16 02:13:56 +00:00
Scott Wheeler
d4527a0141 Do a dynamic_cast on these instead of a static since in the case of a non-supported
frame flag the frame will still be added to the list, but using the UnknownFrame type
rather than the canonical type.  At the moment, on systems with a build in zlib, this
should only happen for the (very rare) encrypted frames.

BUG:161721
CCMAIL:taglib-devel@kde.org


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@805637 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-05-09 00:16:30 +00:00
Harald Sitter
09dfbb7c3a change external prop back to https://svn.kde.org
CCMAIL: faure@kde.org
CCMAIL: mueller@kde.org

git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@795727 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-04-11 08:45:32 +00:00
Adriaan de Groot
5fe5ee1074 kdesupport is going to compile against stdcxx anyway, Cstd wont cut it, so document better and just put stdcxx in there.
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@794718 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-04-08 12:40:52 +00:00
Scott Wheeler
a724586b43 Don't overflow for really high bitrate files.
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@794711 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-04-08 12:15:20 +00:00
Andreas Hartmetz
bbfcc84dec add missing include; fixes compilation with tests
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@794194 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-04-06 21:22:49 +00:00
Harald Sitter
29995f8c2a change externals property to use svn://anonsvn.kde.org
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@793327 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-04-03 17:04:12 +00:00
431 changed files with 41682 additions and 6701 deletions

18
.astylerc Normal file
View File

@@ -0,0 +1,18 @@
--suffix=none
--style=kr
--indent=spaces=2
--indent-col1-comments
--min-conditional-indent=0
--attach-extern-c
--attach-namespaces
--indent-namespaces
--pad-oper
--unpad-paren
--align-pointer=name
--align-reference=name
--max-instatement-indent=40
--break-closing-brackets
--remove-brackets
--convert-tabs
--max-code-length=100
--break-after-logical

21
.editorconfig Normal file
View File

@@ -0,0 +1,21 @@
# EditorConfig is awesome: http://EditorConfig.org
# top-most EditorConfig file
root = true
# Non-specified newlines with a newline ending every file
[*]
insert_final_newline = true
# 2 space indentation
[*.{h,cpp,tcc,cmake,yml}]
indent_style = space
indent_size = 2
# Trim traling whitespaces
[*.{h,cpp,tcc,cmake,yml}]
trim_trailing_whitespace = true
# UTF-8 without BOM
[*]
charset = utf-8

49
.gitignore vendored Normal file
View File

@@ -0,0 +1,49 @@
cmake_install.cmake
cmake_uninstall.cmake
Makefile
CTestTestfile.cmake
CMakeFiles/
*.so
*.so.*
*.dylib
*.vcproj
*.ncb
*.sln
*.suo
*.user
.*
*~
/CMakeCache.txt
/Doxyfile
/config.h
/taglib.pc
/tests/test_runner
/tests/Testing
/taglib/libtag.a
/taglib_config.h
/taglib-config
/bindings/c/libtag_c.a
/bindings/c/taglib_c.pc
/bindings/c/Debug
/bindings/c/MinSizeRel
/bindings/c/Release
/bindings/c/tag_c.dir/Debug
/bindings/c/tag_c.dir/MinSizeRel
/bindings/c/tag_c.dir/Release
/examples/framelist
/examples/strip-id3v1
/examples/tagreader
/examples/tagreader_c
/examples/tagwriter
/doc/html
/taglib/Debug
/taglib/MinSizeRel
/taglib/Release
/taglib/tag.dir/Debug
/taglib/tag.dir/MinSizeRel
/taglib/tag.dir/Release
/ALL_BUILD.dir
/ZERO_CHECK.dir
taglib.h.stamp
taglib.xcodeproj
CMakeScripts

32
.travis.yml Normal file
View File

@@ -0,0 +1,32 @@
language: cpp
sudo: false
os:
- linux
- osx
dist: trusty
compiler:
- gcc
- clang
arch:
- ppc64le
addons:
apt:
packages:
- libcppunit-dev
- zlib1g-dev
matrix:
exclude:
- os: osx
compiler: gcc
install:
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew install cppunit; fi
script: cmake -DBUILD_TESTS=ON -DBUILD_EXAMPLES=ON -DBUILD_BINDINGS=ON -DCMAKE_CXX_FLAGS="-std=c++11" . && make && make check

327
3rdparty/utf8-cpp/checked.h vendored Normal file
View File

@@ -0,0 +1,327 @@
// Copyright 2006-2016 Nemanja Trifunovic
/*
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#ifndef UTF8_FOR_CPP_CHECKED_H_2675DCD0_9480_4c0c_B92A_CC14C027B731
#define UTF8_FOR_CPP_CHECKED_H_2675DCD0_9480_4c0c_B92A_CC14C027B731
#include "core.h"
#include <stdexcept>
namespace utf8
{
// Base for the exceptions that may be thrown from the library
class exception : public ::std::exception {
};
// Exceptions that may be thrown from the library functions.
class invalid_code_point : public exception {
uint32_t cp;
public:
invalid_code_point(uint32_t codepoint) : cp(codepoint) {}
virtual const char* what() const throw() { return "Invalid code point"; }
uint32_t code_point() const {return cp;}
};
class invalid_utf8 : public exception {
uint8_t u8;
public:
invalid_utf8 (uint8_t u) : u8(u) {}
virtual const char* what() const throw() { return "Invalid UTF-8"; }
uint8_t utf8_octet() const {return u8;}
};
class invalid_utf16 : public exception {
uint16_t u16;
public:
invalid_utf16 (uint16_t u) : u16(u) {}
virtual const char* what() const throw() { return "Invalid UTF-16"; }
uint16_t utf16_word() const {return u16;}
};
class not_enough_room : public exception {
public:
virtual const char* what() const throw() { return "Not enough space"; }
};
/// The library API - functions intended to be called by the users
template <typename octet_iterator>
octet_iterator append(uint32_t cp, octet_iterator result)
{
if (!utf8::internal::is_code_point_valid(cp))
throw invalid_code_point(cp);
if (cp < 0x80) // one octet
*(result++) = static_cast<uint8_t>(cp);
else if (cp < 0x800) { // two octets
*(result++) = static_cast<uint8_t>((cp >> 6) | 0xc0);
*(result++) = static_cast<uint8_t>((cp & 0x3f) | 0x80);
}
else if (cp < 0x10000) { // three octets
*(result++) = static_cast<uint8_t>((cp >> 12) | 0xe0);
*(result++) = static_cast<uint8_t>(((cp >> 6) & 0x3f) | 0x80);
*(result++) = static_cast<uint8_t>((cp & 0x3f) | 0x80);
}
else { // four octets
*(result++) = static_cast<uint8_t>((cp >> 18) | 0xf0);
*(result++) = static_cast<uint8_t>(((cp >> 12) & 0x3f) | 0x80);
*(result++) = static_cast<uint8_t>(((cp >> 6) & 0x3f) | 0x80);
*(result++) = static_cast<uint8_t>((cp & 0x3f) | 0x80);
}
return result;
}
template <typename octet_iterator, typename output_iterator>
output_iterator replace_invalid(octet_iterator start, octet_iterator end, output_iterator out, uint32_t replacement)
{
while (start != end) {
octet_iterator sequence_start = start;
internal::utf_error err_code = utf8::internal::validate_next(start, end);
switch (err_code) {
case internal::UTF8_OK :
for (octet_iterator it = sequence_start; it != start; ++it)
*out++ = *it;
break;
case internal::NOT_ENOUGH_ROOM:
throw not_enough_room();
case internal::INVALID_LEAD:
out = utf8::append (replacement, out);
++start;
break;
case internal::INCOMPLETE_SEQUENCE:
case internal::OVERLONG_SEQUENCE:
case internal::INVALID_CODE_POINT:
out = utf8::append (replacement, out);
++start;
// just one replacement mark for the sequence
while (start != end && utf8::internal::is_trail(*start))
++start;
break;
}
}
return out;
}
template <typename octet_iterator, typename output_iterator>
inline output_iterator replace_invalid(octet_iterator start, octet_iterator end, output_iterator out)
{
static const uint32_t replacement_marker = utf8::internal::mask16(0xfffd);
return utf8::replace_invalid(start, end, out, replacement_marker);
}
template <typename octet_iterator>
uint32_t next(octet_iterator& it, octet_iterator end)
{
uint32_t cp = 0;
internal::utf_error err_code = utf8::internal::validate_next(it, end, cp);
switch (err_code) {
case internal::UTF8_OK :
break;
case internal::NOT_ENOUGH_ROOM :
throw not_enough_room();
case internal::INVALID_LEAD :
case internal::INCOMPLETE_SEQUENCE :
case internal::OVERLONG_SEQUENCE :
throw invalid_utf8(*it);
case internal::INVALID_CODE_POINT :
throw invalid_code_point(cp);
}
return cp;
}
template <typename octet_iterator>
uint32_t peek_next(octet_iterator it, octet_iterator end)
{
return utf8::next(it, end);
}
template <typename octet_iterator>
uint32_t prior(octet_iterator& it, octet_iterator start)
{
// can't do much if it == start
if (it == start)
throw not_enough_room();
octet_iterator end = it;
// Go back until we hit either a lead octet or start
while (utf8::internal::is_trail(*(--it)))
if (it == start)
throw invalid_utf8(*it); // error - no lead byte in the sequence
return utf8::peek_next(it, end);
}
/// Deprecated in versions that include "prior"
template <typename octet_iterator>
uint32_t previous(octet_iterator& it, octet_iterator pass_start)
{
octet_iterator end = it;
while (utf8::internal::is_trail(*(--it)))
if (it == pass_start)
throw invalid_utf8(*it); // error - no lead byte in the sequence
octet_iterator temp = it;
return utf8::next(temp, end);
}
template <typename octet_iterator, typename distance_type>
void advance (octet_iterator& it, distance_type n, octet_iterator end)
{
for (distance_type i = 0; i < n; ++i)
utf8::next(it, end);
}
template <typename octet_iterator>
typename std::iterator_traits<octet_iterator>::difference_type
distance (octet_iterator first, octet_iterator last)
{
typename std::iterator_traits<octet_iterator>::difference_type dist;
for (dist = 0; first < last; ++dist)
utf8::next(first, last);
return dist;
}
template <typename u16bit_iterator, typename octet_iterator>
octet_iterator utf16to8 (u16bit_iterator start, u16bit_iterator end, octet_iterator result)
{
while (start != end) {
uint32_t cp = utf8::internal::mask16(*start++);
// Take care of surrogate pairs first
if (utf8::internal::is_lead_surrogate(cp)) {
if (start != end) {
uint32_t trail_surrogate = utf8::internal::mask16(*start++);
if (utf8::internal::is_trail_surrogate(trail_surrogate))
cp = (cp << 10) + trail_surrogate + internal::SURROGATE_OFFSET;
else
throw invalid_utf16(static_cast<uint16_t>(trail_surrogate));
}
else
throw invalid_utf16(static_cast<uint16_t>(cp));
}
// Lone trail surrogate
else if (utf8::internal::is_trail_surrogate(cp))
throw invalid_utf16(static_cast<uint16_t>(cp));
result = utf8::append(cp, result);
}
return result;
}
template <typename u16bit_iterator, typename octet_iterator>
u16bit_iterator utf8to16 (octet_iterator start, octet_iterator end, u16bit_iterator result)
{
while (start < end) {
uint32_t cp = utf8::next(start, end);
if (cp > 0xffff) { //make a surrogate pair
*result++ = static_cast<uint16_t>((cp >> 10) + internal::LEAD_OFFSET);
*result++ = static_cast<uint16_t>((cp & 0x3ff) + internal::TRAIL_SURROGATE_MIN);
}
else
*result++ = static_cast<uint16_t>(cp);
}
return result;
}
template <typename octet_iterator, typename u32bit_iterator>
octet_iterator utf32to8 (u32bit_iterator start, u32bit_iterator end, octet_iterator result)
{
while (start != end)
result = utf8::append(*(start++), result);
return result;
}
template <typename octet_iterator, typename u32bit_iterator>
u32bit_iterator utf8to32 (octet_iterator start, octet_iterator end, u32bit_iterator result)
{
while (start < end)
(*result++) = utf8::next(start, end);
return result;
}
// The iterator class
template <typename octet_iterator>
class iterator : public std::iterator <std::bidirectional_iterator_tag, uint32_t> {
octet_iterator it;
octet_iterator range_start;
octet_iterator range_end;
public:
iterator () {}
explicit iterator (const octet_iterator& octet_it,
const octet_iterator& rangestart,
const octet_iterator& rangeend) :
it(octet_it), range_start(rangestart), range_end(rangeend)
{
if (it < range_start || it > range_end)
throw std::out_of_range("Invalid utf-8 iterator position");
}
// the default "big three" are OK
octet_iterator base () const { return it; }
uint32_t operator * () const
{
octet_iterator temp = it;
return utf8::next(temp, range_end);
}
bool operator == (const iterator& rhs) const
{
if (range_start != rhs.range_start || range_end != rhs.range_end)
throw std::logic_error("Comparing utf-8 iterators defined with different ranges");
return (it == rhs.it);
}
bool operator != (const iterator& rhs) const
{
return !(operator == (rhs));
}
iterator& operator ++ ()
{
utf8::next(it, range_end);
return *this;
}
iterator operator ++ (int)
{
iterator temp = *this;
utf8::next(it, range_end);
return temp;
}
iterator& operator -- ()
{
utf8::prior(it, range_start);
return *this;
}
iterator operator -- (int)
{
iterator temp = *this;
utf8::prior(it, range_start);
return temp;
}
}; // class iterator
} // namespace utf8
#endif //header guard

332
3rdparty/utf8-cpp/core.h vendored Normal file
View File

@@ -0,0 +1,332 @@
// Copyright 2006 Nemanja Trifunovic
/*
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#ifndef UTF8_FOR_CPP_CORE_H_2675DCD0_9480_4c0c_B92A_CC14C027B731
#define UTF8_FOR_CPP_CORE_H_2675DCD0_9480_4c0c_B92A_CC14C027B731
#include <iterator>
namespace utf8
{
// The typedefs for 8-bit, 16-bit and 32-bit unsigned integers
// You may need to change them to match your system.
// These typedefs have the same names as ones from cstdint, or boost/cstdint
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
// Helper code - not intended to be directly called by the library users. May be changed at any time
namespace internal
{
// Unicode constants
// Leading (high) surrogates: 0xd800 - 0xdbff
// Trailing (low) surrogates: 0xdc00 - 0xdfff
const uint16_t LEAD_SURROGATE_MIN = 0xd800u;
const uint16_t LEAD_SURROGATE_MAX = 0xdbffu;
const uint16_t TRAIL_SURROGATE_MIN = 0xdc00u;
const uint16_t TRAIL_SURROGATE_MAX = 0xdfffu;
const uint16_t LEAD_OFFSET = LEAD_SURROGATE_MIN - (0x10000 >> 10);
const uint32_t SURROGATE_OFFSET = 0x10000u - (LEAD_SURROGATE_MIN << 10) - TRAIL_SURROGATE_MIN;
// Maximum valid value for a Unicode code point
const uint32_t CODE_POINT_MAX = 0x0010ffffu;
template<typename octet_type>
inline uint8_t mask8(octet_type oc)
{
return static_cast<uint8_t>(0xff & oc);
}
template<typename u16_type>
inline uint16_t mask16(u16_type oc)
{
return static_cast<uint16_t>(0xffff & oc);
}
template<typename octet_type>
inline bool is_trail(octet_type oc)
{
return ((utf8::internal::mask8(oc) >> 6) == 0x2);
}
template <typename u16>
inline bool is_lead_surrogate(u16 cp)
{
return (cp >= LEAD_SURROGATE_MIN && cp <= LEAD_SURROGATE_MAX);
}
template <typename u16>
inline bool is_trail_surrogate(u16 cp)
{
return (cp >= TRAIL_SURROGATE_MIN && cp <= TRAIL_SURROGATE_MAX);
}
template <typename u16>
inline bool is_surrogate(u16 cp)
{
return (cp >= LEAD_SURROGATE_MIN && cp <= TRAIL_SURROGATE_MAX);
}
template <typename u32>
inline bool is_code_point_valid(u32 cp)
{
return (cp <= CODE_POINT_MAX && !utf8::internal::is_surrogate(cp));
}
template <typename octet_iterator>
inline typename std::iterator_traits<octet_iterator>::difference_type
sequence_length(octet_iterator lead_it)
{
uint8_t lead = utf8::internal::mask8(*lead_it);
if (lead < 0x80)
return 1;
else if ((lead >> 5) == 0x6)
return 2;
else if ((lead >> 4) == 0xe)
return 3;
else if ((lead >> 3) == 0x1e)
return 4;
else
return 0;
}
template <typename octet_difference_type>
inline bool is_overlong_sequence(uint32_t cp, octet_difference_type length)
{
if (cp < 0x80) {
if (length != 1)
return true;
}
else if (cp < 0x800) {
if (length != 2)
return true;
}
else if (cp < 0x10000) {
if (length != 3)
return true;
}
return false;
}
enum utf_error {UTF8_OK, NOT_ENOUGH_ROOM, INVALID_LEAD, INCOMPLETE_SEQUENCE, OVERLONG_SEQUENCE, INVALID_CODE_POINT};
/// Helper for get_sequence_x
template <typename octet_iterator>
utf_error increase_safely(octet_iterator& it, octet_iterator end)
{
if (++it == end)
return NOT_ENOUGH_ROOM;
if (!utf8::internal::is_trail(*it))
return INCOMPLETE_SEQUENCE;
return UTF8_OK;
}
#define UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(IT, END) {utf_error ret = increase_safely(IT, END); if (ret != UTF8_OK) return ret;}
/// get_sequence_x functions decode utf-8 sequences of the length x
template <typename octet_iterator>
utf_error get_sequence_1(octet_iterator& it, octet_iterator end, uint32_t& code_point)
{
if (it == end)
return NOT_ENOUGH_ROOM;
code_point = utf8::internal::mask8(*it);
return UTF8_OK;
}
template <typename octet_iterator>
utf_error get_sequence_2(octet_iterator& it, octet_iterator end, uint32_t& code_point)
{
if (it == end)
return NOT_ENOUGH_ROOM;
code_point = utf8::internal::mask8(*it);
UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end)
code_point = ((code_point << 6) & 0x7ff) + ((*it) & 0x3f);
return UTF8_OK;
}
template <typename octet_iterator>
utf_error get_sequence_3(octet_iterator& it, octet_iterator end, uint32_t& code_point)
{
if (it == end)
return NOT_ENOUGH_ROOM;
code_point = utf8::internal::mask8(*it);
UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end)
code_point = ((code_point << 12) & 0xffff) + ((utf8::internal::mask8(*it) << 6) & 0xfff);
UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end)
code_point += (*it) & 0x3f;
return UTF8_OK;
}
template <typename octet_iterator>
utf_error get_sequence_4(octet_iterator& it, octet_iterator end, uint32_t& code_point)
{
if (it == end)
return NOT_ENOUGH_ROOM;
code_point = utf8::internal::mask8(*it);
UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end)
code_point = ((code_point << 18) & 0x1fffff) + ((utf8::internal::mask8(*it) << 12) & 0x3ffff);
UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end)
code_point += (utf8::internal::mask8(*it) << 6) & 0xfff;
UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end)
code_point += (*it) & 0x3f;
return UTF8_OK;
}
#undef UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR
template <typename octet_iterator>
utf_error validate_next(octet_iterator& it, octet_iterator end, uint32_t& code_point)
{
if (it == end)
return NOT_ENOUGH_ROOM;
// Save the original value of it so we can go back in case of failure
// Of course, it does not make much sense with i.e. stream iterators
octet_iterator original_it = it;
uint32_t cp = 0;
// Determine the sequence length based on the lead octet
typedef typename std::iterator_traits<octet_iterator>::difference_type octet_difference_type;
const octet_difference_type length = utf8::internal::sequence_length(it);
// Get trail octets and calculate the code point
utf_error err = UTF8_OK;
switch (length) {
case 0:
return INVALID_LEAD;
case 1:
err = utf8::internal::get_sequence_1(it, end, cp);
break;
case 2:
err = utf8::internal::get_sequence_2(it, end, cp);
break;
case 3:
err = utf8::internal::get_sequence_3(it, end, cp);
break;
case 4:
err = utf8::internal::get_sequence_4(it, end, cp);
break;
}
if (err == UTF8_OK) {
// Decoding succeeded. Now, security checks...
if (utf8::internal::is_code_point_valid(cp)) {
if (!utf8::internal::is_overlong_sequence(cp, length)){
// Passed! Return here.
code_point = cp;
++it;
return UTF8_OK;
}
else
err = OVERLONG_SEQUENCE;
}
else
err = INVALID_CODE_POINT;
}
// Failure branch - restore the original value of the iterator
it = original_it;
return err;
}
template <typename octet_iterator>
inline utf_error validate_next(octet_iterator& it, octet_iterator end) {
uint32_t ignored;
return utf8::internal::validate_next(it, end, ignored);
}
} // namespace internal
/// The library API - functions intended to be called by the users
// Byte order mark
const uint8_t bom[] = {0xef, 0xbb, 0xbf};
template <typename octet_iterator>
octet_iterator find_invalid(octet_iterator start, octet_iterator end)
{
octet_iterator result = start;
while (result != end) {
utf8::internal::utf_error err_code = utf8::internal::validate_next(result, end);
if (err_code != internal::UTF8_OK)
return result;
}
return result;
}
template <typename octet_iterator>
inline bool is_valid(octet_iterator start, octet_iterator end)
{
return (utf8::find_invalid(start, end) == end);
}
template <typename octet_iterator>
inline bool starts_with_bom (octet_iterator it, octet_iterator end)
{
return (
((it != end) && (utf8::internal::mask8(*it++)) == bom[0]) &&
((it != end) && (utf8::internal::mask8(*it++)) == bom[1]) &&
((it != end) && (utf8::internal::mask8(*it)) == bom[2])
);
}
//Deprecated in release 2.3
template <typename octet_iterator>
inline bool is_bom (octet_iterator it)
{
return (
(utf8::internal::mask8(*it++)) == bom[0] &&
(utf8::internal::mask8(*it++)) == bom[1] &&
(utf8::internal::mask8(*it)) == bom[2]
);
}
} // namespace utf8
#endif // header guard

12
AUTHORS
View File

@@ -1,11 +1,23 @@
Scott Wheeler <wheeler@kde.org>
Author, maintainer
Lukas Lalinsky <lalinsky@gmail.com>
Implementation of multiple new file formats, many bug fixes, maintainer
Tsuda Kageyu <tsuda.kageyu@gmail.com>
A lot of bug fixes and performance improvements, maintainer.
Stephen F. Booth <me@sbooth.org>
DSF metadata implementation, bug fixes, maintainer.
Ismael Orenstein <orenstein@kde.org>
Xing header implementation
Allan Sandfeld Jensen <kde@carewolf.org>
FLAC metadata implementation
Teemu Tervo <teemu.tervo@gmx.net>
Numerous bug reports and fixes
Mathias Panzenböck <grosser.meister.morti@gmx.net>
Mod, S3M, IT and XM metadata implementations
Damien Plisson <damien78@audirvana.com>
DSDIFF metadata implementation
Urs Fleisch <ufleisch@users.sourceforge.net>
Bug fixes, maintainer.
Please send all patches and questions to taglib-devel@kde.org rather than to
individual developers!

View File

@@ -1,56 +1,168 @@
cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)
project(taglib)
OPTION(BUILD_TESTS "Build the test suite" OFF)
OPTION(BUILD_EXAMPLES "Build the examples" OFF)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
OPTION(NO_ITUNES_HACKS "Disable workarounds for iTunes bugs" OFF)
if(DEFINED ENABLE_STATIC)
message(FATAL_ERROR "This option is no longer available, use BUILD_SHARED_LIBS instead")
endif()
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
if(APPLE)
option(BUILD_FRAMEWORK "Build an OS X framework" OFF)
if(BUILD_FRAMEWORK)
set(BUILD_SHARED_LIBS ON)
#set(CMAKE_MACOSX_RPATH 1)
set(FRAMEWORK_INSTALL_DIR "/Library/Frameworks" CACHE STRING "Directory to install frameworks to.")
endif()
endif()
if(NOT BUILD_SHARED_LIBS)
add_definitions(-DTAGLIB_STATIC)
endif()
option(ENABLE_STATIC_RUNTIME "Visual Studio, link with runtime statically" OFF)
option(ENABLE_CCACHE "Use ccache when building libtag" OFF)
if(ENABLE_CCACHE)
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif()
endif()
option(VISIBILITY_HIDDEN "Build with -fvisibility=hidden" OFF)
option(BUILD_TESTS "Build the test suite" OFF)
option(BUILD_EXAMPLES "Build the examples" OFF)
option(BUILD_BINDINGS "Build the bindings" ON)
option(NO_ITUNES_HACKS "Disable workarounds for iTunes bugs" OFF)
option(PLATFORM_WINRT "Enable WinRT support" OFF)
if(PLATFORM_WINRT)
add_definitions(-DPLATFORM_WINRT)
endif()
add_definitions(-DHAVE_CONFIG_H)
set(TESTS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/tests/")
#add some KDE specific stuff
set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" )
set(EXEC_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE PATH "Base directory for executables and libraries" FORCE)
#
## the following are directories where stuff will be installed to
set(BIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/bin" CACHE PATH "The kde info install dir (default prefix/info)" FORCE)
set(LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}" CACHE PATH "The subdirectory relative to the install prefix where libraries will be installed (default is /lib${LIB_SUFFIX})" FORCE)
set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "The subdirectory to the header prefix" FORCE)
set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)")
set(EXEC_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" CACHE PATH "Base directory for executables and libraries")
set(BIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/bin" CACHE PATH "The subdirectory to the binaries prefix (default prefix/bin)")
set(LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}" CACHE PATH "The subdirectory relative to the install prefix where libraries will be installed (default is /lib${LIB_SUFFIX})")
set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "The subdirectory to the header prefix")
if (CMAKE_COMPILER_IS_GNUCXX)
if (CMAKE_SYSTEM_NAME MATCHES Linux)
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long -ansi -Wundef -Wcast-align -Werror-implicit-function-declaration -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-common")
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -fno-check-new -fno-common")
endif (CMAKE_SYSTEM_NAME MATCHES Linux)
endif (CMAKE_COMPILER_IS_GNUCXX)
if(MSVC)
add_definitions( -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE )
endif(MSVC)
if (WIN32)
set(CMAKE_DEBUG_POSTFIX "d")
endif (WIN32)
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
endif()
SET(TAGLIB_LIB_MAJOR_VERSION "1")
SET(TAGLIB_LIB_MINOR_VERSION "5")
SET(TAGLIB_LIB_PATCH_VERSION "0")
if(MSVC AND ENABLE_STATIC_RUNTIME)
foreach(flag_var CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
endforeach(flag_var)
endif()
SET(TAGLIB_LIB_VERSION_STRING "${TAGLIB_LIB_MAJOR_VERSION}.${TAGLIB_LIB_MINOR_VERSION}.${TAGLIB_LIB_PATCH_VERSION}")
# Read version information from file taglib/toolkit/taglib.h into variables
# TAGLIB_LIB_MAJOR_VERSION, TAGLIB_LIB_MINOR_VERSION, TAGLIB_LIB_PATCH_VERSION.
foreach(version_part MAJOR MINOR PATCH)
set(version_var_name "TAGLIB_${version_part}_VERSION")
file(STRINGS taglib/toolkit/taglib.h version_line
REGEX "^#define +${version_var_name}")
if(NOT version_line)
message(FATAL_ERROR "${version_var_name} not found in taglib.h")
endif()
string(REGEX MATCH "${version_var_name} +([^ ]+)" result ${version_line})
set(TAGLIB_LIB_${version_part}_VERSION ${CMAKE_MATCH_1})
endforeach(version_part)
# Only used to force cmake rerun when taglib.h changes.
configure_file(taglib/toolkit/taglib.h ${CMAKE_CURRENT_BINARY_DIR}/taglib.h.stamp)
if("${TAGLIB_LIB_PATCH_VERSION}" EQUAL "0")
set(TAGLIB_LIB_VERSION_STRING "${TAGLIB_LIB_MAJOR_VERSION}.${TAGLIB_LIB_MINOR_VERSION}")
else()
set(TAGLIB_LIB_VERSION_STRING "${TAGLIB_LIB_MAJOR_VERSION}.${TAGLIB_LIB_MINOR_VERSION}.${TAGLIB_LIB_PATCH_VERSION}")
endif()
# 1. If the library source code has changed at all since the last update, then increment revision.
# 2. If any interfaces have been added, removed, or changed since the last update, increment current, and set revision to 0.
# 3. If any interfaces have been added since the last public release, then increment age.
# 4. If any interfaces have been removed since the last public release, then set age to 0.
set(TAGLIB_SOVERSION_CURRENT 19)
set(TAGLIB_SOVERSION_REVISION 0)
set(TAGLIB_SOVERSION_AGE 18)
math(EXPR TAGLIB_SOVERSION_MAJOR "${TAGLIB_SOVERSION_CURRENT} - ${TAGLIB_SOVERSION_AGE}")
math(EXPR TAGLIB_SOVERSION_MINOR "${TAGLIB_SOVERSION_AGE}")
math(EXPR TAGLIB_SOVERSION_PATCH "${TAGLIB_SOVERSION_REVISION}")
include(ConfigureChecks.cmake)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/taglib-config.cmake ${CMAKE_CURRENT_BINARY_DIR}/taglib-config )
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/taglib.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/taglib.pc )
if(${ZLIB_FOUND})
set(ZLIB_LIBRARIES_FLAGS -lz)
endif()
configure_file(config-taglib.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h )
ADD_SUBDIRECTORY( taglib )
ADD_SUBDIRECTORY(tests)
ADD_SUBDIRECTORY(examples)
ADD_SUBDIRECTORY(bindings)
if(NOT WIN32)
INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/taglib.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig )
endif(NOT WIN32)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/taglib-config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/taglib-config" @ONLY)
install(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/taglib-config" DESTINATION "${BIN_INSTALL_DIR}")
endif()
INSTALL( PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/taglib-config DESTINATION ${BIN_INSTALL_DIR})
if(WIN32)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/taglib-config.cmd.cmake" "${CMAKE_CURRENT_BINARY_DIR}/taglib-config.cmd")
install(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/taglib-config.cmd" DESTINATION "${BIN_INSTALL_DIR}")
endif()
if(NOT BUILD_FRAMEWORK)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/taglib.pc.cmake" "${CMAKE_CURRENT_BINARY_DIR}/taglib.pc" @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/taglib.pc" DESTINATION "${LIB_INSTALL_DIR}/pkgconfig")
endif()
if(NOT HAVE_ZLIB AND ZLIB_SOURCE)
set(HAVE_ZLIB 1)
set(HAVE_ZLIB_SOURCE 1)
endif()
include_directories(${CMAKE_CURRENT_BINARY_DIR})
configure_file(config.h.cmake "${CMAKE_CURRENT_BINARY_DIR}/config.h")
if(WITH_ASF)
set(TAGLIB_WITH_ASF TRUE)
endif()
if(WITH_MP4)
set(TAGLIB_WITH_MP4 TRUE)
endif()
option(TRACE_IN_RELEASE "Output debug messages even in release mode" OFF)
if(TRACE_IN_RELEASE)
set(TRACE_IN_RELEASE TRUE)
endif()
configure_file(taglib/taglib_config.h.cmake "${CMAKE_CURRENT_BINARY_DIR}/taglib_config.h")
add_subdirectory(taglib)
if(BUILD_BINDINGS)
add_subdirectory(bindings)
endif()
if(BUILD_TESTS AND NOT BUILD_SHARED_LIBS)
enable_testing()
add_subdirectory(tests)
endif()
if(BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.cmake" "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile")
file(COPY doc/taglib.png DESTINATION doc)
add_custom_target(docs doxygen)
# uninstall target
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY)
if(NOT TARGET uninstall)
add_custom_target(uninstall COMMAND "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
endif()

View File

@@ -1,113 +1,125 @@
GNU LIBRARY GENERAL PUBLIC LICENSE
Version 2, June 1991
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991 Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA.
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the library GPL. It is
numbered 2 because it goes with version 2 of the ordinary GPL.]
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Library General Public License, applies to some
specially designated Free Software Foundation software, and to any
other libraries whose authors decide to use it. You can use it for
your libraries, too.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if
you distribute copies of the library, or if you modify it.
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link a program with the library, you must provide
complete object files to the recipients so that they can relink them
with the library, after making changes to the library and recompiling
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
Our method of protecting your rights has two steps: (1) copyright
the library, and (2) offer you this license which gives you legal
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
Also, for each distributor's protection, we want to make certain
that everyone understands that there is no warranty for this free
library. If the library is modified by someone else and passed on, we
want its recipients to know that what they have is not the original
version, so that any problems introduced by others will not reflect on
the original authors' reputations.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that companies distributing free
software will individually obtain patent licenses, thus in effect
transforming the program into proprietary software. To prevent this,
we have made it clear that any patent must be licensed for everyone's
free use or not licensed at all.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the ordinary
GNU General Public License, which was designed for utility programs. This
license, the GNU Library General Public License, applies to certain
designated libraries. This license is quite different from the ordinary
one; be sure to read it in full, and don't assume that anything in it is
the same as in the ordinary license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
The reason we have a separate public license for some libraries is that
they blur the distinction we usually make between modifying or adding to a
program and simply using it. Linking a program with a library, without
changing the library, is in some sense simply using the library, and is
analogous to running a utility program or application program. However, in
a textual and legal sense, the linked executable is a combined work, a
derivative of the original library, and the ordinary General Public License
treats it as such.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
Because of this blurred distinction, using the ordinary General
Public License for libraries did not effectively promote software
sharing, because most developers did not use the libraries. We
concluded that weaker conditions might promote sharing better.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
However, unrestricted linking of non-free programs would deprive the
users of those programs of all benefit from the free status of the
libraries themselves. This Library General Public License is intended to
permit developers of non-free programs to use free libraries, while
preserving your freedom as a user of such programs to change the free
libraries that are incorporated in them. (We have not seen how to achieve
this as regards changes in header files, but we have achieved it as regards
changes in the actual functions of the Library.) The hope is that this
will lead to faster development of free libraries.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, while the latter only
works together with the library.
Note that it is possible for a library to be covered by the ordinary
General Public License rather than by this special one.
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LIBRARY GENERAL PUBLIC LICENSE
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library which
contains a notice placed by the copyright holder or other authorized
party saying it may be distributed under the terms of this Library
General Public License (also called "this License"). Each licensee is
addressed as "you".
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
@@ -134,7 +146,7 @@ such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
@@ -256,7 +268,7 @@ distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also compile or
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
@@ -283,23 +295,31 @@ of these things:
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Accompany the work with a written offer, valid for at
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
c) If distribution of the work is made by offering access to copy
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
d) Verify that the user has already received a copy of these
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the source code distributed need not include anything that is normally
distributed (in either source or binary form) with the major
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
@@ -348,7 +368,7 @@ Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
@@ -391,7 +411,7 @@ excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Library General Public License from time to time.
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
@@ -412,7 +432,7 @@ decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
@@ -435,8 +455,9 @@ FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
@@ -455,7 +476,7 @@ convey the exclusion of warranty; and each file should have at least the
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -464,7 +485,7 @@ convey the exclusion of warranty; and each file should have at least the
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.

View File

@@ -1,28 +1,203 @@
# NOTE: only add something here if it is really needed by all of kdelibs.
# Otherwise please prefer adding to the relevant config-foo.h.cmake file,
# and the CMakeLists.txt that generates it (or a separate ConfigureChecks.make file if you prefer)
# to minimize recompilations and increase modularity.
include(CheckIncludeFile)
include(CheckIncludeFiles)
include(CheckSymbolExists)
include(CheckFunctionExists)
include(CheckLibraryExists)
include(CheckTypeSize)
include(CheckCXXSourceCompiles)
#check for libz using the cmake supplied FindZLIB.cmake
FIND_PACKAGE(ZLIB)
# Check if the size of numeric types are suitable.
IF(ZLIB_FOUND)
SET(HAVE_ZLIB 1)
ELSE(ZLIB_FOUND)
SET(HAVE_ZLIB 0)
ENDIF(ZLIB_FOUND)
check_type_size("short" SIZEOF_SHORT)
if(NOT ${SIZEOF_SHORT} EQUAL 2)
message(FATAL_ERROR "TagLib requires that short is 16-bit wide.")
endif()
SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
FIND_PACKAGE(CppUnit)
IF (NOT CPPUNIT_FOUND AND BUILD_TESTS)
MESSAGE(STATUS "CppUnit not found, disabling tests.")
SET(BUILD_TESTS OFF)
ENDIF(NOT CPPUNIT_FOUND AND BUILD_TESTS)
check_type_size("int" SIZEOF_INT)
if(NOT ${SIZEOF_INT} EQUAL 4)
message(FATAL_ERROR "TagLib requires that int is 32-bit wide.")
endif()
check_type_size("long long" SIZEOF_LONGLONG)
if(NOT ${SIZEOF_LONGLONG} EQUAL 8)
message(FATAL_ERROR "TagLib requires that long long is 64-bit wide.")
endif()
check_type_size("wchar_t" SIZEOF_WCHAR_T)
if(${SIZEOF_WCHAR_T} LESS 2)
message(FATAL_ERROR "TagLib requires that wchar_t is sufficient to store a UTF-16 char.")
endif()
check_type_size("float" SIZEOF_FLOAT)
if(NOT ${SIZEOF_FLOAT} EQUAL 4)
message(FATAL_ERROR "TagLib requires that float is 32-bit wide.")
endif()
check_type_size("double" SIZEOF_DOUBLE)
if(NOT ${SIZEOF_DOUBLE} EQUAL 8)
message(FATAL_ERROR "TagLib requires that double is 64-bit wide.")
endif()
# Determine which kind of atomic operations your compiler supports.
check_cxx_source_compiles("
int main() {
volatile int x;
__sync_add_and_fetch(&x, 1);
int y = __sync_sub_and_fetch(&x, 1);
return 0;
}
" HAVE_GCC_ATOMIC)
if(NOT HAVE_GCC_ATOMIC)
check_cxx_source_compiles("
#include <libkern/OSAtomic.h>
int main() {
volatile int32_t x;
OSAtomicIncrement32Barrier(&x);
int32_t y = OSAtomicDecrement32Barrier(&x);
return 0;
}
" HAVE_MAC_ATOMIC)
if(NOT HAVE_MAC_ATOMIC)
check_cxx_source_compiles("
#include <windows.h>
int main() {
volatile LONG x;
InterlockedIncrement(&x);
LONG y = InterlockedDecrement(&x);
return 0;
}
" HAVE_WIN_ATOMIC)
if(NOT HAVE_WIN_ATOMIC)
check_cxx_source_compiles("
#include <ia64intrin.h>
int main() {
volatile int x;
__sync_add_and_fetch(&x, 1);
int y = __sync_sub_and_fetch(&x, 1);
return 0;
}
" HAVE_IA64_ATOMIC)
endif()
endif()
endif()
# Determine which kind of byte swap functions your compiler supports.
check_cxx_source_compiles("
int main() {
__builtin_bswap16(0);
__builtin_bswap32(0);
__builtin_bswap64(0);
return 0;
}
" HAVE_GCC_BYTESWAP)
if(NOT HAVE_GCC_BYTESWAP)
check_cxx_source_compiles("
#include <byteswap.h>
int main() {
__bswap_16(0);
__bswap_32(0);
__bswap_64(0);
return 0;
}
" HAVE_GLIBC_BYTESWAP)
if(NOT HAVE_GLIBC_BYTESWAP)
check_cxx_source_compiles("
#include <stdlib.h>
int main() {
_byteswap_ushort(0);
_byteswap_ulong(0);
_byteswap_uint64(0);
return 0;
}
" HAVE_MSC_BYTESWAP)
if(NOT HAVE_MSC_BYTESWAP)
check_cxx_source_compiles("
#include <libkern/OSByteOrder.h>
int main() {
OSSwapInt16(0);
OSSwapInt32(0);
OSSwapInt64(0);
return 0;
}
" HAVE_MAC_BYTESWAP)
if(NOT HAVE_MAC_BYTESWAP)
check_cxx_source_compiles("
#include <sys/endian.h>
int main() {
swap16(0);
swap32(0);
swap64(0);
return 0;
}
" HAVE_OPENBSD_BYTESWAP)
endif()
endif()
endif()
endif()
# Determine whether your compiler supports some safer version of vsprintf.
check_cxx_source_compiles("
#include <cstdio>
#include <cstdarg>
int main() {
char buf[20];
va_list args;
vsnprintf(buf, 20, \"%d\", args);
return 0;
}
" HAVE_VSNPRINTF)
if(NOT HAVE_VSNPRINTF)
check_cxx_source_compiles("
#include <cstdio>
#include <cstdarg>
int main() {
char buf[20];
va_list args;
vsprintf_s(buf, \"%d\", args);
return 0;
}
" HAVE_VSPRINTF_S)
endif()
# Determine whether your compiler supports ISO _strdup.
check_cxx_source_compiles("
#include <cstring>
int main() {
_strdup(0);
return 0;
}
" HAVE_ISO_STRDUP)
# Determine whether zlib is installed.
if(NOT ZLIB_SOURCE)
find_package(ZLIB)
if(ZLIB_FOUND)
set(HAVE_ZLIB 1)
else()
set(HAVE_ZLIB 0)
endif()
endif()
# Determine whether CppUnit is installed.
if(BUILD_TESTS AND NOT BUILD_SHARED_LIBS)
find_package(CppUnit)
if(NOT CppUnit_FOUND)
message(STATUS "CppUnit not found, disabling tests.")
set(BUILD_TESTS OFF)
endif()
endif()
# Detect WinRT mode
if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
set(PLATFORM WINRT 1)
endif()

View File

@@ -4,8 +4,8 @@
# Project related configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = TagLib
PROJECT_NUMBER =
OUTPUT_DIRECTORY = .
PROJECT_NUMBER = ${TAGLIB_LIB_VERSION_STRING}
OUTPUT_DIRECTORY = doc
OUTPUT_LANGUAGE = English
USE_WINDOWS_ENCODING = NO
BRIEF_MEMBER_DESC = YES
@@ -61,7 +61,7 @@ WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = ../taglib/
INPUT = @CMAKE_SOURCE_DIR@/taglib
FILE_PATTERNS = *.h \
*.hh \
*.H
@@ -96,9 +96,9 @@ IGNORE_PREFIX =
GENERATE_HTML = YES
HTML_OUTPUT = html
HTML_FILE_EXTENSION = .html
HTML_HEADER = api-header.html
HTML_FOOTER = api-footer.html
HTML_STYLESHEET = taglib-api.css
HTML_HEADER = @CMAKE_SOURCE_DIR@/doc/api-header.html
HTML_FOOTER = @CMAKE_SOURCE_DIR@/doc/api-footer.html
HTML_STYLESHEET = @CMAKE_SOURCE_DIR@/doc/taglib-api.css
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
CHM_FILE =
@@ -169,7 +169,9 @@ SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED = DO_NOT_DOCUMENT \
DOXYGEN
DOXYGEN \
WITH_MP4 \
WITH_ASF
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------

167
INSTALL
View File

@@ -1,167 +0,0 @@
Basic Installation
==================
These are generic installation instructions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, a file
`config.cache' that saves the results of its tests to speed up
reconfiguring, and a file `config.log' containing compiler output
(useful mainly for debugging `configure').
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If at some point `config.cache'
contains results you don't want to keep, you may remove or edit it.
The file `configure.in' is used to create `configure' by a program
called `autoconf'. You only need `configure.in' if you want to change
it or regenerate `configure' using a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes a while. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Type `make install' to install the programs and any data files and
documentation.
4. You can remove the program binaries and object files from the
source code directory by typing `make clean'.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. You can give `configure'
initial values for variables by setting them in the environment. Using
a Bourne-compatible shell, you can do that on the command line like
this:
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
Or on systems that have the `env' program, you can do it like this:
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not supports the `VPATH'
variable, you have to compile the package for one architecture at a time
in the source code directory. After you have installed the package for
one architecture, use `make distclean' before reconfiguring for another
architecture.
Installation Names
==================
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' can not figure out
automatically, but needs to determine by the type of host the package
will run on. Usually `configure' can figure that out, but if it prints
a message saying it can not guess the host type, give it the
`--host=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name with three fields:
CPU-COMPANY-SYSTEM
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the host type.
If you are building compiler tools for cross-compiling, you can also
use the `--target=TYPE' option to select the type of system they will
produce code for and the `--build=TYPE' option to select the type of
system on which you are compiling the package.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Operation Controls
==================
`configure' recognizes the following options to control how it
operates.
`--cache-file=FILE'
Use and save the results of the tests in FILE instead of
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
debugging `configure'.
`--help'
Print a summary of the options to `configure', and exit.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made.
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`--version'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`configure' also accepts some other, not widely useful, options.

219
INSTALL.md Normal file
View File

@@ -0,0 +1,219 @@
TagLib Installation
===================
TagLib uses the CMake build system. As a user, you will most likely want to
build TagLib in release mode and install it into a system-wide location.
This can be done using the following commands:
cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release .
make
sudo make install
In order to build the included examples, use the `BUILD_EXAMPLES` option:
cmake -DBUILD_EXAMPLES=ON [...]
See http://www.cmake.org/cmake/help/runningcmake.html for generic help on
running CMake.
Mac OS X
--------
On Mac OS X, you might want to build a framework that can be easily integrated
into your application. If you set the BUILD_FRAMEWORK option on, it will compile
TagLib as a framework. For example, the following command can be used to build
an Universal Binary framework with Mac OS X 10.4 as the deployment target:
cmake -DCMAKE_BUILD_TYPE=Release \
-DBUILD_FRAMEWORK=ON \
-DCMAKE_C_COMPILER=/usr/bin/gcc-4.0 \
-DCMAKE_CXX_COMPILER=/usr/bin/c++-4.0 \
-DCMAKE_OSX_SYSROOT=/Developer/SDKs/MacOSX10.4u.sdk/ \
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.4 \
-DCMAKE_OSX_ARCHITECTURES="ppc;i386;x86_64"
For a 10.6 Snow Leopard static library with both 32-bit and 64-bit code, use:
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.6 \
-DCMAKE_OSX_ARCHITECTURES="i386;x86_64" \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_INSTALL_PREFIX="<folder you want to install to>"
After `make`, and `make install`, add `libtag.` to your XCode project, and add
the include folder to the project's User Header Search Paths.
Windows
-------
It's Windows ... Systems vary!
This means you need to adjust things to suit your system, especially paths.
Tested with:
* Microsoft Visual Studio 2010, 2015, 2017
* Microsoft C++ Build Tools 2015, 2017 (standalone packages not requiring Visual Studio)
* GCC by mingw-w64.sf.net v4.6.3 (Strawberry Perl 32b)
* MinGW32-4.8.0
Requirements:
* Tool chain, build environment, whatever ya want to call it ...
Installed and working.
* CMake program. (Available at: www.cmake.org)
Installed and working.
Optional:
* Zlib library.
Available in some tool chains, not all.
Search the web, take your choice.
Useful configuration options used with CMake (GUI and/or command line):
Any of the `ZLIB_` variables may be used at the command line, `ZLIB_ROOT` is only
available on the command line.
| option | description |
| ----------------------- | ----------- |
| `ZLIB_ROOT=` | Where to find ZLib's root directory. Assumes parent of: `\include` and `\lib.`|
| `ZLIB_INCLUDE_DIR=` | Where to find ZLib's Include directory.|
| `ZLIB_LIBRARY=` | Where to find ZLib's Library.
| `ZLIB_SOURCE=` | Where to find ZLib's Source Code. Alternative to `ZLIB_INCLUDE_DIR` and `ZLIB_LIBRARY`.
| `CMAKE_INSTALL_PREFIX=` | Where to install Taglib. |
| `CMAKE_BUILD_TYPE=` | Release, Debug, etc ... (Not available in MSVC) |
The easiest way is at the command prompt (Visual C++ command prompt for MSVS users batch file and/or shortcuts are your friends).
1. **Build the Makefiles:**
Replace "GENERATOR" with your needs.
* For MSVS: `Visual Studio XX YYYY`, e.g. `Visual Studio 14 2015`.
**Note**: As Visual Studio 2017 supports CMake, you can skip this step and open the taglib
folder in VS instead.
* For MinGW: `MinGW Makefiles`
C:\GitRoot\taglib> cmake -G "GENERATOR" -DCMAKE_INSTALL_PREFIX=C:\Libraries\taglib
Or use the CMake GUI:
1. Open CMake GUI.
2. Set paths: *Where is the source code* and *Where to build the binaries*.
In the example, both would be: `C:\GitRoot\taglib`
3. Tick: Advanced
4. Select: Configure
5. Select: Generator
6. Tick: Use default native compilers
7. Select: Finish
Wait until done.
8. If using ZLib, Scroll down.
(to the bottom of the list of options ... should go over them all)
1. Edit: `ZLIB_INCLUDE_DIR`
2. Edit: `ZLIB_LIBRARY`
9. Select: Generate
2. **Build the project**
* MSVS:
C:\GitRoot\taglib> msbuild all_build.vcxproj /p:Configuration=Release
OR (Depending on MSVS version or personal choice)
C:\GitRoot\taglib> devenv all_build.vcxproj /build Release
OR in the MSVS GUI:
1. Open MSVS.
2. Open taglib solution.
3. Set build type to: Release (look in the tool bars)
2. Hit F7 to build the solution. (project)
* MinGW:
C:\GitRoot\taglib> gmake
OR (Depending on MinGW install)
C:\GitRoot\taglib> mingw32-make
3. **Install the project**
(Change `install` to `uninstall` to uninstall the project)
* MSVS:
C:\GitRoot\taglib> msbuild install.vcxproj
OR (Depending on MSVC version or personal choice)
C:\GitRoot\taglib> devenv install.vcxproj
Or in the MSVS GUI:
1. Open project.
2. Open Solution Explorer.
3. Right Click: INSTALL
4. Select: Project Only
5. Select: Build Only INSTALL
* MinGW:
C:\GitRoot\taglib> gmake install
OR (Depending on MinGW install)
C:\GitRoot\taglib> mingw32-make install
To build a static library, set the following two options with CMake:
-DBUILD_SHARED_LIBS=OFF -DENABLE_STATIC_RUNTIME=ON
Including `ENABLE_STATIC_RUNTIME=ON` indicates you want TagLib built using the
static runtime library, rather than the DLL form of the runtime.
Unit Tests
----------
If you want to run the test suite to make sure TagLib works properly on your
system, you need to have cppunit installed. To build the tests, include
the option `-DBUILD_TESTS=ON -DBUILD_SHARED_LIBS=OFF` when running cmake.
The test suite has a custom target in the build system, so you can run
the tests using make:
make check
Windows MinGW:
* Get cppunit from https://www.freedesktop.org/wiki/Software/cppunit/
* Build it for MinGW:
- `./autogen.sh`
- `./configure --disable-shared`
- `mingw32-make; mingw32-make install DESTDIR=/path/to/install/dir`
* Build TagLib with testing enabled:
- ```
cmake -G "MinGW Makefiles" -DBUILD_TESTS=ON -DBUILD_EXAMPLES=ON -DBUILD_SHARED_LIBS=OFF \
-DCPPUNIT_INCLUDE_DIR=/path/to/cppunit/include \
-DCPPUNIT_LIBRARIES=/path/to/cppunit/lib/libcppunit.a \
-DCPPUNIT_INSTALLED_VERSION=1.15.1
```
- `mingw32-make`
- `mingw32-make check`
Windows MSVS:
* Get cppunit from https://www.freedesktop.org/wiki/Software/cppunit/
* Build it in Visual Studio:
- Open examples/examples2008.sln, convert all, do not overwrite.
- Set architecture to x64, build configuration, e.g. Debug DLL.
- It may fail, but the needed libraries should be available in src\cppunit\DebugDll.
* Build TagLib with testing enabled:
- ```
cmake -G "Visual Studio 16 2019" -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=ON -DBUILD_EXAMPLES=ON
-DBUILD_SHARED_LIBS=OFF -DENABLE_STATIC_RUNTIME=ON
-DCPPUNIT_INCLUDE_DIR=\path\to\cppunit\include
-DCPPUNIT_LIBRARIES=\path\to\cppunit\DebugDll\cppunitd_dll.lib
-DCPPUNIT_INSTALLED_VERSION=1.15.1
```
- `msbuild all_build.vcxproj /p:Configuration=Debug`
- `path %path%;\path\to\cppunit\DebugDll`
- `tests\Debug\test_runner.exe`
macOS:
* Install cppunit using a package manager, e.g. `brew install cppunit`
* Build TagLib with testing enabled:
- `cmake -DBUILD_TESTS=ON -DBUILD_EXAMPLES=ON -DBUILD_SHARED_LIBS=OFF`
- `make`
- `make check`

View File

@@ -1,54 +0,0 @@
SUBDIRS = taglib bindings tests
AUTOMAKE_OPTIONS = foreign
$(top_srcdir)/configure.in: configure.in.in $(top_srcdir)/subdirs
cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common configure.in ;
$(top_srcdir)/subdirs:
cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common subdirs
$(top_srcdir)/acinclude.m4: $(top_srcdir)/admin/acinclude.m4.in $(top_srcdir)/admin/libtool.m4.in
@cd $(top_srcdir) && cat admin/acinclude.m4.in admin/libtool.m4.in > acinclude.m4
MAINTAINERCLEANFILES = subdirs configure.in acinclude.m4 configure.files
bin_SCRIPTS = taglib-config
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = taglib.pc
package-messages:
$(MAKE) -f admin/Makefile.common package-messages
dist-hook:
cd $(top_distdir) && perl admin/am_edit -padmin
cd $(top_distdir) && $(MAKE) -f admin/Makefile.common subdirs
examples: examples-all
examples-all:
cd examples ; \
$(MAKE) all
apidox:
$(mkinstalldirs) doc/api; \
if test ! -x doc/common; then \
$(LN_S) $(kde_libs_htmldir)/en/common doc/common ; \
fi; \
cp $(top_srcdir)/admin/Doxyfile.global taglib.doxyfile; \
echo "PROJECT_NAME = TagLib" >> taglib.doxyfile; \
echo "PROJECT_NUMBER = \"Version 1.5\"" >> taglib.doxyfile; \
echo "INPUT = $(srcdir)" >> taglib.doxyfile; \
echo "OUTPUT_DIRECTORY = doc/api" >> taglib.doxyfile; \
echo "HTML_OUTPUT = html" >> taglib.doxyfile; \
echo "GENERATE_HTML = YES" >> taglib.doxyfile ; \
echo "GENERATE_MAN = NO" >> taglib.doxyfile ; \
echo "GENERATE_LATEX = NO" >> taglib.doxyfile ; \
echo "HTML_HEADER = doc/common/header.html" >> taglib.doxyfile ; \
echo "HTML_FOOTER = doc/common/footer.html" >> taglib.doxyfile ; \
echo "HTML_STYLESHEET = doc/common/doxygen.css" >> taglib.doxyfile ; \
echo "FILE_PATTERNS = *.h" >> taglib.doxyfile ; \
echo "PREDEFINED = DO_NOT_DOCUMENT DOXYGEN" >> taglib.doxyfile ; \
echo "EXTRACT_ALL = YES" >> taglib.doxyfile ; \
doxygen taglib.doxyfile

View File

@@ -1,14 +0,0 @@
all:
@echo "This Makefile is only for the CVS repository"
@echo "This will be deleted before making the distribution"
@echo ""
@if test ! -d admin; then \
echo "Please recheckout this module!" ;\
echo "for cvs: use checkout once and after that update again" ;\
echo "for cvsup: checkout kde-common from cvsup and" ;\
echo " link kde-common/admin to ./admin" ;\
exit 1 ;\
fi
$(MAKE) -f admin/Makefile.common cvs
.SILENT:

336
NEWS Normal file
View File

@@ -0,0 +1,336 @@
TagLib 1.12 (Feb 16, 2021)
==========================
* Added support for WinRT.
* Added support for Linux on POWER.
* Added support for classical music tags of iTunes 12.5.
* Added support for file descriptor to FileStream.
* Added support for 'cmID', 'purl', 'egid' MP4 atoms.
* Added support for 'GRP1' ID3v2 frame.
* Added support for extensible WAV subformat.
* Enabled FileRef to detect file types based on the stream content.
* Dropped support for Windows 9x and NT 4.0 or older.
* Check for mandatory header objects in ASF files.
* More tolerant handling of RIFF padding, WAV files, broken MPEG streams.
* Improved calculation of Ogg, Opus, Speex, WAV, MP4 bitrates.
* Improved Windows compatibility by storing FLAC picture after comments.
* Fixed numerical genres in ID3v2.3.0 'TCON' frames.
* Fixed consistency of API removing MP4 items when empty values are set.
* Fixed consistency of API preferring COMM frames with no description.
* Fixed OOB read on invalid Ogg FLAC files (CVE-2018-11439).
* Fixed handling of empty MPEG files.
* Fixed parsing MP4 mdhd timescale.
* Fixed reading MP4 atoms with zero length.
* Fixed reading FLAC files with zero-sized seektables.
* Fixed handling of lowercase field names in Vorbis Comments.
* Fixed handling of 'rate' atoms in MP4 files.
* Fixed handling of invalid UTF-8 sequences.
* Fixed possible file corruptions when saving Ogg files.
* Fixed handling of non-audio blocks, sampling rates, DSD audio in WavPack files.
* TableOfContentsFrame::toString() improved.
* UserTextIdentificationFrame::toString() improved.
* Marked FileRef::create() deprecated.
* Marked MPEG::File::save() with boolean parameters deprecated,
provide overloads with enum parameters.
* Several smaller bug fixes and performance improvements.
TagLib 1.11.1 (Oct 24, 2016)
============================
* Fixed binary incompatible change in TagLib::String.
* Fixed reading ID3v2 CTOC frames with a lot of entries.
* Fixed seeking ByteVectorStream from the end.
TagLib 1.11 (Apr 29, 2016)
==========================
1.11:
* Fixed reading APE items with long keys.
* Fixed reading ID3v2 SYLT frames when description is empty.
1.11 BETA 2:
* Better handling of PCM WAV files with a 'fact' chunk.
* Better handling of corrupted APE tags.
* Efficient decoding of unsynchronized ID3v2 frames.
* Fixed text encoding when saving certain frames in ID3v2.3 tags.
* Fixed updating the size of RIFF files when removing chunks.
* Several smaller bug fixes and performance improvements.
1.11 BETA:
* New API for creating FileRef from IOStream.
* Added support for ID3v2 PCST and WFED frames.
* Added support for pictures in XiphComment.
* Added String::clear().
* Added FLAC::File::strip() for removing non-standard tags.
* Added alternative functions to XiphComment::removeField().
* Added BUILD_BINDINGS build option.
* Added ENABLE_CCACHE build option.
* Replaced ENABLE_STATIC build option with BUILD_SHARED_LIBS.
* Better handling of duplicate ID3v2 tags in all kinds of files.
* Better handling of duplicate tag chunks in WAV files.
* Better handling of duplicate tag chunks in AIFF files.
* Better handling of duplicate Vorbis comment blocks in FLAC files.
* Better handling of broken MPEG audio frames.
* Fixed crash when calling File::properties() after strip().
* Fixed crash when parsing certain MPEG files.
* Fixed crash when saving Ogg files.
* Fixed possible file corruptions when saving ASF files.
* Fixed possible file corruptions when saving FLAC files.
* Fixed possible file corruptions when saving MP4 files.
* Fixed possible file corruptions when saving MPEG files.
* Fixed possible file corruptions when saving APE files.
* Fixed possible file corruptions when saving Musepack files.
* Fixed possible file corruptions when saving WavPack files.
* Fixed updating the comment field of Vorbis comments.
* Fixed reading date and time in ID3v2.3 tags.
* Marked ByteVector::null and ByteVector::isNull() deprecated.
* Marked String::null and String::isNull() deprecated.
* Marked XiphComment::removeField() deprecated.
* Marked Ogg::Page::getCopyWithNewPageSequenceNumber() deprecated. It returns null.
* Marked custom integer types deprecated.
* Many smaller bug fixes and performance improvements.
TagLib 1.10 (Nov 11, 2015)
==========================
1.10:
* Added new options to the tagwriter example.
* Fixed self-assignment operator in some types.
* Fixed extraction of MP4 tag keys with an empty list.
1.10 BETA:
* New API for the audio length in milliseconds.
* Added support for ID3v2 ETCO and SYLT frames.
* Added support for album artist in PropertyMap API of MP4 files.
* Added support for embedded frames in ID3v2 CHAP and CTOC frames.
* Added support for AIFF-C files.
* Better handling of duplicate ID3v2 tags in MPEG files.
* Allowed generating taglib.pc on Windows.
* Added ZLIB_SOURCE build option.
* Fixed backwards-incompatible change in TagLib::String when constructing UTF16 strings.
* Fixed crash when parsing certain FLAC files.
* Fixed crash when encoding empty strings.
* Fixed saving of certain XM files on OS X.
* Changed Xiph and APE generic getters to return space-concatenated values.
* Fixed possible file corruptions when removing tags from WAV files.
* Added support for MP4 files with 64-bit atoms in certain 64-bit environments.
* Prevented ID3v2 padding from being too large.
* Fixed crash when parsing corrupted APE files.
* Fixed crash when parsing corrupted WAV files.
* Fixed crash when parsing corrupted Ogg FLAC files.
* Fixed crash when parsing corrupted MPEG files.
* Fixed saving empty tags in WAV files.
* Fixed crash when parsing corrupted Musepack files.
* Fixed possible memory leaks when parsing AIFF and WAV files.
* Fixed crash when parsing corrupted MP4 files.
* Stopped writing empty ID3v2 frames.
* Fixed possible file corruptions when saving WMA files.
* Added TagLib::MP4::Tag::isEmpty().
* Added accessors to manipulate MP4 tags.
* Fixed crash when parsing corrupted WavPack files.
* Fixed seeking MPEG frames.
* Fixed reading FLAC files with zero-sized padding blocks.
* Added support for reading the encoder information of WMA files.
* Added support for reading the codec of WAV files.
* Added support for multi channel WavPack files.
* Added support for reading the nominal bitrate of Ogg Speex files.
* Added support for VBR headers in MPEG files.
* Marked FLAC::File::streamInfoData() deprecated. It returns an empty ByteVector.
* Marked FLAC::File::streamLength() deprecated. It returns zero.
* Fixed possible file corruptions when adding an ID3v1 tag to FLAC files.
* Many smaller bug fixes and performance improvements.
TagLib 1.9.1 (Oct 8, 2013)
==========================
* Fixed binary incompatible change in TagLib::Map and TagLib::List.
* Fixed constructing String from ByteVector.
* Fixed compilation on MSVC with the /Zc:wchar_t- option.
* Fixed detecting of RIFF files with invalid chunk sizes.
* Added TagLib::MP4::Properties::codec().
TagLib 1.9 (Oct 6, 2013)
========================
* Added support for the Ogg Opus file format.
* Added support for INFO tags in WAV files.
* Changed FileStream to use Windows file API.
* Included taglib-config.cmd script for Windows.
* New ID3v1::Tag methods for working directly with genre numbers.
* New MPEG::File methods for checking which tags are saved in the file.
* Added support for the PropertyMap API to ASF and MP4 files.
* Added MusicBrainz identifiers to the PropertyMap API.
* Allowed reading of MP4 cover art without an explicitly specified format.
* Better parsing of corrupted FLAC files.
* Fixed saving of PropertyMap comments without description into ID3v2 tags.
* Fixed crash when parsing certain XM files.
* Fixed compilation of unit test with clang.
* Better handling of files that can't be open or have read-only permissions.
* Improved atomic reference counting.
* New hookable API for debug messages.
* More complete Windows install instructions.
* Many smaller bug fixes and performance improvements.
TagLib 1.8 (Sep 6, 2012)
========================
1.8:
* Added support for OWNE ID3 frames.
* Changed key validation in the new PropertyMap API.
* ID3v1::Tag::setStringHandler will no londer delete the previous handler,
the caller is responsible for this.
* File objects will also no longer delete the passed IOStream objects. It
should be done in the caller code after the File object is no longer
used.
* Added ID3v2::Tag::setLatin1StringHandler for custom handling of
latin1-encoded text in ID3v2 frames.
* Fixed validation of ID3v2 frame IDs (IDs with '0' were ignored).
1.8 BETA:
* New API for accessing tags by name.
* New abstract I/O stream layer to allow custom I/O handlers.
* Support for writing ID3v2.3 tags.
* Support for various module file formats (MOD, S3M, IT, XM).
* Support for MP4 and ASF is now enabled by default.
* Started using atomic int operations for reference counting.
* Added methods for checking if WMA and MP4 files are DRM-protected.
* Added taglib_free to the C bindings.
* New method to allow removing pictures from FLAC files.
* Support for reading audio properties from ALAC and Musepack SV8 files.
* Added replay-gain information to Musepack audio properties.
* Support for APEv2 binary tags.
* Many AudioProperties subclasses now provide information about the total number of samples.
* Various small bug fixes.
TagLib 1.7.2 (Apr 20, 2012)
===========================
* Fixed division by zero while parsing corrupted MP4 files (CVE-2012-2396).
* Fixed compilation on Haiku.
TagLib 1.7.1 (Mar 17, 2012)
===========================
* Improved parsing of corrupted WMA, RIFF and OGG files.
* Fixed a memory leak in the WMA parser.
* Fixed a memory leak in the FLAC parser.
* Fixed a possible division by zero in the APE parser.
* Added detection of TTA2 files.
* Fixed saving of multiple identically named tags to Vorbis Comments.
TagLib 1.7 (Mar 11, 2011)
=========================
1.7:
* Fixed memory leaks in the FLAC file format parser.
* Fixed bitrate calculation for WAV files.
1.7 RC1:
* Support for reading/writing tags from Monkey's Audio files. (BUG:210404)
* Support for reading/writing embedded pictures from WMA files.
* Support for reading/writing embedded pictures from FLAC files (BUG:218696).
* Implemented APE::Tag::isEmpty() to check for all APE tags, not just the
basic ones.
* Added reading of WAV audio length. (BUG:116033)
* Exposed FLAC MD5 signature of the uncompressed audio stream via
FLAC::Properties::signature(). (BUG:160172)
* Added function ByteVector::toHex() for hex-encoding of byte vectors.
* WavPack reader now tries to get the audio length by finding the final
block, if the header doesn't have the information. (BUG:258016)
* Fixed a memory leak in the ID3v2.2 PIC frame parser. (BUG:257007)
* Fixed writing of RIFF files with even chunk sizes. (BUG:243954)
* Fixed compilation on MSVC 2010.
* Removed support for building using autoconf/automake.
* API docs can be now built using "make docs".
TagLib 1.6.3 (Apr 17, 2010)
===========================
* Fixed definitions of the TAGLIB_WITH_MP4 and TAGLIB_WITH_ASF macros.
* Fixed upgrading of ID3v2.3 genre frame with ID3v1 code 0 (Blues).
* New method `int String::toInt(bool *ok)` which can return whether the
conversion to a number was successful.
* Fixed parsing of incorrectly written lengths in ID3v2 (affects mainly
compressed frames). (BUG:231075)
TagLib 1.6.2 (Apr 9, 2010)
==========================
* Read Vorbis Comments from the first FLAC metadata block, if there are
multiple ones. (BUG:211089)
* Fixed a memory leak in FileRef's OGA format detection.
* Fixed compilation with the Sun Studio compiler. (BUG:215225)
* Handle WM/TrackNumber attributes with DWORD content in WMA files.
(BUG:218526)
* More strict check if something is a valid MP4 file. (BUG:216819)
* Correctly save MP4 int-pair atoms with flags set to 0.
* Fixed compilation of the test runner on Windows.
* Store ASF attributes larger than 64k in the metadata library object.
* Ignore trailing non-data atoms when parsing MP4 covr atoms.
* Don't upgrade ID3v2.2 frame TDA to TDRC. (BUG:228968)
TagLib 1.6.1 (Oct 31, 2009)
===========================
* Better detection of the audio codec of .oga files in FileRef.
* Fixed saving of Vorbis comments to Ogg FLAC files. TagLib tried to
include the Vorbis framing bit, which is only correct for Ogg Vorbis.
* Public symbols now have explicitly set visibility to "default" on GCC.
* Added missing exports for static ID3v1 functions.
* Fixed a typo in taglib_c.pc
* Fixed a failing test on ppc64.
* Support for binary 'covr' atom in MP4 files. TagLib 1.6 treated them
as text atoms, which corrupted them in some cases.
* Fixed ID3v1-style genre to string conversion in MP4 files.
TagLib 1.6 (Sep 13, 2009)
=========================
1.6:
* New CMake option to build a static version - ENABLE_STATIC.
* Added support for disabling dllimport/dllexport on Windows using the
TAGLIB_STATIC macro.
* Support for parsing the obsolete 'gnre' MP4 atom.
* New cpp macros TAGLIB_WITH_MP4 and TAGLIB_WITH_ASF to determine if
TagLib was built with MP4/ASF support.
1.6 RC1:
* Split Ogg packets larger than 64k into multiple pages. (BUG:171957)
* TagLib can now use FLAC padding block. (BUG:107659)
* ID3v2.2 frames are now not incorrectly saved. (BUG:176373)
* Support for ID3v2.2 PIC frames. (BUG:167786)
* Fixed a bug in ByteVectorList::split().
* XiphComment::year() now falls back to YEAR if DATE doesn't exist
and XiphComment::year() falls back to TRACKNUM if TRACKNUMBER doesn't
exist. (BUG:144396)
* Improved ID3v2.3 genre parsing. (BUG:188578)
* Better checking of corrupted ID3v2 APIC data. (BUG:168382)
* Bitrate calculating using the Xing header now uses floating point
numbers. (BUG:172556)
* New TagLib::String method rfind().
* Added support for MP4 file format with iTunes-style metadata [optional].
* Added support for ASF (WMA) file format [optional].
* Fixed crash when saving a Locator APEv2 tag. (BUG:169810)
* Fixed a possible crash in the non-const version of String::operator[]
and in String::operator+=. (BUG:169389)
* Added support for PRIV ID3v2 frames.
* Empty ID3v2 genres are no longer treated as numeric ID3v1 genres.
* Added support for the POPM (rating/playcount) ID3v2 frame.
* Generic RIFF file format support:
* Support for AIFF files with ID3v2 tags.
* Support for WAV files with ID3v2 tags.
* Fixed crash on handling unsupported ID3v2 frames, e.g. on encrypted
frames. (BUG:161721)
* Fixed overflow while calculating bitrate of FLAC files with a very
high bitrate.

26
README.md Normal file
View File

@@ -0,0 +1,26 @@
# TagLib
[![Build Status](https://travis-ci.org/taglib/taglib.svg?branch=master)](https://travis-ci.org/taglib/taglib)
### TagLib Audio Metadata Library
https://taglib.org/
TagLib is a library for reading and editing the metadata of several
popular audio formats. Currently it supports both ID3v1 and [ID3v2][]
for MP3 files, [Ogg Vorbis][] comments and ID3 tags
in [FLAC][], MPC, Speex, WavPack, TrueAudio, WAV, AIFF, MP4, APE,
and ASF files.
TagLib is distributed under the [GNU Lesser General Public License][]
(LGPL) and [Mozilla Public License][] (MPL). Essentially that means that
it may be used in proprietary applications, but if changes are made to
TagLib they must be contributed back to the project. Please review the
licenses if you are considering using TagLib in your project.
[ID3v2]: https://id3.org/
[Ogg Vorbis]: https://xiph.org/vorbis/
[FLAC]: https://xiph.org/flac/
[GNU Lesser General Public License]: https://www.gnu.org/licenses/lgpl.html
[Mozilla Public License]: https://www.mozilla.org/MPL/MPL-1.1.html

View File

@@ -1 +1 @@
ADD_SUBDIRECTORY( c )
add_subdirectory(c)

View File

@@ -1 +0,0 @@
SUBDIRS = c

View File

@@ -2,5 +2,5 @@ There are a few other people that have done bindings externally that I have
been made aware of. I have not personally reviewed these bindings, but I'm
listing them here so that those who find them useful are able to find them:
- Ruby - http://www.hakubi.us/ruby-taglib/
- Python - http://namingmuse.berlios.de/
http://developer.kde.org/~wheeler/taglib.html#bindings

View File

@@ -1,59 +1,75 @@
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/../../taglib
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/toolkit
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/mpeg
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/ogg
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/ogg/vorbis
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/ogg/flac
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/flac
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/mpc
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/mpeg/id3v2
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/wavpack
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/ogg/speex
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/trueaudio
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/toolkit
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/asf
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/mpeg
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/ogg
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/ogg/vorbis
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/ogg/flac
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/flac
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/mpc
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/mp4
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/mpeg/id3v2
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/mpeg/id3v2/frames
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/wavpack
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/ogg/speex
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/trueaudio
)
set(tag_c_HDRS tag_c.h)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/taglib_c.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/taglib_c.pc )
########### next target ###############
add_library(tag_c tag_c.cpp ${tag_c_HDRS})
SET(tag_c_LIB_SRCS
tag_c.cpp
target_link_libraries(tag_c tag)
set_target_properties(tag_c PROPERTIES
PUBLIC_HEADER "${tag_c_HDRS}"
DEFINE_SYMBOL MAKE_TAGLIB_LIB
)
ADD_LIBRARY(tag_c SHARED ${tag_c_LIB_SRCS})
TARGET_LINK_LIBRARIES(tag_c tag )
if(VISIBILITY_HIDDEN)
set_target_properties(tag_c PROPERTIES C_VISIBILITY_PRESET hidden
)
endif()
if(BUILD_FRAMEWORK)
set_target_properties(tag_c PROPERTIES FRAMEWORK TRUE)
endif()
# On Solaris we need to explicitly add the C++ standard and runtime
# libraries to the libs used by this library, to link them to apps
# using these bindings.
CHECK_LIBRARY_EXISTS(Crun __RTTI___ "" HAVE_CRUN_LIB)
IF(HAVE_CRUN_LIB)
# libraries to the libs used by the C bindings, because those C bindings
# themselves won't pull in the C++ libs -- and if a C application is
# using the C bindings then we get link errors.
check_library_exists(Crun __RTTI___ "" HAVE_CRUN_LIB)
if(HAVE_CRUN_LIB)
# Which libraries to link depends critically on which
# STL version is going to be used by your application
# and which runtime is in use. While Crun is pretty much
# the only game in town, the three available STLs -- Cstd,
# stlport4 and stdcxx -- make this a mess. We really only
# support stdcxx, but won't force the issue here.
#
TARGET_LINK_LIBRARIES(tag_c Crun)
ENDIF(HAVE_CRUN_LIB)
# stlport4 and stdcxx -- make this a mess. The KDE-Solaris
# team supports stdcxx (Apache RogueWave stdcxx 4.1.3).
# According to http://bugs.kde.org/show_bug.cgi?id=215225 the library can have the following two names:
find_library(ROGUEWAVE_STDCXX_LIBRARY NAMES stdcxx4 stdcxx)
if(NOT ROGUEWAVE_STDCXX_LIBRARY)
message(FATAL_ERROR "Did not find supported STL library (tried stdcxx4 and stdcxx)")
endif()
target_link_libraries(tag_c ${ROGUEWAVE_STDCXX_LIBRARY} Crun)
endif()
SET_TARGET_PROPERTIES(tag_c PROPERTIES
set_target_properties(tag_c PROPERTIES
VERSION 0.0.0
SOVERSION 0
DEFINE_SYMBOL MAKE_TAGLIB_C_LIB
)
INSTALL(TARGETS tag_c
INSTALL_NAME_DIR ${LIB_INSTALL_DIR}
)
install(TARGETS tag_c
FRAMEWORK DESTINATION ${FRAMEWORK_INSTALL_DIR}
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
RUNTIME DESTINATION bin
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
RUNTIME DESTINATION ${BIN_INSTALL_DIR}
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
PUBLIC_HEADER DESTINATION ${INCLUDE_INSTALL_DIR}/taglib
)
########### install files ###############
INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/taglib_c.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
INSTALL( FILES tag_c.h DESTINATION ${INCLUDE_INSTALL_DIR}/taglib)
if(NOT BUILD_FRAMEWORK)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/taglib_c.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/taglib_c.pc)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/taglib_c.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
endif()

View File

@@ -1,26 +0,0 @@
INCLUDES = \
-I$(top_srcdir)/taglib \
-I$(top_srcdir)/taglib/toolkit \
-I$(top_srcdir)/taglib/mpeg \
-I$(top_srcdir)/taglib/ogg \
-I$(top_srcdir)/taglib/ogg/vorbis \
-I$(top_srcdir)/taglib/ogg/speex \
-I$(top_srcdir)/taglib/ogg/flac \
-I$(top_srcdir)/taglib/flac \
-I$(top_srcdir)/taglib/mpc \
-I$(top_srcdir)/taglib/mpeg/id3v2 \
-I$(top_srcdir)/taglib/wavpack \
-I$(top_srcdir)/taglib/trueaudio \
$(all_includes)
lib_LTLIBRARIES = libtag_c.la
libtag_c_la_SOURCES = tag_c.cpp
taglib_include_HEADERS = tag_c.h
taglib_includedir = $(includedir)/taglib
libtag_c_la_LDFLAGS = $(all_libraries) -no-undefined -version-info 0:0
libtag_c_la_LIBADD = ../../taglib/libtag.la
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = taglib_c.pc

View File

@@ -1 +0,0 @@
dnl AC_OUTPUT(bindings/c/taglib_c.pc)

View File

@@ -19,11 +19,14 @@
* USA *
***************************************************************************/
#include "tag_c.h"
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdlib.h>
#include <fileref.h>
#include <tfile.h>
#include <asffile.h>
#include <vorbisfile.h>
#include <mpegfile.h>
#include <flacfile.h>
@@ -32,24 +35,55 @@
#include <wavpackfile.h>
#include <speexfile.h>
#include <trueaudiofile.h>
#include <mp4file.h>
#include <tag.h>
#include <string.h>
#include <id3v2framefactory.h>
#include "tag_c.h"
using namespace TagLib;
static List<char *> strings;
static bool unicodeStrings = true;
static bool stringManagementEnabled = true;
namespace
{
List<char *> strings;
bool unicodeStrings = true;
bool stringManagementEnabled = true;
char *stringToCharArray(const String &s)
{
const std::string str = s.to8Bit(unicodeStrings);
#ifdef HAVE_ISO_STRDUP
return ::_strdup(str.c_str());
#else
return ::strdup(str.c_str());
#endif
}
String charArrayToString(const char *s)
{
return String(s, unicodeStrings ? String::UTF8 : String::Latin1);
}
}
void taglib_set_strings_unicode(BOOL unicode)
{
unicodeStrings = bool(unicode);
unicodeStrings = (unicode != 0);
}
void taglib_set_string_management_enabled(BOOL management)
{
stringManagementEnabled = bool(management);
stringManagementEnabled = (management != 0);
}
void taglib_free(void* pointer)
{
free(pointer);
}
////////////////////////////////////////////////////////////////////////////////
@@ -80,9 +114,13 @@ TagLib_File *taglib_file_new_type(const char *filename, TagLib_File_Type type)
return reinterpret_cast<TagLib_File *>(new Ogg::Speex::File(filename));
case TagLib_File_TrueAudio:
return reinterpret_cast<TagLib_File *>(new TrueAudio::File(filename));
case TagLib_File_MP4:
return reinterpret_cast<TagLib_File *>(new MP4::File(filename));
case TagLib_File_ASF:
return reinterpret_cast<TagLib_File *>(new ASF::File(filename));
default:
return 0;
}
return 0;
}
void taglib_file_free(TagLib_File *file)
@@ -92,7 +130,7 @@ void taglib_file_free(TagLib_File *file)
BOOL taglib_file_is_valid(const TagLib_File *file)
{
return reinterpret_cast<const File *>(file)->isValid();
return reinterpret_cast<const File *>(file)->isValid();
}
TagLib_Tag *taglib_file_tag(const TagLib_File *file)
@@ -119,7 +157,7 @@ BOOL taglib_file_save(TagLib_File *file)
char *taglib_tag_title(const TagLib_Tag *tag)
{
const Tag *t = reinterpret_cast<const Tag *>(tag);
char *s = ::strdup(t->title().toCString(unicodeStrings));
char *s = stringToCharArray(t->title());
if(stringManagementEnabled)
strings.append(s);
return s;
@@ -128,7 +166,7 @@ char *taglib_tag_title(const TagLib_Tag *tag)
char *taglib_tag_artist(const TagLib_Tag *tag)
{
const Tag *t = reinterpret_cast<const Tag *>(tag);
char *s = ::strdup(t->artist().toCString(unicodeStrings));
char *s = stringToCharArray(t->artist());
if(stringManagementEnabled)
strings.append(s);
return s;
@@ -137,7 +175,7 @@ char *taglib_tag_artist(const TagLib_Tag *tag)
char *taglib_tag_album(const TagLib_Tag *tag)
{
const Tag *t = reinterpret_cast<const Tag *>(tag);
char *s = ::strdup(t->album().toCString(unicodeStrings));
char *s = stringToCharArray(t->album());
if(stringManagementEnabled)
strings.append(s);
return s;
@@ -146,7 +184,7 @@ char *taglib_tag_album(const TagLib_Tag *tag)
char *taglib_tag_comment(const TagLib_Tag *tag)
{
const Tag *t = reinterpret_cast<const Tag *>(tag);
char *s = ::strdup(t->comment().toCString(unicodeStrings));
char *s = stringToCharArray(t->comment());
if(stringManagementEnabled)
strings.append(s);
return s;
@@ -155,7 +193,7 @@ char *taglib_tag_comment(const TagLib_Tag *tag)
char *taglib_tag_genre(const TagLib_Tag *tag)
{
const Tag *t = reinterpret_cast<const Tag *>(tag);
char *s = ::strdup(t->genre().toCString(unicodeStrings));
char *s = stringToCharArray(t->genre());
if(stringManagementEnabled)
strings.append(s);
return s;
@@ -176,31 +214,31 @@ unsigned int taglib_tag_track(const TagLib_Tag *tag)
void taglib_tag_set_title(TagLib_Tag *tag, const char *title)
{
Tag *t = reinterpret_cast<Tag *>(tag);
t->setTitle(String(title, unicodeStrings ? String::UTF8 : String::Latin1));
t->setTitle(charArrayToString(title));
}
void taglib_tag_set_artist(TagLib_Tag *tag, const char *artist)
{
Tag *t = reinterpret_cast<Tag *>(tag);
t->setArtist(String(artist, unicodeStrings ? String::UTF8 : String::Latin1));
t->setArtist(charArrayToString(artist));
}
void taglib_tag_set_album(TagLib_Tag *tag, const char *album)
{
Tag *t = reinterpret_cast<Tag *>(tag);
t->setAlbum(String(album, unicodeStrings ? String::UTF8 : String::Latin1));
t->setAlbum(charArrayToString(album));
}
void taglib_tag_set_comment(TagLib_Tag *tag, const char *comment)
{
Tag *t = reinterpret_cast<Tag *>(tag);
t->setComment(String(comment, unicodeStrings ? String::UTF8 : String::Latin1));
t->setComment(charArrayToString(comment));
}
void taglib_tag_set_genre(TagLib_Tag *tag, const char *genre)
{
Tag *t = reinterpret_cast<Tag *>(tag);
t->setGenre(String(genre, unicodeStrings ? String::UTF8 : String::Latin1));
t->setGenre(charArrayToString(genre));
}
void taglib_tag_set_year(TagLib_Tag *tag, unsigned int year)
@@ -220,7 +258,7 @@ void taglib_tag_free_strings()
if(!stringManagementEnabled)
return;
for(List<char *>::Iterator it = strings.begin(); it != strings.end(); ++it)
for(List<char *>::ConstIterator it = strings.begin(); it != strings.end(); ++it)
free(*it);
strings.clear();
}

View File

@@ -29,12 +29,16 @@
extern "C" {
#endif
#if defined(_WIN32) || defined(_WIN64)
#if defined(TAGLIB_STATIC)
#define TAGLIB_C_EXPORT
#elif defined(_WIN32) || defined(_WIN64)
#ifdef MAKE_TAGLIB_C_LIB
#define TAGLIB_C_EXPORT __declspec(dllexport)
#else
#define TAGLIB_C_EXPORT __declspec(dllimport)
#endif
#elif defined(__GNUC__) && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 1)
#define TAGLIB_C_EXPORT __attribute__ ((visibility("default")))
#else
#define TAGLIB_C_EXPORT
#endif
@@ -77,6 +81,11 @@ TAGLIB_C_EXPORT void taglib_set_strings_unicode(BOOL unicode);
*/
TAGLIB_C_EXPORT void taglib_set_string_management_enabled(BOOL management);
/*!
* Explicitly free a string returned from TagLib
*/
TAGLIB_C_EXPORT void taglib_free(void* pointer);
/*******************************************************************************
* File API
******************************************************************************/
@@ -89,13 +98,15 @@ typedef enum {
TagLib_File_OggFlac,
TagLib_File_WavPack,
TagLib_File_Speex,
TagLib_File_TrueAudio
TagLib_File_TrueAudio,
TagLib_File_MP4,
TagLib_File_ASF
} TagLib_File_Type;
/*!
* Creates a TagLib file based on \a filename. TagLib will try to guess the file
* type.
*
*
* \returns NULL if the file type cannot be determined or the file cannot
* be opened.
*/
@@ -113,7 +124,7 @@ TAGLIB_C_EXPORT TagLib_File *taglib_file_new_type(const char *filename, TagLib_F
TAGLIB_C_EXPORT void taglib_file_free(TagLib_File *file);
/*!
* Returns true if the file is open and readble and valid information for
* Returns true if the file is open and readable and valid information for
* the Tag and / or AudioProperties was found.
*/
@@ -126,7 +137,7 @@ TAGLIB_C_EXPORT BOOL taglib_file_is_valid(const TagLib_File *file);
TAGLIB_C_EXPORT TagLib_Tag *taglib_file_tag(const TagLib_File *file);
/*!
* Returns a pointer to the the audio properties associated with this file. This
* Returns a pointer to the audio properties associated with this file. This
* will be freed automatically when the file is freed.
*/
TAGLIB_C_EXPORT const TagLib_AudioProperties *taglib_file_audioproperties(const TagLib_File *file);

View File

@@ -7,6 +7,6 @@ includedir=${INCLUDE_INSTALL_DIR}
Name: TagLib C Bindings
Description: Audio meta-data library (C bindings)
Requires: taglib
Version: ${TAGLIB_LIB_MAJOR_VERSION}.${TAGLIB_LIB_MINOR_VERSION}.${TAGLIB_LIB_PATCH_VERSION}
Version: ${TAGLIB_LIB_VERSION_STRING}
Libs: -L${LIB_INSTALL_DIR} -ltag_c
Cflags: -I=${INCLUDE_INSTALL_DIR}/taglib
Cflags: -I${INCLUDE_INSTALL_DIR}/taglib

View File

@@ -1,11 +0,0 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: TagLib C Bindings
Description: Audio meta-data library (C bindings)
Requires: taglib
Version: 1.5
Libs: -L${libdir} -ltag_c
Cflags: -I${includedir}/taglib

View File

@@ -1,28 +1,69 @@
INCLUDE(UsePkgConfig)
PKGCONFIG(cppunit _CppUnitIncDir _CppUnitLinkDir _CppUnitLinkFlags _CppUnitCflags)
# - Try to find the libcppunit libraries
# Once done this will define
#
# CppUnit_FOUND - system has libcppunit
# CPPUNIT_INCLUDE_DIR - the libcppunit include directory
# CPPUNIT_LIBRARIES - libcppunit library
FIND_PATH(CPPUNIT_INCLUDE_DIR cppunit/TestCase.h
${_CppUnitIncDir}
/usr/local/include
/usr/include
)
include (MacroEnsureVersion)
FIND_LIBRARY(CPPUNIT_LIBRARIES cppunit
${_CppUnitLinkDir}
/usr/local/lib
/usr/lib
)
if(NOT CPPUNIT_MIN_VERSION)
SET(CPPUNIT_MIN_VERSION 1.12.0)
endif(NOT CPPUNIT_MIN_VERSION)
IF (CPPUNIT_INCLUDE_DIR AND CPPUNIT_LIBRARIES)
SET(CPPUNIT_FOUND TRUE)
ENDIF (CPPUNIT_INCLUDE_DIR AND CPPUNIT_LIBRARIES)
FIND_PROGRAM(CPPUNIT_CONFIG_EXECUTABLE cppunit-config )
IF (CPPUNIT_FOUND)
IF (NOT CppUnit_FIND_QUIETLY)
MESSAGE(STATUS "Found CppUnit: ${CPPUNIT_LIBRARIES}")
ENDIF (NOT CppUnit_FIND_QUIETLY)
ELSE (CPPUNIT_FOUND)
IF (CppUnit_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find CppUnit")
ENDIF (CppUnit_FIND_REQUIRED)
ENDIF (CPPUNIT_FOUND)
IF(CPPUNIT_INCLUDE_DIR AND CPPUNIT_LIBRARIES)
# in cache already
SET(CppUnit_FOUND TRUE)
ELSE(CPPUNIT_INCLUDE_DIR AND CPPUNIT_LIBRARIES)
SET(CPPUNIT_INCLUDE_DIR)
SET(CPPUNIT_LIBRARIES)
IF(CPPUNIT_CONFIG_EXECUTABLE)
EXEC_PROGRAM(${CPPUNIT_CONFIG_EXECUTABLE} ARGS --cflags RETURN_VALUE _return_VALUE OUTPUT_VARIABLE CPPUNIT_CFLAGS)
EXEC_PROGRAM(${CPPUNIT_CONFIG_EXECUTABLE} ARGS --libs RETURN_VALUE _return_VALUE OUTPUT_VARIABLE CPPUNIT_LIBRARIES)
EXEC_PROGRAM(${CPPUNIT_CONFIG_EXECUTABLE} ARGS --version RETURN_VALUE _return_VALUE OUTPUT_VARIABLE CPPUNIT_INSTALLED_VERSION)
STRING(REGEX REPLACE "-I(.+)" "\\1" CPPUNIT_CFLAGS "${CPPUNIT_CFLAGS}")
ELSE(CPPUNIT_CONFIG_EXECUTABLE)
# in case win32 needs to find it the old way?
FIND_PATH(CPPUNIT_CFLAGS cppunit/TestRunner.h PATHS /usr/include /usr/local/include )
FIND_LIBRARY(CPPUNIT_LIBRARIES NAMES cppunit PATHS /usr/lib /usr/local/lib )
# how can we find cppunit version?
MESSAGE (STATUS "Ensure you cppunit installed version is at least ${CPPUNIT_MIN_VERSION}")
SET (CPPUNIT_INSTALLED_VERSION ${CPPUNIT_MIN_VERSION})
ENDIF(CPPUNIT_CONFIG_EXECUTABLE)
SET(CPPUNIT_INCLUDE_DIR ${CPPUNIT_CFLAGS} "${CPPUNIT_CFLAGS}/cppunit")
ENDIF(CPPUNIT_INCLUDE_DIR AND CPPUNIT_LIBRARIES)
IF(CPPUNIT_INCLUDE_DIR AND CPPUNIT_LIBRARIES)
SET(CppUnit_FOUND TRUE)
if(NOT CppUnit_FIND_QUIETLY)
MESSAGE (STATUS "Found cppunit: ${CPPUNIT_LIBRARIES}")
endif(NOT CppUnit_FIND_QUIETLY)
IF(CPPUNIT_CONFIG_EXECUTABLE)
EXEC_PROGRAM(${CPPUNIT_CONFIG_EXECUTABLE} ARGS --version RETURN_VALUE _return_VALUE OUTPUT_VARIABLE CPPUNIT_INSTALLED_VERSION)
ENDIF(CPPUNIT_CONFIG_EXECUTABLE)
macro_ensure_version( ${CPPUNIT_MIN_VERSION} ${CPPUNIT_INSTALLED_VERSION} CPPUNIT_INSTALLED_VERSION_OK )
IF(NOT CPPUNIT_INSTALLED_VERSION_OK)
MESSAGE ("** CppUnit version is too old: found ${CPPUNIT_INSTALLED_VERSION} installed, ${CPPUNIT_MIN_VERSION} or major is required")
SET(CppUnit_FOUND FALSE)
ENDIF(NOT CPPUNIT_INSTALLED_VERSION_OK)
ELSE(CPPUNIT_INCLUDE_DIR AND CPPUNIT_LIBRARIES)
SET(CppUnit_FOUND FALSE CACHE BOOL "Not found cppunit library")
ENDIF(CPPUNIT_INCLUDE_DIR AND CPPUNIT_LIBRARIES)
MARK_AS_ADVANCED(CPPUNIT_INCLUDE_DIR CPPUNIT_LIBRARIES)

View File

@@ -0,0 +1,71 @@
# This macro compares version numbers of the form "x.y.z"
# MACRO_ENSURE_VERSION( FOO_MIN_VERSION FOO_VERSION_FOUND FOO_VERSION_OK)
# will set FOO_VERSIN_OK to true if FOO_VERSION_FOUND >= FOO_MIN_VERSION
# where both have to be in a 3-part-version format, leading and trailing
# text is ok, e.g.
# MACRO_ENSURE_VERSION( "2.5.31" "flex 2.5.4a" VERSION_OK)
# which means 2.5.31 is required and "flex 2.5.4a" is what was found on the system
# Copyright (c) 2006, David Faure, <faure@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
MACRO(MACRO_ENSURE_VERSION requested_version found_version var_too_old)
# parse the parts of the version string
STRING(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" req_major_vers "${requested_version}")
STRING(REGEX REPLACE "[0-9]+\\.([0-9]+)\\.[0-9]+" "\\1" req_minor_vers "${requested_version}")
STRING(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" req_patch_vers "${requested_version}")
STRING(REGEX REPLACE "[^0-9]*([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" found_major_vers "${found_version}")
STRING(REGEX REPLACE "[^0-9]*[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" found_minor_vers "${found_version}")
STRING(REGEX REPLACE "[^0-9]*[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" found_patch_vers "${found_version}")
# compute an overall version number which can be compared at once
MATH(EXPR req_vers_num "${req_major_vers}*10000 + ${req_minor_vers}*100 + ${req_patch_vers}")
MATH(EXPR found_vers_num "${found_major_vers}*10000 + ${found_minor_vers}*100 + ${found_patch_vers}")
if (found_vers_num LESS req_vers_num)
set( ${var_too_old} FALSE )
else (found_vers_num LESS req_vers_num)
set( ${var_too_old} TRUE )
endif (found_vers_num LESS req_vers_num)
ENDMACRO(MACRO_ENSURE_VERSION)
# This macro compares version numbers of the form "x.y"
# MACRO_ENSURE_VERSION( FOO_MIN_VERSION FOO_VERSION_FOUND FOO_VERSION_OK)
# will set FOO_VERSIN_OK to true if FOO_VERSION_FOUND >= FOO_MIN_VERSION
# where both have to be in a 2-part-version format, leading and trailing
# text is ok, e.g.
# MACRO_ENSURE_VERSION( "0.5" "foo 0.6" VERSION_OK)
# which means 0.5 is required and "foo 0.6" is what was found on the system
# Copyright (c) 2006, David Faure, <faure@kde.org>
# Copyright (c) 2007, Pino Toscano, <pino@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
MACRO(MACRO_ENSURE_VERSION2 requested_version found_version var_too_old)
# parse the parts of the version string
STRING(REGEX REPLACE "([0-9]+)\\.[0-9]+" "\\1" req_major_vers "${requested_version}")
STRING(REGEX REPLACE "[0-9]+\\.([0-9]+)" "\\1" req_minor_vers "${requested_version}")
STRING(REGEX REPLACE "[^0-9]*([0-9]+)\\.[0-9]+.*" "\\1" found_major_vers "${found_version}")
STRING(REGEX REPLACE "[^0-9]*[0-9]+\\.([0-9]+).*" "\\1" found_minor_vers "${found_version}")
# compute an overall version number which can be compared at once
MATH(EXPR req_vers_num "${req_major_vers}*100 + ${req_minor_vers}")
MATH(EXPR found_vers_num "${found_major_vers}*100 + ${found_minor_vers}")
if (found_vers_num LESS req_vers_num)
set( ${var_too_old} FALSE )
else (found_vers_num LESS req_vers_num)
set( ${var_too_old} TRUE )
endif (found_vers_num LESS req_vers_num)
ENDMACRO(MACRO_ENSURE_VERSION2)

21
cmake_uninstall.cmake.in Normal file
View File

@@ -0,0 +1,21 @@
if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
endif()
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
string(REGEX REPLACE "\n" ";" files "${files}")
foreach (file ${files})
message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
if (EXISTS "$ENV{DESTDIR}${file}")
execute_process(
COMMAND @CMAKE_COMMAND@ -E remove "$ENV{DESTDIR}${file}"
OUTPUT_VARIABLE rm_out
RESULT_VARIABLE rm_retval
)
if(NOT ${rm_retval} EQUAL 0)
message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
endif ()
else ()
message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
endif ()
endforeach()

View File

@@ -1,9 +0,0 @@
/* config-taglib.h. Generated by cmake from config-taglib.h.cmake */
/* NOTE: only add something here if it is really needed by all of kdelibs.
Otherwise please prefer adding to the relevant config-foo.h.cmake file,
to minimize recompilations and increase modularity. */
/* Define if you have libz */
#cmakedefine HAVE_ZLIB 1
#cmakedefine NO_ITUNES_HACKS 1

34
config.h.cmake Normal file
View File

@@ -0,0 +1,34 @@
/* config.h. Generated by cmake from config.h.cmake */
#ifndef TAGLIB_CONFIG_H
#define TAGLIB_CONFIG_H
/* Defined if your compiler supports some byte swap functions */
#cmakedefine HAVE_GCC_BYTESWAP 1
#cmakedefine HAVE_GLIBC_BYTESWAP 1
#cmakedefine HAVE_MSC_BYTESWAP 1
#cmakedefine HAVE_MAC_BYTESWAP 1
#cmakedefine HAVE_OPENBSD_BYTESWAP 1
/* Defined if your compiler supports some atomic operations */
#cmakedefine HAVE_GCC_ATOMIC 1
#cmakedefine HAVE_MAC_ATOMIC 1
#cmakedefine HAVE_WIN_ATOMIC 1
#cmakedefine HAVE_IA64_ATOMIC 1
/* Defined if your compiler supports some safer version of vsprintf */
#cmakedefine HAVE_VSNPRINTF 1
#cmakedefine HAVE_VSPRINTF_S 1
/* Defined if your compiler supports ISO _strdup */
#cmakedefine HAVE_ISO_STRDUP 1
/* Defined if zlib is installed */
#cmakedefine HAVE_ZLIB 1
/* Indicates whether debug messages are shown even in release mode */
#cmakedefine TRACE_IN_RELEASE 1
#cmakedefine TESTS_DIR "@TESTS_DIR@"
#endif

View File

@@ -1,8 +0,0 @@
if test "x$have_zlib" = "xfalse"; then
echo "**************************************************"
echo "*"
echo "* You don't seem to have libz / zlib.h installed."
echo "* Compressed frames have been disabled."
echo "*"
echo "**************************************************"
fi

View File

@@ -1,133 +0,0 @@
dnl This file is part of the KDE libraries/packages
dnl Copyright (C) 2001 Stephan Kulow (coolo@kde.org)
dnl modified by Walter Tasin (tasin@kdevelop.org)
dnl for c++ console applications
dnl This file is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Library General Public
dnl License as published by the Free Software Foundation; either
dnl version 2 of the License, or (at your option) any later version.
dnl This library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl Library General Public License for more details.
dnl You should have received a copy of the GNU Library General Public License
dnl along with this library; see the file COPYING.LIB. If not, write to
dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
dnl Boston, MA 02111-1307, USA.
# Original Author was Kalle@kde.org
# I lifted it in some mater. (Stephan Kulow)
# I used much code from Janos Farkas
dnl Process this file with autoconf to produce a configure script.
AC_INIT(acinclude.m4) dnl a source file from your sub dir
dnl This is so we can use kde-common
AC_CONFIG_AUX_DIR(admin)
dnl This ksh/zsh feature conflicts with `cd blah ; pwd`
unset CDPATH
dnl Checking host/target/build systems, for make, install etc.
AC_CANONICAL_SYSTEM
dnl Perform program name transformation
AC_ARG_PROGRAM
dnl Automake doc recommends to do this only here. (Janos)
AM_INIT_AUTOMAKE(taglib,1.4)
dnl almost the same like KDE_SET_PEFIX but the path is /usr/local
dnl
unset CDPATH
dnl make /usr/local the default for the installation
AC_PREFIX_DEFAULT(/usr/local)
if test "x$prefix" = "xNONE"; then
prefix=$ac_default_prefix
ac_configure_args="$ac_configure_args --prefix $prefix"
fi
KDE_FAST_CONFIGURE
KDE_CONF_FILES
dnl without this order in this file, automake will be confused!
dnl
AM_CONFIG_HEADER(config.h)
dnl checks for programs.
dnl first check for c/c++ compilers
AC_CHECK_COMPILERS
dnl CXXFLAGS="$NOOPT_CXXFLAGS" dnl __kdevelop[noopt]__
dnl CFLAGS="$NOOPT_CFLAGS" dnl __kdevelop[noopt]__
CXXFLAGS="$CXXFLAGS $USE_EXCEPTIONS" dnl __kdevelop[exc]__
dnl create only shared libtool-libraries
AC_ENABLE_SHARED(yes)
dnl set the following to yes, if you want to create static
dnl libtool-libraries, too.
AC_ENABLE_STATIC(no)
dnl create a working libtool-script
KDE_PROG_LIBTOOL
dnl activate the next macro call for DLOPEN tests and setting LIBDL
dnl (n.b. KDE_MISC_TESTS does the same to you, so use either this or the next one)
dnl KDE_CHECK_DLOPEN
dnl activate the next macro call for some additional tests
dnl (compat, crypt, socket, nsl, dlopen, ...)
dnl KDE_MISC_TESTS dnl __kdevelop__
dnl KDE_NEED_FLEX dnl __kdevelop__
dnl AC_PROG_YACC dnl __kdevelop__
dnl KDE_CHECK_EXTRA_LIBS
all_libraries="$all_libraries $USER_LDFLAGS"
all_includes="$all_includes $USER_INCLUDES"
AC_SUBST(all_includes)
AC_SUBST(all_libraries)
AC_SUBST(AUTODIRS)
#AM_INIT_AUTOMAKE(taglib,1.0)
dnl don't remove the below
dnl AC_OUTPUT(taglib-config)
dnl AC_OUTPUT(taglib.pc)
AC_DEFUN([AC_HAVE_ZLIB],
[
AC_DEFINE(HAVE_ZLIB, 1, [have zlib])
have_zlib=true
])
AC_DEFUN([AC_NO_ZLIB],
[
AC_DEFINE(HAVE_ZLIB, 0, [have zlib])
have_zlib=false
])
AC_CHECK_HEADER(zlib.h, AC_HAVE_ZLIB, AC_NO_ZLIB)
AM_CONDITIONAL(link_zlib, test x$have_zlib = xtrue)
AC_DEFUN([AC_HAVE_CPPUNIT],
[
AC_DEFINE(HAVE_CPPUNIT, 1, [have cppunit])
have_cppunit=true
])
AC_DEFUN([AC_NO_CPPUNIT],
[
AC_DEFINE(HAVE_CPPUNIT, 0, [have cppunit])
have_cppunit=false
])
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_CHECK_HEADER(cppunit/extensions/HelperMacros.h, AC_HAVE_CPPUNIT, AC_NO_CPPUNIT)
AC_LANG_RESTORE
AM_CONDITIONAL(build_tests, test x$have_cppunit = xtrue)

View File

@@ -1 +1 @@
Run "doxygen taglib.doxgen" to generate the TagLib API documentation.
Run "make docs" in the parent directory to generate the TagLib API documentation.

View File

@@ -17,7 +17,7 @@
<td>
<div id="intro">
<table border="0" height="119" cellpadding="0" cellspacing="0" width="100%">
<tr><td valign="top"><h1>TagLib 1.5 ($title)</h1></td></tr>
<tr><td valign="top"><h1>TagLib $projectnumber ($title)</h1></td></tr>
<tr>
<td valign="bottom">
<div id="links">

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@@ -1,78 +1,40 @@
if(BUILD_EXAMPLES)
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/../taglib
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/toolkit
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/ape
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/mpeg
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/mpeg/id3v1
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/mpeg/id3v2
${CMAKE_CURRENT_SOURCE_DIR}/../bindings/c/ )
########### next target ###############
SET(tagreader_SRCS
tagreader.cpp
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/../taglib
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/toolkit
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/ape
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/mpeg
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/mpeg/id3v1
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/mpeg/id3v2
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/mpeg/id3v2/frames
${CMAKE_CURRENT_SOURCE_DIR}/../bindings/c/
)
ADD_EXECUTABLE(tagreader ${tagreader_SRCS})
TARGET_LINK_LIBRARIES(tagreader tag )
#INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/tagreader DESTINATION ${BIN_INSTALL_DIR} )
if(NOT BUILD_SHARED_LIBS)
add_definitions(-DTAGLIB_STATIC)
endif()
########### next target ###############
SET(tagreader_c_SRCS
tagreader_c.c
)
ADD_EXECUTABLE(tagreader_c ${tagreader_c_SRCS})
TARGET_LINK_LIBRARIES(tagreader_c tag_c )
#INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/tagreader_c DESTINATION ${BIN_INSTALL_DIR})
add_executable(tagreader tagreader.cpp)
target_link_libraries(tagreader tag)
########### next target ###############
SET(tagwriter_SRCS
tagwriter.cpp
)
ADD_EXECUTABLE(tagwriter ${tagwriter_SRCS})
TARGET_LINK_LIBRARIES(tagwriter tag )
#INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/tagwriter DESTINATION ${BIN_INSTALL_DIR})
add_executable(tagreader_c tagreader_c.c)
target_link_libraries(tagreader_c tag_c)
########### next target ###############
SET(framelist_SRCS
framelist.cpp
)
ADD_EXECUTABLE(framelist ${framelist_SRCS})
TARGET_LINK_LIBRARIES(framelist tag )
#INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/framelist DESTINATION ${BIN_INSTALL_DIR})
add_executable(tagwriter tagwriter.cpp)
target_link_libraries(tagwriter tag)
########### next target ###############
SET(strip-id3v1_SRCS
strip-id3v1.cpp)
add_executable(framelist framelist.cpp)
target_link_libraries(framelist tag)
ADD_EXECUTABLE(strip-id3v1 ${strip-id3v1_SRCS})
########### next target ###############
TARGET_LINK_LIBRARIES(strip-id3v1 tag )
#INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/strip-id3v1 DESTINATION ${BIN_INSTALL_DIR})
endif(BUILD_EXAMPLES)
add_executable(strip-id3v1 strip-id3v1.cpp)
target_link_libraries(strip-id3v1 tag)

View File

@@ -1,18 +0,0 @@
bin_PROGRAMS = tagreader tagreader_c tagwriter framelist strip-id3v1
tagreader_SOURCES = tagreader.cpp
tagreader_c_SOURCES = tagreader_c.c
tagwriter_SOURCES = tagwriter.cpp
framelist_SOURCES = framelist.cpp
strip_id3v1_SOURCES = strip-id3v1.cpp
INCLUDES = \
-I$(top_srcdir)/taglib \
-I$(top_srcdir)/taglib/toolkit \
-I$(top_srcdir)/taglib/ape \
-I$(top_srcdir)/taglib/mpeg \
-I$(top_srcdir)/taglib/mpeg/id3v1 \
-I$(top_srcdir)/taglib/mpeg/id3v2 \
-I$(top_srcdir)/bindings/c
LDADD = ../taglib/libtag.la
tagreader_c_LDADD = ../bindings/c/libtag_c.la

View File

@@ -32,6 +32,7 @@
#include <id3v2tag.h>
#include <id3v2frame.h>
#include <id3v2header.h>
#include <commentsframe.h>
#include <id3v1tag.h>
@@ -65,8 +66,15 @@ int main(int argc, char *argv[])
<< endl;
ID3v2::FrameList::ConstIterator it = id3v2tag->frameList().begin();
for(; it != id3v2tag->frameList().end(); it++)
cout << (*it)->frameID() << " - \"" << (*it)->toString() << "\"" << endl;
for(; it != id3v2tag->frameList().end(); it++) {
cout << (*it)->frameID();
if(ID3v2::CommentsFrame *comment = dynamic_cast<ID3v2::CommentsFrame *>(*it))
if(!comment->description().isEmpty())
cout << " [" << comment->description() << "]";
cout << " - \"" << (*it)->toString() << "\"" << endl;
}
}
else
cout << "file does not have a valid id3v2 tag" << endl;
@@ -95,7 +103,10 @@ int main(int argc, char *argv[])
for(APE::ItemListMap::ConstIterator it = ape->itemListMap().begin();
it != ape->itemListMap().end(); ++it)
{
cout << (*it).first << " - \"" << (*it).second.toString() << "\"" << endl;
if((*it).second.type() != APE::Item::Binary)
cout << (*it).first << " - \"" << (*it).second.toString() << "\"" << endl;
else
cout << (*it).first << " - Binary data (" << (*it).second.binaryData().size() << " bytes)" << endl;
}
}
else

View File

@@ -23,20 +23,15 @@
*/
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <fileref.h>
#include <tag.h>
#include <tpropertymap.h>
using namespace std;
TagLib::String formatSeconds(int seconds)
{
char secondsString[3];
sprintf(secondsString, "%02i", seconds);
return secondsString;
}
int main(int argc, char *argv[])
{
for(int i = 1; i < argc; i++) {
@@ -49,7 +44,7 @@ int main(int argc, char *argv[])
TagLib::Tag *tag = f.tag();
cout << "-- TAG --" << endl;
cout << "-- TAG (basic) --" << endl;
cout << "title - \"" << tag->title() << "\"" << endl;
cout << "artist - \"" << tag->artist() << "\"" << endl;
cout << "album - \"" << tag->album() << "\"" << endl;
@@ -57,6 +52,23 @@ int main(int argc, char *argv[])
cout << "comment - \"" << tag->comment() << "\"" << endl;
cout << "track - \"" << tag->track() << "\"" << endl;
cout << "genre - \"" << tag->genre() << "\"" << endl;
TagLib::PropertyMap tags = f.file()->properties();
unsigned int longest = 0;
for(TagLib::PropertyMap::ConstIterator i = tags.begin(); i != tags.end(); ++i) {
if (i->first.size() > longest) {
longest = i->first.size();
}
}
cout << "-- TAG (properties) --" << endl;
for(TagLib::PropertyMap::ConstIterator i = tags.begin(); i != tags.end(); ++i) {
for(TagLib::StringList::ConstIterator j = i->second.begin(); j != i->second.end(); ++j) {
cout << left << std::setw(longest) << i->first << " - " << '"' << *j << '"' << endl;
}
}
}
if(!f.isNull() && f.audioProperties()) {
@@ -70,7 +82,7 @@ int main(int argc, char *argv[])
cout << "bitrate - " << properties->bitrate() << endl;
cout << "sample rate - " << properties->sampleRate() << endl;
cout << "channels - " << properties->channels() << endl;
cout << "length - " << minutes << ":" << formatSeconds(seconds) << endl;
cout << "length - " << minutes << ":" << setfill('0') << setw(2) << seconds << endl;
}
}
return 0;

View File

@@ -51,23 +51,27 @@ int main(int argc, char *argv[])
tag = taglib_file_tag(file);
properties = taglib_file_audioproperties(file);
printf("-- TAG --\n");
printf("title - \"%s\"\n", taglib_tag_title(tag));
printf("artist - \"%s\"\n", taglib_tag_artist(tag));
printf("album - \"%s\"\n", taglib_tag_album(tag));
printf("year - \"%i\"\n", taglib_tag_year(tag));
printf("comment - \"%s\"\n", taglib_tag_comment(tag));
printf("track - \"%i\"\n", taglib_tag_track(tag));
printf("genre - \"%s\"\n", taglib_tag_genre(tag));
if(tag != NULL) {
printf("-- TAG --\n");
printf("title - \"%s\"\n", taglib_tag_title(tag));
printf("artist - \"%s\"\n", taglib_tag_artist(tag));
printf("album - \"%s\"\n", taglib_tag_album(tag));
printf("year - \"%i\"\n", taglib_tag_year(tag));
printf("comment - \"%s\"\n", taglib_tag_comment(tag));
printf("track - \"%i\"\n", taglib_tag_track(tag));
printf("genre - \"%s\"\n", taglib_tag_genre(tag));
}
seconds = taglib_audioproperties_length(properties) % 60;
minutes = (taglib_audioproperties_length(properties) - seconds) / 60;
if(properties != NULL) {
seconds = taglib_audioproperties_length(properties) % 60;
minutes = (taglib_audioproperties_length(properties) - seconds) / 60;
printf("-- AUDIO --\n");
printf("bitrate - %i\n", taglib_audioproperties_bitrate(properties));
printf("sample rate - %i\n", taglib_audioproperties_samplerate(properties));
printf("channels - %i\n", taglib_audioproperties_channels(properties));
printf("length - %i:%02i\n", minutes, seconds);
printf("-- AUDIO --\n");
printf("bitrate - %i\n", taglib_audioproperties_bitrate(properties));
printf("sample rate - %i\n", taglib_audioproperties_samplerate(properties));
printf("channels - %i\n", taglib_audioproperties_channels(properties));
printf("length - %i:%02i\n", minutes, seconds);
}
taglib_tag_free_strings();
taglib_file_free(file);

View File

@@ -23,6 +23,7 @@
*/
#include <iostream>
#include <iomanip>
#include <string.h>
#include <stdio.h>
@@ -34,6 +35,7 @@
#include <fileref.h>
#include <tfile.h>
#include <tag.h>
#include <tpropertymap.h>
using namespace std;
@@ -65,11 +67,32 @@ void usage()
cout << " -g <genre>" << endl;
cout << " -y <year>" << endl;
cout << " -T <track>" << endl;
cout << " -R <tagname> <tagvalue>" << endl;
cout << " -I <tagname> <tagvalue>" << endl;
cout << " -D <tagname>" << endl;
cout << endl;
exit(1);
}
void checkForRejectedProperties(const TagLib::PropertyMap &tags)
{ // stolen from tagreader.cpp
if(tags.size() > 0) {
unsigned int longest = 0;
for(TagLib::PropertyMap::ConstIterator i = tags.begin(); i != tags.end(); ++i) {
if(i->first.size() > longest) {
longest = i->first.size();
}
}
cout << "-- rejected TAGs (properties) --" << endl;
for(TagLib::PropertyMap::ConstIterator i = tags.begin(); i != tags.end(); ++i) {
for(TagLib::StringList::ConstIterator j = i->second.begin(); j != i->second.end(); ++j) {
cout << left << std::setw(longest) << i->first << " - " << '"' << *j << '"' << endl;
}
}
}
}
int main(int argc, char *argv[])
{
TagLib::List<TagLib::FileRef> fileList;
@@ -94,7 +117,7 @@ int main(int argc, char *argv[])
char field = argv[i][1];
TagLib::String value = argv[i + 1];
TagLib::List<TagLib::FileRef>::Iterator it;
TagLib::List<TagLib::FileRef>::ConstIterator it;
for(it = fileList.begin(); it != fileList.end(); ++it) {
TagLib::Tag *t = (*it).tag();
@@ -121,6 +144,29 @@ int main(int argc, char *argv[])
case 'T':
t->setTrack(value.toInt());
break;
case 'R':
case 'I':
if(i + 2 < argc) {
TagLib::PropertyMap map = (*it).file()->properties ();
if(field == 'R') {
map.replace(value, TagLib::String(argv[i + 2]));
}
else {
map.insert(value, TagLib::String(argv[i + 2]));
}
++i;
checkForRejectedProperties((*it).file()->setProperties(map));
}
else {
usage();
}
break;
case 'D': {
TagLib::PropertyMap map = (*it).file()->properties();
map.erase(value);
checkForRejectedProperties((*it).file()->setProperties(map));
break;
}
default:
usage();
break;
@@ -131,7 +177,7 @@ int main(int argc, char *argv[])
usage();
}
TagLib::List<TagLib::FileRef>::Iterator it;
TagLib::List<TagLib::FileRef>::ConstIterator it;
for(it = fileList.begin(); it != fileList.end(); ++it)
(*it).file()->save();

View File

@@ -14,10 +14,10 @@ EOH
exit 1;
}
prefix=${CMAKE_INSTALL_PREFIX}
exec_prefix=${CMAKE_INSTALL_PREFIX}
libdir=${LIB_INSTALL_DIR}
includedir=${INCLUDE_INSTALL_DIR}
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=@CMAKE_INSTALL_PREFIX@
libdir=@LIB_INSTALL_DIR@
includedir=@INCLUDE_INSTALL_DIR@
flags=""
@@ -29,13 +29,13 @@ while test $# -gt 0
do
case $1 in
--libs)
flags="$flags -L$libdir -ltag"
flags="$flags -L$libdir -ltag @ZLIB_LIBRARIES_FLAGS@"
;;
--cflags)
flags="$flags -I$includedir/taglib"
flags="$flags -I$includedir -I$includedir/taglib"
;;
--version)
echo 1.5
echo @TAGLIB_LIB_VERSION_STRING@
;;
--prefix)
echo $prefix

36
taglib-config.cmd.cmake Normal file
View File

@@ -0,0 +1,36 @@
@echo off
goto beginning
*
* It is what it is, you can do with it as you please.
*
* Just don't blame me if it teaches your computer to smoke!
*
* -Enjoy
* fh :)_~
*
:beginning
if /i "%1#" == "--libs#" goto doit
if /i "%1#" == "--cflags#" goto doit
if /i "%1#" == "--version#" goto doit
if /i "%1#" == "--prefix#" goto doit
echo "usage: %0 [OPTIONS]"
echo [--libs]
echo [--cflags]
echo [--version]
echo [--prefix]
goto theend
*
* NOTE: Windows does not assume libraries are prefixed with 'lib'.
* NOTE: If '-llibtag' is the last element, it is easily appended in the users installation/makefile process
* to allow for static, shared or debug builds.
* It would be preferable if the top level CMakeLists.txt provided the library name during config. ??
:doit
if /i "%1#" == "--libs#" echo -L${LIB_INSTALL_DIR} -llibtag
if /i "%1#" == "--cflags#" echo -I${INCLUDE_INSTALL_DIR} -I${INCLUDE_INSTALL_DIR}/taglib
if /i "%1#" == "--version#" echo ${TAGLIB_LIB_VERSION_STRING}
if /i "%1#" == "--prefix#" echo ${CMAKE_INSTALL_PREFIX}
:theend

View File

@@ -1,55 +0,0 @@
#!/bin/sh
usage()
{
echo "usage: $0 [OPTIONS]"
cat << EOH
options:
[--libs]
[--cflags]
[--version]
[--prefix]
EOH
exit 1;
}
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
flags=""
if test $# -eq 0 ; then
usage
fi
while test $# -gt 0
do
case $1 in
--libs)
flags="$flags -L$libdir -ltag"
;;
--cflags)
flags="$flags -I$includedir/taglib"
;;
--version)
echo 1.5
;;
--prefix)
echo $prefix
;;
*)
echo "$0: unknown option $1"
echo
usage
;;
esac
shift
done
if test -n "$flags"
then
echo $flags
fi

View File

@@ -1,11 +1,11 @@
prefix=${CMAKE_INSTALL_PREFIX}
exec_prefix=${CMAKE_INSTALL_PREFIX}
libdir=${LIB_INSTALL_DIR}
includedir=${INCLUDE_INSTALL_DIR}
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=@CMAKE_INSTALL_PREFIX@
libdir=@LIB_INSTALL_DIR@
includedir=@INCLUDE_INSTALL_DIR@
Name: TagLib
Description: Audio meta-data library
Requires:
Version: ${TAGLIB_LIB_MAJOR_VERSION}.${TAGLIB_LIB_MINOR_VERSION}.${TAGLIB_LIB_PATCH_VERSION}
Libs: -L${LIB_INSTALL_DIR} -ltag
Cflags: -I${INCLUDE_INSTALL_DIR}/taglib
Version: @TAGLIB_LIB_VERSION_STRING@
Libs: -L${libdir} -ltag @ZLIB_LIBRARIES_FLAGS@
Cflags: -I${includedir} -I${includedir}/taglib

View File

@@ -1,11 +0,0 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: TagLib
Description: Audio meta-data library
Requires:
Version: 1.5
Libs: -L${libdir} -ltag
Cflags: -I${includedir}/taglib

View File

@@ -1,160 +1,372 @@
set(CMAKE_INCLUDE_CURRENT_DIR ON)
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_SOURCE_DIR}/toolkit
${CMAKE_CURRENT_SOURCE_DIR}/mpeg
${CMAKE_CURRENT_SOURCE_DIR}/ogg
${CMAKE_CURRENT_SOURCE_DIR}/ogg/flac
${CMAKE_CURRENT_SOURCE_DIR}/flac
${CMAKE_CURRENT_SOURCE_DIR}/mpc
${CMAKE_CURRENT_SOURCE_DIR}/ogg/vorbis
${CMAKE_CURRENT_SOURCE_DIR}/ogg/speex
${CMAKE_CURRENT_SOURCE_DIR}/mpeg/id3v2
${CMAKE_CURRENT_SOURCE_DIR}/mpeg/id3v1
${CMAKE_CURRENT_SOURCE_DIR}/ape
${CMAKE_CURRENT_SOURCE_DIR}/wavpack
${CMAKE_CURRENT_SOURCE_DIR}/trueaudio
${CMAKE_CURRENT_BINARY_DIR}/taglib
${CMAKE_CURRENT_BINARY_DIR}/..
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/toolkit
${CMAKE_CURRENT_SOURCE_DIR}/asf
${CMAKE_CURRENT_SOURCE_DIR}/mpeg
${CMAKE_CURRENT_SOURCE_DIR}/ogg
${CMAKE_CURRENT_SOURCE_DIR}/ogg/flac
${CMAKE_CURRENT_SOURCE_DIR}/flac
${CMAKE_CURRENT_SOURCE_DIR}/mpc
${CMAKE_CURRENT_SOURCE_DIR}/mp4
${CMAKE_CURRENT_SOURCE_DIR}/ogg/vorbis
${CMAKE_CURRENT_SOURCE_DIR}/ogg/speex
${CMAKE_CURRENT_SOURCE_DIR}/ogg/opus
${CMAKE_CURRENT_SOURCE_DIR}/mpeg/id3v2
${CMAKE_CURRENT_SOURCE_DIR}/mpeg/id3v2/frames
${CMAKE_CURRENT_SOURCE_DIR}/mpeg/id3v1
${CMAKE_CURRENT_SOURCE_DIR}/ape
${CMAKE_CURRENT_SOURCE_DIR}/wavpack
${CMAKE_CURRENT_SOURCE_DIR}/trueaudio
${CMAKE_CURRENT_SOURCE_DIR}/riff
${CMAKE_CURRENT_SOURCE_DIR}/riff/aiff
${CMAKE_CURRENT_SOURCE_DIR}/riff/wav
${CMAKE_CURRENT_SOURCE_DIR}/mod
${CMAKE_CURRENT_SOURCE_DIR}/s3m
${CMAKE_CURRENT_SOURCE_DIR}/it
${CMAKE_CURRENT_SOURCE_DIR}/xm
${taglib_SOURCE_DIR}/3rdparty
)
if(ZLIB_FOUND)
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
endif(ZLIB_FOUND)
include_directories(${ZLIB_INCLUDE_DIR})
elseif(HAVE_ZLIB_SOURCE)
include_directories(${ZLIB_SOURCE})
endif()
ADD_SUBDIRECTORY( toolkit )
ADD_SUBDIRECTORY( mpeg )
ADD_SUBDIRECTORY( ogg )
ADD_SUBDIRECTORY( flac )
ADD_SUBDIRECTORY( ape )
ADD_SUBDIRECTORY( mpc )
ADD_SUBDIRECTORY( wavpack )
ADD_SUBDIRECTORY( trueaudio )
########### next target ###############
SET(mpeg_SRCS
mpeg/mpegfile.cpp
mpeg/mpegproperties.cpp
mpeg/mpegheader.cpp
mpeg/xingheader.cpp
set(tag_HDRS
tag.h
fileref.h
audioproperties.h
taglib_export.h
${CMAKE_CURRENT_BINARY_DIR}/../taglib_config.h
toolkit/taglib.h
toolkit/tstring.h
toolkit/tlist.h
toolkit/tlist.tcc
toolkit/tstringlist.h
toolkit/tbytevector.h
toolkit/tbytevectorlist.h
toolkit/tbytevectorstream.h
toolkit/tiostream.h
toolkit/tfile.h
toolkit/tfilestream.h
toolkit/tmap.h
toolkit/tmap.tcc
toolkit/tpropertymap.h
toolkit/trefcounter.h
toolkit/tdebuglistener.h
mpeg/mpegfile.h
mpeg/mpegproperties.h
mpeg/mpegheader.h
mpeg/xingheader.h
mpeg/id3v1/id3v1tag.h
mpeg/id3v1/id3v1genres.h
mpeg/id3v2/id3v2.h
mpeg/id3v2/id3v2extendedheader.h
mpeg/id3v2/id3v2frame.h
mpeg/id3v2/id3v2header.h
mpeg/id3v2/id3v2synchdata.h
mpeg/id3v2/id3v2footer.h
mpeg/id3v2/id3v2framefactory.h
mpeg/id3v2/id3v2tag.h
mpeg/id3v2/frames/attachedpictureframe.h
mpeg/id3v2/frames/commentsframe.h
mpeg/id3v2/frames/eventtimingcodesframe.h
mpeg/id3v2/frames/generalencapsulatedobjectframe.h
mpeg/id3v2/frames/ownershipframe.h
mpeg/id3v2/frames/popularimeterframe.h
mpeg/id3v2/frames/privateframe.h
mpeg/id3v2/frames/relativevolumeframe.h
mpeg/id3v2/frames/synchronizedlyricsframe.h
mpeg/id3v2/frames/textidentificationframe.h
mpeg/id3v2/frames/uniquefileidentifierframe.h
mpeg/id3v2/frames/unknownframe.h
mpeg/id3v2/frames/unsynchronizedlyricsframe.h
mpeg/id3v2/frames/urllinkframe.h
mpeg/id3v2/frames/chapterframe.h
mpeg/id3v2/frames/tableofcontentsframe.h
mpeg/id3v2/frames/podcastframe.h
ogg/oggfile.h
ogg/oggpage.h
ogg/oggpageheader.h
ogg/xiphcomment.h
ogg/vorbis/vorbisfile.h
ogg/vorbis/vorbisproperties.h
ogg/flac/oggflacfile.h
ogg/speex/speexfile.h
ogg/speex/speexproperties.h
ogg/opus/opusfile.h
ogg/opus/opusproperties.h
flac/flacfile.h
flac/flacpicture.h
flac/flacproperties.h
flac/flacmetadatablock.h
ape/apefile.h
ape/apeproperties.h
ape/apetag.h
ape/apefooter.h
ape/apeitem.h
mpc/mpcfile.h
mpc/mpcproperties.h
wavpack/wavpackfile.h
wavpack/wavpackproperties.h
trueaudio/trueaudiofile.h
trueaudio/trueaudioproperties.h
riff/rifffile.h
riff/aiff/aifffile.h
riff/aiff/aiffproperties.h
riff/wav/wavfile.h
riff/wav/wavproperties.h
riff/wav/infotag.h
asf/asffile.h
asf/asfproperties.h
asf/asftag.h
asf/asfattribute.h
asf/asfpicture.h
mp4/mp4file.h
mp4/mp4atom.h
mp4/mp4tag.h
mp4/mp4item.h
mp4/mp4properties.h
mp4/mp4coverart.h
mod/modfilebase.h
mod/modfile.h
mod/modtag.h
mod/modproperties.h
it/itfile.h
it/itproperties.h
s3m/s3mfile.h
s3m/s3mproperties.h
xm/xmfile.h
xm/xmproperties.h
)
SET(id3v1_SRCS
mpeg/id3v1/id3v1tag.cpp
mpeg/id3v1/id3v1genres.cpp
set(mpeg_SRCS
mpeg/mpegfile.cpp
mpeg/mpegproperties.cpp
mpeg/mpegheader.cpp
mpeg/xingheader.cpp
)
SET(id3v2_SRCS
mpeg/id3v2/id3v2framefactory.cpp
mpeg/id3v2/id3v2synchdata.cpp
mpeg/id3v2/id3v2tag.cpp
mpeg/id3v2/id3v2header.cpp
mpeg/id3v2/id3v2frame.cpp
mpeg/id3v2/id3v2footer.cpp
mpeg/id3v2/id3v2extendedheader.cpp
set(id3v1_SRCS
mpeg/id3v1/id3v1tag.cpp
mpeg/id3v1/id3v1genres.cpp
)
set(id3v2_SRCS
mpeg/id3v2/id3v2framefactory.cpp
mpeg/id3v2/id3v2synchdata.cpp
mpeg/id3v2/id3v2tag.cpp
mpeg/id3v2/id3v2header.cpp
mpeg/id3v2/id3v2frame.cpp
mpeg/id3v2/id3v2footer.cpp
mpeg/id3v2/id3v2extendedheader.cpp
)
SET(frames_SRCS
mpeg/id3v2/frames/attachedpictureframe.cpp
mpeg/id3v2/frames/commentsframe.cpp
mpeg/id3v2/frames/generalencapsulatedobjectframe.cpp
mpeg/id3v2/frames/relativevolumeframe.cpp
mpeg/id3v2/frames/textidentificationframe.cpp
mpeg/id3v2/frames/uniquefileidentifierframe.cpp
mpeg/id3v2/frames/unknownframe.cpp
mpeg/id3v2/frames/unsynchronizedlyricsframe.cpp
mpeg/id3v2/frames/urllinkframe.cpp
set(frames_SRCS
mpeg/id3v2/frames/attachedpictureframe.cpp
mpeg/id3v2/frames/commentsframe.cpp
mpeg/id3v2/frames/eventtimingcodesframe.cpp
mpeg/id3v2/frames/generalencapsulatedobjectframe.cpp
mpeg/id3v2/frames/ownershipframe.cpp
mpeg/id3v2/frames/popularimeterframe.cpp
mpeg/id3v2/frames/privateframe.cpp
mpeg/id3v2/frames/relativevolumeframe.cpp
mpeg/id3v2/frames/synchronizedlyricsframe.cpp
mpeg/id3v2/frames/textidentificationframe.cpp
mpeg/id3v2/frames/uniquefileidentifierframe.cpp
mpeg/id3v2/frames/unknownframe.cpp
mpeg/id3v2/frames/unsynchronizedlyricsframe.cpp
mpeg/id3v2/frames/urllinkframe.cpp
mpeg/id3v2/frames/chapterframe.cpp
mpeg/id3v2/frames/tableofcontentsframe.cpp
mpeg/id3v2/frames/podcastframe.cpp
)
SET(ogg_SRCS
ogg/oggfile.cpp
ogg/oggpage.cpp
ogg/oggpageheader.cpp
ogg/xiphcomment.cpp
set(ogg_SRCS
ogg/oggfile.cpp
ogg/oggpage.cpp
ogg/oggpageheader.cpp
ogg/xiphcomment.cpp
)
SET(vorbis_SRCS
ogg/vorbis/vorbisfile.cpp
ogg/vorbis/vorbisproperties.cpp
set(vorbis_SRCS
ogg/vorbis/vorbisfile.cpp
ogg/vorbis/vorbisproperties.cpp
)
SET(flacs_SRCS
flac/flacfile.cpp
flac/flacproperties.cpp
set(flacs_SRCS
flac/flacfile.cpp
flac/flacpicture.cpp
flac/flacproperties.cpp
flac/flacmetadatablock.cpp
flac/flacunknownmetadatablock.cpp
)
SET(oggflacs_SRCS
ogg/flac/oggflacfile.cpp
set(oggflacs_SRCS
ogg/flac/oggflacfile.cpp
)
SET(mpc_SRCS
mpc/mpcfile.cpp
mpc/mpcproperties.cpp
set(mpc_SRCS
mpc/mpcfile.cpp
mpc/mpcproperties.cpp
)
SET(ape_SRCS
ape/apetag.cpp
ape/apefooter.cpp
ape/apeitem.cpp
set(mp4_SRCS
mp4/mp4file.cpp
mp4/mp4atom.cpp
mp4/mp4tag.cpp
mp4/mp4item.cpp
mp4/mp4properties.cpp
mp4/mp4coverart.cpp
)
SET(wavpack_SRCS
wavpack/wavpackfile.cpp
wavpack/wavpackproperties.cpp
set(ape_SRCS
ape/apetag.cpp
ape/apefooter.cpp
ape/apeitem.cpp
ape/apefile.cpp
ape/apeproperties.cpp
)
SET(speex_SRCS
ogg/speex/speexfile.cpp
ogg/speex/speexproperties.cpp
set(wavpack_SRCS
wavpack/wavpackfile.cpp
wavpack/wavpackproperties.cpp
)
SET(trueaudio_SRCS
trueaudio/trueaudiofile.cpp
trueaudio/trueaudioproperties.cpp
set(speex_SRCS
ogg/speex/speexfile.cpp
ogg/speex/speexproperties.cpp
)
SET(toolkit_SRCS
toolkit/tstring.cpp
toolkit/tstringlist.cpp
toolkit/tbytevector.cpp
toolkit/tbytevectorlist.cpp
toolkit/tfile.cpp
toolkit/tdebug.cpp
toolkit/unicode.cpp
set(opus_SRCS
ogg/opus/opusfile.cpp
ogg/opus/opusproperties.cpp
)
SET(tag_LIB_SRCS ${mpeg_SRCS} ${id3v1_SRCS} ${id3v2_SRCS} ${frames_SRCS} ${ogg_SRCS}
${vorbis_SRCS} ${oggflacs_SRCS} ${mpc_SRCS} ${ape_SRCS} ${toolkit_SRCS} ${flacs_SRCS}
${wavpack_SRCS} ${speex_SRCS} ${trueaudio_SRCS}
tag.cpp
tagunion.cpp
fileref.cpp
audioproperties.cpp
set(trueaudio_SRCS
trueaudio/trueaudiofile.cpp
trueaudio/trueaudioproperties.cpp
)
ADD_LIBRARY(tag SHARED ${tag_LIB_SRCS})
TARGET_LINK_LIBRARIES(tag )
if(ZLIB_FOUND)
TARGET_LINK_LIBRARIES(tag ${ZLIB_LIBRARIES})
endif(ZLIB_FOUND)
SET_TARGET_PROPERTIES(tag PROPERTIES
VERSION ${TAGLIB_LIB_MAJOR_VERSION}.${TAGLIB_LIB_MINOR_VERSION}.${TAGLIB_LIB_PATCH_VERSION}
SOVERSION ${TAGLIB_LIB_MAJOR_VERSION}
INSTALL_NAME_DIR ${LIB_INSTALL_DIR}
DEFINE_SYMBOL MAKE_TAGLIB_LIB
)
INSTALL(TARGETS tag
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
RUNTIME DESTINATION bin
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
set(asf_SRCS
asf/asftag.cpp
asf/asffile.cpp
asf/asfproperties.cpp
asf/asfattribute.cpp
asf/asfpicture.cpp
)
INSTALL( FILES tag.h fileref.h audioproperties.h taglib_export.h DESTINATION ${INCLUDE_INSTALL_DIR}/taglib)
set(riff_SRCS
riff/rifffile.cpp
)
set(aiff_SRCS
riff/aiff/aifffile.cpp
riff/aiff/aiffproperties.cpp
)
set(wav_SRCS
riff/wav/wavfile.cpp
riff/wav/wavproperties.cpp
riff/wav/infotag.cpp
)
set(mod_SRCS
mod/modfilebase.cpp
mod/modfile.cpp
mod/modtag.cpp
mod/modproperties.cpp
)
set(s3m_SRCS
s3m/s3mfile.cpp
s3m/s3mproperties.cpp
)
set(it_SRCS
it/itfile.cpp
it/itproperties.cpp
)
set(xm_SRCS
xm/xmfile.cpp
xm/xmproperties.cpp
)
set(toolkit_SRCS
toolkit/tstring.cpp
toolkit/tstringlist.cpp
toolkit/tbytevector.cpp
toolkit/tbytevectorlist.cpp
toolkit/tbytevectorstream.cpp
toolkit/tiostream.cpp
toolkit/tfile.cpp
toolkit/tfilestream.cpp
toolkit/tdebug.cpp
toolkit/tpropertymap.cpp
toolkit/trefcounter.cpp
toolkit/tdebuglistener.cpp
toolkit/tzlib.cpp
)
if(HAVE_ZLIB_SOURCE)
set(zlib_SRCS
${ZLIB_SOURCE}/adler32.c
${ZLIB_SOURCE}/crc32.c
${ZLIB_SOURCE}/inffast.c
${ZLIB_SOURCE}/inflate.c
${ZLIB_SOURCE}/inftrees.c
${ZLIB_SOURCE}/zutil.c
)
endif()
set(tag_LIB_SRCS
${mpeg_SRCS} ${id3v1_SRCS} ${id3v2_SRCS} ${frames_SRCS} ${ogg_SRCS}
${vorbis_SRCS} ${oggflacs_SRCS} ${mpc_SRCS} ${ape_SRCS} ${toolkit_SRCS} ${flacs_SRCS}
${wavpack_SRCS} ${speex_SRCS} ${trueaudio_SRCS} ${riff_SRCS} ${aiff_SRCS} ${wav_SRCS}
${asf_SRCS} ${mp4_SRCS} ${mod_SRCS} ${s3m_SRCS} ${it_SRCS} ${xm_SRCS} ${opus_SRCS}
${zlib_SRCS}
tag.cpp
tagunion.cpp
fileref.cpp
audioproperties.cpp
tagutils.cpp
)
add_library(tag ${tag_LIB_SRCS} ${tag_HDRS})
set_property(TARGET tag PROPERTY CXX_STANDARD 98)
if(HAVE_ZLIB AND NOT HAVE_ZLIB_SOURCE)
target_link_libraries(tag ${ZLIB_LIBRARIES})
endif()
set_target_properties(tag PROPERTIES
VERSION ${TAGLIB_SOVERSION_MAJOR}.${TAGLIB_SOVERSION_MINOR}.${TAGLIB_SOVERSION_PATCH}
SOVERSION ${TAGLIB_SOVERSION_MAJOR}
INSTALL_NAME_DIR ${LIB_INSTALL_DIR}
DEFINE_SYMBOL MAKE_TAGLIB_LIB
LINK_INTERFACE_LIBRARIES ""
PUBLIC_HEADER "${tag_HDRS}"
)
if(VISIBILITY_HIDDEN)
set_target_properties(tag PROPERTIES C_VISIBILITY_PRESET hidden)
endif()
if(BUILD_FRAMEWORK)
unset(INSTALL_NAME_DIR)
set_target_properties(tag PROPERTIES
FRAMEWORK TRUE
MACOSX_RPATH 1
VERSION "A"
SOVERSION "A"
)
endif()
install(TARGETS tag
FRAMEWORK DESTINATION ${FRAMEWORK_INSTALL_DIR}
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
RUNTIME DESTINATION ${BIN_INSTALL_DIR}
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
PUBLIC_HEADER DESTINATION ${INCLUDE_INSTALL_DIR}/taglib
)

View File

@@ -1,26 +0,0 @@
SUBDIRS = toolkit mpeg ogg flac ape mpc wavpack trueaudio
INCLUDES = \
-I$(top_srcdir)/taglib \
-I$(top_srcdir)/taglib/toolkit \
-I$(top_srcdir)/taglib/mpeg \
-I$(top_srcdir)/taglib/ogg \
-I$(top_srcdir)/taglib/ogg/flac \
-I$(top_srcdir)/taglib/flac \
-I$(top_srcdir)/taglib/mpc \
-I$(top_srcdir)/taglib/ogg/vorbis \
-I$(top_srcdir)/taglib/ogg/speex \
-I$(top_srcdir)/taglib/wavpack \
-I$(top_srcdir)/taglib/trueaudio \
$(all_includes)
lib_LTLIBRARIES = libtag.la
libtag_la_SOURCES = tag.cpp tagunion.cpp fileref.cpp audioproperties.cpp
taglib_include_HEADERS = tag.h fileref.h audioproperties.h taglib_export.h
taglib_includedir = $(includedir)/taglib
libtag_la_LDFLAGS = $(all_libraries) -no-undefined -version-info 6:0:5
libtag_la_LIBADD = ./mpeg/libmpeg.la ./ogg/libogg.la ./flac/libflac.la ./mpc/libmpc.la \
./ape/libape.la ./toolkit/libtoolkit.la ./wavpack/libwavpack.la \
./trueaudio/libtrueaudio.la

View File

@@ -1 +0,0 @@
INSTALL( FILES apetag.h apefooter.h apeitem.h DESTINATION ${INCLUDE_INSTALL_DIR}/taglib)

View File

@@ -1,11 +0,0 @@
INCLUDES = \
-I$(top_srcdir)/taglib \
-I$(top_srcdir)/taglib/toolkit \
$(all_includes)
noinst_LTLIBRARIES = libape.la
libape_la_SOURCES = apetag.cpp apefooter.cpp apeitem.cpp
taglib_include_HEADERS = apetag.h apefooter.h apeitem.h
taglib_includedir = $(includedir)/taglib

View File

@@ -49,8 +49,8 @@ APE Tag Version 2.000 (with header, recommended):
APE tag items should be sorted ascending by size. When streaming, parts of the
APE tag may be dropped to reduce the danger of drop outs between tracks. This
is not required, but is strongly recommended. It would be desirable for the i
tems to be sorted by importance / size, but this is not feasible. This
is not required, but is strongly recommended. It would be desirable for the
items to be sorted by importance / size, but this is not feasible. This
convention should only be broken when adding less important small items and it
is not desirable to rewrite the entire tag. An APE tag at the end of a file
(the recommended location) must have at least a footer; an APE tag at the

314
taglib/ape/apefile.cpp Normal file
View File

@@ -0,0 +1,314 @@
/***************************************************************************
copyright : (C) 2010 by Alex Novichkov
email : novichko@atnet.ru
copyright : (C) 2006 by Lukáš Lalinský
email : lalinsky@gmail.com
(original WavPack implementation)
copyright : (C) 2004 by Allan Sandfeld Jensen
email : kde@carewolf.org
(original MPC implementation)
***************************************************************************/
/***************************************************************************
* This library is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License version *
* 2.1 as published by the Free Software Foundation. *
* *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#include <tbytevector.h>
#include <tstring.h>
#include <tdebug.h>
#include <tagunion.h>
#include <id3v1tag.h>
#include <id3v2header.h>
#include <tpropertymap.h>
#include <tagutils.h>
#include "apefile.h"
#include "apetag.h"
#include "apefooter.h"
using namespace TagLib;
namespace
{
enum { ApeAPEIndex = 0, ApeID3v1Index = 1 };
}
class APE::File::FilePrivate
{
public:
FilePrivate() :
APELocation(-1),
APESize(0),
ID3v1Location(-1),
ID3v2Header(0),
ID3v2Location(-1),
ID3v2Size(0),
properties(0) {}
~FilePrivate()
{
delete ID3v2Header;
delete properties;
}
long APELocation;
long APESize;
long ID3v1Location;
ID3v2::Header *ID3v2Header;
long ID3v2Location;
long ID3v2Size;
TagUnion tag;
Properties *properties;
};
////////////////////////////////////////////////////////////////////////////////
// static members
////////////////////////////////////////////////////////////////////////////////
bool APE::File::isSupported(IOStream *stream)
{
// An APE file has an ID "MAC " somewhere. An ID3v2 tag may precede.
const ByteVector buffer = Utils::readHeader(stream, bufferSize(), true);
return (buffer.find("MAC ") >= 0);
}
////////////////////////////////////////////////////////////////////////////////
// public members
////////////////////////////////////////////////////////////////////////////////
APE::File::File(FileName file, bool readProperties, Properties::ReadStyle) :
TagLib::File(file),
d(new FilePrivate())
{
if(isOpen())
read(readProperties);
}
APE::File::File(IOStream *stream, bool readProperties, Properties::ReadStyle) :
TagLib::File(stream),
d(new FilePrivate())
{
if(isOpen())
read(readProperties);
}
APE::File::~File()
{
delete d;
}
TagLib::Tag *APE::File::tag() const
{
return &d->tag;
}
PropertyMap APE::File::properties() const
{
return d->tag.properties();
}
void APE::File::removeUnsupportedProperties(const StringList &properties)
{
d->tag.removeUnsupportedProperties(properties);
}
PropertyMap APE::File::setProperties(const PropertyMap &properties)
{
if(ID3v1Tag())
ID3v1Tag()->setProperties(properties);
return APETag(true)->setProperties(properties);
}
APE::Properties *APE::File::audioProperties() const
{
return d->properties;
}
bool APE::File::save()
{
if(readOnly()) {
debug("APE::File::save() -- File is read only.");
return false;
}
// Update ID3v1 tag
if(ID3v1Tag() && !ID3v1Tag()->isEmpty()) {
// ID3v1 tag is not empty. Update the old one or create a new one.
if(d->ID3v1Location >= 0) {
seek(d->ID3v1Location);
}
else {
seek(0, End);
d->ID3v1Location = tell();
}
writeBlock(ID3v1Tag()->render());
}
else {
// ID3v1 tag is empty. Remove the old one.
if(d->ID3v1Location >= 0) {
truncate(d->ID3v1Location);
d->ID3v1Location = -1;
}
}
// Update APE tag
if(APETag() && !APETag()->isEmpty()) {
// APE tag is not empty. Update the old one or create a new one.
if(d->APELocation < 0) {
if(d->ID3v1Location >= 0)
d->APELocation = d->ID3v1Location;
else
d->APELocation = length();
}
const ByteVector data = APETag()->render();
insert(data, d->APELocation, d->APESize);
if(d->ID3v1Location >= 0)
d->ID3v1Location += (static_cast<long>(data.size()) - d->APESize);
d->APESize = data.size();
}
else {
// APE tag is empty. Remove the old one.
if(d->APELocation >= 0) {
removeBlock(d->APELocation, d->APESize);
if(d->ID3v1Location >= 0)
d->ID3v1Location -= d->APESize;
d->APELocation = -1;
d->APESize = 0;
}
}
return true;
}
ID3v1::Tag *APE::File::ID3v1Tag(bool create)
{
return d->tag.access<ID3v1::Tag>(ApeID3v1Index, create);
}
APE::Tag *APE::File::APETag(bool create)
{
return d->tag.access<APE::Tag>(ApeAPEIndex, create);
}
void APE::File::strip(int tags)
{
if(tags & ID3v1)
d->tag.set(ApeID3v1Index, 0);
if(tags & APE)
d->tag.set(ApeAPEIndex, 0);
if(!ID3v1Tag())
APETag(true);
}
bool APE::File::hasAPETag() const
{
return (d->APELocation >= 0);
}
bool APE::File::hasID3v1Tag() const
{
return (d->ID3v1Location >= 0);
}
////////////////////////////////////////////////////////////////////////////////
// private members
////////////////////////////////////////////////////////////////////////////////
void APE::File::read(bool readProperties)
{
// Look for an ID3v2 tag
d->ID3v2Location = Utils::findID3v2(this);
if(d->ID3v2Location >= 0) {
seek(d->ID3v2Location);
d->ID3v2Header = new ID3v2::Header(readBlock(ID3v2::Header::size()));
d->ID3v2Size = d->ID3v2Header->completeTagSize();
}
// Look for an ID3v1 tag
d->ID3v1Location = Utils::findID3v1(this);
if(d->ID3v1Location >= 0)
d->tag.set(ApeID3v1Index, new ID3v1::Tag(this, d->ID3v1Location));
// Look for an APE tag
d->APELocation = Utils::findAPE(this, d->ID3v1Location);
if(d->APELocation >= 0) {
d->tag.set(ApeAPEIndex, new APE::Tag(this, d->APELocation));
d->APESize = APETag()->footer()->completeTagSize();
d->APELocation = d->APELocation + APE::Footer::size() - d->APESize;
}
if(d->ID3v1Location < 0)
APETag(true);
// Look for APE audio properties
if(readProperties) {
long streamLength;
if(d->APELocation >= 0)
streamLength = d->APELocation;
else if(d->ID3v1Location >= 0)
streamLength = d->ID3v1Location;
else
streamLength = length();
if(d->ID3v2Location >= 0) {
seek(d->ID3v2Location + d->ID3v2Size);
streamLength -= (d->ID3v2Location + d->ID3v2Size);
}
else {
seek(0);
}
d->properties = new Properties(this, streamLength);
}
}

235
taglib/ape/apefile.h Normal file
View File

@@ -0,0 +1,235 @@
/***************************************************************************
copyright : (C) 2010 by Alex Novichkov
email : novichko@atnet.ru
copyright : (C) 2006 by Lukáš Lalinský
email : lalinsky@gmail.com
(original WavPack implementation)
copyright : (C) 2004 by Allan Sandfeld Jensen
email : kde@carewolf.org
(original MPC implementation)
***************************************************************************/
/***************************************************************************
* This library is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License version *
* 2.1 as published by the Free Software Foundation. *
* *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#ifndef TAGLIB_APEFILE_H
#define TAGLIB_APEFILE_H
#include "tfile.h"
#include "taglib_export.h"
#include "apeproperties.h"
namespace TagLib {
class Tag;
namespace ID3v1 { class Tag; }
namespace APE { class Tag; }
//! An implementation of APE metadata
/*!
* This is implementation of APE metadata.
*
* This supports ID3v1 and APE (v1 and v2) style comments as well as reading stream
* properties from the file.
*/
namespace APE {
//! An implementation of TagLib::File with APE specific methods
/*!
* This implements and provides an interface for APE files to the
* TagLib::Tag and TagLib::AudioProperties interfaces by way of implementing
* the abstract TagLib::File API as well as providing some additional
* information specific to APE files.
*/
class TAGLIB_EXPORT File : public TagLib::File
{
public:
/*!
* This set of flags is used for various operations and is suitable for
* being OR-ed together.
*/
enum TagTypes {
//! Empty set. Matches no tag types.
NoTags = 0x0000,
//! Matches ID3v1 tags.
ID3v1 = 0x0001,
//! Matches APE tags.
APE = 0x0002,
//! Matches all tag types.
AllTags = 0xffff
};
/*!
* Constructs an APE file from \a file. If \a readProperties is true the
* file's audio properties will also be read.
*
* \note In the current implementation, \a propertiesStyle is ignored.
*/
File(FileName file, bool readProperties = true,
Properties::ReadStyle propertiesStyle = Properties::Average);
/*!
* Constructs an APE file from \a stream. If \a readProperties is true the
* file's audio properties will also be read.
*
* \note TagLib will *not* take ownership of the stream, the caller is
* responsible for deleting it after the File object.
*
* \note In the current implementation, \a propertiesStyle is ignored.
*/
File(IOStream *stream, bool readProperties = true,
Properties::ReadStyle propertiesStyle = Properties::Average);
/*!
* Destroys this instance of the File.
*/
virtual ~File();
/*!
* Returns the Tag for this file. This will be an APE tag, an ID3v1 tag
* or a combination of the two.
*/
virtual TagLib::Tag *tag() const;
/*!
* Implements the unified property interface -- export function.
* If the file contains both an APE and an ID3v1 tag, only APE
* will be converted to the PropertyMap.
*/
PropertyMap properties() const;
/*!
* Removes unsupported properties. Forwards to the actual Tag's
* removeUnsupportedProperties() function.
*/
void removeUnsupportedProperties(const StringList &properties);
/*!
* Implements the unified property interface -- import function.
* Creates an APEv2 tag if necessary. A potentially existing ID3v1
* tag will be updated as well.
*/
PropertyMap setProperties(const PropertyMap &);
/*!
* Returns the APE::Properties for this file. If no audio properties
* were read then this will return a null pointer.
*/
virtual Properties *audioProperties() const;
/*!
* Saves the file.
*
* \note According to the official Monkey's Audio SDK, an APE file
* can only have either ID3V1 or APE tags, so a parameter is used here.
*/
virtual bool save();
/*!
* Returns a pointer to the ID3v1 tag of the file.
*
* If \a create is false (the default) this may return a null pointer
* if there is no valid ID3v1 tag. If \a create is true it will create
* an ID3v1 tag if one does not exist and returns a valid pointer.
*
* \note This may return a valid pointer regardless of whether or not the
* file on disk has an ID3v1 tag. Use hasID3v1Tag() to check if the file
* on disk actually has an ID3v1 tag.
*
* \note The Tag <b>is still</b> owned by the MPEG::File and should not be
* deleted by the user. It will be deleted when the file (object) is
* destroyed.
*
* \see hasID3v1Tag()
*/
ID3v1::Tag *ID3v1Tag(bool create = false);
/*!
* Returns a pointer to the APE tag of the file.
*
* If \a create is false (the default) this may return a null pointer
* if there is no valid APE tag. If \a create is true it will create
* an APE tag if one does not exist and returns a valid pointer.
*
* \note This may return a valid pointer regardless of whether or not the
* file on disk has an APE tag. Use hasAPETag() to check if the file
* on disk actually has an APE tag.
*
* \note The Tag <b>is still</b> owned by the MPEG::File and should not be
* deleted by the user. It will be deleted when the file (object) is
* destroyed.
*
* \see hasAPETag()
*/
APE::Tag *APETag(bool create = false);
/*!
* This will remove the tags that match the OR-ed together TagTypes from the
* file. By default it removes all tags.
*
* \note This will also invalidate pointers to the tags
* as their memory will be freed.
* \note In order to make the removal permanent save() still needs to be called
*/
void strip(int tags = AllTags);
/*!
* Returns whether or not the file on disk actually has an APE tag.
*
* \see APETag()
*/
bool hasAPETag() const;
/*!
* Returns whether or not the file on disk actually has an ID3v1 tag.
*
* \see ID3v1Tag()
*/
bool hasID3v1Tag() const;
/*!
* Returns whether or not the given \a stream can be opened as an APE
* file.
*
* \note This method is designed to do a quick check. The result may
* not necessarily be correct.
*/
static bool isSupported(IOStream *stream);
private:
File(const File &);
File &operator=(const File &);
void read(bool readProperties);
class FilePrivate;
FilePrivate *d;
};
}
}
#endif

View File

@@ -16,8 +16,8 @@
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
* USA *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
@@ -35,132 +35,130 @@
using namespace TagLib;
using namespace APE;
class Footer::FooterPrivate
class APE::Footer::FooterPrivate
{
public:
FooterPrivate() : version(0),
footerPresent(true),
headerPresent(false),
isHeader(false),
itemCount(0),
tagSize(0) {}
FooterPrivate() :
version(0),
footerPresent(true),
headerPresent(false),
isHeader(false),
itemCount(0),
tagSize(0) {}
~FooterPrivate() {}
uint version;
unsigned int version;
bool footerPresent;
bool headerPresent;
bool isHeader;
uint itemCount;
uint tagSize;
static const uint size = 32;
unsigned int itemCount;
unsigned int tagSize;
};
////////////////////////////////////////////////////////////////////////////////
// static members
////////////////////////////////////////////////////////////////////////////////
TagLib::uint Footer::size()
unsigned int APE::Footer::size()
{
return FooterPrivate::size;
return 32;
}
ByteVector Footer::fileIdentifier()
ByteVector APE::Footer::fileIdentifier()
{
return ByteVector::fromCString("APETAGEX");
return ByteVector("APETAGEX");
}
////////////////////////////////////////////////////////////////////////////////
// public members
////////////////////////////////////////////////////////////////////////////////
Footer::Footer()
APE::Footer::Footer() :
d(new FooterPrivate())
{
d = new FooterPrivate;
}
Footer::Footer(const ByteVector &data)
APE::Footer::Footer(const ByteVector &data) :
d(new FooterPrivate())
{
d = new FooterPrivate;
parse(data);
}
Footer::~Footer()
APE::Footer::~Footer()
{
delete d;
}
TagLib::uint Footer::version() const
unsigned int APE::Footer::version() const
{
return d->version;
}
bool Footer::headerPresent() const
bool APE::Footer::headerPresent() const
{
return d->headerPresent;
}
bool Footer::footerPresent() const
bool APE::Footer::footerPresent() const
{
return d->footerPresent;
}
bool Footer::isHeader() const
bool APE::Footer::isHeader() const
{
return d->isHeader;
}
void Footer::setHeaderPresent(bool b) const
void APE::Footer::setHeaderPresent(bool b) const
{
d->headerPresent = b;
}
TagLib::uint Footer::itemCount() const
unsigned int APE::Footer::itemCount() const
{
return d->itemCount;
}
void Footer::setItemCount(uint s)
void APE::Footer::setItemCount(unsigned int s)
{
d->itemCount = s;
}
TagLib::uint Footer::tagSize() const
unsigned int APE::Footer::tagSize() const
{
return d->tagSize;
}
TagLib::uint Footer::completeTagSize() const
unsigned int APE::Footer::completeTagSize() const
{
if(d->headerPresent)
return d->tagSize + d->size;
return d->tagSize + size();
else
return d->tagSize;
}
void Footer::setTagSize(uint s)
void APE::Footer::setTagSize(unsigned int s)
{
d->tagSize = s;
}
void Footer::setData(const ByteVector &data)
void APE::Footer::setData(const ByteVector &data)
{
parse(data);
}
ByteVector Footer::renderFooter() const
ByteVector APE::Footer::renderFooter() const
{
return render(false);
return render(false);
}
ByteVector Footer::renderHeader() const
ByteVector APE::Footer::renderHeader() const
{
if (!d->headerPresent) return ByteVector();
if(!d->headerPresent)
return ByteVector();
else
return render(true);
}
@@ -168,7 +166,7 @@ ByteVector Footer::renderHeader() const
// protected members
////////////////////////////////////////////////////////////////////////////////
void Footer::parse(const ByteVector &data)
void APE::Footer::parse(const ByteVector &data)
{
if(data.size() < size())
return;
@@ -177,19 +175,19 @@ void Footer::parse(const ByteVector &data)
// Read the version number
d->version = data.mid(8, 4).toUInt(false);
d->version = data.toUInt(8, false);
// Read the tag size
d->tagSize = data.mid(12, 4).toUInt(false);
d->tagSize = data.toUInt(12, false);
// Read the item count
d->itemCount = data.mid(16, 4).toUInt(false);
d->itemCount = data.toUInt(16, false);
// Read the flags
std::bitset<32> flags(data.mid(20, 4).toUInt(false));
std::bitset<32> flags(TAGLIB_CONSTRUCT_BITSET(data.toUInt(20, false)));
d->headerPresent = flags[31];
d->footerPresent = !flags[30];
@@ -197,7 +195,7 @@ void Footer::parse(const ByteVector &data)
}
ByteVector Footer::render(bool isHeader) const
ByteVector APE::Footer::render(bool isHeader) const
{
ByteVector v;

View File

@@ -15,8 +15,8 @@
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
* USA *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
@@ -37,7 +37,7 @@ namespace TagLib {
/*!
* This class implements APE footers (and headers). It attempts to follow, both
* semantically and programatically, the structure specified in
* semantically and programmatically, the structure specified in
* the APE v2.0 standard. The API is based on the properties of APE footer and
* headers specified there.
*/
@@ -64,7 +64,7 @@ namespace TagLib {
/*!
* Returns the version number. (Note: This is the 1000 or 2000.)
*/
uint version() const;
unsigned int version() const;
/*!
* Returns true if a header is present in the tag.
@@ -89,13 +89,13 @@ namespace TagLib {
/*!
* Returns the number of items in the tag.
*/
uint itemCount() const;
unsigned int itemCount() const;
/*!
* Set the item count to \a s.
* \see itemCount()
*/
void setItemCount(uint s);
void setItemCount(unsigned int s);
/*!
* Returns the tag size in bytes. This is the size of the frame content and footer.
@@ -103,7 +103,7 @@ namespace TagLib {
*
* \see completeTagSize()
*/
uint tagSize() const;
unsigned int tagSize() const;
/*!
* Returns the tag size, including if present, the header
@@ -111,18 +111,18 @@ namespace TagLib {
*
* \see tagSize()
*/
uint completeTagSize() const;
unsigned int completeTagSize() const;
/*!
* Set the tag size to \a s.
* \see tagSize()
*/
void setTagSize(uint s);
void setTagSize(unsigned int s);
/*!
* Returns the size of the footer. Presently this is always 32 bytes.
*/
static uint size();
static unsigned int size();
/*!
* Returns the string used to identify an APE tag inside of a file.

View File

@@ -15,8 +15,8 @@
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
* USA *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
@@ -34,7 +34,9 @@ using namespace APE;
class APE::Item::ItemPrivate
{
public:
ItemPrivate() : type(Text), readOnly(false) {}
ItemPrivate() :
type(Text),
readOnly(false) {}
Item::ItemTypes type;
String key;
@@ -43,28 +45,45 @@ public:
bool readOnly;
};
APE::Item::Item()
////////////////////////////////////////////////////////////////////////////////
// public members
////////////////////////////////////////////////////////////////////////////////
APE::Item::Item() :
d(new ItemPrivate())
{
d = new ItemPrivate;
}
APE::Item::Item(const String &key, const String &value)
APE::Item::Item(const String &key, const String &value) :
d(new ItemPrivate())
{
d = new ItemPrivate;
d->key = key;
d->text.append(value);
}
APE::Item::Item(const String &key, const StringList &values)
APE::Item::Item(const String &key, const StringList &values) :
d(new ItemPrivate())
{
d = new ItemPrivate;
d->key = key;
d->text = values;
}
APE::Item::Item(const Item &item)
APE::Item::Item(const String &key, const ByteVector &value, bool binary) :
d(new ItemPrivate())
{
d->key = key;
if(binary) {
d->type = Binary;
d->value = value;
}
else {
d->text.append(value);
}
}
APE::Item::Item(const Item &item) :
d(new ItemPrivate(*item.d))
{
d = new ItemPrivate(*item.d);
}
APE::Item::~Item()
@@ -74,11 +93,17 @@ APE::Item::~Item()
Item &APE::Item::operator=(const Item &item)
{
delete d;
d = new ItemPrivate(*item.d);
Item(item).swap(*this);
return *this;
}
void APE::Item::swap(Item &item)
{
using std::swap;
swap(d, item.d);
}
void APE::Item::setReadOnly(bool readOnly)
{
d->readOnly = readOnly;
@@ -104,6 +129,18 @@ String APE::Item::key() const
return d->key;
}
ByteVector APE::Item::binaryData() const
{
return d->value;
}
void APE::Item::setBinaryData(const ByteVector &value)
{
d->type = Binary;
d->value = value;
d->text.clear();
}
ByteVector APE::Item::value() const
{
// This seems incorrect as it won't be actually rendering the value to keep it
@@ -114,32 +151,58 @@ ByteVector APE::Item::value() const
void APE::Item::setKey(const String &key)
{
d->key = key;
d->key = key;
}
void APE::Item::setValue(const String &value)
{
d->text = value;
d->type = Text;
d->text = value;
d->value.clear();
}
void APE::Item::setValues(const StringList &value)
{
d->text = value;
d->type = Text;
d->text = value;
d->value.clear();
}
void APE::Item::appendValue(const String &value)
{
d->text.append(value);
d->type = Text;
d->text.append(value);
d->value.clear();
}
void APE::Item::appendValues(const StringList &values)
{
d->text.append(values);
d->type = Text;
d->text.append(values);
d->value.clear();
}
int APE::Item::size() const
{
return 8 + d->key.size() + 1 + d->value.size();
int result = 8 + d->key.size() + 1;
switch(d->type) {
case Text:
if(!d->text.isEmpty()) {
StringList::ConstIterator it = d->text.begin();
result += it->data(String::UTF8).size();
it++;
for(; it != d->text.end(); ++it)
result += 1 + it->data(String::UTF8).size();
}
break;
case Binary:
case Locator:
result += d->value.size();
break;
}
return result;
}
StringList APE::Item::toStringList() const
@@ -154,20 +217,23 @@ StringList APE::Item::values() const
String APE::Item::toString() const
{
return isEmpty() ? String::null : d->text.front();
if(d->type == Text && !isEmpty())
return d->text.front();
else
return String();
}
bool APE::Item::isEmpty() const
{
switch(d->type) {
case 0:
case 1:
case Text:
if(d->text.isEmpty())
return true;
if(d->text.size() == 1 && d->text.front().isEmpty())
return true;
return false;
case 2:
case Binary:
case Locator:
return d->value.isEmpty();
default:
return false;
@@ -183,31 +249,37 @@ void APE::Item::parse(const ByteVector &data)
return;
}
uint valueLength = data.mid(0, 4).toUInt(false);
uint flags = data.mid(4, 4).toUInt(false);
const unsigned int valueLength = data.toUInt(0, false);
const unsigned int flags = data.toUInt(4, false);
d->key = String(data.mid(8), String::UTF8);
// An item key can contain ASCII characters from 0x20 up to 0x7E, not UTF-8.
// We assume that the validity of the given key has been checked.
d->value = data.mid(8 + d->key.size() + 1, valueLength);
d->key = String(&data[8], String::Latin1);
const ByteVector value = data.mid(8 + d->key.size() + 1, valueLength);
setReadOnly(flags & 1);
setType(ItemTypes((flags >> 1) & 3));
if(int(d->type) < 2)
d->text = StringList(ByteVectorList::split(d->value, '\0'), String::UTF8);
if(Text == d->type)
d->text = StringList(ByteVectorList::split(value, '\0'), String::UTF8);
else
d->value = value;
}
ByteVector APE::Item::render() const
{
ByteVector data;
TagLib::uint flags = ((d->readOnly) ? 1 : 0) | (d->type << 1);
unsigned int flags = ((d->readOnly) ? 1 : 0) | (d->type << 1);
ByteVector value;
if(isEmpty())
return data;
if(d->type != Item::Binary) {
if(d->type == Text) {
StringList::ConstIterator it = d->text.begin();
value.append(it->data(String::UTF8));
it++;
for(; it != d->text.end(); ++it) {
@@ -221,7 +293,7 @@ ByteVector APE::Item::render() const
data.append(ByteVector::fromUInt(value.size(), false));
data.append(ByteVector::fromUInt(flags, false));
data.append(d->key.data(String::UTF8));
data.append(d->key.data(String::Latin1));
data.append(ByteVector('\0'));
data.append(value);

View File

@@ -15,8 +15,8 @@
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
* USA *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
@@ -59,16 +59,22 @@ namespace TagLib {
Item();
/*!
* Constructs an item with \a key and \a value.
* Constructs a text item with \a key and \a value.
*/
// BIC: Remove this, StringList has a constructor from a single string
Item(const String &key, const String &value);
/*!
* Constructs an item with \a key and \a values.
* Constructs a text item with \a key and \a values.
*/
Item(const String &key, const StringList &values);
/*!
* Constructs an item with \a key and \a value.
* If \a binary is true a Binary item will be created, otherwise \a value will be interpreted as text
*/
Item(const String &key, const ByteVector &value, bool binary);
/*!
* Construct an item as a copy of \a item.
*/
@@ -84,6 +90,11 @@ namespace TagLib {
*/
Item &operator=(const Item &item);
/*!
* Exchanges the content of this item by the content of \a item.
*/
void swap(Item &item);
/*!
* Returns the key.
*/
@@ -91,12 +102,20 @@ namespace TagLib {
/*!
* Returns the binary value.
*
* \deprecated This will be removed in the next binary incompatible version
* as it is not kept in sync with the things that are set using setValue()
* and friends.
* If the item type is not \a Binary, always returns an empty ByteVector.
*/
ByteVector binaryData() const;
/*!
* Set the binary value to \a value
* The item's type will also be set to \a Binary
*/
void setBinaryData(const ByteVector &value);
#ifndef DO_NOT_DOCUMENT
/* Remove in next binary incompatible release */
ByteVector value() const;
#endif
/*!
* Sets the key for the item to \a key.
@@ -104,14 +123,14 @@ namespace TagLib {
void setKey(const String &key);
/*!
* Sets the value of the item to \a value and clears any previous contents.
* Sets the text value of the item to \a value and clears any previous contents.
*
* \see toString()
*/
void setValue(const String &value);
/*!
* Sets the value of the item to the list of values in \a value and clears
* Sets the text value of the item to the list of values in \a value and clears
* any previous contents.
*
* \see toStringList()
@@ -119,14 +138,14 @@ namespace TagLib {
void setValues(const StringList &values);
/*!
* Appends \a value to create (or extend) the current list of values.
* Appends \a value to create (or extend) the current list of text values.
*
* \see toString()
*/
void appendValue(const String &value);
/*!
* Appends \a values to extend the current list of values.
* Appends \a values to extend the current list of text values.
*
* \see toStringList()
*/
@@ -138,19 +157,20 @@ namespace TagLib {
int size() const;
/*!
* Returns the value as a single string. In case of multiple strings,
* the first is returned.
* Returns the value as a single string. In case of multiple strings,
* the first is returned. If the data type is not \a Text, always returns
* an empty String.
*/
String toString() const;
/*!
* \deprecated
* \see values
*/
#ifndef DO_NOT_DOCUMENT
/* Remove in next binary incompatible release */
StringList toStringList() const;
#endif
/*!
* Returns the list of values.
* Returns the list of text values. If the data type is not \a Text, always
* returns an empty StringList.
*/
StringList values() const;

View File

@@ -0,0 +1,252 @@
/***************************************************************************
copyright : (C) 2010 by Alex Novichkov
email : novichko@atnet.ru
copyright : (C) 2006 by Lukáš Lalinský
email : lalinsky@gmail.com
(original WavPack implementation)
***************************************************************************/
/***************************************************************************
* This library is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License version *
* 2.1 as published by the Free Software Foundation. *
* *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#include <tstring.h>
#include <tdebug.h>
#include <bitset>
#include "id3v2tag.h"
#include "apeproperties.h"
#include "apefile.h"
#include "apetag.h"
#include "apefooter.h"
using namespace TagLib;
class APE::Properties::PropertiesPrivate
{
public:
PropertiesPrivate() :
length(0),
bitrate(0),
sampleRate(0),
channels(0),
version(0),
bitsPerSample(0),
sampleFrames(0) {}
int length;
int bitrate;
int sampleRate;
int channels;
int version;
int bitsPerSample;
unsigned int sampleFrames;
};
////////////////////////////////////////////////////////////////////////////////
// public members
////////////////////////////////////////////////////////////////////////////////
APE::Properties::Properties(File *, ReadStyle style) :
AudioProperties(style),
d(new PropertiesPrivate())
{
debug("APE::Properties::Properties() -- This constructor is no longer used.");
}
APE::Properties::Properties(File *file, long streamLength, ReadStyle style) :
AudioProperties(style),
d(new PropertiesPrivate())
{
read(file, streamLength);
}
APE::Properties::~Properties()
{
delete d;
}
int APE::Properties::length() const
{
return lengthInSeconds();
}
int APE::Properties::lengthInSeconds() const
{
return d->length / 1000;
}
int APE::Properties::lengthInMilliseconds() const
{
return d->length;
}
int APE::Properties::bitrate() const
{
return d->bitrate;
}
int APE::Properties::sampleRate() const
{
return d->sampleRate;
}
int APE::Properties::channels() const
{
return d->channels;
}
int APE::Properties::version() const
{
return d->version;
}
int APE::Properties::bitsPerSample() const
{
return d->bitsPerSample;
}
unsigned int APE::Properties::sampleFrames() const
{
return d->sampleFrames;
}
////////////////////////////////////////////////////////////////////////////////
// private members
////////////////////////////////////////////////////////////////////////////////
namespace
{
int headerVersion(const ByteVector &header)
{
if(header.size() < 6 || !header.startsWith("MAC "))
return -1;
return header.toUShort(4, false);
}
}
void APE::Properties::read(File *file, long streamLength)
{
// First, we assume that the file pointer is set at the first descriptor.
long offset = file->tell();
int version = headerVersion(file->readBlock(6));
// Next, we look for the descriptor.
if(version < 0) {
offset = file->find("MAC ", offset);
file->seek(offset);
version = headerVersion(file->readBlock(6));
}
if(version < 0) {
debug("APE::Properties::read() -- APE descriptor not found");
return;
}
d->version = version;
if(d->version >= 3980)
analyzeCurrent(file);
else
analyzeOld(file);
if(d->sampleFrames > 0 && d->sampleRate > 0) {
const double length = d->sampleFrames * 1000.0 / d->sampleRate;
d->length = static_cast<int>(length + 0.5);
d->bitrate = static_cast<int>(streamLength * 8.0 / length + 0.5);
}
}
void APE::Properties::analyzeCurrent(File *file)
{
// Read the descriptor
file->seek(2, File::Current);
const ByteVector descriptor = file->readBlock(44);
if(descriptor.size() < 44) {
debug("APE::Properties::analyzeCurrent() -- descriptor is too short.");
return;
}
const unsigned int descriptorBytes = descriptor.toUInt(0, false);
if((descriptorBytes - 52) > 0)
file->seek(descriptorBytes - 52, File::Current);
// Read the header
const ByteVector header = file->readBlock(24);
if(header.size() < 24) {
debug("APE::Properties::analyzeCurrent() -- MAC header is too short.");
return;
}
// Get the APE info
d->channels = header.toShort(18, false);
d->sampleRate = header.toUInt(20, false);
d->bitsPerSample = header.toShort(16, false);
const unsigned int totalFrames = header.toUInt(12, false);
if(totalFrames == 0)
return;
const unsigned int blocksPerFrame = header.toUInt(4, false);
const unsigned int finalFrameBlocks = header.toUInt(8, false);
d->sampleFrames = (totalFrames - 1) * blocksPerFrame + finalFrameBlocks;
}
void APE::Properties::analyzeOld(File *file)
{
const ByteVector header = file->readBlock(26);
if(header.size() < 26) {
debug("APE::Properties::analyzeOld() -- MAC header is too short.");
return;
}
const unsigned int totalFrames = header.toUInt(18, false);
// Fail on 0 length APE files (catches non-finalized APE files)
if(totalFrames == 0)
return;
const short compressionLevel = header.toShort(0, false);
unsigned int blocksPerFrame;
if(d->version >= 3950)
blocksPerFrame = 73728 * 4;
else if(d->version >= 3900 || (d->version >= 3800 && compressionLevel == 4000))
blocksPerFrame = 73728;
else
blocksPerFrame = 9216;
// Get the APE info
d->channels = header.toShort(4, false);
d->sampleRate = header.toUInt(6, false);
const unsigned int finalFrameBlocks = header.toUInt(22, false);
d->sampleFrames = (totalFrames - 1) * blocksPerFrame + finalFrameBlocks;
// Get the bit depth from the RIFF-fmt chunk.
file->seek(16, File::Current);
const ByteVector fmt = file->readBlock(28);
if(fmt.size() < 28 || !fmt.startsWith("WAVEfmt ")) {
debug("APE::Properties::analyzeOld() -- fmt header is too short.");
return;
}
d->bitsPerSample = fmt.toShort(26, false);
}

143
taglib/ape/apeproperties.h Normal file
View File

@@ -0,0 +1,143 @@
/***************************************************************************
copyright : (C) 2010 by Alex Novichkov
email : novichko@atnet.ru
copyright : (C) 2006 by Lukáš Lalinský
email : lalinsky@gmail.com
(original WavPack implementation)
***************************************************************************/
/***************************************************************************
* This library is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License version *
* 2.1 as published by the Free Software Foundation. *
* *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#ifndef TAGLIB_APEPROPERTIES_H
#define TAGLIB_APEPROPERTIES_H
#include "taglib_export.h"
#include "audioproperties.h"
namespace TagLib {
namespace APE {
class File;
//! An implementation of audio property reading for APE
/*!
* This reads the data from an APE stream found in the AudioProperties
* API.
*/
class TAGLIB_EXPORT Properties : public AudioProperties
{
public:
/*!
* Create an instance of APE::Properties with the data read from the
* APE::File \a file.
*
* \deprecated
*/
TAGLIB_DEPRECATED Properties(File *file, ReadStyle style = Average);
/*!
* Create an instance of APE::Properties with the data read from the
* APE::File \a file.
*/
Properties(File *file, long streamLength, ReadStyle style = Average);
/*!
* Destroys this APE::Properties instance.
*/
virtual ~Properties();
/*!
* Returns the length of the file in seconds. The length is rounded down to
* the nearest whole second.
*
* \note This method is just an alias of lengthInSeconds().
*
* \deprecated
*/
TAGLIB_DEPRECATED virtual int length() const;
/*!
* Returns the length of the file in seconds. The length is rounded down to
* the nearest whole second.
*
* \see lengthInMilliseconds()
*/
// BIC: make virtual
int lengthInSeconds() const;
/*!
* Returns the length of the file in milliseconds.
*
* \see lengthInSeconds()
*/
// BIC: make virtual
int lengthInMilliseconds() const;
/*!
* Returns the average bit rate of the file in kb/s.
*/
virtual int bitrate() const;
/*!
* Returns the sample rate in Hz.
*/
virtual int sampleRate() const;
/*!
* Returns the number of audio channels.
*/
virtual int channels() const;
/*!
* Returns the number of bits per audio sample.
*/
int bitsPerSample() const;
/*!
* Returns the total number of audio samples in file.
*/
unsigned int sampleFrames() const;
/*!
* Returns APE version.
*/
int version() const;
private:
Properties(const Properties &);
Properties &operator=(const Properties &);
void read(File *file, long streamLength);
void analyzeCurrent(File *file);
void analyzeOld(File *file);
class PropertiesPrivate;
PropertiesPrivate *d;
};
}
}
#endif

View File

@@ -15,15 +15,15 @@
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
* USA *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#ifdef __SUNPRO_CC
#if defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x5130)
// Sun Studio finds multiple specializations of Map because
// it considers specializations with and without class types
// to be different; this define forces Map to use only the
@@ -34,6 +34,9 @@
#include <tfile.h>
#include <tstring.h>
#include <tmap.h>
#include <tpropertymap.h>
#include <tdebug.h>
#include <tutils.h>
#include "apetag.h"
#include "apefooter.h"
@@ -42,17 +45,44 @@
using namespace TagLib;
using namespace APE;
namespace
{
const unsigned int MinKeyLength = 2;
const unsigned int MaxKeyLength = 255;
bool isKeyValid(const ByteVector &key)
{
const char *invalidKeys[] = { "ID3", "TAG", "OGGS", "MP+", 0 };
// only allow printable ASCII including space (32..126)
for(ByteVector::ConstIterator it = key.begin(); it != key.end(); ++it) {
const int c = static_cast<unsigned char>(*it);
if(c < 32 || c > 126)
return false;
}
const String upperKey = String(key).upper();
for(size_t i = 0; invalidKeys[i] != 0; ++i) {
if(upperKey == invalidKeys[i])
return false;
}
return true;
}
}
class APE::Tag::TagPrivate
{
public:
TagPrivate() : file(0), footerLocation(-1), tagLength(0) {}
TagPrivate() :
file(0),
footerLocation(0) {}
File *file;
long footerLocation;
long tagLength;
Footer footer;
ItemListMap itemListMap;
};
@@ -60,14 +90,16 @@ public:
// public methods
////////////////////////////////////////////////////////////////////////////////
APE::Tag::Tag() : TagLib::Tag()
APE::Tag::Tag() :
TagLib::Tag(),
d(new TagPrivate())
{
d = new TagPrivate;
}
APE::Tag::Tag(File *file, long footerLocation) : TagLib::Tag()
APE::Tag::Tag(TagLib::File *file, long footerLocation) :
TagLib::Tag(),
d(new TagPrivate())
{
d = new TagPrivate;
d->file = file;
d->footerLocation = footerLocation;
@@ -87,46 +119,46 @@ ByteVector APE::Tag::fileIdentifier()
String APE::Tag::title() const
{
if(d->itemListMap["TITLE"].isEmpty())
return String::null;
return d->itemListMap["TITLE"].toString();
return String();
return d->itemListMap["TITLE"].values().toString();
}
String APE::Tag::artist() const
{
if(d->itemListMap["ARTIST"].isEmpty())
return String::null;
return d->itemListMap["ARTIST"].toString();
return String();
return d->itemListMap["ARTIST"].values().toString();
}
String APE::Tag::album() const
{
if(d->itemListMap["ALBUM"].isEmpty())
return String::null;
return d->itemListMap["ALBUM"].toString();
return String();
return d->itemListMap["ALBUM"].values().toString();
}
String APE::Tag::comment() const
{
if(d->itemListMap["COMMENT"].isEmpty())
return String::null;
return d->itemListMap["COMMENT"].toString();
return String();
return d->itemListMap["COMMENT"].values().toString();
}
String APE::Tag::genre() const
{
if(d->itemListMap["GENRE"].isEmpty())
return String::null;
return d->itemListMap["GENRE"].toString();
return String();
return d->itemListMap["GENRE"].values().toString();
}
TagLib::uint APE::Tag::year() const
unsigned int APE::Tag::year() const
{
if(d->itemListMap["YEAR"].isEmpty())
return 0;
return d->itemListMap["YEAR"].toString().toInt();
}
TagLib::uint APE::Tag::track() const
unsigned int APE::Tag::track() const
{
if(d->itemListMap["TRACK"].isEmpty())
return 0;
@@ -158,22 +190,121 @@ void APE::Tag::setGenre(const String &s)
addValue("GENRE", s, true);
}
void APE::Tag::setYear(uint i)
void APE::Tag::setYear(unsigned int i)
{
if(i <= 0)
if(i == 0)
removeItem("YEAR");
else
addValue("YEAR", String::number(i), true);
}
void APE::Tag::setTrack(uint i)
void APE::Tag::setTrack(unsigned int i)
{
if(i <= 0)
if(i == 0)
removeItem("TRACK");
else
addValue("TRACK", String::number(i), true);
}
namespace
{
// conversions of tag keys between what we use in PropertyMap and what's usual
// for APE tags
// usual, APE
const char *keyConversions[][2] = {{"TRACKNUMBER", "TRACK" },
{"DATE", "YEAR" },
{"ALBUMARTIST", "ALBUM ARTIST"},
{"DISCNUMBER", "DISC" },
{"REMIXER", "MIXARTIST" },
{"RELEASESTATUS", "MUSICBRAINZ_ALBUMSTATUS" },
{"RELEASETYPE", "MUSICBRAINZ_ALBUMTYPE" }};
const size_t keyConversionsSize = sizeof(keyConversions) / sizeof(keyConversions[0]);
}
PropertyMap APE::Tag::properties() const
{
PropertyMap properties;
ItemListMap::ConstIterator it = itemListMap().begin();
for(; it != itemListMap().end(); ++it) {
String tagName = it->first.upper();
// if the item is Binary or Locator, or if the key is an invalid string,
// add to unsupportedData
if(it->second.type() != Item::Text || tagName.isEmpty()) {
properties.unsupportedData().append(it->first);
}
else {
// Some tags need to be handled specially
for(size_t i = 0; i < keyConversionsSize; ++i) {
if(tagName == keyConversions[i][1])
tagName = keyConversions[i][0];
}
properties[tagName].append(it->second.toStringList());
}
}
return properties;
}
void APE::Tag::removeUnsupportedProperties(const StringList &properties)
{
StringList::ConstIterator it = properties.begin();
for(; it != properties.end(); ++it)
removeItem(*it);
}
PropertyMap APE::Tag::setProperties(const PropertyMap &origProps)
{
PropertyMap properties(origProps); // make a local copy that can be modified
// see comment in properties()
for(size_t i = 0; i < keyConversionsSize; ++i)
if(properties.contains(keyConversions[i][0])) {
properties.insert(keyConversions[i][1], properties[keyConversions[i][0]]);
properties.erase(keyConversions[i][0]);
}
// first check if tags need to be removed completely
StringList toRemove;
ItemListMap::ConstIterator remIt = itemListMap().begin();
for(; remIt != itemListMap().end(); ++remIt) {
String key = remIt->first.upper();
// only remove if a) key is valid, b) type is text, c) key not contained in new properties
if(!key.isEmpty() && remIt->second.type() == APE::Item::Text && !properties.contains(key))
toRemove.append(remIt->first);
}
for(StringList::ConstIterator removeIt = toRemove.begin(); removeIt != toRemove.end(); removeIt++)
removeItem(*removeIt);
// now sync in the "forward direction"
PropertyMap::ConstIterator it = properties.begin();
PropertyMap invalid;
for(; it != properties.end(); ++it) {
const String &tagName = it->first;
if(!checkKey(tagName))
invalid.insert(it->first, it->second);
else if(!(itemListMap().contains(tagName)) || !(itemListMap()[tagName].values() == it->second)) {
if(it->second.isEmpty())
removeItem(tagName);
else {
StringList::ConstIterator valueIt = it->second.begin();
addValue(tagName, *valueIt, true);
++valueIt;
for(; valueIt != it->second.end(); ++valueIt)
addValue(tagName, *valueIt, false);
}
}
}
return invalid;
}
bool APE::Tag::checkKey(const String &key)
{
if(key.size() < MinKeyLength || key.size() > MaxKeyLength)
return false;
return isKeyValid(key.data(String::UTF8));
}
APE::Footer *APE::Tag::footer() const
{
return &d->footer;
@@ -186,26 +317,51 @@ const APE::ItemListMap& APE::Tag::itemListMap() const
void APE::Tag::removeItem(const String &key)
{
Map<const String, Item>::Iterator it = d->itemListMap.find(key.upper());
if(it != d->itemListMap.end())
d->itemListMap.erase(it);
d->itemListMap.erase(key.upper());
}
void APE::Tag::addValue(const String &key, const String &value, bool replace)
{
if(replace)
removeItem(key);
if(!value.isEmpty()) {
if(d->itemListMap.contains(key) || !replace)
d->itemListMap[key.upper()].appendValue(value);
else
setItem(key, Item(key, value));
}
if(value.isEmpty())
return;
// Text items may contain more than one value.
// Binary or locator items may have only one value, hence always replaced.
ItemListMap::Iterator it = d->itemListMap.find(key.upper());
if(it != d->itemListMap.end() && it->second.type() == Item::Text)
it->second.appendValue(value);
else
setItem(key, Item(key, value));
}
void APE::Tag::setData(const String &key, const ByteVector &value)
{
removeItem(key);
if(value.isEmpty())
return;
setItem(key, Item(key, value, true));
}
void APE::Tag::setItem(const String &key, const Item &item)
{
d->itemListMap.insert(key.upper(), item);
if(!checkKey(key)) {
debug("APE::Tag::setItem() - Couldn't set an item due to an invalid key.");
return;
}
d->itemListMap[key.upper()] = item;
}
bool APE::Tag::isEmpty() const
{
return d->itemListMap.isEmpty();
}
////////////////////////////////////////////////////////////////////////////////
@@ -220,7 +376,7 @@ void APE::Tag::read()
d->footer.setData(d->file->readBlock(Footer::size()));
if(d->footer.tagSize() <= Footer::size() ||
d->footer.tagSize() > uint(d->file->length()))
d->footer.tagSize() > static_cast<unsigned long>(d->file->length()))
return;
d->file->seek(d->footerLocation + Footer::size() - d->footer.tagSize());
@@ -231,15 +387,11 @@ void APE::Tag::read()
ByteVector APE::Tag::render() const
{
ByteVector data;
uint itemCount = 0;
unsigned int itemCount = 0;
{
for(Map<const String, Item>::ConstIterator it = d->itemListMap.begin();
it != d->itemListMap.end(); ++it)
{
data.append(it->second.render());
itemCount++;
}
for(ItemListMap::ConstIterator it = d->itemListMap.begin(); it != d->itemListMap.end(); ++it) {
data.append(it->second.render());
itemCount++;
}
d->footer.setItemCount(itemCount);
@@ -251,16 +403,37 @@ ByteVector APE::Tag::render() const
void APE::Tag::parse(const ByteVector &data)
{
uint pos = 0;
// 11 bytes is the minimum size for an APE item
for(uint i = 0; i < d->footer.itemCount() && pos <= data.size() - 11; i++) {
APE::Item item;
item.parse(data.mid(pos));
if(data.size() < 11)
return;
d->itemListMap.insert(item.key().upper(), item);
unsigned int pos = 0;
pos += item.size();
for(unsigned int i = 0; i < d->footer.itemCount() && pos <= data.size() - 11; i++) {
const int nullPos = data.find('\0', pos + 8);
if(nullPos < 0) {
debug("APE::Tag::parse() - Couldn't find a key/value separator. Stopped parsing.");
return;
}
const unsigned int keyLength = nullPos - pos - 8;
const unsigned int valLegnth = data.toUInt(pos, false);
if(keyLength >= MinKeyLength
&& keyLength <= MaxKeyLength
&& isKeyValid(data.mid(pos + 8, keyLength)))
{
APE::Item item;
item.parse(data.mid(pos));
d->itemListMap.insert(item.key().upper(), item);
}
else {
debug("APE::Tag::parse() - Skipped an item due to an invalid key.");
}
pos += keyLength + valLegnth + 9;
}
}

View File

@@ -15,8 +15,8 @@
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
* USA *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
@@ -66,7 +66,7 @@ namespace TagLib {
* Create an APE tag and parse the data in \a file with APE footer at
* \a tagOffset.
*/
Tag(File *file, long footerLocation);
Tag(TagLib::File *file, long footerLocation);
/*!
* Destroys this Tag instance.
@@ -92,16 +92,47 @@ namespace TagLib {
virtual String album() const;
virtual String comment() const;
virtual String genre() const;
virtual uint year() const;
virtual uint track() const;
virtual unsigned int year() const;
virtual unsigned int track() const;
virtual void setTitle(const String &s);
virtual void setArtist(const String &s);
virtual void setAlbum(const String &s);
virtual void setComment(const String &s);
virtual void setGenre(const String &s);
virtual void setYear(uint i);
virtual void setTrack(uint i);
virtual void setYear(unsigned int i);
virtual void setTrack(unsigned int i);
/*!
* Implements the unified tag dictionary interface -- export function.
* APE tags are perfectly compatible with the dictionary interface because they
* support both arbitrary tag names and multiple values. Currently only
* APE items of type *Text* are handled by the dictionary interface; all *Binary*
* and *Locator* items will be put into the unsupportedData list and can be
* deleted on request using removeUnsupportedProperties(). The same happens
* to Text items if their key is invalid for PropertyMap (which should actually
* never happen).
*
* The only conversion done by this export function is to rename the APE tags
* TRACK to TRACKNUMBER, YEAR to DATE, and ALBUM ARTIST to ALBUMARTIST, respectively,
* in order to be compliant with the names used in other formats.
*/
PropertyMap properties() const;
void removeUnsupportedProperties(const StringList &properties);
/*!
* Implements the unified tag dictionary interface -- import function. The same
* comments as for the export function apply; additionally note that the APE tag
* specification requires keys to have between 2 and 16 printable ASCII characters
* with the exception of the fixed strings "ID3", "TAG", "OGGS", and "MP+".
*/
PropertyMap setProperties(const PropertyMap &);
/*!
* Check if the given String is a valid APE tag key.
*/
static bool checkKey(const String&);
/*!
* Returns a pointer to the tag's footer.
@@ -112,7 +143,10 @@ namespace TagLib {
* Returns a reference to the item list map. This is an ItemListMap of
* all of the items in the tag.
*
* This is the most powerfull structure for accessing the items of the tag.
* This is the most powerful structure for accessing the items of the tag.
*
* APE tags are case-insensitive, all keys in this map have been converted
* to upper case.
*
* \warning You should not modify this data structure directly, instead
* use setItem() and removeItem().
@@ -125,18 +159,30 @@ namespace TagLib {
void removeItem(const String &key);
/*!
* Adds to the item specified by \a key the data \a value. If \a replace
* Adds to the text item specified by \a key the data \a value. If \a replace
* is true, then all of the other values on the same key will be removed
* first.
* first. If a binary item exists for \a key it will be removed first.
*/
void addValue(const String &key, const String &value, bool replace = true);
/*!
* Set the binary data for the key specified by \a item to \a value
* This will convert the item to type \a Binary if it isn't already and
* all of the other values on the same key will be removed.
*/
void setData(const String &key, const ByteVector &value);
/*!
* Sets the \a key item to the value of \a item. If an item with the \a key is already
* present, it will be replaced.
*/
void setItem(const String &key, const Item &item);
/*!
* Returns true if the tag does not contain any data.
*/
bool isEmpty() const;
protected:
/*!

351
taglib/asf/asfattribute.cpp Normal file
View File

@@ -0,0 +1,351 @@
/**************************************************************************
copyright : (C) 2005-2007 by Lukáš Lalinský
email : lalinsky@gmail.com
**************************************************************************/
/***************************************************************************
* This library is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License version *
* 2.1 as published by the Free Software Foundation. *
* *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#include <taglib.h>
#include <tdebug.h>
#include <trefcounter.h>
#include "asfattribute.h"
#include "asffile.h"
#include "asfutils.h"
using namespace TagLib;
class ASF::Attribute::AttributePrivate : public RefCounter
{
public:
AttributePrivate() :
pictureValue(ASF::Picture::fromInvalid()),
numericValue(0),
stream(0),
language(0) {}
AttributeTypes type;
String stringValue;
ByteVector byteVectorValue;
ASF::Picture pictureValue;
unsigned long long numericValue;
int stream;
int language;
};
////////////////////////////////////////////////////////////////////////////////
// public members
////////////////////////////////////////////////////////////////////////////////
ASF::Attribute::Attribute() :
d(new AttributePrivate())
{
d->type = UnicodeType;
}
ASF::Attribute::Attribute(const ASF::Attribute &other) :
d(other.d)
{
d->ref();
}
ASF::Attribute::Attribute(const String &value) :
d(new AttributePrivate())
{
d->type = UnicodeType;
d->stringValue = value;
}
ASF::Attribute::Attribute(const ByteVector &value) :
d(new AttributePrivate())
{
d->type = BytesType;
d->byteVectorValue = value;
}
ASF::Attribute::Attribute(const ASF::Picture &value) :
d(new AttributePrivate())
{
d->type = BytesType;
d->pictureValue = value;
}
ASF::Attribute::Attribute(unsigned int value) :
d(new AttributePrivate())
{
d->type = DWordType;
d->numericValue = value;
}
ASF::Attribute::Attribute(unsigned long long value) :
d(new AttributePrivate())
{
d->type = QWordType;
d->numericValue = value;
}
ASF::Attribute::Attribute(unsigned short value) :
d(new AttributePrivate())
{
d->type = WordType;
d->numericValue = value;
}
ASF::Attribute::Attribute(bool value) :
d(new AttributePrivate())
{
d->type = BoolType;
d->numericValue = value;
}
ASF::Attribute &ASF::Attribute::operator=(const ASF::Attribute &other)
{
Attribute(other).swap(*this);
return *this;
}
void ASF::Attribute::swap(Attribute &other)
{
using std::swap;
swap(d, other.d);
}
ASF::Attribute::~Attribute()
{
if(d->deref())
delete d;
}
ASF::Attribute::AttributeTypes ASF::Attribute::type() const
{
return d->type;
}
String ASF::Attribute::toString() const
{
return d->stringValue;
}
ByteVector ASF::Attribute::toByteVector() const
{
if(d->pictureValue.isValid())
return d->pictureValue.render();
return d->byteVectorValue;
}
unsigned short ASF::Attribute::toBool() const
{
return d->numericValue ? 1 : 0;
}
unsigned short ASF::Attribute::toUShort() const
{
return static_cast<unsigned short>(d->numericValue);
}
unsigned int ASF::Attribute::toUInt() const
{
return static_cast<unsigned int>(d->numericValue);
}
unsigned long long ASF::Attribute::toULongLong() const
{
return static_cast<unsigned long long>(d->numericValue);
}
ASF::Picture ASF::Attribute::toPicture() const
{
return d->pictureValue;
}
String ASF::Attribute::parse(ASF::File &f, int kind)
{
unsigned int size, nameLength;
String name;
d->pictureValue = Picture::fromInvalid();
// extended content descriptor
if(kind == 0) {
nameLength = readWORD(&f);
name = readString(&f, nameLength);
d->type = ASF::Attribute::AttributeTypes(readWORD(&f));
size = readWORD(&f);
}
// metadata & metadata library
else {
int temp = readWORD(&f);
// metadata library
if(kind == 2) {
d->language = temp;
}
d->stream = readWORD(&f);
nameLength = readWORD(&f);
d->type = ASF::Attribute::AttributeTypes(readWORD(&f));
size = readDWORD(&f);
name = readString(&f, nameLength);
}
if(kind != 2 && size > 65535) {
debug("ASF::Attribute::parse() -- Value larger than 64kB");
}
switch(d->type) {
case WordType:
d->numericValue = readWORD(&f);
break;
case BoolType:
if(kind == 0) {
d->numericValue = (readDWORD(&f) != 0);
}
else {
d->numericValue = (readWORD(&f) != 0);
}
break;
case DWordType:
d->numericValue = readDWORD(&f);
break;
case QWordType:
d->numericValue = readQWORD(&f);
break;
case UnicodeType:
d->stringValue = readString(&f, size);
break;
case BytesType:
case GuidType:
d->byteVectorValue = f.readBlock(size);
break;
}
if(d->type == BytesType && name == "WM/Picture") {
d->pictureValue.parse(d->byteVectorValue);
if(d->pictureValue.isValid()) {
d->byteVectorValue.clear();
}
}
return name;
}
int ASF::Attribute::dataSize() const
{
switch (d->type) {
case WordType:
return 2;
case BoolType:
return 4;
case DWordType:
return 4;
case QWordType:
return 5;
case UnicodeType:
return d->stringValue.size() * 2 + 2;
case BytesType:
if(d->pictureValue.isValid())
return d->pictureValue.dataSize();
case GuidType:
return d->byteVectorValue.size();
}
return 0;
}
ByteVector ASF::Attribute::render(const String &name, int kind) const
{
ByteVector data;
switch (d->type) {
case WordType:
data.append(ByteVector::fromShort(toUShort(), false));
break;
case BoolType:
if(kind == 0) {
data.append(ByteVector::fromUInt(toBool(), false));
}
else {
data.append(ByteVector::fromShort(toBool(), false));
}
break;
case DWordType:
data.append(ByteVector::fromUInt(toUInt(), false));
break;
case QWordType:
data.append(ByteVector::fromLongLong(toULongLong(), false));
break;
case UnicodeType:
data.append(renderString(d->stringValue));
break;
case BytesType:
if(d->pictureValue.isValid()) {
data.append(d->pictureValue.render());
break;
}
case GuidType:
data.append(d->byteVectorValue);
break;
}
if(kind == 0) {
data = renderString(name, true) +
ByteVector::fromShort((int)d->type, false) +
ByteVector::fromShort(data.size(), false) +
data;
}
else {
ByteVector nameData = renderString(name);
data = ByteVector::fromShort(kind == 2 ? d->language : 0, false) +
ByteVector::fromShort(d->stream, false) +
ByteVector::fromShort(nameData.size(), false) +
ByteVector::fromShort((int)d->type, false) +
ByteVector::fromUInt(data.size(), false) +
nameData +
data;
}
return data;
}
int ASF::Attribute::language() const
{
return d->language;
}
void ASF::Attribute::setLanguage(int value)
{
d->language = value;
}
int ASF::Attribute::stream() const
{
return d->stream;
}
void ASF::Attribute::setStream(int value)
{
d->stream = value;
}

208
taglib/asf/asfattribute.h Normal file
View File

@@ -0,0 +1,208 @@
/**************************************************************************
copyright : (C) 2005-2007 by Lukáš Lalinský
email : lalinsky@gmail.com
**************************************************************************/
/***************************************************************************
* This library is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License version *
* 2.1 as published by the Free Software Foundation. *
* *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#ifndef TAGLIB_ASFATTRIBUTE_H
#define TAGLIB_ASFATTRIBUTE_H
#include "tstring.h"
#include "tbytevector.h"
#include "taglib_export.h"
#include "asfpicture.h"
namespace TagLib
{
namespace ASF
{
class File;
class Picture;
class TAGLIB_EXPORT Attribute
{
public:
/*!
* Enum of types an Attribute can have.
*/
enum AttributeTypes {
UnicodeType = 0,
BytesType = 1,
BoolType = 2,
DWordType = 3,
QWordType = 4,
WordType = 5,
GuidType = 6
};
/*!
* Constructs an empty attribute.
*/
Attribute();
/*!
* Constructs an attribute with \a key and a UnicodeType \a value.
*/
Attribute(const String &value);
/*!
* Constructs an attribute with \a key and a BytesType \a value.
*/
Attribute(const ByteVector &value);
/*!
* Constructs an attribute with \a key and a Picture \a value.
*
* This attribute is compatible with the ID3 frame, APIC. The ID3 specification for the APIC frame stipulates that,
* while there may be any number of APIC frames associated with a file,
* only one may be of type 1 and only one may be of type 2.
*
* The specification also states that the description of the picture can be no longer than 64 characters, but can be empty.
* WM/Picture attributes added with TagLib::ASF are not automatically validated to conform to ID3 specifications.
* You must add code in your application to perform validations if you want to maintain complete compatibility with ID3.
*/
Attribute(const Picture &value);
/*!
* Constructs an attribute with \a key and a DWordType \a value.
*/
Attribute(unsigned int value);
/*!
* Constructs an attribute with \a key and a QWordType \a value.
*/
Attribute(unsigned long long value);
/*!
* Constructs an attribute with \a key and a WordType \a value.
*/
Attribute(unsigned short value);
/*!
* Constructs an attribute with \a key and a BoolType \a value.
*/
Attribute(bool value);
/*!
* Construct an attribute as a copy of \a other.
*/
Attribute(const Attribute &item);
/*!
* Copies the contents of \a other into this item.
*/
Attribute &operator=(const Attribute &other);
/*!
* Exchanges the content of the Attribute by the content of \a other.
*/
void swap(Attribute &other);
/*!
* Destroys the attribute.
*/
virtual ~Attribute();
/*!
* Returns type of the value.
*/
AttributeTypes type() const;
/*!
* Returns the BoolType \a value.
*/
unsigned short toBool() const;
/*!
* Returns the WordType \a value.
*/
unsigned short toUShort() const;
/*!
* Returns the DWordType \a value.
*/
unsigned int toUInt() const;
/*!
* Returns the QWordType \a value.
*/
unsigned long long toULongLong() const;
/*!
* Returns the UnicodeType \a value.
*/
String toString() const;
/*!
* Returns the BytesType \a value.
*/
ByteVector toByteVector() const;
/*!
* Returns the Picture \a value.
*/
Picture toPicture() const;
/*!
* Returns the language number, or 0 is no stream number was set.
*/
int language() const;
/*!
* Sets the language number.
*/
void setLanguage(int value);
/*!
* Returns the stream number, or 0 is no stream number was set.
*/
int stream() const;
/*!
* Sets the stream number.
*/
void setStream(int value);
#ifndef DO_NOT_DOCUMENT
/* THIS IS PRIVATE, DON'T TOUCH IT! */
String parse(ASF::File &file, int kind = 0);
#endif
//! Returns the size of the stored data
int dataSize() const;
private:
friend class File;
ByteVector render(const String &name, int kind = 0) const;
class AttributePrivate;
AttributePrivate *d;
};
}
}
#endif

705
taglib/asf/asffile.cpp Normal file
View File

@@ -0,0 +1,705 @@
/**************************************************************************
copyright : (C) 2005-2007 by Lukáš Lalinský
email : lalinsky@gmail.com
**************************************************************************/
/***************************************************************************
* This library is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License version *
* 2.1 as published by the Free Software Foundation. *
* *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#include <tdebug.h>
#include <tbytevectorlist.h>
#include <tpropertymap.h>
#include <tstring.h>
#include <tagutils.h>
#include "asffile.h"
#include "asftag.h"
#include "asfproperties.h"
#include "asfutils.h"
using namespace TagLib;
class ASF::File::FilePrivate
{
public:
class BaseObject;
class UnknownObject;
class FilePropertiesObject;
class StreamPropertiesObject;
class ContentDescriptionObject;
class ExtendedContentDescriptionObject;
class HeaderExtensionObject;
class CodecListObject;
class MetadataObject;
class MetadataLibraryObject;
FilePrivate():
headerSize(0),
tag(0),
properties(0),
contentDescriptionObject(0),
extendedContentDescriptionObject(0),
headerExtensionObject(0),
metadataObject(0),
metadataLibraryObject(0)
{
objects.setAutoDelete(true);
}
~FilePrivate()
{
delete tag;
delete properties;
}
unsigned long long headerSize;
ASF::Tag *tag;
ASF::Properties *properties;
List<BaseObject *> objects;
ContentDescriptionObject *contentDescriptionObject;
ExtendedContentDescriptionObject *extendedContentDescriptionObject;
HeaderExtensionObject *headerExtensionObject;
MetadataObject *metadataObject;
MetadataLibraryObject *metadataLibraryObject;
};
namespace
{
const ByteVector headerGuid("\x30\x26\xB2\x75\x8E\x66\xCF\x11\xA6\xD9\x00\xAA\x00\x62\xCE\x6C", 16);
const ByteVector filePropertiesGuid("\xA1\xDC\xAB\x8C\x47\xA9\xCF\x11\x8E\xE4\x00\xC0\x0C\x20\x53\x65", 16);
const ByteVector streamPropertiesGuid("\x91\x07\xDC\xB7\xB7\xA9\xCF\x11\x8E\xE6\x00\xC0\x0C\x20\x53\x65", 16);
const ByteVector contentDescriptionGuid("\x33\x26\xB2\x75\x8E\x66\xCF\x11\xA6\xD9\x00\xAA\x00\x62\xCE\x6C", 16);
const ByteVector extendedContentDescriptionGuid("\x40\xA4\xD0\xD2\x07\xE3\xD2\x11\x97\xF0\x00\xA0\xC9\x5E\xA8\x50", 16);
const ByteVector headerExtensionGuid("\xb5\x03\xbf_.\xa9\xcf\x11\x8e\xe3\x00\xc0\x0c Se", 16);
const ByteVector metadataGuid("\xEA\xCB\xF8\xC5\xAF[wH\204g\xAA\214D\xFAL\xCA", 16);
const ByteVector metadataLibraryGuid("\224\034#D\230\224\321I\241A\x1d\x13NEpT", 16);
const ByteVector codecListGuid("\x40\x52\xd1\x86\x1d\x31\xd0\x11\xa3\xa4\x00\xa0\xc9\x03\x48\xf6", 16);
const ByteVector contentEncryptionGuid("\xFB\xB3\x11\x22\x23\xBD\xD2\x11\xB4\xB7\x00\xA0\xC9\x55\xFC\x6E", 16);
const ByteVector extendedContentEncryptionGuid("\x14\xE6\x8A\x29\x22\x26 \x17\x4C\xB9\x35\xDA\xE0\x7E\xE9\x28\x9C", 16);
const ByteVector advancedContentEncryptionGuid("\xB6\x9B\x07\x7A\xA4\xDA\x12\x4E\xA5\xCA\x91\xD3\x8D\xC1\x1A\x8D", 16);
}
class ASF::File::FilePrivate::BaseObject
{
public:
ByteVector data;
virtual ~BaseObject() {}
virtual ByteVector guid() const = 0;
virtual void parse(ASF::File *file, unsigned int size);
virtual ByteVector render(ASF::File *file);
};
class ASF::File::FilePrivate::UnknownObject : public ASF::File::FilePrivate::BaseObject
{
ByteVector myGuid;
public:
UnknownObject(const ByteVector &guid);
ByteVector guid() const;
};
class ASF::File::FilePrivate::FilePropertiesObject : public ASF::File::FilePrivate::BaseObject
{
public:
ByteVector guid() const;
void parse(ASF::File *file, unsigned int size);
};
class ASF::File::FilePrivate::StreamPropertiesObject : public ASF::File::FilePrivate::BaseObject
{
public:
ByteVector guid() const;
void parse(ASF::File *file, unsigned int size);
};
class ASF::File::FilePrivate::ContentDescriptionObject : public ASF::File::FilePrivate::BaseObject
{
public:
ByteVector guid() const;
void parse(ASF::File *file, unsigned int size);
ByteVector render(ASF::File *file);
};
class ASF::File::FilePrivate::ExtendedContentDescriptionObject : public ASF::File::FilePrivate::BaseObject
{
public:
ByteVectorList attributeData;
ByteVector guid() const;
void parse(ASF::File *file, unsigned int size);
ByteVector render(ASF::File *file);
};
class ASF::File::FilePrivate::MetadataObject : public ASF::File::FilePrivate::BaseObject
{
public:
ByteVectorList attributeData;
ByteVector guid() const;
void parse(ASF::File *file, unsigned int size);
ByteVector render(ASF::File *file);
};
class ASF::File::FilePrivate::MetadataLibraryObject : public ASF::File::FilePrivate::BaseObject
{
public:
ByteVectorList attributeData;
ByteVector guid() const;
void parse(ASF::File *file, unsigned int size);
ByteVector render(ASF::File *file);
};
class ASF::File::FilePrivate::HeaderExtensionObject : public ASF::File::FilePrivate::BaseObject
{
public:
List<ASF::File::FilePrivate::BaseObject *> objects;
HeaderExtensionObject();
ByteVector guid() const;
void parse(ASF::File *file, unsigned int size);
ByteVector render(ASF::File *file);
};
class ASF::File::FilePrivate::CodecListObject : public ASF::File::FilePrivate::BaseObject
{
public:
ByteVector guid() const;
void parse(ASF::File *file, unsigned int size);
private:
enum CodecType
{
Video = 0x0001,
Audio = 0x0002,
Unknown = 0xFFFF
};
};
void ASF::File::FilePrivate::BaseObject::parse(ASF::File *file, unsigned int size)
{
data.clear();
if(size > 24 && size <= (unsigned int)(file->length()))
data = file->readBlock(size - 24);
else
data = ByteVector();
}
ByteVector ASF::File::FilePrivate::BaseObject::render(ASF::File * /*file*/)
{
return guid() + ByteVector::fromLongLong(data.size() + 24, false) + data;
}
ASF::File::FilePrivate::UnknownObject::UnknownObject(const ByteVector &guid) : myGuid(guid)
{
}
ByteVector ASF::File::FilePrivate::UnknownObject::guid() const
{
return myGuid;
}
ByteVector ASF::File::FilePrivate::FilePropertiesObject::guid() const
{
return filePropertiesGuid;
}
void ASF::File::FilePrivate::FilePropertiesObject::parse(ASF::File *file, unsigned int size)
{
BaseObject::parse(file, size);
if(data.size() < 64) {
debug("ASF::File::FilePrivate::FilePropertiesObject::parse() -- data is too short.");
return;
}
const long long duration = data.toLongLong(40, false);
const long long preroll = data.toLongLong(56, false);
file->d->properties->setLengthInMilliseconds(static_cast<int>(duration / 10000.0 - preroll + 0.5));
}
ByteVector ASF::File::FilePrivate::StreamPropertiesObject::guid() const
{
return streamPropertiesGuid;
}
void ASF::File::FilePrivate::StreamPropertiesObject::parse(ASF::File *file, unsigned int size)
{
BaseObject::parse(file, size);
if(data.size() < 70) {
debug("ASF::File::FilePrivate::StreamPropertiesObject::parse() -- data is too short.");
return;
}
file->d->properties->setCodec(data.toUShort(54, false));
file->d->properties->setChannels(data.toUShort(56, false));
file->d->properties->setSampleRate(data.toUInt(58, false));
file->d->properties->setBitrate(static_cast<int>(data.toUInt(62, false) * 8.0 / 1000.0 + 0.5));
file->d->properties->setBitsPerSample(data.toUShort(68, false));
}
ByteVector ASF::File::FilePrivate::ContentDescriptionObject::guid() const
{
return contentDescriptionGuid;
}
void ASF::File::FilePrivate::ContentDescriptionObject::parse(ASF::File *file, unsigned int /*size*/)
{
const int titleLength = readWORD(file);
const int artistLength = readWORD(file);
const int copyrightLength = readWORD(file);
const int commentLength = readWORD(file);
const int ratingLength = readWORD(file);
file->d->tag->setTitle(readString(file,titleLength));
file->d->tag->setArtist(readString(file,artistLength));
file->d->tag->setCopyright(readString(file,copyrightLength));
file->d->tag->setComment(readString(file,commentLength));
file->d->tag->setRating(readString(file,ratingLength));
}
ByteVector ASF::File::FilePrivate::ContentDescriptionObject::render(ASF::File *file)
{
const ByteVector v1 = renderString(file->d->tag->title());
const ByteVector v2 = renderString(file->d->tag->artist());
const ByteVector v3 = renderString(file->d->tag->copyright());
const ByteVector v4 = renderString(file->d->tag->comment());
const ByteVector v5 = renderString(file->d->tag->rating());
data.clear();
data.append(ByteVector::fromShort(v1.size(), false));
data.append(ByteVector::fromShort(v2.size(), false));
data.append(ByteVector::fromShort(v3.size(), false));
data.append(ByteVector::fromShort(v4.size(), false));
data.append(ByteVector::fromShort(v5.size(), false));
data.append(v1);
data.append(v2);
data.append(v3);
data.append(v4);
data.append(v5);
return BaseObject::render(file);
}
ByteVector ASF::File::FilePrivate::ExtendedContentDescriptionObject::guid() const
{
return extendedContentDescriptionGuid;
}
void ASF::File::FilePrivate::ExtendedContentDescriptionObject::parse(ASF::File *file, unsigned int /*size*/)
{
int count = readWORD(file);
while(count--) {
ASF::Attribute attribute;
String name = attribute.parse(*file);
file->d->tag->addAttribute(name, attribute);
}
}
ByteVector ASF::File::FilePrivate::ExtendedContentDescriptionObject::render(ASF::File *file)
{
data.clear();
data.append(ByteVector::fromShort(attributeData.size(), false));
data.append(attributeData.toByteVector(""));
return BaseObject::render(file);
}
ByteVector ASF::File::FilePrivate::MetadataObject::guid() const
{
return metadataGuid;
}
void ASF::File::FilePrivate::MetadataObject::parse(ASF::File *file, unsigned int /*size*/)
{
int count = readWORD(file);
while(count--) {
ASF::Attribute attribute;
String name = attribute.parse(*file, 1);
file->d->tag->addAttribute(name, attribute);
}
}
ByteVector ASF::File::FilePrivate::MetadataObject::render(ASF::File *file)
{
data.clear();
data.append(ByteVector::fromShort(attributeData.size(), false));
data.append(attributeData.toByteVector(""));
return BaseObject::render(file);
}
ByteVector ASF::File::FilePrivate::MetadataLibraryObject::guid() const
{
return metadataLibraryGuid;
}
void ASF::File::FilePrivate::MetadataLibraryObject::parse(ASF::File *file, unsigned int /*size*/)
{
int count = readWORD(file);
while(count--) {
ASF::Attribute attribute;
String name = attribute.parse(*file, 2);
file->d->tag->addAttribute(name, attribute);
}
}
ByteVector ASF::File::FilePrivate::MetadataLibraryObject::render(ASF::File *file)
{
data.clear();
data.append(ByteVector::fromShort(attributeData.size(), false));
data.append(attributeData.toByteVector(""));
return BaseObject::render(file);
}
ASF::File::FilePrivate::HeaderExtensionObject::HeaderExtensionObject()
{
objects.setAutoDelete(true);
}
ByteVector ASF::File::FilePrivate::HeaderExtensionObject::guid() const
{
return headerExtensionGuid;
}
void ASF::File::FilePrivate::HeaderExtensionObject::parse(ASF::File *file, unsigned int /*size*/)
{
file->seek(18, File::Current);
long long dataSize = readDWORD(file);
long long dataPos = 0;
while(dataPos < dataSize) {
ByteVector guid = file->readBlock(16);
if(guid.size() != 16) {
file->setValid(false);
break;
}
bool ok;
long long size = readQWORD(file, &ok);
if(!ok) {
file->setValid(false);
break;
}
BaseObject *obj;
if(guid == metadataGuid) {
file->d->metadataObject = new MetadataObject();
obj = file->d->metadataObject;
}
else if(guid == metadataLibraryGuid) {
file->d->metadataLibraryObject = new MetadataLibraryObject();
obj = file->d->metadataLibraryObject;
}
else {
obj = new UnknownObject(guid);
}
obj->parse(file, (unsigned int)size);
objects.append(obj);
dataPos += size;
}
}
ByteVector ASF::File::FilePrivate::HeaderExtensionObject::render(ASF::File *file)
{
data.clear();
for(List<BaseObject *>::ConstIterator it = objects.begin(); it != objects.end(); ++it) {
data.append((*it)->render(file));
}
data = ByteVector("\x11\xD2\xD3\xAB\xBA\xA9\xcf\x11\x8E\xE6\x00\xC0\x0C\x20\x53\x65\x06\x00", 18) + ByteVector::fromUInt(data.size(), false) + data;
return BaseObject::render(file);
}
ByteVector ASF::File::FilePrivate::CodecListObject::guid() const
{
return codecListGuid;
}
void ASF::File::FilePrivate::CodecListObject::parse(ASF::File *file, unsigned int size)
{
BaseObject::parse(file, size);
if(data.size() <= 20) {
debug("ASF::File::FilePrivate::CodecListObject::parse() -- data is too short.");
return;
}
unsigned int pos = 16;
const int count = data.toUInt(pos, false);
pos += 4;
for(int i = 0; i < count; ++i) {
if(pos >= data.size())
break;
const CodecType type = static_cast<CodecType>(data.toUShort(pos, false));
pos += 2;
int nameLength = data.toUShort(pos, false);
pos += 2;
const unsigned int namePos = pos;
pos += nameLength * 2;
const int descLength = data.toUShort(pos, false);
pos += 2;
const unsigned int descPos = pos;
pos += descLength * 2;
const int infoLength = data.toUShort(pos, false);
pos += 2 + infoLength * 2;
if(type == CodecListObject::Audio) {
// First audio codec found.
const String name(data.mid(namePos, nameLength * 2), String::UTF16LE);
file->d->properties->setCodecName(name.stripWhiteSpace());
const String desc(data.mid(descPos, descLength * 2), String::UTF16LE);
file->d->properties->setCodecDescription(desc.stripWhiteSpace());
break;
}
}
}
////////////////////////////////////////////////////////////////////////////////
// static members
////////////////////////////////////////////////////////////////////////////////
bool ASF::File::isSupported(IOStream *stream)
{
// An ASF file has to start with the designated GUID.
const ByteVector id = Utils::readHeader(stream, 16, false);
return (id == headerGuid);
}
////////////////////////////////////////////////////////////////////////////////
// public members
////////////////////////////////////////////////////////////////////////////////
ASF::File::File(FileName file, bool, Properties::ReadStyle) :
TagLib::File(file),
d(new FilePrivate())
{
if(isOpen())
read();
}
ASF::File::File(IOStream *stream, bool, Properties::ReadStyle) :
TagLib::File(stream),
d(new FilePrivate())
{
if(isOpen())
read();
}
ASF::File::~File()
{
delete d;
}
ASF::Tag *ASF::File::tag() const
{
return d->tag;
}
PropertyMap ASF::File::properties() const
{
return d->tag->properties();
}
void ASF::File::removeUnsupportedProperties(const StringList &properties)
{
d->tag->removeUnsupportedProperties(properties);
}
PropertyMap ASF::File::setProperties(const PropertyMap &properties)
{
return d->tag->setProperties(properties);
}
ASF::Properties *ASF::File::audioProperties() const
{
return d->properties;
}
bool ASF::File::save()
{
if(readOnly()) {
debug("ASF::File::save() -- File is read only.");
return false;
}
if(!isValid()) {
debug("ASF::File::save() -- Trying to save invalid file.");
return false;
}
if(!d->contentDescriptionObject) {
d->contentDescriptionObject = new FilePrivate::ContentDescriptionObject();
d->objects.append(d->contentDescriptionObject);
}
if(!d->extendedContentDescriptionObject) {
d->extendedContentDescriptionObject = new FilePrivate::ExtendedContentDescriptionObject();
d->objects.append(d->extendedContentDescriptionObject);
}
if(!d->headerExtensionObject) {
d->headerExtensionObject = new FilePrivate::HeaderExtensionObject();
d->objects.append(d->headerExtensionObject);
}
if(!d->metadataObject) {
d->metadataObject = new FilePrivate::MetadataObject();
d->headerExtensionObject->objects.append(d->metadataObject);
}
if(!d->metadataLibraryObject) {
d->metadataLibraryObject = new FilePrivate::MetadataLibraryObject();
d->headerExtensionObject->objects.append(d->metadataLibraryObject);
}
d->extendedContentDescriptionObject->attributeData.clear();
d->metadataObject->attributeData.clear();
d->metadataLibraryObject->attributeData.clear();
const AttributeListMap allAttributes = d->tag->attributeListMap();
for(AttributeListMap::ConstIterator it = allAttributes.begin(); it != allAttributes.end(); ++it) {
const String &name = it->first;
const AttributeList &attributes = it->second;
bool inExtendedContentDescriptionObject = false;
bool inMetadataObject = false;
for(AttributeList::ConstIterator jt = attributes.begin(); jt != attributes.end(); ++jt) {
const Attribute &attribute = *jt;
const bool largeValue = (attribute.dataSize() > 65535);
const bool guid = (attribute.type() == Attribute::GuidType);
if(!inExtendedContentDescriptionObject && !guid && !largeValue && attribute.language() == 0 && attribute.stream() == 0) {
d->extendedContentDescriptionObject->attributeData.append(attribute.render(name));
inExtendedContentDescriptionObject = true;
}
else if(!inMetadataObject && !guid && !largeValue && attribute.language() == 0 && attribute.stream() != 0) {
d->metadataObject->attributeData.append(attribute.render(name, 1));
inMetadataObject = true;
}
else {
d->metadataLibraryObject->attributeData.append(attribute.render(name, 2));
}
}
}
ByteVector data;
for(List<FilePrivate::BaseObject *>::ConstIterator it = d->objects.begin(); it != d->objects.end(); ++it) {
data.append((*it)->render(this));
}
seek(16);
writeBlock(ByteVector::fromLongLong(data.size() + 30, false));
writeBlock(ByteVector::fromUInt(d->objects.size(), false));
writeBlock(ByteVector("\x01\x02", 2));
insert(data, 30, static_cast<unsigned long>(d->headerSize - 30));
d->headerSize = data.size() + 30;
return true;
}
////////////////////////////////////////////////////////////////////////////////
// private members
////////////////////////////////////////////////////////////////////////////////
void ASF::File::read()
{
if(!isValid())
return;
if(readBlock(16) != headerGuid) {
debug("ASF::File::read(): Not an ASF file.");
setValid(false);
return;
}
d->tag = new ASF::Tag();
d->properties = new ASF::Properties();
bool ok;
d->headerSize = readQWORD(this, &ok);
if(!ok) {
setValid(false);
return;
}
int numObjects = readDWORD(this, &ok);
if(!ok) {
setValid(false);
return;
}
seek(2, Current);
FilePrivate::FilePropertiesObject *filePropertiesObject = 0;
FilePrivate::StreamPropertiesObject *streamPropertiesObject = 0;
for(int i = 0; i < numObjects; i++) {
const ByteVector guid = readBlock(16);
if(guid.size() != 16) {
setValid(false);
break;
}
long size = (long)readQWORD(this, &ok);
if(!ok) {
setValid(false);
break;
}
FilePrivate::BaseObject *obj;
if(guid == filePropertiesGuid) {
filePropertiesObject = new FilePrivate::FilePropertiesObject();
obj = filePropertiesObject;
}
else if(guid == streamPropertiesGuid) {
streamPropertiesObject = new FilePrivate::StreamPropertiesObject();
obj = streamPropertiesObject;
}
else if(guid == contentDescriptionGuid) {
d->contentDescriptionObject = new FilePrivate::ContentDescriptionObject();
obj = d->contentDescriptionObject;
}
else if(guid == extendedContentDescriptionGuid) {
d->extendedContentDescriptionObject = new FilePrivate::ExtendedContentDescriptionObject();
obj = d->extendedContentDescriptionObject;
}
else if(guid == headerExtensionGuid) {
d->headerExtensionObject = new FilePrivate::HeaderExtensionObject();
obj = d->headerExtensionObject;
}
else if(guid == codecListGuid) {
obj = new FilePrivate::CodecListObject();
}
else {
if(guid == contentEncryptionGuid ||
guid == extendedContentEncryptionGuid ||
guid == advancedContentEncryptionGuid) {
d->properties->setEncrypted(true);
}
obj = new FilePrivate::UnknownObject(guid);
}
obj->parse(this, size);
d->objects.append(obj);
}
if(!filePropertiesObject || !streamPropertiesObject) {
debug("ASF::File::read(): Missing mandatory header objects.");
setValid(false);
return;
}
}

138
taglib/asf/asffile.h Normal file
View File

@@ -0,0 +1,138 @@
/**************************************************************************
copyright : (C) 2005-2007 by Lukáš Lalinský
email : lalinsky@gmail.com
**************************************************************************/
/***************************************************************************
* This library is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License version *
* 2.1 as published by the Free Software Foundation. *
* *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#ifndef TAGLIB_ASFFILE_H
#define TAGLIB_ASFFILE_H
#include "tag.h"
#include "tfile.h"
#include "taglib_export.h"
#include "asfproperties.h"
#include "asftag.h"
namespace TagLib {
//! An implementation of ASF (WMA) metadata
namespace ASF {
/*!
* This implements and provides an interface for ASF files to the
* TagLib::Tag and TagLib::AudioProperties interfaces by way of implementing
* the abstract TagLib::File API as well as providing some additional
* information specific to ASF files.
*/
class TAGLIB_EXPORT File : public TagLib::File
{
public:
/*!
* Constructs an ASF file from \a file.
*
* \note In the current implementation, both \a readProperties and
* \a propertiesStyle are ignored. The audio properties are always
* read.
*/
File(FileName file, bool readProperties = true,
Properties::ReadStyle propertiesStyle = Properties::Average);
/*!
* Constructs an ASF file from \a stream.
*
* \note In the current implementation, both \a readProperties and
* \a propertiesStyle are ignored. The audio properties are always
* read.
*
* \note TagLib will *not* take ownership of the stream, the caller is
* responsible for deleting it after the File object.
*/
File(IOStream *stream, bool readProperties = true,
Properties::ReadStyle propertiesStyle = Properties::Average);
/*!
* Destroys this instance of the File.
*/
virtual ~File();
/*!
* Returns a pointer to the ASF tag of the file.
*
* ASF::Tag implements the tag interface, so this serves as the
* reimplementation of TagLib::File::tag().
*
* \note The Tag <b>is still</b> owned by the ASF::File and should not be
* deleted by the user. It will be deleted when the file (object) is
* destroyed.
*/
virtual Tag *tag() const;
/*!
* Implements the unified property interface -- export function.
*/
PropertyMap properties() const;
/*!
* Removes unsupported properties. Forwards to the actual Tag's
* removeUnsupportedProperties() function.
*/
void removeUnsupportedProperties(const StringList &properties);
/*!
* Implements the unified property interface -- import function.
*/
PropertyMap setProperties(const PropertyMap &);
/*!
* Returns the ASF audio properties for this file.
*/
virtual Properties *audioProperties() const;
/*!
* Save the file.
*
* This returns true if the save was successful.
*/
virtual bool save();
/*!
* Returns whether or not the given \a stream can be opened as an ASF
* file.
*
* \note This method is designed to do a quick check. The result may
* not necessarily be correct.
*/
static bool isSupported(IOStream *stream);
private:
void read();
class FilePrivate;
FilePrivate *d;
};
}
}
#endif

183
taglib/asf/asfpicture.cpp Normal file
View File

@@ -0,0 +1,183 @@
/**************************************************************************
copyright : (C) 2010 by Anton Sergunov
email : setosha@gmail.com
**************************************************************************/
/***************************************************************************
* This library is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License version *
* 2.1 as published by the Free Software Foundation. *
* *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#include <taglib.h>
#include <tdebug.h>
#include <trefcounter.h>
#include "asfattribute.h"
#include "asffile.h"
#include "asfpicture.h"
#include "asfutils.h"
using namespace TagLib;
class ASF::Picture::PicturePrivate : public RefCounter
{
public:
bool valid;
Type type;
String mimeType;
String description;
ByteVector picture;
};
////////////////////////////////////////////////////////////////////////////////
// Picture class members
////////////////////////////////////////////////////////////////////////////////
ASF::Picture::Picture() :
d(new PicturePrivate())
{
d->valid = true;
}
ASF::Picture::Picture(const Picture& other) :
d(other.d)
{
d->ref();
}
ASF::Picture::~Picture()
{
if(d->deref())
delete d;
}
bool ASF::Picture::isValid() const
{
return d->valid;
}
String ASF::Picture::mimeType() const
{
return d->mimeType;
}
void ASF::Picture::setMimeType(const String &value)
{
d->mimeType = value;
}
ASF::Picture::Type ASF::Picture::type() const
{
return d->type;
}
void ASF::Picture::setType(const ASF::Picture::Type& t)
{
d->type = t;
}
String ASF::Picture::description() const
{
return d->description;
}
void ASF::Picture::setDescription(const String &desc)
{
d->description = desc;
}
ByteVector ASF::Picture::picture() const
{
return d->picture;
}
void ASF::Picture::setPicture(const ByteVector &p)
{
d->picture = p;
}
int ASF::Picture::dataSize() const
{
return
9 + (d->mimeType.length() + d->description.length()) * 2 +
d->picture.size();
}
ASF::Picture& ASF::Picture::operator=(const ASF::Picture& other)
{
Picture(other).swap(*this);
return *this;
}
void ASF::Picture::swap(Picture &other)
{
using std::swap;
swap(d, other.d);
}
ByteVector ASF::Picture::render() const
{
if(!isValid())
return ByteVector();
return
ByteVector((char)d->type) +
ByteVector::fromUInt(d->picture.size(), false) +
renderString(d->mimeType) +
renderString(d->description) +
d->picture;
}
void ASF::Picture::parse(const ByteVector& bytes)
{
d->valid = false;
if(bytes.size() < 9)
return;
int pos = 0;
d->type = (Type)bytes[0]; ++pos;
const unsigned int dataLen = bytes.toUInt(pos, false); pos+=4;
const ByteVector nullStringTerminator(2, 0);
int endPos = bytes.find(nullStringTerminator, pos, 2);
if(endPos < 0)
return;
d->mimeType = String(bytes.mid(pos, endPos - pos), String::UTF16LE);
pos = endPos+2;
endPos = bytes.find(nullStringTerminator, pos, 2);
if(endPos < 0)
return;
d->description = String(bytes.mid(pos, endPos - pos), String::UTF16LE);
pos = endPos+2;
if(dataLen + pos != bytes.size())
return;
d->picture = bytes.mid(pos, dataLen);
d->valid = true;
return;
}
ASF::Picture ASF::Picture::fromInvalid()
{
Picture ret;
ret.d->valid = false;
return ret;
}

222
taglib/asf/asfpicture.h Normal file
View File

@@ -0,0 +1,222 @@
/**************************************************************************
copyright : (C) 2010 by Anton Sergunov
email : setosha@gmail.com
**************************************************************************/
/***************************************************************************
* This library is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License version *
* 2.1 as published by the Free Software Foundation. *
* *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#ifndef ASFPICTURE_H
#define ASFPICTURE_H
#include "tstring.h"
#include "tbytevector.h"
#include "taglib_export.h"
#include "attachedpictureframe.h"
namespace TagLib
{
namespace ASF
{
//! An ASF attached picture interface implementation
/*!
* This is an implementation of ASF attached pictures interface. Pictures may be
* included in attributes, one per WM/Picture attribute (but there may be multiple WM/Picture
* attribute in a single tag). These pictures are usually in either JPEG or
* PNG format.
* \see Attribute::toPicture()
* \see Attribute::Attribute(const Picture& picture)
*/
class TAGLIB_EXPORT Picture {
public:
/*!
* This describes the function or content of the picture.
*/
enum Type {
//! A type not enumerated below
Other = 0x00,
//! 32x32 PNG image that should be used as the file icon
FileIcon = 0x01,
//! File icon of a different size or format
OtherFileIcon = 0x02,
//! Front cover image of the album
FrontCover = 0x03,
//! Back cover image of the album
BackCover = 0x04,
//! Inside leaflet page of the album
LeafletPage = 0x05,
//! Image from the album itself
Media = 0x06,
//! Picture of the lead artist or soloist
LeadArtist = 0x07,
//! Picture of the artist or performer
Artist = 0x08,
//! Picture of the conductor
Conductor = 0x09,
//! Picture of the band or orchestra
Band = 0x0A,
//! Picture of the composer
Composer = 0x0B,
//! Picture of the lyricist or text writer
Lyricist = 0x0C,
//! Picture of the recording location or studio
RecordingLocation = 0x0D,
//! Picture of the artists during recording
DuringRecording = 0x0E,
//! Picture of the artists during performance
DuringPerformance = 0x0F,
//! Picture from a movie or video related to the track
MovieScreenCapture = 0x10,
//! Picture of a large, coloured fish
ColouredFish = 0x11,
//! Illustration related to the track
Illustration = 0x12,
//! Logo of the band or performer
BandLogo = 0x13,
//! Logo of the publisher (record company)
PublisherLogo = 0x14
};
/*!
* Constructs an empty picture.
*/
Picture();
/*!
* Construct an picture as a copy of \a other.
*/
Picture(const Picture& other);
/*!
* Destroys the picture.
*/
virtual ~Picture();
/*!
* Copies the contents of \a other into this picture.
*/
Picture& operator=(const Picture& other);
/*!
* Exchanges the content of the Picture by the content of \a other.
*/
void swap(Picture &other);
/*!
* Returns true if Picture stores valid picture
*/
bool isValid() const;
/*!
* Returns the mime type of the image. This should in most cases be
* "image/png" or "image/jpeg".
* \see setMimeType(const String &)
* \see picture()
* \see setPicture(const ByteArray&)
*/
String mimeType() const;
/*!
* Sets the mime type of the image. This should in most cases be
* "image/png" or "image/jpeg".
* \see setMimeType(const String &)
* \see picture()
* \see setPicture(const ByteArray&)
*/
void setMimeType(const String &value);
/*!
* Returns the type of the image.
*
* \see Type
* \see setType()
*/
Type type() const;
/*!
* Sets the type for the image.
*
* \see Type
* \see type()
*/
void setType(const ASF::Picture::Type& t);
/*!
* Returns a text description of the image.
*
* \see setDescription()
*/
String description() const;
/*!
* Sets a textual description of the image to \a desc.
*
* \see description()
*/
void setDescription(const String &desc);
/*!
* Returns the image data as a ByteVector.
*
* \note ByteVector has a data() method that returns a const char * which
* should make it easy to export this data to external programs.
*
* \see setPicture()
* \see mimeType()
*/
ByteVector picture() const;
/*!
* Sets the image data to \a p. \a p should be of the type specified in
* this frame's mime-type specification.
*
* \see picture()
* \see mimeType()
* \see setMimeType()
*/
void setPicture(const ByteVector &p);
/*!
* Returns picture as binary raw data \a value
*/
ByteVector render() const;
/*!
* Returns picture as binary raw data \a value
*/
int dataSize() const;
#ifndef DO_NOT_DOCUMENT
/* THIS IS PRIVATE, DON'T TOUCH IT! */
void parse(const ByteVector& );
static Picture fromInvalid();
#endif
private:
class PicturePrivate;
PicturePrivate *d;
};
}
}
#endif // ASFPICTURE_H

View File

@@ -0,0 +1,194 @@
/**************************************************************************
copyright : (C) 2005-2007 by Lukáš Lalinský
email : lalinsky@gmail.com
**************************************************************************/
/***************************************************************************
* This library is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License version *
* 2.1 as published by the Free Software Foundation. *
* *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#include <tdebug.h>
#include <tstring.h>
#include "asfproperties.h"
using namespace TagLib;
class ASF::Properties::PropertiesPrivate
{
public:
PropertiesPrivate() :
length(0),
bitrate(0),
sampleRate(0),
channels(0),
bitsPerSample(0),
codec(ASF::Properties::Unknown),
encrypted(false) {}
int length;
int bitrate;
int sampleRate;
int channels;
int bitsPerSample;
ASF::Properties::Codec codec;
String codecName;
String codecDescription;
bool encrypted;
};
////////////////////////////////////////////////////////////////////////////////
// public members
////////////////////////////////////////////////////////////////////////////////
ASF::Properties::Properties() :
AudioProperties(AudioProperties::Average),
d(new PropertiesPrivate())
{
}
ASF::Properties::~Properties()
{
delete d;
}
int ASF::Properties::length() const
{
return lengthInSeconds();
}
int ASF::Properties::lengthInSeconds() const
{
return d->length / 1000;
}
int ASF::Properties::lengthInMilliseconds() const
{
return d->length;
}
int ASF::Properties::bitrate() const
{
return d->bitrate;
}
int ASF::Properties::sampleRate() const
{
return d->sampleRate;
}
int ASF::Properties::channels() const
{
return d->channels;
}
int ASF::Properties::bitsPerSample() const
{
return d->bitsPerSample;
}
ASF::Properties::Codec ASF::Properties::codec() const
{
return d->codec;
}
String ASF::Properties::codecName() const
{
return d->codecName;
}
String ASF::Properties::codecDescription() const
{
return d->codecDescription;
}
bool ASF::Properties::isEncrypted() const
{
return d->encrypted;
}
////////////////////////////////////////////////////////////////////////////////
// private members
////////////////////////////////////////////////////////////////////////////////
void ASF::Properties::setLength(int /*length*/)
{
debug("ASF::Properties::setLength() -- This method is deprecated. Do not use.");
}
void ASF::Properties::setLengthInMilliseconds(int value)
{
d->length = value;
}
void ASF::Properties::setBitrate(int value)
{
d->bitrate = value;
}
void ASF::Properties::setSampleRate(int value)
{
d->sampleRate = value;
}
void ASF::Properties::setChannels(int value)
{
d->channels = value;
}
void ASF::Properties::setBitsPerSample(int value)
{
d->bitsPerSample = value;
}
void ASF::Properties::setCodec(int value)
{
switch(value)
{
case 0x0160:
d->codec = WMA1;
break;
case 0x0161:
d->codec = WMA2;
break;
case 0x0162:
d->codec = WMA9Pro;
break;
case 0x0163:
d->codec = WMA9Lossless;
break;
default:
d->codec = Unknown;
break;
}
}
void ASF::Properties::setCodecName(const String &value)
{
d->codecName = value;
}
void ASF::Properties::setCodecDescription(const String &value)
{
d->codecDescription = value;
}
void ASF::Properties::setEncrypted(bool value)
{
d->encrypted = value;
}

186
taglib/asf/asfproperties.h Normal file
View File

@@ -0,0 +1,186 @@
/**************************************************************************
copyright : (C) 2005-2007 by Lukáš Lalinský
email : lalinsky@gmail.com
**************************************************************************/
/***************************************************************************
* This library is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License version *
* 2.1 as published by the Free Software Foundation. *
* *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#ifndef TAGLIB_ASFPROPERTIES_H
#define TAGLIB_ASFPROPERTIES_H
#include "audioproperties.h"
#include "tstring.h"
#include "taglib_export.h"
namespace TagLib {
namespace ASF {
//! An implementation of ASF audio properties
class TAGLIB_EXPORT Properties : public AudioProperties
{
public:
/*!
* Audio codec types can be used in ASF file.
*/
enum Codec
{
/*!
* Couldn't detect the codec.
*/
Unknown = 0,
/*!
* Windows Media Audio 1
*/
WMA1,
/*!
* Windows Media Audio 2 or above
*/
WMA2,
/*!
* Windows Media Audio 9 Professional
*/
WMA9Pro,
/*!
* Windows Media Audio 9 Lossless
*/
WMA9Lossless,
};
/*!
* Creates an instance of ASF::Properties.
*/
Properties();
/*!
* Destroys this ASF::Properties instance.
*/
virtual ~Properties();
/*!
* Returns the length of the file in seconds. The length is rounded down to
* the nearest whole second.
*
* \note This method is just an alias of lengthInSeconds().
*
* \deprecated
*/
TAGLIB_DEPRECATED virtual int length() const;
/*!
* Returns the length of the file in seconds. The length is rounded down to
* the nearest whole second.
*
* \see lengthInMilliseconds()
*/
// BIC: make virtual
int lengthInSeconds() const;
/*!
* Returns the length of the file in milliseconds.
*
* \see lengthInSeconds()
*/
// BIC: make virtual
int lengthInMilliseconds() const;
/*!
* Returns the average bit rate of the file in kb/s.
*/
virtual int bitrate() const;
/*!
* Returns the sample rate in Hz.
*/
virtual int sampleRate() const;
/*!
* Returns the number of audio channels.
*/
virtual int channels() const;
/*!
* Returns the number of bits per audio sample.
*/
int bitsPerSample() const;
/*!
* Returns the codec used in the file.
*
* \see codecName()
* \see codecDescription()
*/
Codec codec() const;
/*!
* Returns the concrete codec name, for example "Windows Media Audio 9.1"
* used in the file if available, otherwise an empty string.
*
* \see codec()
* \see codecDescription()
*/
String codecName() const;
/*!
* Returns the codec description, typically contains the encoder settings,
* for example "VBR Quality 50, 44kHz, stereo 1-pass VBR" if available,
* otherwise an empty string.
*
* \see codec()
* \see codecName()
*/
String codecDescription() const;
/*!
* Returns whether or not the file is encrypted.
*/
bool isEncrypted() const;
#ifndef DO_NOT_DOCUMENT
// deprecated
void setLength(int value);
void setLengthInMilliseconds(int value);
void setBitrate(int value);
void setSampleRate(int value);
void setChannels(int value);
void setBitsPerSample(int value);
void setCodec(int value);
void setCodecName(const String &value);
void setCodecDescription(const String &value);
void setEncrypted(bool value);
#endif
private:
class PropertiesPrivate;
PropertiesPrivate *d;
};
}
}
#endif

384
taglib/asf/asftag.cpp Normal file
View File

@@ -0,0 +1,384 @@
/**************************************************************************
copyright : (C) 2005-2007 by Lukáš Lalinský
email : lalinsky@gmail.com
**************************************************************************/
/***************************************************************************
* This library is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License version *
* 2.1 as published by the Free Software Foundation. *
* *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#include <tpropertymap.h>
#include "asftag.h"
using namespace TagLib;
class ASF::Tag::TagPrivate
{
public:
String title;
String artist;
String copyright;
String comment;
String rating;
AttributeListMap attributeListMap;
};
ASF::Tag::Tag() :
TagLib::Tag(),
d(new TagPrivate())
{
}
ASF::Tag::~Tag()
{
delete d;
}
String ASF::Tag::title() const
{
return d->title;
}
String ASF::Tag::artist() const
{
return d->artist;
}
String ASF::Tag::album() const
{
if(d->attributeListMap.contains("WM/AlbumTitle"))
return d->attributeListMap["WM/AlbumTitle"][0].toString();
return String();
}
String ASF::Tag::copyright() const
{
return d->copyright;
}
String ASF::Tag::comment() const
{
return d->comment;
}
String ASF::Tag::rating() const
{
return d->rating;
}
unsigned int ASF::Tag::year() const
{
if(d->attributeListMap.contains("WM/Year"))
return d->attributeListMap["WM/Year"][0].toString().toInt();
return 0;
}
unsigned int ASF::Tag::track() const
{
if(d->attributeListMap.contains("WM/TrackNumber")) {
const ASF::Attribute attr = d->attributeListMap["WM/TrackNumber"][0];
if(attr.type() == ASF::Attribute::DWordType)
return attr.toUInt();
else
return attr.toString().toInt();
}
if(d->attributeListMap.contains("WM/Track"))
return d->attributeListMap["WM/Track"][0].toUInt();
return 0;
}
String ASF::Tag::genre() const
{
if(d->attributeListMap.contains("WM/Genre"))
return d->attributeListMap["WM/Genre"][0].toString();
return String();
}
void ASF::Tag::setTitle(const String &value)
{
d->title = value;
}
void ASF::Tag::setArtist(const String &value)
{
d->artist = value;
}
void ASF::Tag::setCopyright(const String &value)
{
d->copyright = value;
}
void ASF::Tag::setComment(const String &value)
{
d->comment = value;
}
void ASF::Tag::setRating(const String &value)
{
d->rating = value;
}
void ASF::Tag::setAlbum(const String &value)
{
setAttribute("WM/AlbumTitle", value);
}
void ASF::Tag::setGenre(const String &value)
{
setAttribute("WM/Genre", value);
}
void ASF::Tag::setYear(unsigned int value)
{
setAttribute("WM/Year", String::number(value));
}
void ASF::Tag::setTrack(unsigned int value)
{
setAttribute("WM/TrackNumber", String::number(value));
}
ASF::AttributeListMap& ASF::Tag::attributeListMap()
{
return d->attributeListMap;
}
const ASF::AttributeListMap &ASF::Tag::attributeListMap() const
{
return d->attributeListMap;
}
bool ASF::Tag::contains(const String &key) const
{
return d->attributeListMap.contains(key);
}
void ASF::Tag::removeItem(const String &key)
{
d->attributeListMap.erase(key);
}
ASF::AttributeList ASF::Tag::attribute(const String &name) const
{
return d->attributeListMap[name];
}
void ASF::Tag::setAttribute(const String &name, const Attribute &attribute)
{
AttributeList value;
value.append(attribute);
d->attributeListMap.insert(name, value);
}
void ASF::Tag::setAttribute(const String &name, const AttributeList &values)
{
d->attributeListMap.insert(name, values);
}
void ASF::Tag::addAttribute(const String &name, const Attribute &attribute)
{
if(d->attributeListMap.contains(name)) {
d->attributeListMap[name].append(attribute);
}
else {
setAttribute(name, attribute);
}
}
bool ASF::Tag::isEmpty() const
{
return TagLib::Tag::isEmpty() &&
copyright().isEmpty() &&
rating().isEmpty() &&
d->attributeListMap.isEmpty();
}
namespace
{
const char *keyTranslation[][2] = {
{ "WM/AlbumTitle", "ALBUM" },
{ "WM/AlbumArtist", "ALBUMARTIST" },
{ "WM/Composer", "COMPOSER" },
{ "WM/Writer", "LYRICIST" },
{ "WM/Conductor", "CONDUCTOR" },
{ "WM/ModifiedBy", "REMIXER" },
{ "WM/Year", "DATE" },
{ "WM/OriginalReleaseYear", "ORIGINALDATE" },
{ "WM/Producer", "PRODUCER" },
{ "WM/ContentGroupDescription", "GROUPING" },
{ "WM/SubTitle", "SUBTITLE" },
{ "WM/SetSubTitle", "DISCSUBTITLE" },
{ "WM/TrackNumber", "TRACKNUMBER" },
{ "WM/PartOfSet", "DISCNUMBER" },
{ "WM/Genre", "GENRE" },
{ "WM/BeatsPerMinute", "BPM" },
{ "WM/Mood", "MOOD" },
{ "WM/ISRC", "ISRC" },
{ "WM/Lyrics", "LYRICS" },
{ "WM/Media", "MEDIA" },
{ "WM/Publisher", "LABEL" },
{ "WM/CatalogNo", "CATALOGNUMBER" },
{ "WM/Barcode", "BARCODE" },
{ "WM/EncodedBy", "ENCODEDBY" },
{ "WM/AlbumSortOrder", "ALBUMSORT" },
{ "WM/AlbumArtistSortOrder", "ALBUMARTISTSORT" },
{ "WM/ArtistSortOrder", "ARTISTSORT" },
{ "WM/TitleSortOrder", "TITLESORT" },
{ "WM/Script", "SCRIPT" },
{ "WM/Language", "LANGUAGE" },
{ "WM/ARTISTS", "ARTISTS" },
{ "ASIN", "ASIN" },
{ "MusicBrainz/Track Id", "MUSICBRAINZ_TRACKID" },
{ "MusicBrainz/Artist Id", "MUSICBRAINZ_ARTISTID" },
{ "MusicBrainz/Album Id", "MUSICBRAINZ_ALBUMID" },
{ "MusicBrainz/Album Artist Id", "MUSICBRAINZ_ALBUMARTISTID" },
{ "MusicBrainz/Album Release Country", "RELEASECOUNTRY" },
{ "MusicBrainz/Album Status", "RELEASESTATUS" },
{ "MusicBrainz/Album Type", "RELEASETYPE" },
{ "MusicBrainz/Release Group Id", "MUSICBRAINZ_RELEASEGROUPID" },
{ "MusicBrainz/Release Track Id", "MUSICBRAINZ_RELEASETRACKID" },
{ "MusicBrainz/Work Id", "MUSICBRAINZ_WORKID" },
{ "MusicIP/PUID", "MUSICIP_PUID" },
{ "Acoustid/Id", "ACOUSTID_ID" },
{ "Acoustid/Fingerprint", "ACOUSTID_FINGERPRINT" },
};
const size_t keyTranslationSize = sizeof(keyTranslation) / sizeof(keyTranslation[0]);
String translateKey(const String &key)
{
for(size_t i = 0; i < keyTranslationSize; ++i) {
if(key == keyTranslation[i][0])
return keyTranslation[i][1];
}
return String();
}
}
PropertyMap ASF::Tag::properties() const
{
PropertyMap props;
if(!d->title.isEmpty()) {
props["TITLE"] = d->title;
}
if(!d->artist.isEmpty()) {
props["ARTIST"] = d->artist;
}
if(!d->copyright.isEmpty()) {
props["COPYRIGHT"] = d->copyright;
}
if(!d->comment.isEmpty()) {
props["COMMENT"] = d->comment;
}
ASF::AttributeListMap::ConstIterator it = d->attributeListMap.begin();
for(; it != d->attributeListMap.end(); ++it) {
const String key = translateKey(it->first);
if(!key.isEmpty()) {
AttributeList::ConstIterator it2 = it->second.begin();
for(; it2 != it->second.end(); ++it2) {
if(key == "TRACKNUMBER") {
if(it2->type() == ASF::Attribute::DWordType)
props.insert(key, String::number(it2->toUInt()));
else
props.insert(key, it2->toString());
}
else {
props.insert(key, it2->toString());
}
}
}
else {
props.unsupportedData().append(it->first);
}
}
return props;
}
void ASF::Tag::removeUnsupportedProperties(const StringList &props)
{
StringList::ConstIterator it = props.begin();
for(; it != props.end(); ++it)
d->attributeListMap.erase(*it);
}
PropertyMap ASF::Tag::setProperties(const PropertyMap &props)
{
static Map<String, String> reverseKeyMap;
if(reverseKeyMap.isEmpty()) {
int numKeys = sizeof(keyTranslation) / sizeof(keyTranslation[0]);
for(int i = 0; i < numKeys; i++) {
reverseKeyMap[keyTranslation[i][1]] = keyTranslation[i][0];
}
}
PropertyMap origProps = properties();
PropertyMap::ConstIterator it = origProps.begin();
for(; it != origProps.end(); ++it) {
if(!props.contains(it->first) || props[it->first].isEmpty()) {
if(it->first == "TITLE") {
d->title.clear();
}
else if(it->first == "ARTIST") {
d->artist.clear();
}
else if(it->first == "COMMENT") {
d->comment.clear();
}
else if(it->first == "COPYRIGHT") {
d->copyright.clear();
}
else {
d->attributeListMap.erase(reverseKeyMap[it->first]);
}
}
}
PropertyMap ignoredProps;
it = props.begin();
for(; it != props.end(); ++it) {
if(reverseKeyMap.contains(it->first)) {
String name = reverseKeyMap[it->first];
removeItem(name);
StringList::ConstIterator it2 = it->second.begin();
for(; it2 != it->second.end(); ++it2) {
addAttribute(name, *it2);
}
}
else if(it->first == "TITLE") {
d->title = it->second.toString();
}
else if(it->first == "ARTIST") {
d->artist = it->second.toString();
}
else if(it->first == "COMMENT") {
d->comment = it->second.toString();
}
else if(it->first == "COPYRIGHT") {
d->copyright = it->second.toString();
}
else {
ignoredProps.insert(it->first, it->second);
}
}
return ignoredProps;
}

210
taglib/asf/asftag.h Normal file
View File

@@ -0,0 +1,210 @@
/**************************************************************************
copyright : (C) 2005-2007 by Lukáš Lalinský
email : lalinsky@gmail.com
**************************************************************************/
/***************************************************************************
* This library is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License version *
* 2.1 as published by the Free Software Foundation. *
* *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#ifndef TAGLIB_ASFTAG_H
#define TAGLIB_ASFTAG_H
#include "tag.h"
#include "tlist.h"
#include "tmap.h"
#include "taglib_export.h"
#include "asfattribute.h"
namespace TagLib {
namespace ASF {
typedef List<Attribute> AttributeList;
typedef Map<String, AttributeList> AttributeListMap;
class TAGLIB_EXPORT Tag : public TagLib::Tag {
friend class File;
public:
Tag();
virtual ~Tag();
/*!
* Returns the track name.
*/
virtual String title() const;
/*!
* Returns the artist name.
*/
virtual String artist() const;
/*!
* Returns the album name; if no album name is present in the tag
* String::null will be returned.
*/
virtual String album() const;
/*!
* Returns the track comment.
*/
virtual String comment() const;
/*!
* Returns the genre name; if no genre is present in the tag String::null
* will be returned.
*/
virtual String genre() const;
/*!
* Returns the rating.
*/
virtual String rating() const;
/*!
* Returns the genre name; if no genre is present in the tag String::null
* will be returned.
*/
virtual String copyright() const;
/*!
* Returns the year; if there is no year set, this will return 0.
*/
virtual unsigned int year() const;
/*!
* Returns the track number; if there is no track number set, this will
* return 0.
*/
virtual unsigned int track() const;
/*!
* Sets the title to \a s.
*/
virtual void setTitle(const String &s);
/*!
* Sets the artist to \a s.
*/
virtual void setArtist(const String &s);
/*!
* Sets the album to \a s. If \a s is String::null then this value will be
* cleared.
*/
virtual void setAlbum(const String &s);
/*!
* Sets the comment to \a s.
*/
virtual void setComment(const String &s);
/*!
* Sets the rating to \a s.
*/
virtual void setRating(const String &s);
/*!
* Sets the copyright to \a s.
*/
virtual void setCopyright(const String &s);
/*!
* Sets the genre to \a s.
*/
virtual void setGenre(const String &s);
/*!
* Sets the year to \a i. If \a s is 0 then this value will be cleared.
*/
virtual void setYear(unsigned int i);
/*!
* Sets the track to \a i. If \a s is 0 then this value will be cleared.
*/
virtual void setTrack(unsigned int i);
/*!
* Returns true if the tag does not contain any data. This should be
* reimplemented in subclasses that provide more than the basic tagging
* abilities in this class.
*/
virtual bool isEmpty() const;
/*!
* \deprecated
*/
AttributeListMap &attributeListMap();
/*!
* Returns a reference to the item list map. This is an AttributeListMap of
* all of the items in the tag.
*/
// BIC: return by value
const AttributeListMap &attributeListMap() const;
/*!
* \return True if a value for \a attribute is currently set.
*/
bool contains(const String &name) const;
/*!
* Removes the \a key attribute from the tag
*/
void removeItem(const String &name);
/*!
* \return The list of values for the key \a name, or an empty list if no
* values have been set.
*/
AttributeList attribute(const String &name) const;
/*!
* Sets the \a key attribute to the value of \a attribute. If an attribute
* with the \a key is already present, it will be replaced.
*/
void setAttribute(const String &name, const Attribute &attribute);
/*!
* Sets multiple \a values to the key \a name.
*/
void setAttribute(const String &name, const AttributeList &values);
/*!
* Sets the \a key attribute to the value of \a attribute. If an attribute
* with the \a key is already present, it will be added to the list.
*/
void addAttribute(const String &name, const Attribute &attribute);
PropertyMap properties() const;
void removeUnsupportedProperties(const StringList& properties);
PropertyMap setProperties(const PropertyMap &properties);
private:
class TagPrivate;
TagPrivate *d;
};
}
}
#endif

104
taglib/asf/asfutils.h Normal file
View File

@@ -0,0 +1,104 @@
/***************************************************************************
copyright : (C) 2015 by Tsuda Kageyu
email : tsuda.kageyu@gmail.com
***************************************************************************/
/***************************************************************************
* This library is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License version *
* 2.1 as published by the Free Software Foundation. *
* *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#ifndef TAGLIB_ASFUTILS_H
#define TAGLIB_ASFUTILS_H
// THIS FILE IS NOT A PART OF THE TAGLIB API
#ifndef DO_NOT_DOCUMENT // tell Doxygen not to document this header
namespace TagLib
{
namespace ASF
{
namespace
{
inline unsigned short readWORD(File *file, bool *ok = 0)
{
const ByteVector v = file->readBlock(2);
if(v.size() != 2) {
if(ok) *ok = false;
return 0;
}
if(ok) *ok = true;
return v.toUShort(false);
}
inline unsigned int readDWORD(File *file, bool *ok = 0)
{
const ByteVector v = file->readBlock(4);
if(v.size() != 4) {
if(ok) *ok = false;
return 0;
}
if(ok) *ok = true;
return v.toUInt(false);
}
inline long long readQWORD(File *file, bool *ok = 0)
{
const ByteVector v = file->readBlock(8);
if(v.size() != 8) {
if(ok) *ok = false;
return 0;
}
if(ok) *ok = true;
return v.toLongLong(false);
}
inline String readString(File *file, int length)
{
ByteVector data = file->readBlock(length);
unsigned int size = data.size();
while (size >= 2) {
if(data[size - 1] != '\0' || data[size - 2] != '\0') {
break;
}
size -= 2;
}
if(size != data.size()) {
data.resize(size);
}
return String(data, String::UTF16LE);
}
inline ByteVector renderString(const String &str, bool includeLength = false)
{
ByteVector data = str.data(String::UTF16LE) + ByteVector::fromShort(0, false);
if(includeLength) {
data = ByteVector::fromShort(data.size(), false) + data;
}
return data;
}
}
}
}
#endif
#endif

View File

@@ -15,18 +15,67 @@
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
* USA *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#include <tbytevector.h>
#include "aiffproperties.h"
#include "apeproperties.h"
#include "asfproperties.h"
#include "flacproperties.h"
#include "mp4properties.h"
#include "mpcproperties.h"
#include "mpegproperties.h"
#include "opusproperties.h"
#include "speexproperties.h"
#include "trueaudioproperties.h"
#include "vorbisproperties.h"
#include "wavproperties.h"
#include "wavpackproperties.h"
#include "audioproperties.h"
using namespace TagLib;
// This macro is a workaround for the fact that we can't add virtual functions.
// Should be true virtual functions in taglib2.
#define VIRTUAL_FUNCTION_WORKAROUND(function_name, default_value) \
if(dynamic_cast<const APE::Properties*>(this)) \
return dynamic_cast<const APE::Properties*>(this)->function_name(); \
else if(dynamic_cast<const ASF::Properties*>(this)) \
return dynamic_cast<const ASF::Properties*>(this)->function_name(); \
else if(dynamic_cast<const FLAC::Properties*>(this)) \
return dynamic_cast<const FLAC::Properties*>(this)->function_name(); \
else if(dynamic_cast<const MP4::Properties*>(this)) \
return dynamic_cast<const MP4::Properties*>(this)->function_name(); \
else if(dynamic_cast<const MPC::Properties*>(this)) \
return dynamic_cast<const MPC::Properties*>(this)->function_name(); \
else if(dynamic_cast<const MPEG::Properties*>(this)) \
return dynamic_cast<const MPEG::Properties*>(this)->function_name(); \
else if(dynamic_cast<const Ogg::Opus::Properties*>(this)) \
return dynamic_cast<const Ogg::Opus::Properties*>(this)->function_name(); \
else if(dynamic_cast<const Ogg::Speex::Properties*>(this)) \
return dynamic_cast<const Ogg::Speex::Properties*>(this)->function_name(); \
else if(dynamic_cast<const TrueAudio::Properties*>(this)) \
return dynamic_cast<const TrueAudio::Properties*>(this)->function_name(); \
else if(dynamic_cast<const RIFF::AIFF::Properties*>(this)) \
return dynamic_cast<const RIFF::AIFF::Properties*>(this)->function_name(); \
else if(dynamic_cast<const RIFF::WAV::Properties*>(this)) \
return dynamic_cast<const RIFF::WAV::Properties*>(this)->function_name(); \
else if(dynamic_cast<const Vorbis::Properties*>(this)) \
return dynamic_cast<const Vorbis::Properties*>(this)->function_name(); \
else if(dynamic_cast<const WavPack::Properties*>(this)) \
return dynamic_cast<const WavPack::Properties*>(this)->function_name(); \
else \
return (default_value);
class AudioProperties::AudioPropertiesPrivate
{
@@ -41,11 +90,22 @@ AudioProperties::~AudioProperties()
}
int AudioProperties::lengthInSeconds() const
{
VIRTUAL_FUNCTION_WORKAROUND(lengthInSeconds, 0)
}
int AudioProperties::lengthInMilliseconds() const
{
VIRTUAL_FUNCTION_WORKAROUND(lengthInMilliseconds, 0)
}
////////////////////////////////////////////////////////////////////////////////
// protected methods
////////////////////////////////////////////////////////////////////////////////
AudioProperties::AudioProperties(ReadStyle)
AudioProperties::AudioProperties(ReadStyle) :
d(0)
{
}

View File

@@ -15,8 +15,8 @@
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
* USA *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
@@ -34,7 +34,7 @@ namespace TagLib {
/*!
* The values here are common to most audio formats. For more specific, codec
* dependant values, please see see the subclasses APIs. This is meant to
* dependent values, please see see the subclasses APIs. This is meant to
* compliment the TagLib::File and TagLib::Tag APIs in providing a simple
* interface that is sufficient for most applications.
*/
@@ -69,6 +69,23 @@ namespace TagLib {
*/
virtual int length() const = 0;
/*!
* Returns the length of the file in seconds. The length is rounded down to
* the nearest whole second.
*
* \see lengthInMilliseconds()
*/
// BIC: make virtual
int lengthInSeconds() const;
/*!
* Returns the length of the file in milliseconds.
*
* \see lengthInSeconds()
*/
// BIC: make virtual
int lengthInMilliseconds() const;
/*!
* Returns the most appropriate bit rate for the file in kb/s. For constant
* bitrate formats this is simply the bitrate of the file. For variable

View File

@@ -1,6 +1,10 @@
/***************************************************************************
copyright : (C) 2002 - 2008 by Scott Wheeler
email : wheeler@kde.org
copyright : (C) 2010 by Alex Novichkov
email : novichko@atnet.ru
(added APE file support)
***************************************************************************/
/***************************************************************************
@@ -15,64 +19,303 @@
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
* USA *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#include <cstring>
#include <tfile.h>
#include <tfilestream.h>
#include <tstring.h>
#include <tdebug.h>
#include <trefcounter.h>
#include "fileref.h"
#include "asffile.h"
#include "mpegfile.h"
#include "vorbisfile.h"
#include "flacfile.h"
#include "oggflacfile.h"
#include "mpcfile.h"
#include "mp4file.h"
#include "wavpackfile.h"
#include "speexfile.h"
#include "opusfile.h"
#include "trueaudiofile.h"
#include "aifffile.h"
#include "wavfile.h"
#include "apefile.h"
#include "modfile.h"
#include "s3mfile.h"
#include "itfile.h"
#include "xmfile.h"
using namespace TagLib;
namespace
{
typedef List<const FileRef::FileTypeResolver *> ResolverList;
ResolverList fileTypeResolvers;
// Detect the file type by user-defined resolvers.
File *detectByResolvers(FileName fileName, bool readAudioProperties,
AudioProperties::ReadStyle audioPropertiesStyle)
{
#ifdef _WIN32
if(::strlen(fileName) == 0 && ::wcslen(fileName) == 0)
return 0;
#else
if(::strlen(fileName) == 0)
return 0;
#endif
ResolverList::ConstIterator it = fileTypeResolvers.begin();
for(; it != fileTypeResolvers.end(); ++it) {
File *file = (*it)->createFile(fileName, readAudioProperties, audioPropertiesStyle);
if(file)
return file;
}
return 0;
}
// Detect the file type based on the file extension.
File* detectByExtension(IOStream *stream, bool readAudioProperties,
AudioProperties::ReadStyle audioPropertiesStyle)
{
#ifdef _WIN32
const String s = stream->name().toString();
#else
const String s(stream->name());
#endif
String ext;
const int pos = s.rfind(".");
if(pos != -1)
ext = s.substr(pos + 1).upper();
// If this list is updated, the method defaultFileExtensions() should also be
// updated. However at some point that list should be created at the same time
// that a default file type resolver is created.
if(ext.isEmpty())
return 0;
// .oga can be any audio in the Ogg container. So leave it to content-based detection.
if(ext == "MP3")
return new MPEG::File(stream, ID3v2::FrameFactory::instance(), readAudioProperties, audioPropertiesStyle);
if(ext == "OGG")
return new Ogg::Vorbis::File(stream, readAudioProperties, audioPropertiesStyle);
if(ext == "FLAC")
return new FLAC::File(stream, ID3v2::FrameFactory::instance(), readAudioProperties, audioPropertiesStyle);
if(ext == "MPC")
return new MPC::File(stream, readAudioProperties, audioPropertiesStyle);
if(ext == "WV")
return new WavPack::File(stream, readAudioProperties, audioPropertiesStyle);
if(ext == "SPX")
return new Ogg::Speex::File(stream, readAudioProperties, audioPropertiesStyle);
if(ext == "OPUS")
return new Ogg::Opus::File(stream, readAudioProperties, audioPropertiesStyle);
if(ext == "TTA")
return new TrueAudio::File(stream, readAudioProperties, audioPropertiesStyle);
if(ext == "M4A" || ext == "M4R" || ext == "M4B" || ext == "M4P" || ext == "MP4" || ext == "3G2" || ext == "M4V")
return new MP4::File(stream, readAudioProperties, audioPropertiesStyle);
if(ext == "WMA" || ext == "ASF")
return new ASF::File(stream, readAudioProperties, audioPropertiesStyle);
if(ext == "AIF" || ext == "AIFF" || ext == "AFC" || ext == "AIFC")
return new RIFF::AIFF::File(stream, readAudioProperties, audioPropertiesStyle);
if(ext == "WAV")
return new RIFF::WAV::File(stream, readAudioProperties, audioPropertiesStyle);
if(ext == "APE")
return new APE::File(stream, readAudioProperties, audioPropertiesStyle);
// module, nst and wow are possible but uncommon extensions
if(ext == "MOD" || ext == "MODULE" || ext == "NST" || ext == "WOW")
return new Mod::File(stream, readAudioProperties, audioPropertiesStyle);
if(ext == "S3M")
return new S3M::File(stream, readAudioProperties, audioPropertiesStyle);
if(ext == "IT")
return new IT::File(stream, readAudioProperties, audioPropertiesStyle);
if(ext == "XM")
return new XM::File(stream, readAudioProperties, audioPropertiesStyle);
return 0;
}
// Detect the file type based on the actual content of the stream.
File *detectByContent(IOStream *stream, bool readAudioProperties,
AudioProperties::ReadStyle audioPropertiesStyle)
{
File *file = 0;
if(MPEG::File::isSupported(stream))
file = new MPEG::File(stream, ID3v2::FrameFactory::instance(), readAudioProperties, audioPropertiesStyle);
else if(Ogg::Vorbis::File::isSupported(stream))
file = new Ogg::Vorbis::File(stream, readAudioProperties, audioPropertiesStyle);
else if(Ogg::FLAC::File::isSupported(stream))
file = new Ogg::FLAC::File(stream, readAudioProperties, audioPropertiesStyle);
else if(FLAC::File::isSupported(stream))
file = new FLAC::File(stream, ID3v2::FrameFactory::instance(), readAudioProperties, audioPropertiesStyle);
else if(MPC::File::isSupported(stream))
file = new MPC::File(stream, readAudioProperties, audioPropertiesStyle);
else if(WavPack::File::isSupported(stream))
file = new WavPack::File(stream, readAudioProperties, audioPropertiesStyle);
else if(Ogg::Speex::File::isSupported(stream))
file = new Ogg::Speex::File(stream, readAudioProperties, audioPropertiesStyle);
else if(Ogg::Opus::File::isSupported(stream))
file = new Ogg::Opus::File(stream, readAudioProperties, audioPropertiesStyle);
else if(TrueAudio::File::isSupported(stream))
file = new TrueAudio::File(stream, readAudioProperties, audioPropertiesStyle);
else if(MP4::File::isSupported(stream))
file = new MP4::File(stream, readAudioProperties, audioPropertiesStyle);
else if(ASF::File::isSupported(stream))
file = new ASF::File(stream, readAudioProperties, audioPropertiesStyle);
else if(RIFF::AIFF::File::isSupported(stream))
file = new RIFF::AIFF::File(stream, readAudioProperties, audioPropertiesStyle);
else if(RIFF::WAV::File::isSupported(stream))
file = new RIFF::WAV::File(stream, readAudioProperties, audioPropertiesStyle);
else if(APE::File::isSupported(stream))
file = new APE::File(stream, readAudioProperties, audioPropertiesStyle);
// isSupported() only does a quick check, so double check the file here.
if(file) {
if(file->isValid())
return file;
else
delete file;
}
return 0;
}
// Internal function that supports FileRef::create().
// This looks redundant, but necessary in order not to change the previous
// behavior of FileRef::create().
File* createInternal(FileName fileName, bool readAudioProperties,
AudioProperties::ReadStyle audioPropertiesStyle)
{
File *file = detectByResolvers(fileName, readAudioProperties, audioPropertiesStyle);
if(file)
return file;
#ifdef _WIN32
const String s = fileName.toString();
#else
const String s(fileName);
#endif
String ext;
const int pos = s.rfind(".");
if(pos != -1)
ext = s.substr(pos + 1).upper();
if(ext.isEmpty())
return 0;
if(ext == "MP3")
return new MPEG::File(fileName, ID3v2::FrameFactory::instance(), readAudioProperties, audioPropertiesStyle);
if(ext == "OGG")
return new Ogg::Vorbis::File(fileName, readAudioProperties, audioPropertiesStyle);
if(ext == "OGA") {
/* .oga can be any audio in the Ogg container. First try FLAC, then Vorbis. */
File *file = new Ogg::FLAC::File(fileName, readAudioProperties, audioPropertiesStyle);
if(file->isValid())
return file;
delete file;
return new Ogg::Vorbis::File(fileName, readAudioProperties, audioPropertiesStyle);
}
if(ext == "FLAC")
return new FLAC::File(fileName, ID3v2::FrameFactory::instance(), readAudioProperties, audioPropertiesStyle);
if(ext == "MPC")
return new MPC::File(fileName, readAudioProperties, audioPropertiesStyle);
if(ext == "WV")
return new WavPack::File(fileName, readAudioProperties, audioPropertiesStyle);
if(ext == "SPX")
return new Ogg::Speex::File(fileName, readAudioProperties, audioPropertiesStyle);
if(ext == "OPUS")
return new Ogg::Opus::File(fileName, readAudioProperties, audioPropertiesStyle);
if(ext == "TTA")
return new TrueAudio::File(fileName, readAudioProperties, audioPropertiesStyle);
if(ext == "M4A" || ext == "M4R" || ext == "M4B" || ext == "M4P" || ext == "MP4" || ext == "3G2" || ext == "M4V")
return new MP4::File(fileName, readAudioProperties, audioPropertiesStyle);
if(ext == "WMA" || ext == "ASF")
return new ASF::File(fileName, readAudioProperties, audioPropertiesStyle);
if(ext == "AIF" || ext == "AIFF" || ext == "AFC" || ext == "AIFC")
return new RIFF::AIFF::File(fileName, readAudioProperties, audioPropertiesStyle);
if(ext == "WAV")
return new RIFF::WAV::File(fileName, readAudioProperties, audioPropertiesStyle);
if(ext == "APE")
return new APE::File(fileName, readAudioProperties, audioPropertiesStyle);
// module, nst and wow are possible but uncommon extensions
if(ext == "MOD" || ext == "MODULE" || ext == "NST" || ext == "WOW")
return new Mod::File(fileName, readAudioProperties, audioPropertiesStyle);
if(ext == "S3M")
return new S3M::File(fileName, readAudioProperties, audioPropertiesStyle);
if(ext == "IT")
return new IT::File(fileName, readAudioProperties, audioPropertiesStyle);
if(ext == "XM")
return new XM::File(fileName, readAudioProperties, audioPropertiesStyle);
return 0;
}
}
class FileRef::FileRefPrivate : public RefCounter
{
public:
FileRefPrivate(File *f) : RefCounter(), file(f) {}
FileRefPrivate() :
RefCounter(),
file(0),
stream(0) {}
~FileRefPrivate() {
delete file;
delete stream;
}
File *file;
static List<const FileTypeResolver *> fileTypeResolvers;
File *file;
IOStream *stream;
};
List<const FileRef::FileTypeResolver *> FileRef::FileRefPrivate::fileTypeResolvers;
////////////////////////////////////////////////////////////////////////////////
// public members
////////////////////////////////////////////////////////////////////////////////
FileRef::FileRef()
FileRef::FileRef() :
d(new FileRefPrivate())
{
d = new FileRefPrivate(0);
}
FileRef::FileRef(FileName fileName, bool readAudioProperties,
AudioProperties::ReadStyle audioPropertiesStyle)
AudioProperties::ReadStyle audioPropertiesStyle) :
d(new FileRefPrivate())
{
d = new FileRefPrivate(create(fileName, readAudioProperties, audioPropertiesStyle));
parse(fileName, readAudioProperties, audioPropertiesStyle);
}
FileRef::FileRef(File *file)
FileRef::FileRef(IOStream* stream, bool readAudioProperties, AudioProperties::ReadStyle audioPropertiesStyle) :
d(new FileRefPrivate())
{
d = new FileRefPrivate(file);
parse(stream, readAudioProperties, audioPropertiesStyle);
}
FileRef::FileRef(const FileRef &ref) : d(ref.d)
FileRef::FileRef(File *file) :
d(new FileRefPrivate())
{
d->file = file;
}
FileRef::FileRef(const FileRef &ref) :
d(ref.d)
{
d->ref();
}
@@ -85,11 +328,19 @@ FileRef::~FileRef()
Tag *FileRef::tag() const
{
if(isNull()) {
debug("FileRef::tag() - Called without a valid file.");
return 0;
}
return d->file->tag();
}
AudioProperties *FileRef::audioProperties() const
{
if(isNull()) {
debug("FileRef::audioProperties() - Called without a valid file.");
return 0;
}
return d->file->audioProperties();
}
@@ -100,12 +351,16 @@ File *FileRef::file() const
bool FileRef::save()
{
if(isNull()) {
debug("FileRef::save() - Called without a valid file.");
return false;
}
return d->file->save();
}
const FileRef::FileTypeResolver *FileRef::addFileTypeResolver(const FileRef::FileTypeResolver *resolver) // static
{
FileRefPrivate::fileTypeResolvers.prepend(resolver);
fileTypeResolvers.prepend(resolver);
return resolver;
}
@@ -116,88 +371,120 @@ StringList FileRef::defaultFileExtensions()
l.append("ogg");
l.append("flac");
l.append("oga");
l.append("opus");
l.append("mp3");
l.append("mpc");
l.append("wv");
l.append("spx");
l.append("tta");
l.append("m4a");
l.append("m4r");
l.append("m4b");
l.append("m4p");
l.append("3g2");
l.append("mp4");
l.append("m4v");
l.append("wma");
l.append("asf");
l.append("aif");
l.append("aiff");
l.append("afc");
l.append("aifc");
l.append("wav");
l.append("ape");
l.append("mod");
l.append("module"); // alias for "mod"
l.append("nst"); // alias for "mod"
l.append("wow"); // alias for "mod"
l.append("s3m");
l.append("it");
l.append("xm");
return l;
}
bool FileRef::isNull() const
{
return !d->file || !d->file->isValid();
return (!d->file || !d->file->isValid());
}
FileRef &FileRef::operator=(const FileRef &ref)
{
if(&ref == this)
return *this;
if(d->deref())
delete d;
d = ref.d;
d->ref();
FileRef(ref).swap(*this);
return *this;
}
void FileRef::swap(FileRef &ref)
{
using std::swap;
swap(d, ref.d);
}
bool FileRef::operator==(const FileRef &ref) const
{
return ref.d->file == d->file;
return (ref.d->file == d->file);
}
bool FileRef::operator!=(const FileRef &ref) const
{
return ref.d->file != d->file;
return (ref.d->file != d->file);
}
File *FileRef::create(FileName fileName, bool readAudioProperties,
AudioProperties::ReadStyle audioPropertiesStyle) // static
{
List<const FileTypeResolver *>::ConstIterator it = FileRefPrivate::fileTypeResolvers.begin();
for(; it != FileRefPrivate::fileTypeResolvers.end(); ++it) {
File *file = (*it)->createFile(fileName, readAudioProperties, audioPropertiesStyle);
if(file)
return file;
}
// Ok, this is really dumb for now, but it works for testing.
String s;
#ifdef _WIN32
s = (wcslen((const wchar_t *) fileName) > 0) ? String((const wchar_t *) fileName) : String((const char *) fileName);
#else
s = fileName;
#endif
// If this list is updated, the method defaultFileExtensions() should also be
// updated. However at some point that list should be created at the same time
// that a default file type resolver is created.
if(s.size() > 4) {
if(s.substr(s.size() - 4, 4).upper() == ".OGG")
return new Ogg::Vorbis::File(fileName, readAudioProperties, audioPropertiesStyle);
if(s.substr(s.size() - 4, 4).upper() == ".MP3")
return new MPEG::File(fileName, readAudioProperties, audioPropertiesStyle);
if(s.substr(s.size() - 4, 4).upper() == ".OGA")
return new Ogg::FLAC::File(fileName, readAudioProperties, audioPropertiesStyle);
if(s.substr(s.size() - 5, 5).upper() == ".FLAC")
return new FLAC::File(fileName, readAudioProperties, audioPropertiesStyle);
if(s.substr(s.size() - 4, 4).upper() == ".MPC")
return new MPC::File(fileName, readAudioProperties, audioPropertiesStyle);
if(s.substr(s.size() - 3, 3).upper() == ".WV")
return new WavPack::File(fileName, readAudioProperties, audioPropertiesStyle);
if(s.substr(s.size() - 4, 4).upper() == ".SPX")
return new Ogg::Speex::File(fileName, readAudioProperties, audioPropertiesStyle);
if(s.substr(s.size() - 4, 4).upper() == ".TTA")
return new TrueAudio::File(fileName, readAudioProperties, audioPropertiesStyle);
}
return 0;
return createInternal(fileName, readAudioProperties, audioPropertiesStyle);
}
////////////////////////////////////////////////////////////////////////////////
// private members
////////////////////////////////////////////////////////////////////////////////
void FileRef::parse(FileName fileName, bool readAudioProperties,
AudioProperties::ReadStyle audioPropertiesStyle)
{
// Try user-defined resolvers.
d->file = detectByResolvers(fileName, readAudioProperties, audioPropertiesStyle);
if(d->file)
return;
// Try to resolve file types based on the file extension.
d->stream = new FileStream(fileName);
d->file = detectByExtension(d->stream, readAudioProperties, audioPropertiesStyle);
if(d->file)
return;
// At last, try to resolve file types based on the actual content.
d->file = detectByContent(d->stream, readAudioProperties, audioPropertiesStyle);
if(d->file)
return;
// Stream have to be closed here if failed to resolve file types.
delete d->stream;
d->stream = 0;
}
void FileRef::parse(IOStream *stream, bool readAudioProperties,
AudioProperties::ReadStyle audioPropertiesStyle)
{
// Try user-defined resolvers.
d->file = detectByResolvers(stream->name(), readAudioProperties, audioPropertiesStyle);
if(d->file)
return;
// Try to resolve file types based on the file extension.
d->file = detectByExtension(stream, readAudioProperties, audioPropertiesStyle);
if(d->file)
return;
// At last, try to resolve file types based on the actual content of the file.
d->file = detectByContent(stream, readAudioProperties, audioPropertiesStyle);
}

View File

@@ -15,8 +15,8 @@
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
* USA *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
@@ -26,8 +26,8 @@
#ifndef TAGLIB_FILEREF_H
#define TAGLIB_FILEREF_H
#include <tfile.h>
#include <tstringlist.h>
#include "tfile.h"
#include "tstringlist.h"
#include "taglib_export.h"
#include "audioproperties.h"
@@ -72,7 +72,7 @@ namespace TagLib {
*
* class MyFileTypeResolver : FileTypeResolver
* {
* TagLib::File *createFile(TagLib::FileName *fileName, bool, AudioProperties::ReadStyle)
* TagLib::File *createFile(TagLib::FileName *fileName, bool, AudioProperties::ReadStyle) const
* {
* if(someCheckForAnMP3File(fileName))
* return new TagLib::MPEG::File(fileName);
@@ -91,10 +91,8 @@ namespace TagLib {
class TAGLIB_EXPORT FileTypeResolver
{
TAGLIB_IGNORE_MISSING_DESTRUCTOR
public:
// do not fix compiler warning about missing virtual destructor
// since this would not be binary compatible
// let Scott fix it whenever he thinks BIC changes can next be applied
/*!
* This method must be overridden to provide an additional file type
* resolver. If the resolver is able to determine the file type it should
@@ -130,7 +128,24 @@ namespace TagLib {
audioPropertiesStyle = AudioProperties::Average);
/*!
* Contruct a FileRef using \a file. The FileRef now takes ownership of the
* Construct a FileRef from an opened \a IOStream. If \a readAudioProperties
* is true then the audio properties will be read using \a audioPropertiesStyle.
* If \a readAudioProperties is false then \a audioPropertiesStyle will be
* ignored.
*
* Also see the note in the class documentation about why you may not want to
* use this method in your application.
*
* \note TagLib will *not* take ownership of the stream, the caller is
* responsible for deleting it after the File object.
*/
explicit FileRef(IOStream* stream,
bool readAudioProperties = true,
AudioProperties::ReadStyle
audioPropertiesStyle = AudioProperties::Average);
/*!
* Construct a FileRef using \a file. The FileRef now takes ownership of the
* pointer and will delete the File when it passes out of scope.
*/
explicit FileRef(File *file);
@@ -151,6 +166,9 @@ namespace TagLib {
* \warning This pointer will become invalid when this FileRef and all
* copies pass out of scope.
*
* \warning Do not cast it to any subclasses of Tag.
* Use tag returning methods of appropriate subclasses of File instead.
*
* \see File::tag()
*/
Tag *tag() const;
@@ -190,7 +208,7 @@ namespace TagLib {
* is tried.
*
* Returns a pointer to the added resolver (the same one that's passed in --
* this is mostly so that static inialializers have something to use for
* this is mostly so that static initializers have something to use for
* assignment).
*
* \see FileTypeResolver
@@ -208,7 +226,7 @@ namespace TagLib {
* by TagLib for resolution is case-insensitive.
*
* \note This does not account for any additional file type resolvers that
* are plugged in. Also note that this is not intended to replace a propper
* are plugged in. Also note that this is not intended to replace a proper
* mime-type resolution system, but is just here for reference.
*
* \see FileTypeResolver
@@ -225,6 +243,11 @@ namespace TagLib {
*/
FileRef &operator=(const FileRef &ref);
/*!
* Exchanges the content of the FileRef by the content of \a ref.
*/
void swap(FileRef &ref);
/*!
* Returns true if this FileRef and \a ref point to the same File object.
*/
@@ -251,8 +274,10 @@ namespace TagLib {
bool readAudioProperties = true,
AudioProperties::ReadStyle audioPropertiesStyle = AudioProperties::Average);
private:
void parse(FileName fileName, bool readAudioProperties, AudioProperties::ReadStyle audioPropertiesStyle);
void parse(IOStream *stream, bool readAudioProperties, AudioProperties::ReadStyle audioPropertiesStyle);
class FileRefPrivate;
FileRefPrivate *d;
};

View File

@@ -1 +0,0 @@
INSTALL( FILES flacfile.h flacproperties.h DESTINATION ${INCLUDE_INSTALL_DIR}/taglib )

View File

@@ -1,14 +0,0 @@
INCLUDES = \
-I$(top_srcdir)/taglib \
-I$(top_srcdir)/taglib/toolkit \
-I$(top_srcdir)/taglib/ogg \
-I$(top_srcdir)/taglib/mpeg/id3v2 \
-I$(top_srcdir)/taglib/mpeg/id3v1 \
$(all_includes)
noinst_LTLIBRARIES = libflac.la
libflac_la_SOURCES = flacfile.cpp flacproperties.cpp
taglib_include_HEADERS = flacfile.h flacproperties.h
taglib_includedir = $(includedir)/taglib

View File

@@ -15,8 +15,8 @@
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
* USA *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
@@ -28,38 +28,50 @@
#include <tlist.h>
#include <tdebug.h>
#include <tagunion.h>
#include <tpropertymap.h>
#include <tagutils.h>
#include <id3v2header.h>
#include <id3v2tag.h>
#include <id3v1tag.h>
#include <xiphcomment.h>
#include "flacpicture.h"
#include "flacfile.h"
#include "flacmetadatablock.h"
#include "flacunknownmetadatablock.h"
using namespace TagLib;
namespace
{
enum { XiphIndex = 0, ID3v2Index = 1, ID3v1Index = 2 };
enum { StreamInfo = 0, Padding, Application, SeekTable, VorbisComment, CueSheet };
typedef List<FLAC::MetadataBlock *> BlockList;
typedef BlockList::Iterator BlockIterator;
typedef BlockList::Iterator BlockConstIterator;
enum { FlacXiphIndex = 0, FlacID3v2Index = 1, FlacID3v1Index = 2 };
const long MinPaddingLength = 4096;
const long MaxPaddingLegnth = 1024 * 1024;
const char LastBlockFlag = '\x80';
}
class FLAC::File::FilePrivate
{
public:
FilePrivate() :
ID3v2FrameFactory(ID3v2::FrameFactory::instance()),
FilePrivate(const ID3v2::FrameFactory *frameFactory = ID3v2::FrameFactory::instance()) :
ID3v2FrameFactory(frameFactory),
ID3v2Location(-1),
ID3v2OriginalSize(0),
ID3v1Location(-1),
properties(0),
flacStart(0),
streamStart(0),
streamLength(0),
scanned(false),
hasXiphComment(false),
hasID3v2(false),
hasID3v1(false) {}
scanned(false)
{
blocks.setAutoDelete(true);
}
~FilePrivate()
{
@@ -68,45 +80,61 @@ public:
const ID3v2::FrameFactory *ID3v2FrameFactory;
long ID3v2Location;
uint ID3v2OriginalSize;
long ID3v2OriginalSize;
long ID3v1Location;
TagUnion tag;
Properties *properties;
ByteVector streamInfoData;
ByteVector xiphCommentData;
BlockList blocks;
long flacStart;
long streamStart;
long streamLength;
bool scanned;
bool hasXiphComment;
bool hasID3v2;
bool hasID3v1;
};
////////////////////////////////////////////////////////////////////////////////
// static members
////////////////////////////////////////////////////////////////////////////////
bool FLAC::File::isSupported(IOStream *stream)
{
// A FLAC file has an ID "fLaC" somewhere. An ID3v2 tag may precede.
const ByteVector buffer = Utils::readHeader(stream, bufferSize(), true);
return (buffer.find("fLaC") >= 0);
}
////////////////////////////////////////////////////////////////////////////////
// public members
////////////////////////////////////////////////////////////////////////////////
FLAC::File::File(FileName file, bool readProperties,
Properties::ReadStyle propertiesStyle) :
TagLib::File(file)
FLAC::File::File(FileName file, bool readProperties, Properties::ReadStyle) :
TagLib::File(file),
d(new FilePrivate())
{
d = new FilePrivate;
read(readProperties, propertiesStyle);
if(isOpen())
read(readProperties);
}
FLAC::File::File(FileName file, ID3v2::FrameFactory *frameFactory,
bool readProperties, Properties::ReadStyle propertiesStyle) :
TagLib::File(file)
bool readProperties, Properties::ReadStyle) :
TagLib::File(file),
d(new FilePrivate(frameFactory))
{
d = new FilePrivate;
d->ID3v2FrameFactory = frameFactory;
read(readProperties, propertiesStyle);
if(isOpen())
read(readProperties);
}
FLAC::File::File(IOStream *stream, ID3v2::FrameFactory *frameFactory,
bool readProperties, Properties::ReadStyle) :
TagLib::File(stream),
d(new FilePrivate(frameFactory))
{
if(isOpen())
read(readProperties);
}
FLAC::File::~File()
@@ -119,12 +147,26 @@ TagLib::Tag *FLAC::File::tag() const
return &d->tag;
}
PropertyMap FLAC::File::properties() const
{
return d->tag.properties();
}
void FLAC::File::removeUnsupportedProperties(const StringList &unsupported)
{
d->tag.removeUnsupportedProperties(unsupported);
}
PropertyMap FLAC::File::setProperties(const PropertyMap &properties)
{
return xiphComment(true)->setProperties(properties);
}
FLAC::Properties *FLAC::File::audioProperties() const
{
return d->properties;
}
bool FLAC::File::save()
{
if(readOnly()) {
@@ -132,113 +174,160 @@ bool FLAC::File::save()
return false;
}
// Create new vorbis comments
if(!isValid()) {
debug("FLAC::File::save() -- Trying to save invalid file.");
return false;
}
Tag::duplicate(&d->tag, xiphComment(true), true);
// Create new vorbis comments
if(!hasXiphComment())
Tag::duplicate(&d->tag, xiphComment(true), false);
d->xiphCommentData = xiphComment()->render(false);
// A Xiph comment portion of the data stream starts with a 4-byte descriptor.
// The first byte indicates the frame type. The last three bytes are used
// to give the length of the data segment. Here we start
// Replace metadata blocks
ByteVector data = ByteVector::fromUInt(d->xiphCommentData.size());
data[0] = char(VorbisComment);
data.append(d->xiphCommentData);
// If file already have comment => find and update it
// if not => insert one
// TODO: Search for padding and use that
if(d->hasXiphComment) {
long nextBlockOffset = d->flacStart;
bool isLastBlock = false;
while(!isLastBlock) {
seek(nextBlockOffset);
ByteVector header = readBlock(4);
char blockType = header[0] & 0x7f;
isLastBlock = (header[0] & 0x80) != 0;
uint blockLength = header.mid(1, 3).toUInt();
if(blockType == VorbisComment) {
data[0] = header[0];
insert(data, nextBlockOffset, blockLength + 4);
break;
}
nextBlockOffset += blockLength + 4;
MetadataBlock *commentBlock =
new UnknownMetadataBlock(MetadataBlock::VorbisComment, d->xiphCommentData);
for(BlockIterator it = d->blocks.begin(); it != d->blocks.end();) {
if((*it)->code() == MetadataBlock::VorbisComment) {
// Remove the old Vorbis Comment block
delete *it;
it = d->blocks.erase(it);
continue;
}
if(commentBlock && (*it)->code() == MetadataBlock::Picture) {
// Set the new Vorbis Comment block before the first picture block
d->blocks.insert(it, commentBlock);
commentBlock = 0;
}
++it;
}
if(commentBlock)
d->blocks.append(commentBlock);
// Render data for the metadata blocks
ByteVector data;
for(BlockConstIterator it = d->blocks.begin(); it != d->blocks.end(); ++it) {
ByteVector blockData = (*it)->render();
ByteVector blockHeader = ByteVector::fromUInt(blockData.size());
blockHeader[0] = (*it)->code();
data.append(blockHeader);
data.append(blockData);
}
// Compute the amount of padding, and append that to data.
long originalLength = d->streamStart - d->flacStart;
long paddingLength = originalLength - data.size() - 4;
if(paddingLength <= 0) {
paddingLength = MinPaddingLength;
}
else {
// Padding won't increase beyond 1% of the file size or 1MB.
const long firstBlockOffset = d->flacStart;
seek(firstBlockOffset);
long threshold = length() / 100;
threshold = std::max(threshold, MinPaddingLength);
threshold = std::min(threshold, MaxPaddingLegnth);
ByteVector header = readBlock(4);
bool isLastBlock = (header[0] & 0x80) != 0;
uint blockLength = header.mid(1, 3).toUInt();
if(isLastBlock) {
// If the first block was previously also the last block, then we want to
// mark it as no longer being the first block (the writeBlock() call) and
// then set the data for the block that we're about to write to mark our
// new block as the last block.
seek(firstBlockOffset);
writeBlock(static_cast<char>(header[0] & 0x7F));
data[0] |= 0x80;
}
insert(data, firstBlockOffset + blockLength + 4, 0);
d->hasXiphComment = true;
if(paddingLength > threshold)
paddingLength = MinPaddingLength;
}
ByteVector paddingHeader = ByteVector::fromUInt(paddingLength);
paddingHeader[0] = static_cast<char>(MetadataBlock::Padding | LastBlockFlag);
data.append(paddingHeader);
data.resize(static_cast<unsigned int>(data.size() + paddingLength));
// Write the data to the file
insert(data, d->flacStart, originalLength);
d->streamStart += (static_cast<long>(data.size()) - originalLength);
if(d->ID3v1Location >= 0)
d->ID3v1Location += (static_cast<long>(data.size()) - originalLength);
// Update ID3 tags
if(ID3v2Tag()) {
if(d->hasID3v2) {
if(d->ID3v2Location < d->flacStart)
debug("FLAC::File::save() -- This can't be right -- an ID3v2 tag after the "
"start of the FLAC bytestream? Not writing the ID3v2 tag.");
else
insert(ID3v2Tag()->render(), d->ID3v2Location, d->ID3v2OriginalSize);
if(ID3v2Tag() && !ID3v2Tag()->isEmpty()) {
// ID3v2 tag is not empty. Update the old one or create a new one.
if(d->ID3v2Location < 0)
d->ID3v2Location = 0;
data = ID3v2Tag()->render();
insert(data, d->ID3v2Location, d->ID3v2OriginalSize);
d->flacStart += (static_cast<long>(data.size()) - d->ID3v2OriginalSize);
d->streamStart += (static_cast<long>(data.size()) - d->ID3v2OriginalSize);
if(d->ID3v1Location >= 0)
d->ID3v1Location += (static_cast<long>(data.size()) - d->ID3v2OriginalSize);
d->ID3v2OriginalSize = data.size();
}
else {
// ID3v2 tag is empty. Remove the old one.
if(d->ID3v2Location >= 0) {
removeBlock(d->ID3v2Location, d->ID3v2OriginalSize);
d->flacStart -= d->ID3v2OriginalSize;
d->streamStart -= d->ID3v2OriginalSize;
if(d->ID3v1Location >= 0)
d->ID3v1Location -= d->ID3v2OriginalSize;
d->ID3v2Location = -1;
d->ID3v2OriginalSize = 0;
}
else
insert(ID3v2Tag()->render(), 0, 0);
}
if(ID3v1Tag()) {
seek(-128, End);
if(ID3v1Tag() && !ID3v1Tag()->isEmpty()) {
// ID3v1 tag is not empty. Update the old one or create a new one.
if(d->ID3v1Location >= 0) {
seek(d->ID3v1Location);
}
else {
seek(0, End);
d->ID3v1Location = tell();
}
writeBlock(ID3v1Tag()->render());
}
else {
// ID3v1 tag is empty. Remove the old one.
if(d->ID3v1Location >= 0) {
truncate(d->ID3v1Location);
d->ID3v1Location = -1;
}
}
return true;
}
ID3v2::Tag *FLAC::File::ID3v2Tag(bool create)
{
if(!create || d->tag[ID3v2Index])
return static_cast<ID3v2::Tag *>(d->tag[ID3v2Index]);
d->tag.set(ID3v2Index, new ID3v2::Tag);
return static_cast<ID3v2::Tag *>(d->tag[ID3v2Index]);
return d->tag.access<ID3v2::Tag>(FlacID3v2Index, create);
}
ID3v1::Tag *FLAC::File::ID3v1Tag(bool create)
{
return d->tag.access<ID3v1::Tag>(ID3v1Index, create);
return d->tag.access<ID3v1::Tag>(FlacID3v1Index, create);
}
Ogg::XiphComment *FLAC::File::xiphComment(bool create)
{
return d->tag.access<Ogg::XiphComment>(XiphIndex, create);
return d->tag.access<Ogg::XiphComment>(FlacXiphIndex, create);
}
void FLAC::File::setID3v2FrameFactory(const ID3v2::FrameFactory *factory)
@@ -246,37 +335,108 @@ void FLAC::File::setID3v2FrameFactory(const ID3v2::FrameFactory *factory)
d->ID3v2FrameFactory = factory;
}
ByteVector FLAC::File::streamInfoData()
{
debug("FLAC::File::streamInfoData() -- This function is obsolete. Returning an empty ByteVector.");
return ByteVector();
}
long FLAC::File::streamLength()
{
debug("FLAC::File::streamLength() -- This function is obsolete. Returning zero.");
return 0;
}
List<FLAC::Picture *> FLAC::File::pictureList()
{
List<Picture *> pictures;
for(BlockConstIterator it = d->blocks.begin(); it != d->blocks.end(); ++it) {
Picture *picture = dynamic_cast<Picture *>(*it);
if(picture) {
pictures.append(picture);
}
}
return pictures;
}
void FLAC::File::addPicture(Picture *picture)
{
d->blocks.append(picture);
}
void FLAC::File::removePicture(Picture *picture, bool del)
{
BlockIterator it = d->blocks.find(picture);
if(it != d->blocks.end())
d->blocks.erase(it);
if(del)
delete picture;
}
void FLAC::File::removePictures()
{
for(BlockIterator it = d->blocks.begin(); it != d->blocks.end(); ) {
if(dynamic_cast<Picture *>(*it)) {
delete *it;
it = d->blocks.erase(it);
}
else {
++it;
}
}
}
void FLAC::File::strip(int tags)
{
if(tags & ID3v1)
d->tag.set(FlacID3v1Index, 0);
if(tags & ID3v2)
d->tag.set(FlacID3v2Index, 0);
if(tags & XiphComment) {
xiphComment()->removeAllFields();
xiphComment()->removeAllPictures();
}
}
bool FLAC::File::hasXiphComment() const
{
return !d->xiphCommentData.isEmpty();
}
bool FLAC::File::hasID3v1Tag() const
{
return (d->ID3v1Location >= 0);
}
bool FLAC::File::hasID3v2Tag() const
{
return (d->ID3v2Location >= 0);
}
////////////////////////////////////////////////////////////////////////////////
// private members
////////////////////////////////////////////////////////////////////////////////
void FLAC::File::read(bool readProperties, Properties::ReadStyle propertiesStyle)
void FLAC::File::read(bool readProperties)
{
// Look for an ID3v2 tag
d->ID3v2Location = findID3v2();
d->ID3v2Location = Utils::findID3v2(this);
if(d->ID3v2Location >= 0) {
d->tag.set(ID3v2Index, new ID3v2::Tag(this, d->ID3v2Location, d->ID3v2FrameFactory));
d->tag.set(FlacID3v2Index, new ID3v2::Tag(this, d->ID3v2Location, d->ID3v2FrameFactory));
d->ID3v2OriginalSize = ID3v2Tag()->header()->completeTagSize();
if(ID3v2Tag()->header()->tagSize() <= 0)
d->tag.set(ID3v2Index, 0);
else
d->hasID3v2 = true;
}
// Look for an ID3v1 tag
d->ID3v1Location = findID3v1();
d->ID3v1Location = Utils::findID3v1(this);
if(d->ID3v1Location >= 0) {
d->tag.set(ID3v1Index, new ID3v1::Tag(this, d->ID3v1Location));
d->hasID3v1 = true;
}
if(d->ID3v1Location >= 0)
d->tag.set(FlacID3v1Index, new ID3v1::Tag(this, d->ID3v1Location));
// Look for FLAC metadata, including vorbis comments
@@ -285,28 +445,26 @@ void FLAC::File::read(bool readProperties, Properties::ReadStyle propertiesStyle
if(!isValid())
return;
if(d->hasXiphComment)
d->tag.set(XiphIndex, new Ogg::XiphComment(xiphCommentData()));
if(!d->xiphCommentData.isEmpty())
d->tag.set(FlacXiphIndex, new Ogg::XiphComment(d->xiphCommentData));
else
d->tag.set(XiphIndex, new Ogg::XiphComment);
d->tag.set(FlacXiphIndex, new Ogg::XiphComment());
if(readProperties)
d->properties = new Properties(streamInfoData(), streamLength(), propertiesStyle);
}
if(readProperties) {
ByteVector FLAC::File::streamInfoData()
{
return isValid() ? d->streamInfoData : ByteVector();
}
// First block should be the stream_info metadata
ByteVector FLAC::File::xiphCommentData() const
{
return (isValid() && d->hasXiphComment) ? d->xiphCommentData : ByteVector();
}
const ByteVector infoData = d->blocks.front()->render();
long FLAC::File::streamLength()
{
return d->streamLength;
long streamLength;
if(d->ID3v1Location >= 0)
streamLength = d->ID3v1Location - d->streamStart;
else
streamLength = length() - d->streamStart;
d->properties = new Properties(infoData, streamLength);
}
}
void FLAC::File::scan()
@@ -321,7 +479,7 @@ void FLAC::File::scan()
long nextBlockOffset;
if(d->hasID3v2)
if(d->ID3v2Location >= 0)
nextBlockOffset = find("fLaC", d->ID3v2Location + d->ID3v2OriginalSize);
else
nextBlockOffset = find("fLaC");
@@ -335,97 +493,91 @@ void FLAC::File::scan()
nextBlockOffset += 4;
d->flacStart = nextBlockOffset;
seek(nextBlockOffset);
while(true) {
ByteVector header = readBlock(4);
seek(nextBlockOffset);
const ByteVector header = readBlock(4);
// Header format (from spec):
// <1> Last-metadata-block flag
// <7> BLOCK_TYPE
// 0 : STREAMINFO
// 1 : PADDING
// ..
// 4 : VORBIS_COMMENT
// ..
// <24> Length of metadata to follow
// Header format (from spec):
// <1> Last-metadata-block flag
// <7> BLOCK_TYPE
// 0 : STREAMINFO
// 1 : PADDING
// ..
// 4 : VORBIS_COMMENT
// ..
// 6 : PICTURE
// ..
// <24> Length of metadata to follow
char blockType = header[0] & 0x7f;
bool isLastBlock = (header[0] & 0x80) != 0;
uint length = header.mid(1, 3).toUInt();
const char blockType = header[0] & ~LastBlockFlag;
const bool isLastBlock = (header[0] & LastBlockFlag) != 0;
const unsigned int blockLength = header.toUInt(1U, 3U);
// First block should be the stream_info metadata
// First block should be the stream_info metadata
if(blockType != StreamInfo) {
debug("FLAC::File::scan() -- invalid FLAC stream");
setValid(false);
return;
}
d->streamInfoData = readBlock(length);
nextBlockOffset += length + 4;
// Search through the remaining metadata
while(!isLastBlock) {
header = readBlock(4);
blockType = header[0] & 0x7f;
isLastBlock = (header[0] & 0x80) != 0;
length = header.mid(1, 3).toUInt();
if(blockType == Padding) {
// debug("FLAC::File::scan() -- Padding found");
}
// Found the vorbis-comment
else if(blockType == VorbisComment) {
d->xiphCommentData = readBlock(length);
d->hasXiphComment = true;
}
nextBlockOffset += length + 4;
if(nextBlockOffset >= File::length()) {
debug("FLAC::File::scan() -- FLAC stream corrupted");
if(d->blocks.isEmpty() && blockType != MetadataBlock::StreamInfo) {
debug("FLAC::File::scan() -- First block should be the stream_info metadata");
setValid(false);
return;
}
seek(nextBlockOffset);
if(blockLength == 0
&& blockType != MetadataBlock::Padding && blockType != MetadataBlock::SeekTable)
{
debug("FLAC::File::scan() -- Zero-sized metadata block found");
setValid(false);
return;
}
const ByteVector data = readBlock(blockLength);
if(data.size() != blockLength) {
debug("FLAC::File::scan() -- Failed to read a metadata block");
setValid(false);
return;
}
MetadataBlock *block = 0;
// Found the vorbis-comment
if(blockType == MetadataBlock::VorbisComment) {
if(d->xiphCommentData.isEmpty()) {
d->xiphCommentData = data;
block = new UnknownMetadataBlock(MetadataBlock::VorbisComment, data);
}
else {
debug("FLAC::File::scan() -- multiple Vorbis Comment blocks found, discarding");
}
}
else if(blockType == MetadataBlock::Picture) {
FLAC::Picture *picture = new FLAC::Picture();
if(picture->parse(data)) {
block = picture;
}
else {
debug("FLAC::File::scan() -- invalid picture found, discarding");
delete picture;
}
}
else if(blockType == MetadataBlock::Padding) {
// Skip all padding blocks.
}
else {
block = new UnknownMetadataBlock(blockType, data);
}
if(block)
d->blocks.append(block);
nextBlockOffset += blockLength + 4;
if(isLastBlock)
break;
}
// End of metadata, now comes the datastream
d->streamStart = nextBlockOffset;
d->streamLength = File::length() - d->streamStart;
if(d->hasID3v1)
d->streamLength -= 128;
d->scanned = true;
}
long FLAC::File::findID3v1()
{
if(!isValid())
return -1;
seek(-128, End);
long p = tell();
if(readBlock(3) == ID3v1::Tag::fileIdentifier())
return p;
return -1;
}
long FLAC::File::findID3v2()
{
if(!isValid())
return -1;
seek(0);
if(readBlock(3) == ID3v2::Header::fileIdentifier())
return 0;
return -1;
}

View File

@@ -15,8 +15,8 @@
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
* USA *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
@@ -28,13 +28,15 @@
#include "taglib_export.h"
#include "tfile.h"
#include "tlist.h"
#include "tag.h"
#include "flacpicture.h"
#include "flacproperties.h"
namespace TagLib {
class Tag;
namespace ID3v2 { class FrameFactory; class Tag; }
namespace ID3v1 { class Tag; }
namespace Ogg { class XiphComment; }
@@ -44,7 +46,7 @@ namespace TagLib {
/*!
* This is implementation of FLAC metadata for non-Ogg FLAC files. At some
* point when Ogg / FLAC is more common there will be a similar implementation
* under the Ogg hiearchy.
* under the Ogg hierarchy.
*
* This supports ID3v1, ID3v2 and Xiph style comments as well as reading stream
* properties from the file.
@@ -65,9 +67,27 @@ namespace TagLib {
{
public:
/*!
* Contructs a FLAC file from \a file. If \a readProperties is true the
* file's audio properties will also be read using \a propertiesStyle. If
* false, \a propertiesStyle is ignored.
* This set of flags is used for various operations and is suitable for
* being OR-ed together.
*/
enum TagTypes {
//! Empty set. Matches no tag types.
NoTags = 0x0000,
//! Matches Vorbis comments.
XiphComment = 0x0001,
//! Matches ID3v1 tags.
ID3v1 = 0x0002,
//! Matches ID3v2 tags.
ID3v2 = 0x0004,
//! Matches all tag types.
AllTags = 0xffff
};
/*!
* Constructs a FLAC file from \a file. If \a readProperties is true the
* file's audio properties will also be read.
*
* \note In the current implementation, \a propertiesStyle is ignored.
*
* \deprecated This constructor will be dropped in favor of the one below
* in a future version.
@@ -76,18 +96,36 @@ namespace TagLib {
Properties::ReadStyle propertiesStyle = Properties::Average);
/*!
* Contructs a FLAC file from \a file. If \a readProperties is true the
* file's audio properties will also be read using \a propertiesStyle. If
* false, \a propertiesStyle is ignored.
* Constructs an FLAC file from \a file. If \a readProperties is true the
* file's audio properties will also be read.
*
* If this file contains and ID3v2 tag the frames will be created using
* \a frameFactory.
*
* \note In the current implementation, \a propertiesStyle is ignored.
*/
// BIC: merge with the above constructor
File(FileName file, ID3v2::FrameFactory *frameFactory,
bool readProperties = true,
Properties::ReadStyle propertiesStyle = Properties::Average);
/*!
* Constructs a FLAC file from \a stream. If \a readProperties is true the
* file's audio properties will also be read.
*
* \note TagLib will *not* take ownership of the stream, the caller is
* responsible for deleting it after the File object.
*
* If this file contains and ID3v2 tag the frames will be created using
* \a frameFactory.
*
* \note In the current implementation, \a propertiesStyle is ignored.
*/
// BIC: merge with the above constructor
File(IOStream *stream, ID3v2::FrameFactory *frameFactory,
bool readProperties = true,
Properties::ReadStyle propertiesStyle = Properties::Average);
/*!
* Destroys this instance of the File.
*/
@@ -103,6 +141,25 @@ namespace TagLib {
*/
virtual TagLib::Tag *tag() const;
/*!
* Implements the unified property interface -- export function.
* If the file contains more than one tag (e.g. XiphComment and ID3v1),
* only the first one (in the order XiphComment, ID3v2, ID3v1) will be
* converted to the PropertyMap.
*/
PropertyMap properties() const;
void removeUnsupportedProperties(const StringList &);
/*!
* Implements the unified property interface -- import function.
* This always creates a Xiph comment, if none exists. The return value
* relates to the Xiph comment only.
* Ignores any changes to ID3v1 or ID3v2 comments since they are not allowed
* in the FLAC specification.
*/
PropertyMap setProperties(const PropertyMap &);
/*!
* Returns the FLAC::Properties for this file. If no audio properties
* were read then this will return a null pointer.
@@ -121,39 +178,57 @@ namespace TagLib {
/*!
* Returns a pointer to the ID3v2 tag of the file.
*
* If \a create is false (the default) this will return a null pointer
* If \a create is false (the default) this returns a null pointer
* if there is no valid ID3v2 tag. If \a create is true it will create
* an ID3v2 tag if one does not exist.
* an ID3v2 tag if one does not exist and returns a valid pointer.
*
* \note The Tag <b>is still</b> owned by the FLAC::File and should not be
* \note This may return a valid pointer regardless of whether or not the
* file on disk has an ID3v2 tag. Use hasID3v2Tag() to check if the file
* on disk actually has an ID3v2 tag.
*
* \note The Tag <b>is still</b> owned by the MPEG::File and should not be
* deleted by the user. It will be deleted when the file (object) is
* destroyed.
*
* \see hasID3v2Tag()
*/
ID3v2::Tag *ID3v2Tag(bool create = false);
/*!
* Returns a pointer to the ID3v1 tag of the file.
*
* If \a create is false (the default) this will return a null pointer
* if there is no valid ID3v1 tag. If \a create is true it will create
* an ID3v1 tag if one does not exist.
* If \a create is false (the default) this returns a null pointer
* if there is no valid APE tag. If \a create is true it will create
* an APE tag if one does not exist and returns a valid pointer.
*
* \note The Tag <b>is still</b> owned by the FLAC::File and should not be
* \note This may return a valid pointer regardless of whether or not the
* file on disk has an ID3v1 tag. Use hasID3v1Tag() to check if the file
* on disk actually has an ID3v1 tag.
*
* \note The Tag <b>is still</b> owned by the MPEG::File and should not be
* deleted by the user. It will be deleted when the file (object) is
* destroyed.
*
* \see hasID3v1Tag()
*/
ID3v1::Tag *ID3v1Tag(bool create = false);
/*!
* Returns a pointer to the XiphComment for the file.
*
* If \a create is false (the default) this will return a null pointer
* If \a create is false (the default) this returns a null pointer
* if there is no valid XiphComment. If \a create is true it will create
* a XiphComment if one does not exist.
* a XiphComment if one does not exist and returns a valid pointer.
*
* \note This may return a valid pointer regardless of whether or not the
* file on disk has a XiphComment. Use hasXiphComment() to check if the
* file on disk actually has a XiphComment.
*
* \note The Tag <b>is still</b> owned by the FLAC::File and should not be
* deleted by the user. It will be deleted when the file (object) is
* destroyed.
*
* \see hasXiphComment()
*/
Ogg::XiphComment *xiphComment(bool create = false);
@@ -163,34 +238,101 @@ namespace TagLib {
* when
*
* \see ID3v2FrameFactory
* \deprecated This value should be passed in via the constructor
*/
void setID3v2FrameFactory(const ID3v2::FrameFactory *factory);
TAGLIB_DEPRECATED void setID3v2FrameFactory(const ID3v2::FrameFactory *factory);
/*!
* Returns the block of data used by FLAC::Properties for parsing the
* stream properties.
*
* \deprecated This method will not be public in a future release.
* \deprecated Always returns an empty vector.
*/
ByteVector streamInfoData(); // BIC: remove
TAGLIB_DEPRECATED ByteVector streamInfoData(); // BIC: remove
/*!
* Returns the length of the audio-stream, used by FLAC::Properties for
* calculating the bitrate.
*
* \deprecated This method will not be public in a future release.
* \deprecated Always returns zero.
*/
long streamLength(); // BIC: remove
TAGLIB_DEPRECATED long streamLength(); // BIC: remove
/*!
* Returns a list of pictures attached to the FLAC file.
*/
List<Picture *> pictureList();
/*!
* Removes an attached picture. If \a del is true the picture's memory
* will be freed; if it is false, it must be deleted by the user.
*/
void removePicture(Picture *picture, bool del = true);
/*!
* Remove all attached images.
*/
void removePictures();
/*!
* Add a new picture to the file. The file takes ownership of the
* picture and will handle freeing its memory.
*
* \note The file will be saved only after calling save().
*/
void addPicture(Picture *picture);
/*!
* This will remove the tags that match the OR-ed together TagTypes from
* the file. By default it removes all tags.
*
* \warning This will also invalidate pointers to the tags as their memory
* will be freed.
*
* \note In order to make the removal permanent save() still needs to be
* called.
*
* \note This won't remove the Vorbis comment block completely. The
* vendor ID will be preserved.
*/
void strip(int tags = AllTags);
/*!
* Returns whether or not the file on disk actually has a XiphComment.
*
* \see xiphComment()
*/
bool hasXiphComment() const;
/*!
* Returns whether or not the file on disk actually has an ID3v1 tag.
*
* \see ID3v1Tag()
*/
bool hasID3v1Tag() const;
/*!
* Returns whether or not the file on disk actually has an ID3v2 tag.
*
* \see ID3v2Tag()
*/
bool hasID3v2Tag() const;
/*!
* Returns whether or not the given \a stream can be opened as a FLAC
* file.
*
* \note This method is designed to do a quick check. The result may
* not necessarily be correct.
*/
static bool isSupported(IOStream *stream);
private:
File(const File &);
File &operator=(const File &);
void read(bool readProperties, Properties::ReadStyle propertiesStyle);
void read(bool readProperties);
void scan();
long findID3v2();
long findID3v1();
ByteVector xiphCommentData() const;
class FilePrivate;
FilePrivate *d;

View File

@@ -0,0 +1,47 @@
/**************************************************************************
copyright : (C) 2010 by Lukáš Lalinský
email : lalinsky@gmail.com
**************************************************************************/
/***************************************************************************
* This library is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License version *
* 2.1 as published by the Free Software Foundation. *
* *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#include <taglib.h>
#include <tdebug.h>
#include "flacmetadatablock.h"
using namespace TagLib;
class FLAC::MetadataBlock::MetadataBlockPrivate
{
public:
MetadataBlockPrivate() {}
};
FLAC::MetadataBlock::MetadataBlock()
{
d = 0;
}
FLAC::MetadataBlock::~MetadataBlock()
{
}

View File

@@ -0,0 +1,75 @@
/**************************************************************************
copyright : (C) 2010 by Lukáš Lalinský
email : lalinsky@gmail.com
**************************************************************************/
/***************************************************************************
* This library is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License version *
* 2.1 as published by the Free Software Foundation. *
* *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#ifndef TAGLIB_FLACMETADATABLOCK_H
#define TAGLIB_FLACMETADATABLOCK_H
#include "tlist.h"
#include "tbytevector.h"
#include "taglib_export.h"
namespace TagLib {
namespace FLAC {
class TAGLIB_EXPORT MetadataBlock
{
public:
MetadataBlock();
virtual ~MetadataBlock();
enum BlockType {
StreamInfo = 0,
Padding,
Application,
SeekTable,
VorbisComment,
CueSheet,
Picture
};
/*!
* Returns the FLAC metadata block type.
*/
virtual int code() const = 0;
/*!
* Render the content of the block.
*/
virtual ByteVector render() const = 0;
private:
MetadataBlock(const MetadataBlock &item);
MetadataBlock &operator=(const MetadataBlock &item);
class MetadataBlockPrivate;
MetadataBlockPrivate *d;
};
}
}
#endif

217
taglib/flac/flacpicture.cpp Normal file
View File

@@ -0,0 +1,217 @@
/**************************************************************************
copyright : (C) 2010 by Lukáš Lalinský
email : lalinsky@gmail.com
**************************************************************************/
/***************************************************************************
* This library is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License version *
* 2.1 as published by the Free Software Foundation. *
* *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#include <taglib.h>
#include <tdebug.h>
#include "flacpicture.h"
using namespace TagLib;
class FLAC::Picture::PicturePrivate
{
public:
PicturePrivate() :
type(FLAC::Picture::Other),
width(0),
height(0),
colorDepth(0),
numColors(0)
{}
Type type;
String mimeType;
String description;
int width;
int height;
int colorDepth;
int numColors;
ByteVector data;
};
FLAC::Picture::Picture() :
d(new PicturePrivate())
{
}
FLAC::Picture::Picture(const ByteVector &data) :
d(new PicturePrivate())
{
parse(data);
}
FLAC::Picture::~Picture()
{
delete d;
}
int FLAC::Picture::code() const
{
return FLAC::MetadataBlock::Picture;
}
bool FLAC::Picture::parse(const ByteVector &data)
{
if(data.size() < 32) {
debug("A picture block must contain at least 5 bytes.");
return false;
}
unsigned int pos = 0;
d->type = FLAC::Picture::Type(data.toUInt(pos));
pos += 4;
unsigned int mimeTypeLength = data.toUInt(pos);
pos += 4;
if(pos + mimeTypeLength + 24 > data.size()) {
debug("Invalid picture block.");
return false;
}
d->mimeType = String(data.mid(pos, mimeTypeLength), String::UTF8);
pos += mimeTypeLength;
unsigned int descriptionLength = data.toUInt(pos);
pos += 4;
if(pos + descriptionLength + 20 > data.size()) {
debug("Invalid picture block.");
return false;
}
d->description = String(data.mid(pos, descriptionLength), String::UTF8);
pos += descriptionLength;
d->width = data.toUInt(pos);
pos += 4;
d->height = data.toUInt(pos);
pos += 4;
d->colorDepth = data.toUInt(pos);
pos += 4;
d->numColors = data.toUInt(pos);
pos += 4;
unsigned int dataLength = data.toUInt(pos);
pos += 4;
if(pos + dataLength > data.size()) {
debug("Invalid picture block.");
return false;
}
d->data = data.mid(pos, dataLength);
return true;
}
ByteVector FLAC::Picture::render() const
{
ByteVector result;
result.append(ByteVector::fromUInt(d->type));
ByteVector mimeTypeData = d->mimeType.data(String::UTF8);
result.append(ByteVector::fromUInt(mimeTypeData.size()));
result.append(mimeTypeData);
ByteVector descriptionData = d->description.data(String::UTF8);
result.append(ByteVector::fromUInt(descriptionData.size()));
result.append(descriptionData);
result.append(ByteVector::fromUInt(d->width));
result.append(ByteVector::fromUInt(d->height));
result.append(ByteVector::fromUInt(d->colorDepth));
result.append(ByteVector::fromUInt(d->numColors));
result.append(ByteVector::fromUInt(d->data.size()));
result.append(d->data);
return result;
}
FLAC::Picture::Type FLAC::Picture::type() const
{
return d->type;
}
void FLAC::Picture::setType(FLAC::Picture::Type type)
{
d->type = type;
}
String FLAC::Picture::mimeType() const
{
return d->mimeType;
}
void FLAC::Picture::setMimeType(const String &mimeType)
{
d->mimeType = mimeType;
}
String FLAC::Picture::description() const
{
return d->description;
}
void FLAC::Picture::setDescription(const String &description)
{
d->description = description;
}
int FLAC::Picture::width() const
{
return d->width;
}
void FLAC::Picture::setWidth(int width)
{
d->width = width;
}
int FLAC::Picture::height() const
{
return d->height;
}
void FLAC::Picture::setHeight(int height)
{
d->height = height;
}
int FLAC::Picture::colorDepth() const
{
return d->colorDepth;
}
void FLAC::Picture::setColorDepth(int colorDepth)
{
d->colorDepth = colorDepth;
}
int FLAC::Picture::numColors() const
{
return d->numColors;
}
void FLAC::Picture::setNumColors(int numColors)
{
d->numColors = numColors;
}
ByteVector FLAC::Picture::data() const
{
return d->data;
}
void FLAC::Picture::setData(const ByteVector &data)
{
d->data = data;
}

208
taglib/flac/flacpicture.h Normal file
View File

@@ -0,0 +1,208 @@
/**************************************************************************
copyright : (C) 2010 by Lukáš Lalinský
email : lalinsky@gmail.com
**************************************************************************/
/***************************************************************************
* This library is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License version *
* 2.1 as published by the Free Software Foundation. *
* *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#ifndef TAGLIB_FLACPICTURE_H
#define TAGLIB_FLACPICTURE_H
#include "tlist.h"
#include "tstring.h"
#include "tbytevector.h"
#include "taglib_export.h"
#include "flacmetadatablock.h"
namespace TagLib {
namespace FLAC {
class TAGLIB_EXPORT Picture : public MetadataBlock
{
public:
/*!
* This describes the function or content of the picture.
*/
enum Type {
//! A type not enumerated below
Other = 0x00,
//! 32x32 PNG image that should be used as the file icon
FileIcon = 0x01,
//! File icon of a different size or format
OtherFileIcon = 0x02,
//! Front cover image of the album
FrontCover = 0x03,
//! Back cover image of the album
BackCover = 0x04,
//! Inside leaflet page of the album
LeafletPage = 0x05,
//! Image from the album itself
Media = 0x06,
//! Picture of the lead artist or soloist
LeadArtist = 0x07,
//! Picture of the artist or performer
Artist = 0x08,
//! Picture of the conductor
Conductor = 0x09,
//! Picture of the band or orchestra
Band = 0x0A,
//! Picture of the composer
Composer = 0x0B,
//! Picture of the lyricist or text writer
Lyricist = 0x0C,
//! Picture of the recording location or studio
RecordingLocation = 0x0D,
//! Picture of the artists during recording
DuringRecording = 0x0E,
//! Picture of the artists during performance
DuringPerformance = 0x0F,
//! Picture from a movie or video related to the track
MovieScreenCapture = 0x10,
//! Picture of a large, coloured fish
ColouredFish = 0x11,
//! Illustration related to the track
Illustration = 0x12,
//! Logo of the band or performer
BandLogo = 0x13,
//! Logo of the publisher (record company)
PublisherLogo = 0x14
};
Picture();
Picture(const ByteVector &data);
~Picture();
/*!
* Returns the type of the image.
*/
Type type() const;
/*!
* Sets the type of the image.
*/
void setType(Type type);
/*!
* Returns the mime type of the image. This should in most cases be
* "image/png" or "image/jpeg".
*/
String mimeType() const;
/*!
* Sets the mime type of the image. This should in most cases be
* "image/png" or "image/jpeg".
*/
void setMimeType(const String &m);
/*!
* Returns a text description of the image.
*/
String description() const;
/*!
* Sets a textual description of the image to \a desc.
*/
void setDescription(const String &desc);
/*!
* Returns the width of the image.
*/
int width() const;
/*!
* Sets the width of the image.
*/
void setWidth(int w);
/*!
* Returns the height of the image.
*/
int height() const;
/*!
* Sets the height of the image.
*/
void setHeight(int h);
/*!
* Returns the color depth (in bits-per-pixel) of the image.
*/
int colorDepth() const;
/*!
* Sets the color depth (in bits-per-pixel) of the image.
*/
void setColorDepth(int depth);
/*!
* Returns the number of colors used on the image..
*/
int numColors() const;
/*!
* Sets the number of colors used on the image (for indexed images).
*/
void setNumColors(int numColors);
/*!
* Returns the image data.
*/
ByteVector data() const;
/*!
* Sets the image data.
*/
void setData(const ByteVector &data);
/*!
* Returns the FLAC metadata block type.
*/
int code() const;
/*!
* Render the content to the FLAC picture block format.
*/
ByteVector render() const;
/*!
* Parse the picture data in the FLAC picture block format.
*/
bool parse(const ByteVector &rawData);
private:
Picture(const Picture &item);
Picture &operator=(const Picture &item);
class PicturePrivate;
PicturePrivate *d;
};
typedef List<Picture> PictureList;
}
}
#endif

View File

@@ -15,8 +15,8 @@
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
* USA *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
@@ -34,40 +34,39 @@ using namespace TagLib;
class FLAC::Properties::PropertiesPrivate
{
public:
PropertiesPrivate(ByteVector d, long st, ReadStyle s) :
data(d),
streamLength(st),
style(s),
PropertiesPrivate() :
length(0),
bitrate(0),
sampleRate(0),
sampleWidth(0),
channels(0) {}
bitsPerSample(0),
channels(0),
sampleFrames(0) {}
ByteVector data;
long streamLength;
ReadStyle style;
int length;
int bitrate;
int sampleRate;
int sampleWidth;
int bitsPerSample;
int channels;
unsigned long long sampleFrames;
ByteVector signature;
};
////////////////////////////////////////////////////////////////////////////////
// public members
////////////////////////////////////////////////////////////////////////////////
FLAC::Properties::Properties(ByteVector data, long streamLength, ReadStyle style) : AudioProperties(style)
FLAC::Properties::Properties(ByteVector data, long streamLength, ReadStyle style) :
AudioProperties(style),
d(new PropertiesPrivate())
{
d = new PropertiesPrivate(data, streamLength, style);
read();
read(data, streamLength);
}
FLAC::Properties::Properties(File *file, ReadStyle style) : AudioProperties(style)
FLAC::Properties::Properties(File *, ReadStyle style) :
AudioProperties(style),
d(new PropertiesPrivate())
{
d = new PropertiesPrivate(file->streamInfoData(), file->streamLength(), style);
read();
debug("FLAC::Properties::Properties() - This constructor is no longer used.");
}
FLAC::Properties::~Properties()
@@ -76,6 +75,16 @@ FLAC::Properties::~Properties()
}
int FLAC::Properties::length() const
{
return lengthInSeconds();
}
int FLAC::Properties::lengthInSeconds() const
{
return d->length / 1000;
}
int FLAC::Properties::lengthInMilliseconds() const
{
return d->length;
}
@@ -90,9 +99,14 @@ int FLAC::Properties::sampleRate() const
return d->sampleRate;
}
int FLAC::Properties::bitsPerSample() const
{
return d->bitsPerSample;
}
int FLAC::Properties::sampleWidth() const
{
return d->sampleWidth;
return bitsPerSample();
}
int FLAC::Properties::channels() const
@@ -100,18 +114,28 @@ int FLAC::Properties::channels() const
return d->channels;
}
unsigned long long FLAC::Properties::sampleFrames() const
{
return d->sampleFrames;
}
ByteVector FLAC::Properties::signature() const
{
return d->signature;
}
////////////////////////////////////////////////////////////////////////////////
// private members
////////////////////////////////////////////////////////////////////////////////
void FLAC::Properties::read()
void FLAC::Properties::read(const ByteVector &data, long streamLength)
{
if(d->data.size() < 18) {
if(data.size() < 18) {
debug("FLAC::Properties::read() - FLAC properties must contain at least 18 bytes.");
return;
}
int pos = 0;
unsigned int pos = 0;
// Minimum block size (in samples)
pos += 2;
@@ -125,26 +149,28 @@ void FLAC::Properties::read()
// Maximum frame size (in bytes)
pos += 3;
uint flags = d->data.mid(pos, 4).toUInt(true);
d->sampleRate = flags >> 12;
d->channels = ((flags >> 9) & 7) + 1;
d->sampleWidth = ((flags >> 4) & 31) + 1;
const unsigned int flags = data.toUInt(pos, true);
pos += 4;
d->sampleRate = flags >> 12;
d->channels = ((flags >> 9) & 7) + 1;
d->bitsPerSample = ((flags >> 4) & 31) + 1;
// The last 4 bits are the most significant 4 bits for the 36 bit
// stream length in samples. (Audio files measured in days)
uint highLength =d->sampleRate > 0 ? (((flags & 0xf) << 28) / d->sampleRate) << 4 : 0;
const unsigned long long hi = flags & 0xf;
const unsigned long long lo = data.toUInt(pos, true);
pos += 4;
d->length = d->sampleRate > 0 ?
(d->data.mid(pos, 4).toUInt(true)) / d->sampleRate + highLength : 0;
pos += 4;
d->sampleFrames = (hi << 32) | lo;
// Uncompressed bitrate:
if(d->sampleFrames > 0 && d->sampleRate > 0) {
const double length = d->sampleFrames * 1000.0 / d->sampleRate;
d->length = static_cast<int>(length + 0.5);
d->bitrate = static_cast<int>(streamLength * 8.0 / length + 0.5);
}
//d->bitrate = ((d->sampleRate * d->channels) / 1000) * d->sampleWidth;
// Real bitrate:
d->bitrate = d->length > 0 ? ((d->streamLength * 8L) / d->length) / 1000 : 0;
if(data.size() >= pos + 16)
d->signature = data.mid(pos, 16);
}

View File

@@ -15,8 +15,8 @@
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
* USA *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
@@ -64,24 +64,80 @@ namespace TagLib {
*/
virtual ~Properties();
// Reimplementations.
/*!
* Returns the length of the file in seconds. The length is rounded down to
* the nearest whole second.
*
* \note This method is just an alias of lengthInSeconds().
*
* \deprecated
*/
TAGLIB_DEPRECATED virtual int length() const;
virtual int length() const;
/*!
* Returns the length of the file in seconds. The length is rounded down to
* the nearest whole second.
*
* \see lengthInMilliseconds()
*/
// BIC: make virtual
int lengthInSeconds() const;
/*!
* Returns the length of the file in milliseconds.
*
* \see lengthInSeconds()
*/
// BIC: make virtual
int lengthInMilliseconds() const;
/*!
* Returns the average bit rate of the file in kb/s.
*/
virtual int bitrate() const;
/*!
* Returns the sample rate in Hz.
*/
virtual int sampleRate() const;
/*!
* Returns the number of audio channels.
*/
virtual int channels() const;
/*!
* Returns the number of bits per audio sample as read from the FLAC
* identification header.
*/
int bitsPerSample() const;
/*!
* Returns the sample width as read from the FLAC identification
* header.
*
* \note This method is just an alias of bitsPerSample().
*
* \deprecated
*/
int sampleWidth() const;
TAGLIB_DEPRECATED int sampleWidth() const;
/*!
* Return the number of sample frames.
*/
unsigned long long sampleFrames() const;
/*!
* Returns the MD5 signature of the uncompressed audio stream as read
* from the stream info header.
*/
ByteVector signature() const;
private:
Properties(const Properties &);
Properties &operator=(const Properties &);
void read();
void read(const ByteVector &data, long streamLength);
class PropertiesPrivate;
PropertiesPrivate *d;

View File

@@ -0,0 +1,78 @@
/**************************************************************************
copyright : (C) 2010 by Lukáš Lalinský
email : lalinsky@gmail.com
**************************************************************************/
/***************************************************************************
* This library is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License version *
* 2.1 as published by the Free Software Foundation. *
* *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#include <taglib.h>
#include <tdebug.h>
#include <tstring.h>
#include "flacunknownmetadatablock.h"
using namespace TagLib;
class FLAC::UnknownMetadataBlock::UnknownMetadataBlockPrivate
{
public:
UnknownMetadataBlockPrivate() : code(0) {}
int code;
ByteVector data;
};
FLAC::UnknownMetadataBlock::UnknownMetadataBlock(int code, const ByteVector &data) :
d(new UnknownMetadataBlockPrivate())
{
d->code = code;
d->data = data;
}
FLAC::UnknownMetadataBlock::~UnknownMetadataBlock()
{
delete d;
}
int FLAC::UnknownMetadataBlock::code() const
{
return d->code;
}
void FLAC::UnknownMetadataBlock::setCode(int code)
{
d->code = code;
}
ByteVector FLAC::UnknownMetadataBlock::data() const
{
return d->data;
}
void FLAC::UnknownMetadataBlock::setData(const ByteVector &data)
{
d->data = data;
}
ByteVector FLAC::UnknownMetadataBlock::render() const
{
return d->data;
}

View File

@@ -0,0 +1,81 @@
/**************************************************************************
copyright : (C) 2010 by Lukáš Lalinský
email : lalinsky@gmail.com
**************************************************************************/
/***************************************************************************
* This library is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License version *
* 2.1 as published by the Free Software Foundation. *
* *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#ifndef TAGLIB_FLACUNKNOWNMETADATABLOCK_H
#define TAGLIB_FLACUNKNOWNMETADATABLOCK_H
#include "tlist.h"
#include "tbytevector.h"
#include "taglib_export.h"
#include "flacmetadatablock.h"
namespace TagLib {
namespace FLAC {
class TAGLIB_EXPORT UnknownMetadataBlock : public MetadataBlock
{
public:
UnknownMetadataBlock(int blockType, const ByteVector &data);
~UnknownMetadataBlock();
/*!
* Returns the FLAC metadata block type.
*/
int code() const;
/*!
* Sets the FLAC metadata block type.
*/
void setCode(int code);
/*!
* Returns the FLAC metadata block type.
*/
ByteVector data() const;
/*!
* Sets the FLAC metadata block type.
*/
void setData(const ByteVector &data);
/*!
* Render the content of the block.
*/
ByteVector render() const;
private:
UnknownMetadataBlock(const MetadataBlock &item);
UnknownMetadataBlock &operator=(const MetadataBlock &item);
class UnknownMetadataBlockPrivate;
UnknownMetadataBlockPrivate *d;
};
}
}
#endif

335
taglib/it/itfile.cpp Normal file
View File

@@ -0,0 +1,335 @@
/***************************************************************************
copyright : (C) 2011 by Mathias Panzenböck
email : grosser.meister.morti@gmx.net
***************************************************************************/
/***************************************************************************
* This library is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License version *
* 2.1 as published by the Free Software Foundation. *
* *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#include "tstringlist.h"
#include "itfile.h"
#include "tdebug.h"
#include "modfileprivate.h"
#include "tpropertymap.h"
using namespace TagLib;
using namespace IT;
class IT::File::FilePrivate
{
public:
FilePrivate(AudioProperties::ReadStyle propertiesStyle)
: tag(), properties(propertiesStyle)
{
}
Mod::Tag tag;
IT::Properties properties;
};
IT::File::File(FileName file, bool readProperties,
AudioProperties::ReadStyle propertiesStyle) :
Mod::FileBase(file),
d(new FilePrivate(propertiesStyle))
{
if(isOpen())
read(readProperties);
}
IT::File::File(IOStream *stream, bool readProperties,
AudioProperties::ReadStyle propertiesStyle) :
Mod::FileBase(stream),
d(new FilePrivate(propertiesStyle))
{
if(isOpen())
read(readProperties);
}
IT::File::~File()
{
delete d;
}
Mod::Tag *IT::File::tag() const
{
return &d->tag;
}
PropertyMap IT::File::properties() const
{
return d->tag.properties();
}
PropertyMap IT::File::setProperties(const PropertyMap &properties)
{
return d->tag.setProperties(properties);
}
IT::Properties *IT::File::audioProperties() const
{
return &d->properties;
}
bool IT::File::save()
{
if(readOnly())
{
debug("IT::File::save() - Cannot save to a read only file.");
return false;
}
seek(4);
writeString(d->tag.title(), 25);
writeByte(0);
seek(2, Current);
unsigned short length = 0;
unsigned short instrumentCount = 0;
unsigned short sampleCount = 0;
if(!readU16L(length) || !readU16L(instrumentCount) || !readU16L(sampleCount))
return false;
seek(15, Current);
// write comment as instrument and sample names:
StringList lines = d->tag.comment().split("\n");
for(unsigned short i = 0; i < instrumentCount; ++ i) {
seek(192L + length + ((long)i << 2));
unsigned long instrumentOffset = 0;
if(!readU32L(instrumentOffset))
return false;
seek(instrumentOffset + 32);
if(i < lines.size())
writeString(lines[i], 25);
else
writeString(String(), 25);
writeByte(0);
}
for(unsigned short i = 0; i < sampleCount; ++ i) {
seek(192L + length + ((long)instrumentCount << 2) + ((long)i << 2));
unsigned long sampleOffset = 0;
if(!readU32L(sampleOffset))
return false;
seek(sampleOffset + 20);
if((unsigned int)(i + instrumentCount) < lines.size())
writeString(lines[i + instrumentCount], 25);
else
writeString(String(), 25);
writeByte(0);
}
// write rest as message:
StringList messageLines;
for(unsigned int i = instrumentCount + sampleCount; i < lines.size(); ++ i)
messageLines.append(lines[i]);
ByteVector message = messageLines.toString("\r").data(String::Latin1);
// it's actually not really stated if the message needs a
// terminating NUL but it does not hurt to add one:
if(message.size() > 7999)
message.resize(7999);
message.append((char)0);
unsigned short special = 0;
unsigned short messageLength = 0;
unsigned long messageOffset = 0;
seek(46);
if(!readU16L(special))
return false;
unsigned long fileSize = File::length();
if(special & Properties::MessageAttached) {
seek(54);
if(!readU16L(messageLength) || !readU32L(messageOffset))
return false;
if(messageLength == 0)
messageOffset = fileSize;
}
else
{
messageOffset = fileSize;
seek(46);
writeU16L(special | 0x1);
}
if(messageOffset + messageLength >= fileSize) {
// append new message
seek(54);
writeU16L(message.size());
writeU32L(messageOffset);
seek(messageOffset);
writeBlock(message);
truncate(messageOffset + message.size());
}
else {
// Only overwrite existing message.
// I'd need to parse (understand!) the whole file for more.
// Although I could just move the message to the end of file
// and let the existing one be, but that would waste space.
message.resize(messageLength, 0);
seek(messageOffset);
writeBlock(message);
}
return true;
}
void IT::File::read(bool)
{
if(!isOpen())
return;
seek(0);
READ_ASSERT(readBlock(4) == "IMPM");
READ_STRING(d->tag.setTitle, 26);
seek(2, Current);
READ_U16L_AS(length);
READ_U16L_AS(instrumentCount);
READ_U16L_AS(sampleCount);
d->properties.setInstrumentCount(instrumentCount);
d->properties.setSampleCount(sampleCount);
READ_U16L(d->properties.setPatternCount);
READ_U16L(d->properties.setVersion);
READ_U16L(d->properties.setCompatibleVersion);
READ_U16L(d->properties.setFlags);
READ_U16L_AS(special);
d->properties.setSpecial(special);
READ_BYTE(d->properties.setGlobalVolume);
READ_BYTE(d->properties.setMixVolume);
READ_BYTE(d->properties.setBpmSpeed);
READ_BYTE(d->properties.setTempo);
READ_BYTE(d->properties.setPanningSeparation);
READ_BYTE(d->properties.setPitchWheelDepth);
// IT supports some kind of comment tag. Still, the
// sample/instrument names are abused as comments so
// I just add all together.
String message;
if(special & Properties::MessageAttached) {
READ_U16L_AS(messageLength);
READ_U32L_AS(messageOffset);
seek(messageOffset);
ByteVector messageBytes = readBlock(messageLength);
READ_ASSERT(messageBytes.size() == messageLength);
int index = messageBytes.find((char) 0);
if(index > -1)
messageBytes.resize(index, 0);
messageBytes.replace('\r', '\n');
message = messageBytes;
}
seek(64);
ByteVector pannings = readBlock(64);
ByteVector volumes = readBlock(64);
READ_ASSERT(pannings.size() == 64 && volumes.size() == 64);
int channels = 0;
for(int i = 0; i < 64; ++ i) {
// Strictly speaking an IT file has always 64 channels, but
// I don't count disabled and muted channels.
// But this always gives 64 channels for all my files anyway.
// Strangely VLC does report other values. I wonder how VLC
// gets it's values.
if((unsigned char) pannings[i] < 128 && volumes[i] > 0)
++channels;
}
d->properties.setChannels(channels);
// real length might be shorter because of skips and terminator
unsigned short realLength = 0;
for(unsigned short i = 0; i < length; ++ i) {
READ_BYTE_AS(order);
if(order == 255) break;
if(order != 254) ++ realLength;
}
d->properties.setLengthInPatterns(realLength);
StringList comment;
// Note: I found files that have nil characters somewhere
// in the instrument/sample names and more characters
// afterwards. The spec does not mention such a case.
// Currently I just discard anything after a nil, but
// e.g. VLC seems to interpret a nil as a space. I
// don't know what is the proper behaviour.
for(unsigned short i = 0; i < instrumentCount; ++ i) {
seek(192L + length + ((long)i << 2));
READ_U32L_AS(instrumentOffset);
seek(instrumentOffset);
ByteVector instrumentMagic = readBlock(4);
READ_ASSERT(instrumentMagic == "IMPI");
READ_STRING_AS(dosFileName, 13);
seek(15, Current);
READ_STRING_AS(instrumentName, 26);
comment.append(instrumentName);
}
for(unsigned short i = 0; i < sampleCount; ++ i) {
seek(192L + length + ((long)instrumentCount << 2) + ((long)i << 2));
READ_U32L_AS(sampleOffset);
seek(sampleOffset);
ByteVector sampleMagic = readBlock(4);
READ_ASSERT(sampleMagic == "IMPS");
READ_STRING_AS(dosFileName, 13);
READ_BYTE_AS(globalVolume);
READ_BYTE_AS(sampleFlags);
READ_BYTE_AS(sampleVolume);
READ_STRING_AS(sampleName, 26);
/*
READ_BYTE_AS(sampleCvt);
READ_BYTE_AS(samplePanning);
READ_U32L_AS(sampleLength);
READ_U32L_AS(loopStart);
READ_U32L_AS(loopStop);
READ_U32L_AS(c5speed);
READ_U32L_AS(sustainLoopStart);
READ_U32L_AS(sustainLoopEnd);
READ_U32L_AS(sampleDataOffset);
READ_BYTE_AS(vibratoSpeed);
READ_BYTE_AS(vibratoDepth);
READ_BYTE_AS(vibratoRate);
READ_BYTE_AS(vibratoType);
*/
comment.append(sampleName);
}
if(message.size() > 0)
comment.append(message);
d->tag.setComment(comment.toString("\n"));
d->tag.setTrackerName("Impulse Tracker");
}

109
taglib/it/itfile.h Normal file
View File

@@ -0,0 +1,109 @@
/***************************************************************************
copyright : (C) 2011 by Mathias Panzenböck
email : grosser.meister.morti@gmx.net
***************************************************************************/
/***************************************************************************
* This library is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License version *
* 2.1 as published by the Free Software Foundation. *
* *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301 USA *
***************************************************************************/
#ifndef TAGLIB_ITFILE_H
#define TAGLIB_ITFILE_H
#include "tfile.h"
#include "audioproperties.h"
#include "taglib_export.h"
#include "modfilebase.h"
#include "modtag.h"
#include "itproperties.h"
namespace TagLib {
namespace IT {
class TAGLIB_EXPORT File : public Mod::FileBase {
public:
/*!
* Constructs a Impulse Tracker file from \a file.
*
* \note In the current implementation, both \a readProperties and
* \a propertiesStyle are ignored. The audio properties are always
* read.
*/
File(FileName file, bool readProperties = true,
AudioProperties::ReadStyle propertiesStyle =
AudioProperties::Average);
/*!
* Constructs a Impulse Tracker file from \a stream.
*
* \note In the current implementation, both \a readProperties and
* \a propertiesStyle are ignored. The audio properties are always
* read.
*
* \note TagLib will *not* take ownership of the stream, the caller is
* responsible for deleting it after the File object.
*/
File(IOStream *stream, bool readProperties = true,
AudioProperties::ReadStyle propertiesStyle =
AudioProperties::Average);
/*!
* Destroys this instance of the File.
*/
virtual ~File();
Mod::Tag *tag() const;
/*!
* Forwards to Mod::Tag::properties().
* BIC: will be removed once File::toDict() is made virtual
*/
PropertyMap properties() const;
/*!
* Forwards to Mod::Tag::setProperties().
* BIC: will be removed once File::setProperties() is made virtual
*/
PropertyMap setProperties(const PropertyMap &);
/*!
* Returns the IT::Properties for this file. If no audio properties
* were read then this will return a null pointer.
*/
IT::Properties *audioProperties() const;
/*!
* Save the file.
* This is the same as calling save(AllTags);
*
* \note Saving Impulse Tracker tags is not supported.
*/
bool save();
private:
File(const File &);
File &operator=(const File &);
void read(bool readProperties);
class FilePrivate;
FilePrivate *d;
};
}
}
#endif

260
taglib/it/itproperties.cpp Normal file
View File

@@ -0,0 +1,260 @@
/***************************************************************************
copyright :(C) 2011 by Mathias Panzenböck
email : grosser.meister.morti@gmx.net
***************************************************************************/
/***************************************************************************
* This library is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License version *
* 2.1 as published by the Free Software Foundation. *
* *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#include "itproperties.h"
using namespace TagLib;
using namespace IT;
class IT::Properties::PropertiesPrivate
{
public:
PropertiesPrivate() :
channels(0),
lengthInPatterns(0),
instrumentCount(0),
sampleCount(0),
patternCount(0),
version(0),
compatibleVersion(0),
flags(0),
special(0),
globalVolume(0),
mixVolume(0),
tempo(0),
bpmSpeed(0),
panningSeparation(0),
pitchWheelDepth(0)
{
}
int channels;
unsigned short lengthInPatterns;
unsigned short instrumentCount;
unsigned short sampleCount;
unsigned short patternCount;
unsigned short version;
unsigned short compatibleVersion;
unsigned short flags;
unsigned short special;
unsigned char globalVolume;
unsigned char mixVolume;
unsigned char tempo;
unsigned char bpmSpeed;
unsigned char panningSeparation;
unsigned char pitchWheelDepth;
};
IT::Properties::Properties(AudioProperties::ReadStyle propertiesStyle) :
AudioProperties(propertiesStyle),
d(new PropertiesPrivate())
{
}
IT::Properties::~Properties()
{
delete d;
}
int IT::Properties::length() const
{
return 0;
}
int IT::Properties::lengthInSeconds() const
{
return 0;
}
int IT::Properties::lengthInMilliseconds() const
{
return 0;
}
int IT::Properties::bitrate() const
{
return 0;
}
int IT::Properties::sampleRate() const
{
return 0;
}
int IT::Properties::channels() const
{
return d->channels;
}
unsigned short IT::Properties::lengthInPatterns() const
{
return d->lengthInPatterns;
}
bool IT::Properties::stereo() const
{
return d->flags & Stereo;
}
unsigned short IT::Properties::instrumentCount() const
{
return d->instrumentCount;
}
unsigned short IT::Properties::sampleCount() const
{
return d->sampleCount;
}
unsigned short IT::Properties::patternCount() const
{
return d->patternCount;
}
unsigned short IT::Properties::version() const
{
return d->version;
}
unsigned short IT::Properties::compatibleVersion() const
{
return d->compatibleVersion;
}
unsigned short IT::Properties::flags() const
{
return d->flags;
}
unsigned short IT::Properties::special() const
{
return d->special;
}
unsigned char IT::Properties::globalVolume() const
{
return d->globalVolume;
}
unsigned char IT::Properties::mixVolume() const
{
return d->mixVolume;
}
unsigned char IT::Properties::tempo() const
{
return d->tempo;
}
unsigned char IT::Properties::bpmSpeed() const
{
return d->bpmSpeed;
}
unsigned char IT::Properties::panningSeparation() const
{
return d->panningSeparation;
}
unsigned char IT::Properties::pitchWheelDepth() const
{
return d->pitchWheelDepth;
}
void IT::Properties::setChannels(int channels)
{
d->channels = channels;
}
void IT::Properties::setLengthInPatterns(unsigned short lengthInPatterns)
{
d->lengthInPatterns = lengthInPatterns;
}
void IT::Properties::setInstrumentCount(unsigned short instrumentCount)
{
d->instrumentCount = instrumentCount;
}
void IT::Properties::setSampleCount(unsigned short sampleCount)
{
d->sampleCount = sampleCount;
}
void IT::Properties::setPatternCount(unsigned short patternCount)
{
d->patternCount = patternCount;
}
void IT::Properties::setFlags(unsigned short flags)
{
d->flags = flags;
}
void IT::Properties::setSpecial(unsigned short special)
{
d->special = special;
}
void IT::Properties::setCompatibleVersion(unsigned short compatibleVersion)
{
d->compatibleVersion = compatibleVersion;
}
void IT::Properties::setVersion(unsigned short version)
{
d->version = version;
}
void IT::Properties::setGlobalVolume(unsigned char globalVolume)
{
d->globalVolume = globalVolume;
}
void IT::Properties::setMixVolume(unsigned char mixVolume)
{
d->mixVolume = mixVolume;
}
void IT::Properties::setTempo(unsigned char tempo)
{
d->tempo = tempo;
}
void IT::Properties::setBpmSpeed(unsigned char bpmSpeed)
{
d->bpmSpeed = bpmSpeed;
}
void IT::Properties::setPanningSeparation(unsigned char panningSeparation)
{
d->panningSeparation = panningSeparation;
}
void IT::Properties::setPitchWheelDepth(unsigned char pitchWheelDepth)
{
d->pitchWheelDepth = pitchWheelDepth;
}

107
taglib/it/itproperties.h Normal file
View File

@@ -0,0 +1,107 @@
/***************************************************************************
copyright : (C) 2011 by Mathias Panzenböck
email : grosser.meister.morti@gmx.net
***************************************************************************/
/***************************************************************************
* This library is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License version *
* 2.1 as published by the Free Software Foundation. *
* *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#ifndef TAGLIB_ITPROPERTIES_H
#define TAGLIB_ITPROPERTIES_H
#include "taglib.h"
#include "audioproperties.h"
namespace TagLib {
namespace IT {
class TAGLIB_EXPORT Properties : public AudioProperties {
friend class File;
public:
/*! Flag bits. */
enum {
Stereo = 1,
Vol0MixOptimizations = 2,
UseInstruments = 4,
LinearSlides = 8,
OldEffects = 16,
LinkEffects = 32,
UseMidiPitchController = 64,
RequestEmbeddedMidiConf = 128
};
/*! Special bits. */
enum {
MessageAttached = 1,
MidiConfEmbedded = 8
};
Properties(AudioProperties::ReadStyle propertiesStyle);
virtual ~Properties();
int length() const;
int lengthInSeconds() const;
int lengthInMilliseconds() const;
int bitrate() const;
int sampleRate() const;
int channels() const;
unsigned short lengthInPatterns() const;
bool stereo() const;
unsigned short instrumentCount() const;
unsigned short sampleCount() const;
unsigned short patternCount() const;
unsigned short version() const;
unsigned short compatibleVersion() const;
unsigned short flags() const;
unsigned short special() const;
unsigned char globalVolume() const;
unsigned char mixVolume() const;
unsigned char tempo() const;
unsigned char bpmSpeed() const;
unsigned char panningSeparation() const;
unsigned char pitchWheelDepth() const;
void setChannels(int channels);
void setLengthInPatterns(unsigned short lengthInPatterns);
void setInstrumentCount(unsigned short instrumentCount);
void setSampleCount (unsigned short sampleCount);
void setPatternCount(unsigned short patternCount);
void setVersion (unsigned short version);
void setCompatibleVersion(unsigned short compatibleVersion);
void setFlags (unsigned short flags);
void setSpecial (unsigned short special);
void setGlobalVolume(unsigned char globalVolume);
void setMixVolume (unsigned char mixVolume);
void setTempo (unsigned char tempo);
void setBpmSpeed (unsigned char bpmSpeed);
void setPanningSeparation(unsigned char panningSeparation);
void setPitchWheelDepth (unsigned char pitchWheelDepth);
private:
Properties(const Properties&);
Properties &operator=(const Properties&);
class PropertiesPrivate;
PropertiesPrivate *d;
};
}
}
#endif

192
taglib/mod/modfile.cpp Normal file
View File

@@ -0,0 +1,192 @@
/***************************************************************************
copyright : (C) 2011 by Mathias Panzenböck
email : grosser.meister.morti@gmx.net
***************************************************************************/
/***************************************************************************
* This library is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License version *
* 2.1 as published by the Free Software Foundation. *
* *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#include "modfile.h"
#include "tstringlist.h"
#include "tdebug.h"
#include "modfileprivate.h"
#include "tpropertymap.h"
using namespace TagLib;
using namespace Mod;
class Mod::File::FilePrivate
{
public:
FilePrivate(AudioProperties::ReadStyle propertiesStyle)
: properties(propertiesStyle)
{
}
Mod::Tag tag;
Mod::Properties properties;
};
Mod::File::File(FileName file, bool readProperties,
AudioProperties::ReadStyle propertiesStyle) :
Mod::FileBase(file),
d(new FilePrivate(propertiesStyle))
{
if(isOpen())
read(readProperties);
}
Mod::File::File(IOStream *stream, bool readProperties,
AudioProperties::ReadStyle propertiesStyle) :
Mod::FileBase(stream),
d(new FilePrivate(propertiesStyle))
{
if(isOpen())
read(readProperties);
}
Mod::File::~File()
{
delete d;
}
Mod::Tag *Mod::File::tag() const
{
return &d->tag;
}
Mod::Properties *Mod::File::audioProperties() const
{
return &d->properties;
}
PropertyMap Mod::File::properties() const
{
return d->tag.properties();
}
PropertyMap Mod::File::setProperties(const PropertyMap &properties)
{
return d->tag.setProperties(properties);
}
bool Mod::File::save()
{
if(readOnly()) {
debug("Mod::File::save() - Cannot save to a read only file.");
return false;
}
seek(0);
writeString(d->tag.title(), 20);
StringList lines = d->tag.comment().split("\n");
unsigned int n = std::min(lines.size(), d->properties.instrumentCount());
for(unsigned int i = 0; i < n; ++ i) {
writeString(lines[i], 22);
seek(8, Current);
}
for(unsigned int i = n; i < d->properties.instrumentCount(); ++ i) {
writeString(String(), 22);
seek(8, Current);
}
return true;
}
void Mod::File::read(bool)
{
if(!isOpen())
return;
seek(1080);
ByteVector modId = readBlock(4);
READ_ASSERT(modId.size() == 4);
int channels = 4;
unsigned int instruments = 31;
if(modId == "M.K." || modId == "M!K!" || modId == "M&K!" || modId == "N.T.") {
d->tag.setTrackerName("ProTracker");
channels = 4;
}
else if(modId.startsWith("FLT") || modId.startsWith("TDZ")) {
d->tag.setTrackerName("StarTrekker");
char digit = modId[3];
READ_ASSERT(digit >= '0' && digit <= '9');
channels = digit - '0';
}
else if(modId.endsWith("CHN")) {
d->tag.setTrackerName("StarTrekker");
char digit = modId[0];
READ_ASSERT(digit >= '0' && digit <= '9');
channels = digit - '0';
}
else if(modId == "CD81" || modId == "OKTA") {
d->tag.setTrackerName("Atari Oktalyzer");
channels = 8;
}
else if(modId.endsWith("CH") || modId.endsWith("CN")) {
d->tag.setTrackerName("TakeTracker");
char digit = modId[0];
READ_ASSERT(digit >= '0' && digit <= '9');
channels = (digit - '0') * 10;
digit = modId[1];
READ_ASSERT(digit >= '0' && digit <= '9');
channels += digit - '0';
}
else {
// Not sure if this is correct. I'd need a file
// created with NoiseTracker to check this.
d->tag.setTrackerName("NoiseTracker"); // probably
channels = 4;
instruments = 15;
}
d->properties.setChannels(channels);
d->properties.setInstrumentCount(instruments);
seek(0);
READ_STRING(d->tag.setTitle, 20);
StringList comment;
for(unsigned int i = 0; i < instruments; ++ i) {
READ_STRING_AS(instrumentName, 22);
// value in words, * 2 (<< 1) for bytes:
READ_U16B_AS(sampleLength);
READ_BYTE_AS(fineTuneByte);
int fineTune = fineTuneByte & 0xF;
// > 7 means negative value
if(fineTune > 7) fineTune -= 16;
READ_BYTE_AS(volume);
if(volume > 64) volume = 64;
// volume in decibels: 20 * log10(volume / 64)
// value in words, * 2 (<< 1) for bytes:
READ_U16B_AS(repeatStart);
// value in words, * 2 (<< 1) for bytes:
READ_U16B_AS(repatLength);
comment.append(instrumentName);
}
READ_BYTE(d->properties.setLengthInPatterns);
d->tag.setComment(comment.toString("\n"));
}

114
taglib/mod/modfile.h Normal file
View File

@@ -0,0 +1,114 @@
/***************************************************************************
copyright : (C) 2011 by Mathias Panzenböck
email : grosser.meister.morti@gmx.net
***************************************************************************/
/***************************************************************************
* This library is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License version *
* 2.1 as published by the Free Software Foundation. *
* *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#ifndef TAGLIB_MODFILE_H
#define TAGLIB_MODFILE_H
#include "tfile.h"
#include "audioproperties.h"
#include "taglib_export.h"
#include "modfilebase.h"
#include "modtag.h"
#include "modproperties.h"
namespace TagLib {
namespace Mod {
class TAGLIB_EXPORT File : public TagLib::Mod::FileBase
{
public:
/*!
* Constructs a Protracker file from \a file.
*
* \note In the current implementation, both \a readProperties and
* \a propertiesStyle are ignored. The audio properties are always
* read.
*/
File(FileName file, bool readProperties = true,
AudioProperties::ReadStyle propertiesStyle =
AudioProperties::Average);
/*!
* Constructs a Protracker file from \a stream.
*
* \note In the current implementation, both \a readProperties and
* \a propertiesStyle are ignored. The audio properties are always
* read.
*
* \note TagLib will *not* take ownership of the stream, the caller is
* responsible for deleting it after the File object.
*/
File(IOStream *stream, bool readProperties = true,
AudioProperties::ReadStyle propertiesStyle =
AudioProperties::Average);
/*!
* Destroys this instance of the File.
*/
virtual ~File();
Mod::Tag *tag() const;
/*!
* Implements the unified property interface -- export function.
* Forwards to Mod::Tag::properties().
*/
PropertyMap properties() const;
/*!
* Implements the unified property interface -- import function.
* Forwards to Mod::Tag::setProperties().
*/
PropertyMap setProperties(const PropertyMap &);
/*!
* Returns the Mod::Properties for this file. If no audio properties
* were read then this will return a null pointer.
*/
Mod::Properties *audioProperties() const;
/*!
* Save the file.
* This is the same as calling save(AllTags);
*
* \note Saving Protracker tags is not supported.
*/
bool save();
private:
File(const File &);
File &operator=(const File &);
void read(bool readProperties);
class FilePrivate;
FilePrivate *d;
};
}
}
#endif

125
taglib/mod/modfilebase.cpp Normal file
View File

@@ -0,0 +1,125 @@
/***************************************************************************
copyright : (C) 2011 by Mathias Panzenböck
email : grosser.meister.morti@gmx.net
***************************************************************************/
/***************************************************************************
* This library is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License version *
* 2.1 as published by the Free Software Foundation. *
* *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#include "tdebug.h"
#include "modfilebase.h"
using namespace TagLib;
using namespace Mod;
Mod::FileBase::FileBase(FileName file) : TagLib::File(file)
{
}
Mod::FileBase::FileBase(IOStream *stream) : TagLib::File(stream)
{
}
void Mod::FileBase::writeString(const String &s, unsigned long size, char padding)
{
ByteVector data(s.data(String::Latin1));
data.resize(size, padding);
writeBlock(data);
}
bool Mod::FileBase::readString(String &s, unsigned long size)
{
ByteVector data(readBlock(size));
if(data.size() < size) return false;
int index = data.find((char) 0);
if(index > -1)
{
data.resize(index);
}
data.replace('\xff', ' ');
s = data;
return true;
}
void Mod::FileBase::writeByte(unsigned char byte)
{
ByteVector data(1, byte);
writeBlock(data);
}
void Mod::FileBase::writeU16L(unsigned short number)
{
writeBlock(ByteVector::fromShort(number, false));
}
void Mod::FileBase::writeU32L(unsigned long number)
{
writeBlock(ByteVector::fromUInt(number, false));
}
void Mod::FileBase::writeU16B(unsigned short number)
{
writeBlock(ByteVector::fromShort(number, true));
}
void Mod::FileBase::writeU32B(unsigned long number)
{
writeBlock(ByteVector::fromUInt(number, true));
}
bool Mod::FileBase::readByte(unsigned char &byte)
{
ByteVector data(readBlock(1));
if(data.size() < 1) return false;
byte = data[0];
return true;
}
bool Mod::FileBase::readU16L(unsigned short &number)
{
ByteVector data(readBlock(2));
if(data.size() < 2) return false;
number = data.toUShort(false);
return true;
}
bool Mod::FileBase::readU32L(unsigned long &number) {
ByteVector data(readBlock(4));
if(data.size() < 4) return false;
number = data.toUInt(false);
return true;
}
bool Mod::FileBase::readU16B(unsigned short &number)
{
ByteVector data(readBlock(2));
if(data.size() < 2) return false;
number = data.toUShort(true);
return true;
}
bool Mod::FileBase::readU32B(unsigned long &number) {
ByteVector data(readBlock(4));
if(data.size() < 4) return false;
number = data.toUInt(true);
return true;
}

66
taglib/mod/modfilebase.h Normal file
View File

@@ -0,0 +1,66 @@
/***************************************************************************
copyright : (C) 2011 by Mathias Panzenböck
email : grosser.meister.morti@gmx.net
***************************************************************************/
/***************************************************************************
* This library is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License version *
* 2.1 as published by the Free Software Foundation. *
* *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#ifndef TAGLIB_MODFILEBASE_H
#define TAGLIB_MODFILEBASE_H
#include "taglib.h"
#include "tfile.h"
#include "tstring.h"
#include "tlist.h"
#include "taglib_export.h"
#include <algorithm>
namespace TagLib {
namespace Mod {
class TAGLIB_EXPORT FileBase : public TagLib::File
{
protected:
FileBase(FileName file);
FileBase(IOStream *stream);
void writeString(const String &s, unsigned long size, char padding = 0);
void writeByte(unsigned char byte);
void writeU16L(unsigned short number);
void writeU32L(unsigned long number);
void writeU16B(unsigned short number);
void writeU32B(unsigned long number);
bool readString(String &s, unsigned long size);
bool readByte(unsigned char &byte);
bool readU16L(unsigned short &number);
bool readU32L(unsigned long &number);
bool readU16B(unsigned short &number);
bool readU32B(unsigned long &number);
};
}
}
#endif

View File

@@ -0,0 +1,67 @@
/***************************************************************************
copyright : (C) 2011 by Mathias Panzenböck
email : grosser.meister.morti@gmx.net
***************************************************************************/
/***************************************************************************
* This library is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License version *
* 2.1 as published by the Free Software Foundation. *
* *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301 USA *
***************************************************************************/
#ifndef TAGLIB_MODFILEPRIVATE_H
#define TAGLIB_MODFILEPRIVATE_H
// some helper-macros only used internally by (s3m|it|xm)file.cpp
#define READ_ASSERT(cond) \
if(!(cond)) \
{ \
setValid(false); \
return; \
}
#define READ(setter,type,read) \
{ \
type number; \
READ_ASSERT(read(number)); \
setter(number); \
}
#define READ_BYTE(setter) READ(setter,unsigned char,readByte)
#define READ_U16L(setter) READ(setter,unsigned short,readU16L)
#define READ_U32L(setter) READ(setter,unsigned long,readU32L)
#define READ_U16B(setter) READ(setter,unsigned short,readU16B)
#define READ_U32B(setter) READ(setter,unsigned long,readU32B)
#define READ_STRING(setter,size) \
{ \
String s; \
READ_ASSERT(readString(s, size)); \
setter(s); \
}
#define READ_AS(type,name,read) \
type name = 0; \
READ_ASSERT(read(name));
#define READ_BYTE_AS(name) READ_AS(unsigned char,name,readByte)
#define READ_U16L_AS(name) READ_AS(unsigned short,name,readU16L)
#define READ_U32L_AS(name) READ_AS(unsigned long,name,readU32L)
#define READ_U16B_AS(name) READ_AS(unsigned short,name,readU16B)
#define READ_U32B_AS(name) READ_AS(unsigned long,name,readU32B)
#define READ_STRING_AS(name,size) \
String name; \
READ_ASSERT(readString(name, size));
#endif

View File

@@ -0,0 +1,111 @@
/***************************************************************************
copyright : (C) 2011 by Mathias Panzenböck
email : grosser.meister.morti@gmx.net
***************************************************************************/
/***************************************************************************
* This library is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License version *
* 2.1 as published by the Free Software Foundation. *
* *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#include "modproperties.h"
using namespace TagLib;
using namespace Mod;
class Mod::Properties::PropertiesPrivate
{
public:
PropertiesPrivate() :
channels(0),
instrumentCount(0),
lengthInPatterns(0)
{
}
int channels;
unsigned int instrumentCount;
unsigned char lengthInPatterns;
};
Mod::Properties::Properties(AudioProperties::ReadStyle propertiesStyle) :
AudioProperties(propertiesStyle),
d(new PropertiesPrivate())
{
}
Mod::Properties::~Properties()
{
delete d;
}
int Mod::Properties::length() const
{
return 0;
}
int Mod::Properties::lengthInSeconds() const
{
return 0;
}
int Mod::Properties::lengthInMilliseconds() const
{
return 0;
}
int Mod::Properties::bitrate() const
{
return 0;
}
int Mod::Properties::sampleRate() const
{
return 0;
}
int Mod::Properties::channels() const
{
return d->channels;
}
unsigned int Mod::Properties::instrumentCount() const
{
return d->instrumentCount;
}
unsigned char Mod::Properties::lengthInPatterns() const
{
return d->lengthInPatterns;
}
void Mod::Properties::setChannels(int channels)
{
d->channels = channels;
}
void Mod::Properties::setInstrumentCount(unsigned int instrumentCount)
{
d->instrumentCount = instrumentCount;
}
void Mod::Properties::setLengthInPatterns(unsigned char lengthInPatterns)
{
d->lengthInPatterns = lengthInPatterns;
}

Some files were not shown because too many files have changed in this diff Show More