Commit Graph

119 Commits

Author SHA1 Message Date
Jamie
3ccc390155
Add file_new and file_new_type wchar variants for C binding (#1271) 2025-05-16 17:01:23 +02:00
Urs Fleisch
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
Stephen Booth
648f5e5882
Add Shorten (SHN) support (#1257)
* Add Shorten (SHN) support

* Add `<cmath>` include and use `std::log2`

* Use `uintptr_t` for buffer size calculations

* Work around `byteSwap` not using fixed width types

* Remove four-character codes

* Attempt to fix `static_assert`

* Revert previous commit

* Update `read_uint`* functions

* Use ByteVector for byte swaps

* Use different ByteVector ctor

* Rework variable-length input to use ByteVector

* Rename some variables

* Naming and formatting cleanup

* Add basic Shorten tests

* Rename a constant

* Rename `internalFileType` to `fileType`

* Add documentation on `fileType` meaning

* Add DO_NOT_DOCUMENT guard

* Fix shadowVariable issues reported by cppcheck

cppcheck --enable=all --inline-suppr \
  --suppress=noExplicitConstructor --suppress=unusedFunction \
  --suppress=missingIncludeSystem --project=compile_commands.json

* Formatting cleanup

* More explicit types

Reason for these changes: getRiceGolombCode(k, uInt32CodeSize) was
called with int k for uint32_t& argument.
There was also a warning from MSVC for line 299:
warning C4267: 'argument': conversion from 'size_t' to 'int'

* Additional explicit types

* Rename `SHN` namespace to `Shorten`

Also rename files to match

---------

Co-authored-by: Urs Fleisch <ufleisch@users.sourceforge.net>
2024-12-30 07:23:11 -06:00
Urs Fleisch
20cec27ac0 C bindings: Support UTF-8 for property values 2024-04-01 08:45:52 +02:00
Urs Fleisch
e49390c7c5 Inspection: Type can be replaced with auto 2024-01-21 20:46:27 +01:00
Urs Fleisch
580b0b0c82 Inspection: Possibly unused #include directive 2024-01-21 20:46:27 +01:00
Urs Fleisch
c3d73a26ff Inspection: Parameter names do not match 2024-01-21 20:46:27 +01:00
Urs Fleisch
613355665c Inspection: Variable can be moved to inner scope 2024-01-21 20:46:27 +01:00
Urs Fleisch
6b17aa3694 Inspection: Parameter can be made pointer to const 2024-01-21 20:46:27 +01:00
Urs Fleisch
fb0f7dfa57 More API documentation corrections 2024-01-17 20:54:56 +01:00
Urs Fleisch
c5d798a50d Correct the API documentation 2024-01-04 17:18:23 +01:00
Urs Fleisch
bd4c9cbf97 Support installation alongside TagLib 1 with -DTAGLIB_INSTALL_SUFFIX=-2 2023-12-24 14:16:15 +01:00
Urs Fleisch
e414987344 C bindings: Add missing types for taglib_file_new_type() 2023-12-22 13:40:18 +01:00
Urs Fleisch
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
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
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
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
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
nmariusp
3f25d3c342
Proofreading (#1155)
---------

Co-authored-by: Urs Fleisch <ufleisch@users.sourceforge.net>
2023-10-08 05:58:33 +02:00
Urs Fleisch
24e0ac7aa4 Do not use tabs in CMake files 2023-09-30 15:12:51 +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
Rosen Penev
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
Rosen Penev
524b588a1e
manual range loop conversions (#1126)
* manual range loop conversions

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

* Restore const containers where non const temporaries are iterated

* Use std::as_const() instead of const container copies where possible

---------

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Co-authored-by: Urs Fleisch <ufleisch@users.sourceforge.net>
2023-09-06 20:58:13 +02:00
Urs Fleisch
cc7d23cdf5 Consistently use quote form when including our own headers 2023-07-22 07:09:58 +02:00
Urs Fleisch
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
Urs Fleisch
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
Urs Fleisch
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
whatdoineed2do
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
Urs Fleisch
a33cc0635a Remove deprecated stuff 2023-07-09 07:01:37 +02:00
dabrain34
967c0eefed
cmake: generate pc files with the use of prefix (#1071) 2022-12-04 13:27:58 +01:00
Ryan Schmidt
8aa7dd81d8 Fix macOS dylib install name to be absolute path
Closes #1065
2022-10-28 18:04:34 +02:00
Rosen Penev
38d1d4c21c clang-tidy: add ending namespace comments
Found with google-readability-namespace-comments

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-06-21 06:49:32 +02:00
Andreas Sturmlechner
507a42871c Use GNUInstallDirs
Well-established CMake standard for installation directories.

Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2021-03-06 14:52:25 +01: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
Svyatoslav Mishyn
1b878102f0 c: fix a typo
readble => readable
2016-04-22 16:46:15 +03: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
bc8b60ea46 Remove an unreachable statement. 2015-12-02 14:08:20 +09:00
Tsuda Kageyu
72a807def1 Fix a string conversion bug in tag_c.cpp. 2015-11-19 11:50:39 +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
Lukáš Lalinský
29ed265281 Skip the patch version if it's 0 2015-08-25 17:04:34 +02:00
Bart van der Velden
fb1c744daf Compile without warnings with MSVC 2014-12-08 09:42:04 -08:00
Tsuda Kageyu
2971891c69 Reduce useless detach operations by making some non-const iterators const. 2014-08-21 16:35:35 +09: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
Lukáš Lalinský
fdb8a6b065 Reintroduce HAVE_CONFIG_H so that TagLib can be built without CMake 2013-06-20 15:07:25 +02:00
Tsuda Kageyu
b0938a3cf1 Removed config.h and moved macros into taglib_config.h 2013-05-02 20:41:59 +09: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
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
Johannes Pfau
22b57f4463 Add taglib_free function to C binding 2011-08-05 13:17:42 +02:00