musikr: reformat shim
This commit is contained in:
parent
20785300bb
commit
c115e34aac
8 changed files with 254 additions and 207 deletions
|
@ -17,7 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.oxycblt.musikr.metadata
|
package org.oxycblt.musikr.metadata
|
||||||
|
|
||||||
import android.os.ParcelFileDescriptor
|
import android.os.ParcelFileDescriptor
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import java.io.FileInputStream
|
import java.io.FileInputStream
|
||||||
|
@ -39,7 +39,7 @@ private object MetadataExtractorImpl : MetadataExtractor {
|
||||||
val fis = FileInputStream(fd.fileDescriptor)
|
val fis = FileInputStream(fd.fileDescriptor)
|
||||||
val input = NativeInputStream(deviceFile, fis)
|
val input = NativeInputStream(deviceFile, fis)
|
||||||
Log.d("MetadataExtractorImpl", MetadataJNI.openFile(input))
|
Log.d("MetadataExtractorImpl", MetadataJNI.openFile(input))
|
||||||
// MetadataJNI.open(deviceFile, fis).also { fis.close() }
|
// MetadataJNI.open(deviceFile, fis).also { fis.close() }
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2024 Auxio Project
|
* Copyright (c) 2024 Auxio Project
|
||||||
* TagLibJNI.kt is part of Auxio.
|
* MetadataJNI.kt is part of Auxio.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -1,41 +1,51 @@
|
||||||
#include "file_shim.hpp"
|
#include "file_shim.hpp"
|
||||||
|
|
||||||
namespace taglib_shim {
|
namespace taglib_shim
|
||||||
|
{
|
||||||
|
|
||||||
const TagLib::Ogg::File* File_asOgg(const TagLib::File* file) {
|
const TagLib::Ogg::File *File_asOgg(const TagLib::File *file)
|
||||||
return dynamic_cast<const TagLib::Ogg::File*>(file);
|
{
|
||||||
}
|
return dynamic_cast<const TagLib::Ogg::File *>(file);
|
||||||
|
}
|
||||||
|
|
||||||
const TagLib::Ogg::Vorbis::File* File_asVorbis(const TagLib::File* file) {
|
const TagLib::Ogg::Vorbis::File *File_asVorbis(const TagLib::File *file)
|
||||||
return dynamic_cast<const TagLib::Ogg::Vorbis::File*>(file);
|
{
|
||||||
}
|
return dynamic_cast<const TagLib::Ogg::Vorbis::File *>(file);
|
||||||
|
}
|
||||||
|
|
||||||
const TagLib::Ogg::Opus::File* File_asOpus(const TagLib::File* file) {
|
const TagLib::Ogg::Opus::File *File_asOpus(const TagLib::File *file)
|
||||||
return dynamic_cast<const TagLib::Ogg::Opus::File*>(file);
|
{
|
||||||
}
|
return dynamic_cast<const TagLib::Ogg::Opus::File *>(file);
|
||||||
|
}
|
||||||
|
|
||||||
const TagLib::MPEG::File* File_asMPEG(const TagLib::File* file) {
|
const TagLib::MPEG::File *File_asMPEG(const TagLib::File *file)
|
||||||
return dynamic_cast<const TagLib::MPEG::File*>(file);
|
{
|
||||||
}
|
return dynamic_cast<const TagLib::MPEG::File *>(file);
|
||||||
|
}
|
||||||
|
|
||||||
const TagLib::FLAC::File* File_asFLAC(const TagLib::File* file) {
|
const TagLib::FLAC::File *File_asFLAC(const TagLib::File *file)
|
||||||
return dynamic_cast<const TagLib::FLAC::File*>(file);
|
{
|
||||||
}
|
return dynamic_cast<const TagLib::FLAC::File *>(file);
|
||||||
|
}
|
||||||
|
|
||||||
const TagLib::MP4::File* File_asMP4(const TagLib::File* file) {
|
const TagLib::MP4::File *File_asMP4(const TagLib::File *file)
|
||||||
return dynamic_cast<const TagLib::MP4::File*>(file);
|
{
|
||||||
}
|
return dynamic_cast<const TagLib::MP4::File *>(file);
|
||||||
|
}
|
||||||
|
|
||||||
const TagLib::RIFF::WAV::File* File_asWAV(const TagLib::File* file) {
|
const TagLib::RIFF::WAV::File *File_asWAV(const TagLib::File *file)
|
||||||
return dynamic_cast<const TagLib::RIFF::WAV::File*>(file);
|
{
|
||||||
}
|
return dynamic_cast<const TagLib::RIFF::WAV::File *>(file);
|
||||||
|
}
|
||||||
|
|
||||||
const TagLib::WavPack::File* File_asWavPack(const TagLib::File* file) {
|
const TagLib::WavPack::File *File_asWavPack(const TagLib::File *file)
|
||||||
return dynamic_cast<const TagLib::WavPack::File*>(file);
|
{
|
||||||
}
|
return dynamic_cast<const TagLib::WavPack::File *>(file);
|
||||||
|
}
|
||||||
|
|
||||||
const TagLib::APE::File* File_asAPE(const TagLib::File* file) {
|
const TagLib::APE::File *File_asAPE(const TagLib::File *file)
|
||||||
return dynamic_cast<const TagLib::APE::File*>(file);
|
{
|
||||||
}
|
return dynamic_cast<const TagLib::APE::File *>(file);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace taglib_shim
|
} // namespace taglib_shim
|
|
@ -14,17 +14,18 @@
|
||||||
#include <taglib/apefile.h>
|
#include <taglib/apefile.h>
|
||||||
#include <taglib/vorbisfile.h>
|
#include <taglib/vorbisfile.h>
|
||||||
|
|
||||||
namespace taglib_shim {
|
namespace taglib_shim
|
||||||
|
{
|
||||||
|
|
||||||
// File conversion functions
|
// File conversion functions
|
||||||
const TagLib::Ogg::File* File_asOgg(const TagLib::File* file);
|
const TagLib::Ogg::File *File_asOgg(const TagLib::File *file);
|
||||||
const TagLib::Ogg::Vorbis::File* File_asVorbis(const TagLib::File* file);
|
const TagLib::Ogg::Vorbis::File *File_asVorbis(const TagLib::File *file);
|
||||||
const TagLib::Ogg::Opus::File* File_asOpus(const TagLib::File* file);
|
const TagLib::Ogg::Opus::File *File_asOpus(const TagLib::File *file);
|
||||||
const TagLib::MPEG::File* File_asMPEG(const TagLib::File* file);
|
const TagLib::MPEG::File *File_asMPEG(const TagLib::File *file);
|
||||||
const TagLib::FLAC::File* File_asFLAC(const TagLib::File* file);
|
const TagLib::FLAC::File *File_asFLAC(const TagLib::File *file);
|
||||||
const TagLib::MP4::File* File_asMP4(const TagLib::File* file);
|
const TagLib::MP4::File *File_asMP4(const TagLib::File *file);
|
||||||
const TagLib::RIFF::WAV::File* File_asWAV(const TagLib::File* file);
|
const TagLib::RIFF::WAV::File *File_asWAV(const TagLib::File *file);
|
||||||
const TagLib::WavPack::File* File_asWavPack(const TagLib::File* file);
|
const TagLib::WavPack::File *File_asWavPack(const TagLib::File *file);
|
||||||
const TagLib::APE::File* File_asAPE(const TagLib::File* file);
|
const TagLib::APE::File *File_asAPE(const TagLib::File *file);
|
||||||
|
|
||||||
} // namespace taglib_shim
|
} // namespace taglib_shim
|
|
@ -4,126 +4,152 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
// These are the functions we'll define in Rust
|
// These are the functions we'll define in Rust
|
||||||
extern "C" {
|
extern "C"
|
||||||
const char* rust_stream_name(const void* stream);
|
{
|
||||||
size_t rust_stream_read(void* stream, uint8_t* buffer, size_t length);
|
const char *rust_stream_name(const void *stream);
|
||||||
void rust_stream_write(void* stream, const uint8_t* data, size_t length);
|
size_t rust_stream_read(void *stream, uint8_t *buffer, size_t length);
|
||||||
void rust_stream_seek(void* stream, int64_t offset, int32_t whence);
|
void rust_stream_write(void *stream, const uint8_t *data, size_t length);
|
||||||
void rust_stream_truncate(void* stream, int64_t length);
|
void rust_stream_seek(void *stream, int64_t offset, int32_t whence);
|
||||||
int64_t rust_stream_tell(const void* stream);
|
void rust_stream_truncate(void *stream, int64_t length);
|
||||||
int64_t rust_stream_length(const void* stream);
|
int64_t rust_stream_tell(const void *stream);
|
||||||
bool rust_stream_is_readonly(const void* stream);
|
int64_t rust_stream_length(const void *stream);
|
||||||
|
bool rust_stream_is_readonly(const void *stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace taglib_shim {
|
namespace taglib_shim
|
||||||
|
{
|
||||||
|
|
||||||
// Factory function to create a new RustIOStream
|
// Factory function to create a new RustIOStream
|
||||||
std::unique_ptr<RustIOStream> new_rust_iostream(RustStream* stream) {
|
std::unique_ptr<RustIOStream> new_rust_iostream(RustStream *stream)
|
||||||
return std::unique_ptr<RustIOStream>(new RustIOStream(stream));
|
{
|
||||||
}
|
return std::unique_ptr<RustIOStream>(new RustIOStream(stream));
|
||||||
|
|
||||||
// Factory function to create a FileRef from a stream
|
|
||||||
std::unique_ptr<TagLib::FileRef> new_FileRef_from_stream(std::unique_ptr<RustIOStream> stream) {
|
|
||||||
return std::make_unique<TagLib::FileRef>(stream.release(), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
RustIOStream::RustIOStream(RustStream* stream) : rust_stream(stream) {}
|
|
||||||
|
|
||||||
RustIOStream::~RustIOStream() = default;
|
|
||||||
|
|
||||||
TagLib::FileName RustIOStream::name() const {
|
|
||||||
return rust_stream_name(rust_stream);
|
|
||||||
}
|
|
||||||
|
|
||||||
TagLib::ByteVector RustIOStream::readBlock(size_t length) {
|
|
||||||
std::vector<uint8_t> buffer(length);
|
|
||||||
size_t bytes_read = rust_stream_read(rust_stream, buffer.data(), length);
|
|
||||||
return TagLib::ByteVector(reinterpret_cast<char*>(buffer.data()), bytes_read);
|
|
||||||
}
|
|
||||||
|
|
||||||
void RustIOStream::writeBlock(const TagLib::ByteVector& data) {
|
|
||||||
rust_stream_write(rust_stream,
|
|
||||||
reinterpret_cast<const uint8_t*>(data.data()),
|
|
||||||
data.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
void RustIOStream::insert(const TagLib::ByteVector& data, TagLib::offset_t start, size_t replace) {
|
|
||||||
// Save current position
|
|
||||||
auto current = tell();
|
|
||||||
|
|
||||||
// Seek to insert position
|
|
||||||
seek(start);
|
|
||||||
|
|
||||||
// If replacing, remove that section first
|
|
||||||
if (replace > 0) {
|
|
||||||
removeBlock(start, replace);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write new data
|
|
||||||
writeBlock(data);
|
|
||||||
|
|
||||||
// Restore position
|
|
||||||
seek(current);
|
|
||||||
}
|
|
||||||
|
|
||||||
void RustIOStream::removeBlock(TagLib::offset_t start, size_t length) {
|
// Factory function to create a FileRef from a stream
|
||||||
if (length == 0) return;
|
std::unique_ptr<TagLib::FileRef> new_FileRef_from_stream(std::unique_ptr<RustIOStream> stream)
|
||||||
|
{
|
||||||
// Save current position
|
return std::make_unique<TagLib::FileRef>(stream.release(), true);
|
||||||
auto current = tell();
|
|
||||||
|
|
||||||
// Get file size
|
|
||||||
auto file_length = this->length();
|
|
||||||
|
|
||||||
// Read everything after the removed section
|
|
||||||
seek(start + length);
|
|
||||||
auto remaining = readBlock(file_length - (start + length));
|
|
||||||
|
|
||||||
// Truncate to start position
|
|
||||||
seek(start);
|
|
||||||
truncate(start);
|
|
||||||
|
|
||||||
// Write remaining data
|
|
||||||
writeBlock(remaining);
|
|
||||||
|
|
||||||
// Restore position
|
|
||||||
seek(current);
|
|
||||||
}
|
|
||||||
|
|
||||||
void RustIOStream::seek(TagLib::offset_t offset, Position p) {
|
|
||||||
int32_t whence;
|
|
||||||
switch (p) {
|
|
||||||
case Beginning: whence = SEEK_SET; break;
|
|
||||||
case Current: whence = SEEK_CUR; break;
|
|
||||||
case End: whence = SEEK_END; break;
|
|
||||||
default: throw std::runtime_error("Invalid seek position");
|
|
||||||
}
|
}
|
||||||
rust_stream_seek(rust_stream, offset, whence);
|
|
||||||
}
|
|
||||||
|
|
||||||
void RustIOStream::clear() {
|
RustIOStream::RustIOStream(RustStream *stream) : rust_stream(stream) {}
|
||||||
truncate(0);
|
|
||||||
seek(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void RustIOStream::truncate(TagLib::offset_t length) {
|
RustIOStream::~RustIOStream() = default;
|
||||||
rust_stream_truncate(rust_stream, length);
|
|
||||||
}
|
|
||||||
|
|
||||||
TagLib::offset_t RustIOStream::tell() const {
|
TagLib::FileName RustIOStream::name() const
|
||||||
return rust_stream_tell(rust_stream);
|
{
|
||||||
}
|
return rust_stream_name(rust_stream);
|
||||||
|
}
|
||||||
|
|
||||||
TagLib::offset_t RustIOStream::length() {
|
TagLib::ByteVector RustIOStream::readBlock(size_t length)
|
||||||
return rust_stream_length(rust_stream);
|
{
|
||||||
}
|
std::vector<uint8_t> buffer(length);
|
||||||
|
size_t bytes_read = rust_stream_read(rust_stream, buffer.data(), length);
|
||||||
|
return TagLib::ByteVector(reinterpret_cast<char *>(buffer.data()), bytes_read);
|
||||||
|
}
|
||||||
|
|
||||||
bool RustIOStream::readOnly() const {
|
void RustIOStream::writeBlock(const TagLib::ByteVector &data)
|
||||||
return rust_stream_is_readonly(rust_stream);
|
{
|
||||||
}
|
rust_stream_write(rust_stream,
|
||||||
|
reinterpret_cast<const uint8_t *>(data.data()),
|
||||||
|
data.size());
|
||||||
|
}
|
||||||
|
|
||||||
bool RustIOStream::isOpen() const {
|
void RustIOStream::insert(const TagLib::ByteVector &data, TagLib::offset_t start, size_t replace)
|
||||||
return true; // If we have a stream, it's open
|
{
|
||||||
}
|
// Save current position
|
||||||
|
auto current = tell();
|
||||||
|
|
||||||
} // namespace taglib_shim
|
// Seek to insert position
|
||||||
|
seek(start);
|
||||||
|
|
||||||
|
// If replacing, remove that section first
|
||||||
|
if (replace > 0)
|
||||||
|
{
|
||||||
|
removeBlock(start, replace);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write new data
|
||||||
|
writeBlock(data);
|
||||||
|
|
||||||
|
// Restore position
|
||||||
|
seek(current);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RustIOStream::removeBlock(TagLib::offset_t start, size_t length)
|
||||||
|
{
|
||||||
|
if (length == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Save current position
|
||||||
|
auto current = tell();
|
||||||
|
|
||||||
|
// Get file size
|
||||||
|
auto file_length = this->length();
|
||||||
|
|
||||||
|
// Read everything after the removed section
|
||||||
|
seek(start + length);
|
||||||
|
auto remaining = readBlock(file_length - (start + length));
|
||||||
|
|
||||||
|
// Truncate to start position
|
||||||
|
seek(start);
|
||||||
|
truncate(start);
|
||||||
|
|
||||||
|
// Write remaining data
|
||||||
|
writeBlock(remaining);
|
||||||
|
|
||||||
|
// Restore position
|
||||||
|
seek(current);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RustIOStream::seek(TagLib::offset_t offset, Position p)
|
||||||
|
{
|
||||||
|
int32_t whence;
|
||||||
|
switch (p)
|
||||||
|
{
|
||||||
|
case Beginning:
|
||||||
|
whence = SEEK_SET;
|
||||||
|
break;
|
||||||
|
case Current:
|
||||||
|
whence = SEEK_CUR;
|
||||||
|
break;
|
||||||
|
case End:
|
||||||
|
whence = SEEK_END;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw std::runtime_error("Invalid seek position");
|
||||||
|
}
|
||||||
|
rust_stream_seek(rust_stream, offset, whence);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RustIOStream::clear()
|
||||||
|
{
|
||||||
|
truncate(0);
|
||||||
|
seek(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RustIOStream::truncate(TagLib::offset_t length)
|
||||||
|
{
|
||||||
|
rust_stream_truncate(rust_stream, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
TagLib::offset_t RustIOStream::tell() const
|
||||||
|
{
|
||||||
|
return rust_stream_tell(rust_stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
TagLib::offset_t RustIOStream::length()
|
||||||
|
{
|
||||||
|
return rust_stream_length(rust_stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RustIOStream::readOnly() const
|
||||||
|
{
|
||||||
|
return rust_stream_is_readonly(rust_stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RustIOStream::isOpen() const
|
||||||
|
{
|
||||||
|
return true; // If we have a stream, it's open
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace taglib_shim
|
|
@ -5,37 +5,39 @@
|
||||||
#include <taglib/tiostream.h>
|
#include <taglib/tiostream.h>
|
||||||
#include <taglib/fileref.h>
|
#include <taglib/fileref.h>
|
||||||
|
|
||||||
namespace taglib_shim {
|
namespace taglib_shim
|
||||||
|
{
|
||||||
|
|
||||||
// Forward declaration of the Rust-side stream
|
// Forward declaration of the Rust-side stream
|
||||||
struct RustStream;
|
struct RustStream;
|
||||||
|
|
||||||
// C++ implementation of TagLib::IOStream that delegates to Rust
|
// C++ implementation of TagLib::IOStream that delegates to Rust
|
||||||
class RustIOStream : public TagLib::IOStream {
|
class RustIOStream : public TagLib::IOStream
|
||||||
public:
|
{
|
||||||
explicit RustIOStream(RustStream* stream);
|
public:
|
||||||
~RustIOStream() override;
|
explicit RustIOStream(RustStream *stream);
|
||||||
|
~RustIOStream() override;
|
||||||
|
|
||||||
// TagLib::IOStream interface implementation
|
// TagLib::IOStream interface implementation
|
||||||
TagLib::FileName name() const override;
|
TagLib::FileName name() const override;
|
||||||
TagLib::ByteVector readBlock(size_t length) override;
|
TagLib::ByteVector readBlock(size_t length) override;
|
||||||
void writeBlock(const TagLib::ByteVector& data) override;
|
void writeBlock(const TagLib::ByteVector &data) override;
|
||||||
void insert(const TagLib::ByteVector& data, TagLib::offset_t start = 0, size_t replace = 0) override;
|
void insert(const TagLib::ByteVector &data, TagLib::offset_t start = 0, size_t replace = 0) override;
|
||||||
void removeBlock(TagLib::offset_t start = 0, size_t length = 0) override;
|
void removeBlock(TagLib::offset_t start = 0, size_t length = 0) override;
|
||||||
void seek(TagLib::offset_t offset, Position p = Beginning) override;
|
void seek(TagLib::offset_t offset, Position p = Beginning) override;
|
||||||
void clear() override;
|
void clear() override;
|
||||||
void truncate(TagLib::offset_t length) override;
|
void truncate(TagLib::offset_t length) override;
|
||||||
TagLib::offset_t tell() const override;
|
TagLib::offset_t tell() const override;
|
||||||
TagLib::offset_t length() override;
|
TagLib::offset_t length() override;
|
||||||
bool readOnly() const override;
|
bool readOnly() const override;
|
||||||
bool isOpen() const override;
|
bool isOpen() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RustStream* rust_stream;
|
RustStream *rust_stream;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Factory functions
|
// Factory functions
|
||||||
std::unique_ptr<RustIOStream> new_rust_iostream(RustStream* stream);
|
std::unique_ptr<RustIOStream> new_rust_iostream(RustStream *stream);
|
||||||
std::unique_ptr<TagLib::FileRef> new_FileRef_from_stream(std::unique_ptr<RustIOStream> stream);
|
std::unique_ptr<TagLib::FileRef> new_FileRef_from_stream(std::unique_ptr<RustIOStream> stream);
|
||||||
|
|
||||||
} // namespace taglib_shim
|
} // namespace taglib_shim
|
|
@ -1,30 +1,36 @@
|
||||||
#include "tk_shim.hpp"
|
#include "tk_shim.hpp"
|
||||||
|
|
||||||
|
namespace taglib_shim
|
||||||
|
{
|
||||||
|
Property::Property(TagLib::String key, TagLib::StringList value) : key_(key), value_(value) {}
|
||||||
|
|
||||||
namespace taglib_shim {
|
const TagLib::String &Property::key() const
|
||||||
Property::Property(TagLib::String key, TagLib::StringList value) : key_(key), value_(value) {}
|
{
|
||||||
|
return key_;
|
||||||
|
}
|
||||||
|
|
||||||
const TagLib::String &Property::key() const {
|
const TagLib::StringList &Property::value() const
|
||||||
return key_;
|
{
|
||||||
}
|
return value_;
|
||||||
|
}
|
||||||
const TagLib::StringList &Property::value() const {
|
std::unique_ptr<std::vector<Property>> SimplePropertyMap_to_vector(const TagLib::SimplePropertyMap &map)
|
||||||
return value_;
|
{
|
||||||
}
|
|
||||||
std::unique_ptr<std::vector<Property>> SimplePropertyMap_to_vector(const TagLib::SimplePropertyMap &map) {
|
|
||||||
std::unique_ptr<std::vector<Property>> result = std::make_unique<std::vector<Property>>();
|
std::unique_ptr<std::vector<Property>> result = std::make_unique<std::vector<Property>>();
|
||||||
for (const auto &pair : map) {
|
for (const auto &pair : map)
|
||||||
|
{
|
||||||
result->push_back(Property(pair.first, pair.second));
|
result->push_back(Property(pair.first, pair.second));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<std::vector<TagLib::String>> StringList_to_vector(const TagLib::StringList &list) {
|
std::unique_ptr<std::vector<TagLib::String>> StringList_to_vector(const TagLib::StringList &list)
|
||||||
|
{
|
||||||
std::unique_ptr<std::vector<TagLib::String>> result = std::make_unique<std::vector<TagLib::String>>();
|
std::unique_ptr<std::vector<TagLib::String>> result = std::make_unique<std::vector<TagLib::String>>();
|
||||||
for (const auto &str : list) {
|
for (const auto &str : list)
|
||||||
|
{
|
||||||
result->push_back(str);
|
result->push_back(str);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,18 +7,20 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
|
|
||||||
namespace taglib_shim {
|
namespace taglib_shim
|
||||||
|
{
|
||||||
|
|
||||||
struct Property {
|
struct Property
|
||||||
Property(TagLib::String key, TagLib::StringList value);
|
{
|
||||||
const TagLib::String &key() const;
|
Property(TagLib::String key, TagLib::StringList value);
|
||||||
const TagLib::StringList &value() const;
|
const TagLib::String &key() const;
|
||||||
|
const TagLib::StringList &value() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TagLib::String key_;
|
TagLib::String key_;
|
||||||
TagLib::StringList value_;
|
TagLib::StringList value_;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::unique_ptr<std::vector<Property>> SimplePropertyMap_to_vector(const TagLib::SimplePropertyMap &map);
|
std::unique_ptr<std::vector<Property>> SimplePropertyMap_to_vector(const TagLib::SimplePropertyMap &map);
|
||||||
std::unique_ptr<std::vector<TagLib::String>> StringList_to_vector(const TagLib::StringList &list);
|
std::unique_ptr<std::vector<TagLib::String>> StringList_to_vector(const TagLib::StringList &list);
|
||||||
}
|
}
|
Loading…
Reference in a new issue