mirror of
https://github.com/taglib/taglib.git
synced 2025-07-22 06:54:22 -04:00
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>
This commit is contained in:
@ -25,6 +25,7 @@ include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/ogg/opus
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/dsf
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/dsdiff
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/shorten
|
||||
)
|
||||
|
||||
set(tag_c_HDRS tag_c.h)
|
||||
|
@ -55,6 +55,7 @@
|
||||
#include "opusfile.h"
|
||||
#include "dsffile.h"
|
||||
#include "dsdifffile.h"
|
||||
#include "shortenfile.h"
|
||||
#include "tag.h"
|
||||
#include "id3v2framefactory.h"
|
||||
|
||||
@ -190,6 +191,9 @@ TagLib_File *taglib_file_new_type(const char *filename, TagLib_File_Type type)
|
||||
case TagLib_File_DSDIFF:
|
||||
file = new DSDIFF::File(filename);
|
||||
break;
|
||||
case TagLib_File_SHORTEN:
|
||||
file = new Shorten::File(filename);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -130,7 +130,8 @@ typedef enum {
|
||||
TagLib_File_XM,
|
||||
TagLib_File_Opus,
|
||||
TagLib_File_DSF,
|
||||
TagLib_File_DSDIFF
|
||||
TagLib_File_DSDIFF,
|
||||
TagLib_File_SHORTEN
|
||||
} TagLib_File_Type;
|
||||
|
||||
/*!
|
||||
|
Reference in New Issue
Block a user