Commit Graph

69 Commits

Author SHA1 Message Date
b9122afaca Preserve track UID in simple tags
Some encoders write track specific DURATION tags, which should not be
removed.
2026-01-24 14:59:10 +01:00
c817cc0a47 tagwriter: Support setting of complex properties
A complex property can be set with

-C <complex-property-key> <key1=val1,key2=val2,...>

The second parameter can be set to "" to delete complex properties with the
given key. The set complex property values, a simple shorthand syntax can be
used. Multiple maps are separated by ';', values within a map are assigned
with key=value and separated by a ','. Types are automatically detected,
double quotes can be used to force a string. A ByteVector can be constructed
from the contents of a file with the path is given after "file://". There is
no escape, but hex codes are supported, e.g. "\x2C" to include a ',' and \x3B
to include a ';'.

Examples:

Set a GEOB frame in an ID3v2 tag:
examples/tagwriter -C GENERALOBJECT \
  'data=file://file.bin,description=My description,fileName=file.bin,mimeType=application/octet-stream' \
  file.mp3

Set an APIC frame in an ID3v2 tag (same as -p file.jpg 'My description'):
examples/tagwriter -C PICTURE \
  'data=file://file.jpg,description=My description,pictureType=Front Cover,mimeType=image/jpeg' \
  file.mp3

Set an attached file in a Matroska file:
examples/tagwriter -C file.bin \
  'fileName=file.bin,data=file://file.bin,mimeType=application/octet-stream' \
  file.mka

Set simple tag with target type in a Matroska file:
examples/tagwriter -C PART_NUMBER \
  name=PART_NUMBER,targetTypeValue=20,value=2 file.mka

Set simple tag with binary value in a Matroska file:
examples/tagwriter -C BINARY \
  name=BINARY,data=file://file.bin,targetTypeValue=60 file.mka
2026-01-24 14:59:10 +01:00
d47d28f0f8 Fix and simplify Matroska simple tag
Avoid use of raw pointers, fix property interface.
2026-01-24 14:59:10 +01:00
3566b00596 Clean up attachments
Avoid use of raw pointers.
2026-01-24 14:59:10 +01:00
5a6f1f96f8 Apply TagLib code formatting, fix static analysis issues 2026-01-24 14:59:10 +01:00
4546c00417 Compile time configuration WITH_MATROSKA 2026-01-24 14:59:10 +01:00
6d019a894c Initial attachments support 2026-01-24 14:59:10 +01:00
6342f00e8b Support tag language 2026-01-24 14:59:10 +01:00
80837485cf Added write support 2026-01-24 14:59:10 +01:00
47e9b9a17c Initial matroska support 2026-01-24 14:59:10 +01:00
42dcfec86b Use tag_c.h as first include in build with C compiler (#1273)
This will fail on MinGW because its gcc does not have wchar_t without
including wchar.h. With g++ as used with test_tag_c.cpp, the problem is
undetected because g++ supports wchar_t without including wchar.h.
2025-06-14 08:53:30 +02:00
ee1931b811 Compile time configuration of supported formats (#1262)
CMake options WITH_APE, WITH_ASF, WITH_DSF, WITH_MOD, WITH_MP4,
WITH_RIFF, WITH_SHORTEN, WITH_TRUEAUDIO, WITH_VORBIS, by default,
they are all ON.
2025-02-02 12:24:26 +01:00
7c85fcaa81 Remove 'using namespace std' to avoid potential conflicts in example files (#1241)
Co-authored-by: nekiwo <nekiwo@users.noreply.github.com>
2024-08-05 21:54:33 +02:00
c4ed590032 tagwriter option -p not working properly (#1236) (#1237)
The -p option of tagwriter sample does not work.
This is because the picture file is open in text mode instead of binary.
Also, the isFile function does not work on Windows in 32 bit mode with
large files. Using _stat64 instead of stat solves the problem.
2024-07-19 12:25:46 +02: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
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
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
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
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
7646184d6b unused includes (#1133)
* unused includes

Signed-off-by: Rosen Penev <rosenp@gmail.com>

* Use consistent order of includes

Always include in the following order:
- Own header files
- Standard header files
- System header files
- Project header files (toolkit first)

Exceptions:
- cppunit/extensions/HelperMacros.h must be included after
  header files declaring stream operators
- config.h must be included before its definitions are used

---------

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Co-authored-by: Urs Fleisch <ufleisch@users.sourceforge.net>
2023-09-16 08:22:36 +02:00
cc7d23cdf5 Consistently use quote form when including our own headers 2023-07-22 07:09:58 +02:00
2a1fb27735 clang-tidy: Replace C headers with C++ alternatives
run-clang-tidy -header-filter='.*' -checks='-*,modernize-deprecated-headers'

Fixed manually as automatic fix would shuffle headers around.
2023-07-22 07:09:58 +02:00
77ab5e9689 Narrow the scope of iterators
Also make sure that it is visible at first glance that iterators are
not taken from temporaries.
2023-07-22 07:09:58 +02:00
c2c9e8989c clang-tidy: Use auto where it improves the readability
run-clang-tidy -header-filter='.*' -checks='-*,modernize-use-auto' \
-config="{CheckOptions: [{key: modernize-use-auto.RemoveStars, value: '1'}]}" \
-fix

Manually fixed some wrong `const auto` replacements and verified
that all types are deduced correctly.
2023-07-22 07:09:58 +02:00
63922f2676 Avoid unnecessary detaching of containers
If only a constant iterator is needed, make the container const if
possible, otherwise use cbegin() and cend() to get a constant iterator
without detaching the container.

These fixes are needed so that `auto` can deduce the correct
iterator type.
2023-07-22 07:09:58 +02:00
e20a53afbb C bindings - properties i/f (#1091)
Support properties in C bindings

---------

Co-authored-by: whatdoineed2do/Ray <whatdoineed2do@nospam.gmail.com>
Co-authored-by: Urs Fleisch <ufleisch@users.sourceforge.net>
2023-07-09 19:48:27 +02:00
a33cc0635a Remove deprecated stuff 2023-07-09 07:01:37 +02:00
243dd863d7 Install examples after we selected to build them
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2021-03-06 14:52:25 +01:00
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
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
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
0a90687805 add options R, I, D for replace/insert/delete of arbitrary tags 2015-09-23 14:11:40 +02:00
35d5ba4eff Add BUILD_BINDINGS option, moved if(BUILD_EXAMPLES) to taglib/CMakeLists, plus some cleanup. 2015-08-06 17:26:37 -04:00
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
2971891c69 Reduce useless detach operations by making some non-const iterators const. 2014-08-21 16:35:35 +09:00
05e0081414 Avoid using sprintf() in tagreader.cpp to fix an MSVC warning. 2014-02-19 23:35:23 +09:00
4d126c49e9 Fixed a crash of APE::Item::toString() when the data type is binary 2013-07-14 02:47:48 +09:00
15b601f053 Use PropertyMap in tagreader 2012-11-21 14:40:26 +01:00
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
45b0279b41 Add a tool to inspect audio files, only MP4 is implemented for now 2012-11-11 16:43:36 +01:00
050ff3835d Revert "Install examples if built."
This reverts commit 52e96e48c5.
2012-07-14 21:06:53 +02:00
52e96e48c5 Install examples if built. 2012-05-16 04:37:25 +10:00
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
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
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
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
705fa9d79b Fix compilation on MSVC/Windows
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@777124 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-02-19 19:52:04 +00:00
aedbaeaf5a show ape tags in the framelist
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@769307 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2008-02-01 04:15:59 +00:00
bb9e6fe65f Split BUILD_TESTS to BUILD_TESTS and BUILD_EXAMPLES.
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@740072 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2007-11-22 13:20:21 +00:00
0da49842dd SVN_SILENT didn't mean for that to go in
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@727756 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
2007-10-21 17:37:28 +00:00