Auxio/musikr/src/main/cpp/JVMMetadataBuilder.h
Alexander Capehart 8c3750778f
musikr: add id3v1 support
Forgot to go ahead and implement this.
2025-01-08 15:06:25 -07:00

61 lines
1.7 KiB
C++

/*
* Copyright (c) 2024 Auxio Project
* JVMMetadataBuilder.h is part of Auxio.
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef AUXIO_JVMMETADATABUILDER_H
#define AUXIO_JVMMETADATABUILDER_H
#include <jni.h>
#include <string_view>
#include <optional>
#include "taglib/id3v1tag.h"
#include "taglib/id3v2tag.h"
#include "taglib/xiphcomment.h"
#include "taglib/mp4tag.h"
#include "taglib/audioproperties.h"
#include "JVMTagMap.h"
class JVMMetadataBuilder {
public:
JVMMetadataBuilder(JNIEnv *env);
void setMimeType(const std::string_view type);
void setId3v1(TagLib::ID3v1::Tag &tag);
void setId3v2(TagLib::ID3v2::Tag &tag);
void setXiph(TagLib::Ogg::XiphComment &tag);
void setMp4(TagLib::MP4::Tag &tag);
void setFlacPictures(TagLib::List<TagLib::FLAC::Picture*> &pics);
void setProperties(TagLib::AudioProperties *properties);
jobject build();
private:
JNIEnv *env;
std::string_view mimeType;
std::optional<TagLib::ByteVector> cover;
TagLib::AudioProperties *properties;
JVMTagMap id3v2;
JVMTagMap xiph;
JVMTagMap mp4;
};
#endif //AUXIO_JVMMETADATABUILDER_H