Commit Graph

2539 Commits

Author SHA1 Message Date
Urs Fleisch
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
Urs Fleisch
59166f6757 ID3v2: Always pass correct FrameFactory from File to Tag 2023-11-23 16:41:46 +01:00
Urs Fleisch
b993e70cf4 Use ID3v2::FrameFactory also for AIFF 2023-11-23 16:41:46 +01:00
Urs Fleisch
b7dc1ab8ac Fail MPEG header check when frame length is zero (#1174) 2023-11-23 16:41:13 +01:00
Urs Fleisch
c86a2fce70 Fix MPC content check in presence of ID3v2 tag 2023-11-23 16:41:13 +01:00
Urs Fleisch
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
Urs Fleisch
16326b2479 Restore ZLIB_LIBRARIES_FLAGS, used for .pc files 2023-11-23 16:40:40 +01:00
Urs Fleisch
c083d7ce15
Clients can control supported MP4 atoms using an ItemFactory (#1175) 2023-11-23 16:39:57 +01:00
Urs Fleisch
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
Urs Fleisch
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
Urs Fleisch
52b245f015
MP4: Use integer instead of boolean for hdvd atom (#1169) (#1170) 2023-11-05 14:40:49 +01:00
Urs Fleisch
2f4c76b52a
MP4: Get duration from mvhd if not present in mdhd (#1165) (#1168) 2023-11-05 14:40:37 +01:00
Urs Fleisch
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
Urs Fleisch
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
Urs Fleisch
70b4ce79fb Fix build on Mac with Homebrew utf8cpp 2023-11-03 22:53:31 +01:00
Urs Fleisch
8c63c877ad Add "MP2" to supported file extensions 2023-11-03 17:05:29 +01:00
Nick Shaforostoff
3869aa189f
Raw AAC (ADTS) support (#508)
Detect ADTS MPEG header to use it also for AAC.

The test file empty1s.aac was generated using
ffmpeg -f lavfi -i anullsrc=r=11025:cl=mono -t 1 -acodec aac empty1s.aac

---------

Co-authored-by: Nick Shaforostov <mshaforostov@airmusictech.com>
Co-authored-by: Urs Fleisch <ufleisch@users.sourceforge.net>
2023-11-03 05:17:39 +01:00
Urs Fleisch
a7c0b53f7a C bindings: taglib_file_new_iostream() to access file from memory (#987)
A ByteVectorStream can be created/freed from C using
taglib_memory_iostream_new()/taglib_iostream_free().
2023-10-27 09:46:54 +02:00
Urs Fleisch
135c0eb647 tagreader: Fix displaying of seconds in length, UTF-8 for ostream
The padding was wrong, 8 seconds were displayed as 0:80 instead of 0:08.
Also make the output of tagreader and tagreader_c the same, including
the encoding, which was still ISO-8859-1 for std::ostream.
2023-10-27 09:46:54 +02:00
Urs Fleisch
0db487bf61 Remove deprecated FileRef::create() method
In order to achieve this, the TagLib_File type of the C bindings is now
a FileRef and no longer a File. The support for the .oga extension has been
ported to FileRef(), so that taglib_file_new() should still behave the
same, but additionally also support content based file type detection.
2023-10-27 09:46:54 +02:00
Urs Fleisch
8d98ebf24b Provide properties methods on FileRef, make FileRef non-virtual
Use of FileRef::file() is discouraged, but was necessary to access the
properties. It was also not clear whether to access the properties via
tag() or file(). With the property methods on FileRef, it should become
the "simple usage" interface it was meant to be.
As the destructor was the only virtual method on FileRef, it is now made
non-virtual. Probably, it is not useful as a virtual base class.
2023-10-27 09:46:54 +02:00
Urs Fleisch
11f94903d0 DSDIFF: Add tests for ID3 in PROP and DIIN chunks 2023-10-23 06:06:05 +02:00
Urs Fleisch
dce8e016b9 DSDIFF: Fix MSVC warnings 2023-10-23 06:06:05 +02:00
Urs Fleisch
6b5f28d56d DSDIFF: Fix adding and removing DIIN chunks
Also modernize and simplify code, fix formatting, support
ID3v2FrameFactory, fix updating the internal chunk bookkeeping
after file modifications, stripping ID3 and DIIN tags.
2023-10-23 06:06:05 +02:00
Stephen F. Booth
19cceab211 DSDIFF support, add tests, fix formatting 2023-10-23 06:06:05 +02:00
Urs Fleisch
182edcd3f9 Add unit tests for C bindings 2023-10-21 06:19:55 +02:00
Urs Fleisch
a3ad2d0aaa C bindings for complex properties like pictures (#953)
Provides a unified API for complex properties in the same way as
the Properties API in the C bindings. Since constructing and
traversing complex properties in C is a bit complicated, there
are convenience functions for the most common use case of getting
or setting a single picture.

    TAGLIB_COMPLEX_PROPERTY_PICTURE(props, data, size, "Written by TagLib",
                                   "image/jpeg", "Front Cover");
    taglib_complex_property_set(file, "PICTURE", props);

and

    TagLib_Complex_Property_Attribute*** properties =
      taglib_complex_property_get(file, "PICTURE");
    TagLib_Complex_Property_Picture_Data picture;
    taglib_picture_from_complex_property(properties, &picture);
2023-10-21 06:19:55 +02:00
complexlogic
1d213b8b98
List: Add Sort Functions (#1160) 2023-10-18 07:54:22 +02:00
complexlogic
b40b834b1b Add ByteVector conversion functions, tests 2023-10-15 08:29:58 +02:00
Urs Fleisch
6be03b7ae1 Unified interface for complex properties like pictures (#94)
Provides a dynamic interface for properties which cannot be represented
with simple strings, e.g. pictures. The keys of such properties can
be queried using `complexPropertyKeys()`, which could return for example
["PICTURE"]. The property can then be read using
`complexProperties("PICTURE")`, which will return a list of variant maps
containing the picture data and attributes. Adding a picture is as
easy as

    t->setComplexProperties("PICTURE", {
      {
        {"data", data},
        {"pictureType", "Front Cover"},
        {"mimeType", "image/jpeg"}
      }
    });
2023-10-14 09:01:59 +02:00
Urs Fleisch
75d4252480 Variant type as container for complex properties 2023-10-14 09:01:59 +02:00
Urs Fleisch
304ab62957 Fix building without zlib 2023-10-14 09:01:59 +02:00
Rosen Penev
89a54863ee
std::array conversion (#1157) 2023-10-09 17:09:27 +02:00
nmariusp
3f25d3c342
Proofreading (#1155)
---------

Co-authored-by: Urs Fleisch <ufleisch@users.sourceforge.net>
2023-10-08 05:58:33 +02:00
Urs Fleisch
2e3a66cc31 Fix memory leak in testParsePodcastFrame() 2023-10-07 09:18:22 +02:00
Urs Fleisch
41077aa57e Braced list initialization for StringList and ByteVectorList (#1154)
Additionally, provide operator==() and operator!=() for Map and
operator<<() for ByteVectorList to facilitate the writing of tests.
2023-10-07 08:51:17 +02:00
complexlogic
21b08c0dcb
List: Support Braced List Initialization (#1154)
* List: support braced list initialization

* Use swap for assignment

---------

Co-authored-by: complexlogic <complexlogic@users.noreply.github.com>
2023-10-07 07:27:29 +02:00
complexlogic
8a800b8c38
Map: Support Braced List Initialization (#1153)
* Map: support braced list initialization

* Use swap assignment

---------

Co-authored-by: complexlogic <complexlogic@users.noreply.github.com>
2023-10-07 07:27:14 +02:00
Kevin André
c332aa04f2
Add simple runtime version check API (#970)
How to use:

  #include <tversionnumber.h>

  if (TagLib::runtimeVersion() >= TagLib::VersionNumber(1, 11, 1)) {
    // running v1.11.1 or higher
  }

  if (TagLib::runtimeVersion() >= TagLib::VersionNumber(1, 12)) {
    // running v1.12 or higher
  }

---------

Co-authored-by: Urs Fleisch <ufleisch@users.sourceforge.net>
2023-10-06 14:15:30 +02:00
Urs Fleisch
24e0ac7aa4 Do not use tabs in CMake files 2023-09-30 15:12:51 +02:00
evpobr
ad1696ade6 Fix undefined PLATFORM_WINRT CMake option (#870) 2023-09-30 14:34:58 +02:00
Urs Fleisch
c13a42021a
Do not scan full MPEG file for ID3v2 tag in Fast read style (#968) (#1151)
This is based on the patch used by VLC, but the full scan is only
skipped when the read style is explicitly set to Fast.
https://code.videolan.org/videolan/vlc/-/blob/master/contrib/src/taglib/0001-Implement-ID3v2-readStyle-avoid-worst-case.patch
2023-09-30 14:25:52 +02:00
Jan Palus
2154078187
cmake: support both relative and absolute paths for pc files (#1152)
cmake supports both absolute and relative to prefix install dirs. #1071
effectively mandated relative paths only. check if install dir is
relative or absolute and either include ${prefix} in pc file or not

Fixes #1098
2023-09-30 14:25:00 +02:00
Urs Fleisch
eaf7ff8b94 DSF: Support frame factory, ID3v2.3, allow trailing garbage
Additionally test coverage and formatting are improved.
2023-09-26 16:23:03 +02:00
Stephen F. Booth
39d1d68237 DSD Stream File (DSF) support 2023-09-26 16:23:03 +02:00
Rosen Penev
e275abb8a3
Convert private raw pointers to unique_ptr (#1127)
Simplifies the code quite a bit.
2023-09-23 06:46:05 +02:00
nmariusp
967aaf7af2
Require CMake version 3.5 (#1148)
Fix issue "CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.".
2023-09-16 22:00:22 -05:00
Rosen Penev
48c4bf9c05
change two loops to while (#1147)
and one to for range.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-09-16 13:28:12 +02:00
Rosen Penev
bdf50eda99
use some more auto (#1146) 2023-09-16 13:12:04 +02:00
Rosen Penev
653c2fe9e1
clang-tidy: use using instead of typedef (#1120)
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-09-16 09:06:14 +02:00