Commit Graph

2523 Commits

Author SHA1 Message Date
5b19c7aed3 Remove unnecessary comparison 2023-12-18 17:29:39 +01:00
98a9530d23 Fix potential fallthrough 2023-12-18 17:29:39 +01:00
4775c83d8d Fix potential fallthrough 2023-12-18 17:29:39 +01:00
034262c518 Fix implicit conversions
This commit does not address any potential mishandling of
64-bit header sizes
2023-12-18 17:29:39 +01:00
57c8dbe014 Use long long (QWORD) for sizes 2023-12-18 17:29:39 +01:00
bfaf1be6a6 Fix MPC tests 2023-12-18 17:29:39 +01:00
c9f7772198 Use unsigned long for sampleFrames 2023-12-18 17:29:39 +01:00
549bca3382 Fix implicit long to int conversions 2023-12-18 17:29:39 +01:00
98961813dc Fix implicit long to int conversion 2023-12-18 17:29:39 +01:00
9a08678098 Fix implicit long to int conversions 2023-12-18 17:29:39 +01:00
c1d8159a34 Fix MinGW warning 'redeclared without dllimport attribute' 2023-12-16 15:01:11 +01:00
fa234fc053 make swap function noexcept
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-12-13 12:59:03 +01:00
b4fe04f8e0 tests: fix compilation on MSYS2
Something about a deleted operator<<.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-12-13 06:24:39 +01:00
c9486731d9 Fix MSVC warning needs to have dll-interface (#1185)
Unfortunately, MSVC exports everything (not only public members) when
__declspec(dllexport) is set at the class level via TAGLIB_EXPORT, which
leads to many "needs to have dll-interface to be used by clients" 4251
warnings issued by MSVC, because the std::unique_ptr pimpls are
exported too. As it is not possible to "unexport" private members,
such a warning has to be explicitly suppressed for these cases or
all public and protected class member now have to be exported
for classes derived from a template (StringList, ByteVectorList,
PropertyMap).
2023-12-11 06:35:08 +01:00
ec734bbe08 Fix MSVC warning dllexport and extern are incompatible
C4910: '__declspec(dllexport)' and 'extern' are incompatible on an
explicit instantiation
2023-12-11 06:35:08 +01:00
c7babea74a Fix narrowing warning issued by MSVC 2023-12-11 06:35:08 +01:00
8a42e552aa Use private implementations for MP4::Atom, MP4::Atoms 2023-12-11 06:35:08 +01:00
28baa03b23 Improve doc comments for PrivateFrame 2023-12-11 06:35:08 +01:00
10094f66b9 Remove deprecated APE value(), toStringList(), ID3v2 unsycronisation()
- APE::Item::value(): use binaryData()
- APE::Item::toStringList(): use values()
- MPEG::ID3v2::Frame::Header::unsycronisation(): use unsynchronisation()
2023-12-11 06:35:08 +01:00
aca1d0d41c Remove unused file trefcounter.h 2023-12-11 06:35:08 +01:00
491322d1ba Tolerate trailing garbage in M4A files (#1186)
If an M4A file contains trailing garbage (e.g. an APE tag at the
end of the file), it was considered invalid since [e21640b].
It is important to make sure that atoms which affect modifications
written by TagLib are valid, otherwise the file might be damaged.
However, in cases where invalid atoms do not affect modifications
(which are only done inside the root level "moov" and "moof"
containers), they can be safely ignored.

This commit allows trailing garbage in M4A files as it is also
accepted in MP3, WAV and DSF files.
2023-12-08 15:58:01 +01:00
8b3f1a459e Fix issues reported by CppCheck
Many shadowFunction, some useStlAlgorithm, and others.

cppcheck --enable=all --inline-suppr \
  --suppress=noExplicitConstructor --suppress=unusedFunction \
  --suppress=missingIncludeSystem --project=compile_commands.json
2023-12-07 05:00:00 +01:00
131918333b Fix issues reported by Clang Static Analyzer
Some deadcode.DeadStores.

On Debian 12:
CXXFLAGS=-I/usr/include/x86_64-linux-gnu/c++/12 \
cmake -DCMAKE_C_COMPILER=/usr/share/clang/scan-build-14/libexec/ccc-analyzer \
    -DCMAKE_CXX_COMPILER=/usr/share/clang/scan-build-14/libexec/c++-analyzer \
    -DBUILD_SHARED_LIBS=OFF \
    -DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
    -DENABLE_CCACHE=ON -DBUILD_TESTING=ON -DBUILD_EXAMPLES=ON \
    -DCMAKE_BUILD_TYPE=Debug ../taglib
scan-build make
2023-12-07 05:00:00 +01:00
cf2bdce21d ORIGINALDATE and RELEASEDATE mapppings for MP4 2023-12-05 05:26:55 +01:00
51d63ab285 Detach list when setAutoDelete() is called
When calling setAutoDelete() on the implicitly shared copy of a list,
also auto-deletion of the original container was modified because
it was not detached. On the other hand, detach() was called by some
methods getting an Iterator parameter, which can lead to modification
of other implicitly shared copies but not the object is was called on.
This happens when the method is called on a not-already-detached
container, which is normally not the case because the container is
detached when the iterator is taken (e.g. calling begin()).
In such methods detach() cannot be called, and the client must
make sure that the iterator is taken after making an implicit copy.
This will NOT work:

List<int> l1 = { 1 };
auto it = l1.begin();
List<int> l2 = l1;
l1.erase(it);

This will modify both l1 and l2. The second and the third lines
must be swapped so that l1.begin() will detach l1 from l2.
2023-12-02 08:03:14 +01:00
3f11e0ae2f TestId3v2FrameFactory: Fix memory leak
The frames in a frameList() copy were not deleted because it had the
autoDelete property active. However, removed frames cannot be auto
deleted. Using setAutoDelete() affects the source of the copy, which has
to be investigated further.
2023-12-01 07:55:55 +01:00
bd06012b02 Implement property interface for RIFF Info 2023-12-01 07:55:55 +01:00
9233ff1f5d Support OWNER property for MP4
OWNER ownr
2023-12-01 07:55:55 +01:00
88219f2493 Support additional properties for ASF
ARTISTWEBPAGE WM/AuthorURL
ENCODING WM/EncodingSettings
INITIALKEY WM/InitialKey
ORIGINALALBUM WM/OriginalAlbumTitle
ORIGINALARTIST WM/OriginalArtist
ORIGINALFILENAME WM/OriginalFilename
ORIGINALLYRICIST WM/OriginalLyricist
2023-12-01 07:55:55 +01:00
9df243ef74 Separate multiple values in basic tag with " / " instead of " " 2023-12-01 06:22:35 +01:00
c1bb678695 Remove redundant UserTextIdentificationFrame::fieldList() 2023-12-01 06:22:35 +01:00
56382e8cd4 Return tag union for tag() of WAV file 2023-12-01 06:22:35 +01:00
8bb8fc5fe6 Remove null byte removal for table of contents frame 2023-12-01 06:22:35 +01:00
8b564baf01 Make PropertyMap::unsupportedData() const 2023-12-01 06:22:35 +01:00
3d67b139e4 Fix extensibility of ID3v2 FrameFactory
Because the main extension point of FrameFactory was using a protected
Frame subclass, it was not really possible to implement a custom frame
factory. Existing Frame subclasses also show that access to the frame
header might be needed when implementing a Frame subclass.
2023-11-23 16:41:46 +01:00
59166f6757 ID3v2: Always pass correct FrameFactory from File to Tag 2023-11-23 16:41:46 +01:00
b993e70cf4 Use ID3v2::FrameFactory also for AIFF 2023-11-23 16:41:46 +01:00
b7dc1ab8ac Fail MPEG header check when frame length is zero (#1174) 2023-11-23 16:41:13 +01:00
c86a2fce70 Fix MPC content check in presence of ID3v2 tag 2023-11-23 16:41:13 +01:00
faddc4aa06 Export CMake configuration
This will install a <libdir>/cmake/taglib/ folder with CMake
configuration, so that users can simply use

find_package(TagLib)
add_executable(myproject ...)
target_link_libraries(myproject TagLib::tag)
2023-11-23 16:40:40 +01:00
16326b2479 Restore ZLIB_LIBRARIES_FLAGS, used for .pc files 2023-11-23 16:40:40 +01:00
c083d7ce15 Clients can control supported MP4 atoms using an ItemFactory (#1175) 2023-11-23 16:39:57 +01:00
9679b08120 Verify type of ID3v2 frames used for complex properties (#1173)
A frame with ID "APIC" is not guaranteed to be an AttachedPictureFrame,
it can also be an invalid UnknownFrame with ID "APIC". Check the types
of the frames before accessing them.
2023-11-09 20:59:47 +01:00
0e395f4ec4 Use ID3v2::FrameFactory also for WAV and DSDIFF (#1172)
* Use ID3v2::FrameFactory also for WAV and DSDIFF

* Apply suggestions from code review

Co-authored-by: Kevin André <hyperquantum@gmail.com>

---------

Co-authored-by: Kevin André <hyperquantum@gmail.com>
2023-11-09 18:58:51 +01:00
52b245f015 MP4: Use integer instead of boolean for hdvd atom (#1169) (#1170) 2023-11-05 14:40:49 +01:00
2f4c76b52a MP4: Get duration from mvhd if not present in mdhd (#1165) (#1168) 2023-11-05 14:40:37 +01:00
dfa33bec08 Fix crash with invalid WAV files (#1163) (#1164)
With specially crafted WAV files having the "id3 " chunk as the
only valid chunk, when trying to write the tags, the existing
"id3 " chunk is removed, and then vector::front() is called on
the now empty chunks vector.
Now it is checked if the vector is empty to avoid the crash.
2023-11-05 14:40:18 +01:00
f202fa25c3 GitHub Actions: Update Homebrew utfcpp to 4.0.2 (#1171)
Revert "Fix build on Mac with Homebrew utf8cpp"
This reverts commit 70b4ce79fb.

Is now fixed upstream
https://github.com/nemtrif/utfcpp/pull/113
https://github.com/nemtrif/utfcpp/releases/tag/v4.0.2
https://github.com/Homebrew/homebrew-core/pull/153333
2023-11-05 14:39:33 +01:00
70b4ce79fb Fix build on Mac with Homebrew utf8cpp 2023-11-03 22:53:31 +01:00
8c63c877ad Add "MP2" to supported file extensions 2023-11-03 17:05:29 +01:00