Skip to content

Commit

Permalink
musikr: add wav files
Browse files Browse the repository at this point in the history
  • Loading branch information
OxygenCobalt committed Feb 17, 2025
1 parent a3f01f1 commit da43ebd
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions musikr/src/main/jni/src/taglib/bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ mod bridge_impl {
#[namespace = "TagLib::RIFF::WAV"]
#[cxx_name = "File"]
type CPPWAVFile;
#[cxx_name = "ID3v2Tag"]
fn WAVID3v2Tag(self: &CPPWAVFile) -> *mut CPPID3v2Tag;

#[namespace = "TagLib::FLAC"]
#[cxx_name = "Picture"]
Expand Down
1 change: 1 addition & 0 deletions musikr/src/main/jni/src/taglib/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ pub mod tk;
pub mod id3v2;
pub mod id3v1;
pub mod mp4;
pub mod riff;
21 changes: 21 additions & 0 deletions musikr/src/main/jni/src/taglib/riff.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
use super::bridge::{self, CPPWAVFile};
use super::id3v2::ID3v2Tag;
use super::this::{RefThisMut, This, ThisMut};
use std::pin::Pin;

pub struct WAVFile<'file_ref> {
this: RefThisMut<'file_ref, CPPWAVFile>,
}

impl<'file_ref> WAVFile<'file_ref> {
pub(super) fn new(this: RefThisMut<'file_ref, CPPWAVFile>) -> Self {
Self { this }
}

pub fn id3v2_tag(&mut self) -> Option<ID3v2Tag<'file_ref>> {
let tag = self.this.as_ref().WAVID3v2Tag();
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))
}
}

0 comments on commit da43ebd

Please sign in to comment.