musikr: get rid of warnings
This commit is contained in:
parent
7906fcf5af
commit
03d8f70ecd
2 changed files with 27 additions and 37 deletions
|
@ -8,7 +8,6 @@ mod taglib;
|
|||
mod jstream;
|
||||
|
||||
use taglib::file::FileRef;
|
||||
|
||||
use jstream::JInputStream;
|
||||
|
||||
type SharedEnv<'local> = Rc<RefCell<JNIEnv<'local>>>;
|
||||
|
@ -23,40 +22,34 @@ pub extern "C" fn Java_org_oxycblt_musikr_metadata_MetadataJNI_openFile<'local>(
|
|||
let shared_env = Rc::new(RefCell::new(env));
|
||||
let mut stream = JInputStream::new(shared_env.clone(), input);
|
||||
let file_ref = FileRef::new(stream);
|
||||
// file_ref.file().and_then(|file| {
|
||||
// let audio_properties = file.audio_properties().map(|props| AudioProperties {
|
||||
// length_in_milliseconds: props.length_in_milliseconds(),
|
||||
// bitrate_in_kilobits_per_second: props.bitrate(),
|
||||
// sample_rate_in_hz: props.sample_rate(),
|
||||
// number_of_channels: props.channels(),
|
||||
// });
|
||||
let title = file_ref.file().and_then(|file| {
|
||||
let audio_properties = file.audio_properties();
|
||||
|
||||
// if let Some(vorbis_file) = file.as_vorbis() {
|
||||
// let xiph_comments = vorbis_file
|
||||
// .xiph_comments()
|
||||
// .map(|comments| comments.field_list_map().to_hashmap());
|
||||
|
||||
// } else if let Some(opus_file) = file.as_opus() {
|
||||
// let xiph_comments = opus_file
|
||||
// .xiph_comments()
|
||||
// .map(|comments| comments.field_list_map().to_hashmap());
|
||||
|
||||
// Some(File::Opus {
|
||||
// audio_properties,
|
||||
// xiph_comments,
|
||||
// })
|
||||
// } else if let Some(flac_file) = file.as_flac() {
|
||||
// let xiph_comments = flac_file
|
||||
// .xiph_comments()
|
||||
// .map(|comments| comments.field_list_map().to_hashmap());
|
||||
// Some(File::FLAC {
|
||||
// audio_properties,
|
||||
// xiph_comments,
|
||||
// })
|
||||
// } else {
|
||||
// Some(File::Unknown { audio_properties })
|
||||
// }
|
||||
// });
|
||||
if let Some(vorbis_file) = file.as_vorbis() {
|
||||
vorbis_file
|
||||
.xiph_comments()
|
||||
.map(|comments| comments.field_list_map().to_hashmap())
|
||||
.and_then(|comments| comments.get("TITLE").cloned())
|
||||
.and_then(|title| title.first().cloned())
|
||||
.map(|s| s.to_string())
|
||||
} else if let Some(opus_file) = file.as_opus() {
|
||||
opus_file
|
||||
.xiph_comments()
|
||||
.map(|comments| comments.field_list_map().to_hashmap())
|
||||
.and_then(|comments| comments.get("TITLE").cloned())
|
||||
.and_then(|title| title.first().cloned())
|
||||
.map(|s| s.to_string())
|
||||
} else if let Some(flac_file) = file.as_flac() {
|
||||
flac_file
|
||||
.xiph_comments()
|
||||
.map(|comments| comments.field_list_map().to_hashmap())
|
||||
.and_then(|comments| comments.get("TITLE").cloned())
|
||||
.and_then(|title| title.first().cloned())
|
||||
.map(|s| s.to_string())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
});
|
||||
|
||||
// Return the title
|
||||
let output = shared_env.borrow_mut().new_string("title").expect("Couldn't create string!");
|
||||
|
|
|
@ -44,9 +44,6 @@ impl<'a> Drop for BridgedIOStream<'a> {
|
|||
pub(super) struct DynIOStream<'a>(Box<dyn IOStream + 'a>);
|
||||
|
||||
impl<'a> DynIOStream<'a> {
|
||||
pub fn new<T: IOStream + 'a>(stream: T) -> Self {
|
||||
DynIOStream(Box::new(stream))
|
||||
}
|
||||
|
||||
// Implement the exposed functions for cxx bridge
|
||||
pub fn name(&mut self) -> String {
|
||||
|
|
Loading…
Reference in a new issue