musikr: add id3v1 tags to files
This commit is contained in:
parent
60e5614e63
commit
d4890af780
3 changed files with 27 additions and 6 deletions
|
@ -92,6 +92,8 @@ mod bridge_impl {
|
||||||
#[cxx_name = "File"]
|
#[cxx_name = "File"]
|
||||||
type CPPFLACFile;
|
type CPPFLACFile;
|
||||||
fn xiphComment(self: Pin<&mut CPPFLACFile>, create: bool) -> *mut CPPXiphComment;
|
fn xiphComment(self: Pin<&mut CPPFLACFile>, create: bool) -> *mut CPPXiphComment;
|
||||||
|
#[cxx_name = "ID3v1Tag"]
|
||||||
|
fn FLACID3v1Tag(self: Pin<&mut CPPFLACFile>, create: bool) -> *mut CPPID3v1Tag;
|
||||||
#[cxx_name = "ID3v2Tag"]
|
#[cxx_name = "ID3v2Tag"]
|
||||||
fn FLACID3v2Tag(self: Pin<&mut CPPFLACFile>, create: bool) -> *mut CPPID3v2Tag;
|
fn FLACID3v2Tag(self: Pin<&mut CPPFLACFile>, create: bool) -> *mut CPPID3v2Tag;
|
||||||
#[namespace = "taglib_shim"]
|
#[namespace = "taglib_shim"]
|
||||||
|
@ -113,6 +115,8 @@ mod bridge_impl {
|
||||||
#[namespace = "TagLib::MPEG"]
|
#[namespace = "TagLib::MPEG"]
|
||||||
#[cxx_name = "File"]
|
#[cxx_name = "File"]
|
||||||
type CPPMPEGFile;
|
type CPPMPEGFile;
|
||||||
|
#[cxx_name = "ID3v1Tag"]
|
||||||
|
fn MPEGID3v1Tag(self: Pin<&mut CPPMPEGFile>, create: bool) -> *mut CPPID3v1Tag;
|
||||||
#[cxx_name = "ID3v2Tag"]
|
#[cxx_name = "ID3v2Tag"]
|
||||||
fn MPEGID3v2Tag(self: Pin<&mut CPPMPEGFile>, create: bool) -> *mut CPPID3v2Tag;
|
fn MPEGID3v2Tag(self: Pin<&mut CPPMPEGFile>, create: bool) -> *mut CPPID3v2Tag;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
pub use super::bridge::CPPFLACFile;
|
pub use super::bridge::CPPFLACFile;
|
||||||
pub use super::bridge::CPPFLACPicture;
|
pub use super::bridge::CPPFLACPicture;
|
||||||
use super::bridge::{CPPPictureList, FLACFile_pictureList, PictureList_to_vector, Picture_data, CPPByteVector};
|
use super::bridge::{CPPPictureList, FLACFile_pictureList, PictureList_to_vector, Picture_data, CPPByteVector};
|
||||||
|
use super::id3v1::ID3v1Tag;
|
||||||
use super::id3v2::ID3v2Tag;
|
use super::id3v2::ID3v2Tag;
|
||||||
use super::tk::{ByteVector, OwnedByteVector};
|
use super::tk::{ByteVector, OwnedByteVector};
|
||||||
pub use super::xiph::XiphComment;
|
pub use super::xiph::XiphComment;
|
||||||
|
@ -18,12 +19,6 @@ impl<'file_ref> FLACFile<'file_ref> {
|
||||||
Self { this }
|
Self { this }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn id3v2_tag(&mut self) -> Option<ID3v2Tag<'file_ref>> {
|
|
||||||
let tag = self.this.pin_mut().FLACID3v2Tag(false);
|
|
||||||
let tag_ref = unsafe { tag.as_mut() };
|
|
||||||
let tag_this = tag_ref.map(|tag| unsafe { RefThisMut::new(tag) });
|
|
||||||
tag_this.map(|this| ID3v2Tag::new(this))
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn xiph_comments(&mut self) -> Option<XiphComment<'file_ref>> {
|
pub fn xiph_comments(&mut self) -> Option<XiphComment<'file_ref>> {
|
||||||
let tag = self.this.pin_mut().xiphComment(false);
|
let tag = self.this.pin_mut().xiphComment(false);
|
||||||
|
@ -41,6 +36,20 @@ impl<'file_ref> FLACFile<'file_ref> {
|
||||||
let this = unsafe { OwnedThis::new(pictures) };
|
let this = unsafe { OwnedThis::new(pictures) };
|
||||||
this.map(|this| PictureList::new(this))
|
this.map(|this| PictureList::new(this))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn id3v1_tag(&mut self) -> Option<ID3v1Tag<'file_ref>> {
|
||||||
|
let tag = self.this.pin_mut().FLACID3v1Tag(false);
|
||||||
|
let tag_ref = unsafe { tag.as_mut() };
|
||||||
|
let tag_this = tag_ref.map(|tag| unsafe { RefThisMut::new(tag) });
|
||||||
|
tag_this.map(|this| ID3v1Tag::new(this))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn id3v2_tag(&mut self) -> Option<ID3v2Tag<'file_ref>> {
|
||||||
|
let tag = self.this.pin_mut().FLACID3v2Tag(false);
|
||||||
|
let tag_ref = unsafe { tag.as_mut() };
|
||||||
|
let tag_this = tag_ref.map(|tag| unsafe { RefThisMut::new(tag) });
|
||||||
|
tag_this.map(|this| ID3v2Tag::new(this))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct PictureList<'file_ref> {
|
pub struct PictureList<'file_ref> {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
use super::bridge::{self, CPPMPEGFile};
|
use super::bridge::{self, CPPMPEGFile};
|
||||||
|
use super::id3v1::ID3v1Tag;
|
||||||
use super::id3v2::ID3v2Tag;
|
use super::id3v2::ID3v2Tag;
|
||||||
use super::this::{RefThisMut, This, ThisMut};
|
use super::this::{RefThisMut, This, ThisMut};
|
||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
|
@ -12,6 +13,13 @@ impl<'file_ref> MPEGFile<'file_ref> {
|
||||||
Self { this }
|
Self { this }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn id3v1_tag(&mut self) -> Option<ID3v1Tag<'file_ref>> {
|
||||||
|
let tag = self.this.pin_mut().MPEGID3v1Tag(false);
|
||||||
|
let tag_ref = unsafe { tag.as_mut() };
|
||||||
|
let tag_this = tag_ref.map(|tag| unsafe { RefThisMut::new(tag) });
|
||||||
|
tag_this.map(|this| ID3v1Tag::new(this))
|
||||||
|
}
|
||||||
|
|
||||||
pub fn id3v2_tag(&mut self) -> Option<ID3v2Tag<'file_ref>> {
|
pub fn id3v2_tag(&mut self) -> Option<ID3v2Tag<'file_ref>> {
|
||||||
let tag = self.this.pin_mut().MPEGID3v2Tag(false);
|
let tag = self.this.pin_mut().MPEGID3v2Tag(false);
|
||||||
let tag_ref = unsafe { tag.as_mut() };
|
let tag_ref = unsafe { tag.as_mut() };
|
||||||
|
|
Loading…
Reference in a new issue