1
0
Fork 0
mirror of https://github.com/alfg/mp4-rust.git synced 2024-06-11 01:19:21 +00:00

Run cargo clippy --fix

This commit is contained in:
Data Retriever 2022-05-31 00:27:52 +00:00
parent 33959766d4
commit 933de2c90c
44 changed files with 142 additions and 144 deletions

View file

@ -1,13 +1,13 @@
use criterion::BenchmarkId;
use criterion::{criterion_group, criterion_main, Criterion};
use mp4;
use std::fs::File;
fn read_mp4(filename: &str) -> u64 {
let f = File::open(filename).unwrap();
let m = mp4::read_mp4(f).unwrap();
let size = m.size();
size
m.size()
}
fn criterion_benchmark(c: &mut Criterion) {

View file

@ -41,7 +41,7 @@ fn copy<P: AsRef<Path>>(src_filename: &P, dst_filename: &P) -> Result<()> {
let mut mp4_writer = mp4::Mp4Writer::write_start(
writer,
&Mp4Config {
major_brand: mp4_reader.major_brand().clone(),
major_brand: *mp4_reader.major_brand(),
minor_version: mp4_reader.minor_version(),
compatible_brands: mp4_reader.compatible_brands().to_vec(),
timescale: mp4_reader.timescale(),

View file

@ -133,11 +133,11 @@ fn get_boxes(file: File) -> Result<Vec<Box>> {
Ok(boxes)
}
fn build_box<M: Mp4Box + std::fmt::Debug>(ref m: &M) -> Box {
return Box{
fn build_box<M: Mp4Box + std::fmt::Debug>(m: &M) -> Box {
Box{
name: m.box_type().to_string(),
size: m.box_size(),
summary: m.summary().unwrap(),
indent: 0,
};
}
}

View file

@ -32,7 +32,7 @@ fn info<P: AsRef<Path>>(filename: &P) -> Result<()> {
let mut compatible_brands = String::new();
for brand in mp4.compatible_brands().iter() {
compatible_brands.push_str(&brand.to_string());
compatible_brands.push_str(" ");
compatible_brands.push(' ');
}
println!(" compatible_brands: {}\n", compatible_brands);

View file

@ -1,4 +1,4 @@
use mp4;
use std::env;
use std::fs::File;

View file

@ -60,11 +60,11 @@ impl Avc1Box {
impl Mp4Box for Avc1Box {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}
fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}
fn to_json(&self) -> Result<String> {

View file

@ -25,11 +25,11 @@ impl Co64Box {
impl Mp4Box for Co64Box {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}
fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}
fn to_json(&self) -> Result<String> {

View file

@ -31,11 +31,11 @@ pub struct CttsEntry {
impl Mp4Box for CttsBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}
fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}
fn to_json(&self) -> Result<String> {

View file

@ -20,11 +20,11 @@ impl DinfBox {
impl Mp4Box for DinfBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}
fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}
fn to_json(&self) -> Result<String> {
@ -32,7 +32,7 @@ impl Mp4Box for DinfBox {
}
fn summary(&self) -> Result<String> {
let s = format!("");
let s = String::new();
Ok(s)
}
}
@ -119,11 +119,11 @@ impl DrefBox {
impl Mp4Box for DrefBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}
fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}
fn to_json(&self) -> Result<String> {
@ -131,7 +131,7 @@ impl Mp4Box for DrefBox {
}
fn summary(&self) -> Result<String> {
let s = format!("");
let s = String::new();
Ok(s)
}
}
@ -231,11 +231,11 @@ impl UrlBox {
impl Mp4Box for UrlBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}
fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}
fn to_json(&self) -> Result<String> {

View file

@ -29,11 +29,11 @@ impl EdtsBox {
impl Mp4Box for EdtsBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}
fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}
fn to_json(&self) -> Result<String> {
@ -41,7 +41,7 @@ impl Mp4Box for EdtsBox {
}
fn summary(&self) -> Result<String> {
let s = format!("");
let s = String::new();
Ok(s)
}
}

View file

@ -39,11 +39,11 @@ impl ElstBox {
impl Mp4Box for ElstBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}
fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}
fn to_json(&self) -> Result<String> {

View file

@ -23,11 +23,11 @@ impl FtypBox {
impl Mp4Box for FtypBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}
fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}
fn to_json(&self) -> Result<String> {

View file

@ -24,11 +24,11 @@ impl HdlrBox {
impl Mp4Box for HdlrBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}
fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}
fn to_json(&self) -> Result<String> {
@ -36,7 +36,7 @@ impl Mp4Box for HdlrBox {
}
fn summary(&self) -> Result<String> {
let s = format!("handler_type={} name={}", self.handler_type.to_string(), self.name);
let s = format!("handler_type={} name={}", self.handler_type, self.name);
Ok(s)
}
}

View file

@ -60,11 +60,11 @@ impl Hev1Box {
impl Mp4Box for Hev1Box {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}
fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}
fn to_json(&self) -> Result<String> {
@ -170,8 +170,8 @@ impl Mp4Box for HvcCBox {
}
fn box_size(&self) -> u64 {
let size = HEADER_SIZE + 1;
size
HEADER_SIZE + 1
}
fn to_json(&self) -> Result<String> {

View file

@ -50,11 +50,11 @@ impl Default for MdhdBox {
impl Mp4Box for MdhdBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}
fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}
fn to_json(&self) -> Result<String> {
@ -149,7 +149,7 @@ fn language_string(language: u16) -> String {
.map(|r| r.unwrap_or(REPLACEMENT_CHARACTER))
.collect::<String>();
return lang_str;
lang_str
}
fn language_code(language: &str) -> u16 {

View file

@ -23,11 +23,11 @@ impl MdiaBox {
impl Mp4Box for MdiaBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}
fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}
fn to_json(&self) -> Result<String> {
@ -35,7 +35,7 @@ impl Mp4Box for MdiaBox {
}
fn summary(&self) -> Result<String> {
let s = format!("");
let s = String::new();
Ok(s)
}
}

View file

@ -40,11 +40,11 @@ impl Default for MehdBox {
impl Mp4Box for MehdBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}
fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}
fn to_json(&self) -> Result<String> {

View file

@ -33,11 +33,11 @@ impl MfhdBox {
impl Mp4Box for MfhdBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}
fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}
fn to_json(&self) -> Result<String> {

View file

@ -37,11 +37,11 @@ impl MinfBox {
impl Mp4Box for MinfBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}
fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}
fn to_json(&self) -> Result<String> {
@ -49,7 +49,7 @@ impl Mp4Box for MinfBox {
}
fn summary(&self) -> Result<String> {
let s = format!("");
let s = String::new();
Ok(s)
}
}

View file

@ -28,11 +28,11 @@ impl MoofBox {
impl Mp4Box for MoofBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}
fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}
fn to_json(&self) -> Result<String> {

View file

@ -31,11 +31,11 @@ impl MoovBox {
impl Mp4Box for MoovBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}
fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}
fn to_json(&self) -> Result<String> {

View file

@ -328,8 +328,8 @@ impl<R: Read + Seek> ReadDesc<&mut R> for ESDescriptor {
Ok(ESDescriptor {
es_id,
dec_config: dec_config.unwrap_or(DecoderConfigDescriptor::default()),
sl_config: sl_config.unwrap_or(SLConfigDescriptor::default()),
dec_config: dec_config.unwrap_or_default(),
sl_config: sl_config.unwrap_or_default(),
})
}
}
@ -421,7 +421,7 @@ impl<R: Read + Seek> ReadDesc<&mut R> for DecoderConfigDescriptor {
buffer_size_db,
max_bitrate,
avg_bitrate,
dec_specific: dec_specific.unwrap_or(DecoderSpecificDescriptor::default()),
dec_specific: dec_specific.unwrap_or_default(),
})
}
}

View file

@ -22,11 +22,11 @@ impl MvexBox {
impl Mp4Box for MvexBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}
fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}
fn to_json(&self) -> Result<String> {
@ -34,7 +34,7 @@ impl Mp4Box for MvexBox {
}
fn summary(&self) -> Result<String> {
let s = format!("");
let s = String::new();
Ok(s)
}
}

View file

@ -59,11 +59,11 @@ impl Default for MvhdBox {
impl Mp4Box for MvhdBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}
fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}
fn to_json(&self) -> Result<String> {

View file

@ -35,11 +35,11 @@ impl Default for SmhdBox {
impl Mp4Box for SmhdBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}
fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}
fn to_json(&self) -> Result<String> {

View file

@ -62,11 +62,11 @@ impl StblBox {
impl Mp4Box for StblBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}
fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}
fn to_json(&self) -> Result<String> {
@ -74,7 +74,7 @@ impl Mp4Box for StblBox {
}
fn summary(&self) -> Result<String> {
let s = format!("");
let s = String::new();
Ok(s)
}
}
@ -153,12 +153,12 @@ impl<R: Read + Seek> ReadBox<&mut R> for StblBox {
Ok(StblBox {
stsd: stsd.unwrap(),
stts: stts.unwrap(),
ctts: ctts,
stss: stss,
ctts,
stss,
stsc: stsc.unwrap(),
stsz: stsz.unwrap(),
stco: stco,
co64: co64,
stco,
co64,
})
}
}

View file

@ -25,11 +25,11 @@ impl StcoBox {
impl Mp4Box for StcoBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}
fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}
fn to_json(&self) -> Result<String> {
@ -89,7 +89,7 @@ impl std::convert::TryFrom<&co64::Co64Box> for StcoBox {
.entries
.iter()
.copied()
.map(|x| u32::try_from(x))
.map(u32::try_from)
.collect::<std::result::Result<Vec<_>, _>>()?;
Ok(Self {
version: 0,

View file

@ -33,11 +33,11 @@ pub struct StscEntry {
impl Mp4Box for StscBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}
fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}
fn to_json(&self) -> Result<String> {

View file

@ -51,11 +51,11 @@ impl StsdBox {
impl Mp4Box for StsdBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}
fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}
fn to_json(&self) -> Result<String> {
@ -63,7 +63,7 @@ impl Mp4Box for StsdBox {
}
fn summary(&self) -> Result<String> {
let s = format!("");
let s = String::new();
Ok(s)
}
}

View file

@ -25,11 +25,11 @@ impl StssBox {
impl Mp4Box for StssBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}
fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}
fn to_json(&self) -> Result<String> {

View file

@ -27,11 +27,11 @@ impl StszBox {
impl Mp4Box for StszBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}
fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}
fn to_json(&self) -> Result<String> {

View file

@ -31,11 +31,11 @@ pub struct SttsEntry {
impl Mp4Box for SttsBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}
fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}
fn to_json(&self) -> Result<String> {

View file

@ -35,11 +35,11 @@ impl TfhdBox {
impl Mp4Box for TfhdBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}
fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}
fn to_json(&self) -> Result<String> {

View file

@ -118,11 +118,11 @@ impl TkhdBox {
impl Mp4Box for TkhdBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}
fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}
fn to_json(&self) -> Result<String> {

View file

@ -27,11 +27,11 @@ impl TrafBox {
impl Mp4Box for TrafBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}
fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}
fn to_json(&self) -> Result<String> {
@ -39,7 +39,7 @@ impl Mp4Box for TrafBox {
}
fn summary(&self) -> Result<String> {
let s = format!("");
let s = String::new();
Ok(s)
}
}

View file

@ -32,11 +32,11 @@ impl TrakBox {
impl Mp4Box for TrakBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}
fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}
fn to_json(&self) -> Result<String> {
@ -44,7 +44,7 @@ impl Mp4Box for TrakBox {
}
fn summary(&self) -> Result<String> {
let s = format!("");
let s = String::new();
Ok(s)
}
}

View file

@ -27,11 +27,11 @@ impl TrexBox {
impl Mp4Box for TrexBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}
fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}
fn to_json(&self) -> Result<String> {

View file

@ -60,11 +60,11 @@ impl TrunBox {
impl Mp4Box for TrunBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}
fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}
fn to_json(&self) -> Result<String> {

View file

@ -54,11 +54,11 @@ impl Tx3gBox {
impl Mp4Box for Tx3gBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}
fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}
fn to_json(&self) -> Result<String> {

View file

@ -31,11 +31,11 @@ impl VmhdBox {
impl Mp4Box for VmhdBox {
fn box_type(&self) -> BoxType {
return self.get_type();
self.get_type()
}
fn box_size(&self) -> u64 {
return self.get_size();
self.get_size()
}
fn to_json(&self) -> Result<String> {

View file

@ -86,7 +86,7 @@ impl<R: Read + Seek> Mp4Reader<R> {
};
// Update tracks if any fragmented (moof) boxes are found.
if moofs.len() > 0 {
if !moofs.is_empty() {
let mut default_sample_duration = 0;
if let Some(ref moov) = moov {
if let Some(ref mvex) = &moov.mvex {
@ -143,7 +143,7 @@ impl<R: Read + Seek> Mp4Reader<R> {
}
pub fn is_fragmented(&self) -> bool {
self.moofs.len() != 0
!self.moofs.is_empty()
}
pub fn tracks(&self) -> &HashMap<u32, Mp4Track> {

View file

@ -230,7 +230,7 @@ impl Mp4Track {
}
pub fn sample_count(&self) -> u32 {
if self.trafs.len() > 0 {
if !self.trafs.is_empty() {
let mut sample_count = 0u32;
for traf in self.trafs.iter() {
if let Some(ref trun) = traf.trun {
@ -257,7 +257,7 @@ impl Mp4Track {
pub fn sequence_parameter_set(&self) -> Result<&[u8]> {
if let Some(ref avc1) = self.trak.mdia.minf.stbl.stsd.avc1 {
match avc1.avcc.sequence_parameter_sets.get(0) {
Some(ref nal) => Ok(nal.bytes.as_ref()),
Some(nal) => Ok(nal.bytes.as_ref()),
None => Err(Error::EntryInStblNotFound(
self.track_id(),
BoxType::AvcCBox,
@ -272,7 +272,7 @@ impl Mp4Track {
pub fn picture_parameter_set(&self) -> Result<&[u8]> {
if let Some(ref avc1) = self.trak.mdia.minf.stbl.stsd.avc1 {
match avc1.avcc.picture_parameter_sets.get(0) {
Some(ref nal) => Ok(nal.bytes.as_ref()),
Some(nal) => Ok(nal.bytes.as_ref()),
None => Err(Error::EntryInStblNotFound(
self.track_id(),
BoxType::AvcCBox,
@ -337,24 +337,24 @@ impl Mp4Track {
));
}
}
return Err(Error::Box2NotFound(BoxType::StcoBox, BoxType::Co64Box));
Err(Error::Box2NotFound(BoxType::StcoBox, BoxType::Co64Box))
}
fn ctts_index(&self, sample_id: u32) -> Result<(usize, u32)> {
let ctts = self.trak.mdia.minf.stbl.ctts.as_ref().unwrap();
let mut sample_count = 1;
for (i, entry) in ctts.entries.iter().enumerate() {
if sample_id <= sample_count + entry.sample_count - 1 {
if sample_id < sample_count + entry.sample_count {
return Ok((i, sample_count));
}
sample_count += entry.sample_count;
}
return Err(Error::EntryInStblNotFound(
Err(Error::EntryInStblNotFound(
self.track_id(),
BoxType::CttsBox,
sample_id,
));
))
}
/// return `(traf_idx, sample_idx_in_trun)`
@ -374,7 +374,7 @@ impl Mp4Track {
}
fn sample_size(&self, sample_id: u32) -> Result<u32> {
if self.trafs.len() > 0 {
if !self.trafs.is_empty() {
if let Some((traf_idx, sample_idx)) = self.find_traf_idx_and_sample_idx(sample_id) {
if let Some(size) = self.trafs[traf_idx]
.trun
@ -402,11 +402,11 @@ impl Mp4Track {
if let Some(size) = stsz.sample_sizes.get(sample_id as usize - 1) {
Ok(*size)
} else {
return Err(Error::EntryInStblNotFound(
Err(Error::EntryInStblNotFound(
self.track_id(),
BoxType::StszBox,
sample_id,
));
))
}
}
}
@ -425,7 +425,7 @@ impl Mp4Track {
}
fn sample_offset(&self, sample_id: u32) -> Result<u64> {
if self.trafs.len() > 0 {
if !self.trafs.is_empty() {
if let Some((traf_idx, _sample_idx)) = self.find_traf_idx_and_sample_idx(sample_id) {
Ok(self.trafs[traf_idx].tfhd.base_data_offset as u64)
} else {
@ -462,12 +462,12 @@ impl Mp4Track {
let mut sample_count = 1;
let mut elapsed = 0;
if self.trafs.len() > 0 {
if !self.trafs.is_empty() {
let start_time = ((sample_id - 1) * self.default_sample_duration) as u64;
return Ok((start_time, self.default_sample_duration));
Ok((start_time, self.default_sample_duration))
} else {
for entry in stts.entries.iter() {
if sample_id <= sample_count + entry.sample_count - 1 {
if sample_id < sample_count + entry.sample_count {
let start_time =
(sample_id - sample_count) as u64 * entry.sample_delta as u64 + elapsed;
return Ok((start_time, entry.sample_delta));
@ -477,11 +477,11 @@ impl Mp4Track {
elapsed += entry.sample_count as u64 * entry.sample_delta as u64;
}
return Err(Error::EntryInStblNotFound(
Err(Error::EntryInStblNotFound(
self.track_id(),
BoxType::SttsBox,
sample_id,
));
))
}
}
@ -496,7 +496,7 @@ impl Mp4Track {
}
fn is_sync_sample(&self, sample_id: u32) -> bool {
if self.trafs.len() > 0 {
if !self.trafs.is_empty() {
let sample_sizes_count = self.sample_count() / self.trafs.len() as u32;
return sample_id == 1 || sample_id % sample_sizes_count == 0;
}
@ -624,27 +624,25 @@ impl Mp4TrackWriter {
self.fixed_sample_size = size;
self.is_fixed_sample_size = true;
}
} else {
if self.is_fixed_sample_size {
if self.fixed_sample_size != size {
self.is_fixed_sample_size = false;
if self.trak.mdia.minf.stbl.stsz.sample_size > 0 {
self.trak.mdia.minf.stbl.stsz.sample_size = 0;
for _ in 0..self.trak.mdia.minf.stbl.stsz.sample_count {
self.trak
.mdia
.minf
.stbl
.stsz
.sample_sizes
.push(self.fixed_sample_size);
}
} else if self.is_fixed_sample_size {
if self.fixed_sample_size != size {
self.is_fixed_sample_size = false;
if self.trak.mdia.minf.stbl.stsz.sample_size > 0 {
self.trak.mdia.minf.stbl.stsz.sample_size = 0;
for _ in 0..self.trak.mdia.minf.stbl.stsz.sample_count {
self.trak
.mdia
.minf
.stbl
.stsz
.sample_sizes
.push(self.fixed_sample_size);
}
self.trak.mdia.minf.stbl.stsz.sample_sizes.push(size);
}
} else {
self.trak.mdia.minf.stbl.stsz.sample_sizes.push(size);
}
} else {
self.trak.mdia.minf.stbl.stsz.sample_sizes.push(size);
}
self.trak.mdia.minf.stbl.stsz.sample_count += 1;
}
@ -759,7 +757,7 @@ impl Mp4TrackWriter {
}
fn update_sample_to_chunk(&mut self, chunk_id: u32) {
if let Some(ref entry) = self.trak.mdia.minf.stbl.stsc.entries.last() {
if let Some(entry) = self.trak.mdia.minf.stbl.stsc.entries.last() {
if entry.samples_per_chunk == self.chunk_samples {
return;
}

View file

@ -73,14 +73,14 @@ impl FixedPointU16 {
impl fmt::Debug for BoxType {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let fourcc: FourCC = From::from(self.clone());
let fourcc: FourCC = From::from(*self);
write!(f, "{}", fourcc)
}
}
impl fmt::Display for BoxType {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let fourcc: FourCC = From::from(self.clone());
let fourcc: FourCC = From::from(*self);
write!(f, "{}", fourcc)
}
}

View file

@ -62,8 +62,8 @@ impl<W> Mp4Writer<W> {
impl<W: Write + Seek> Mp4Writer<W> {
pub fn write_start(mut writer: W, config: &Mp4Config) -> Result<Self> {
let ftyp = FtypBox {
major_brand: config.major_brand.clone(),
minor_version: config.minor_version.clone(),
major_brand: config.major_brand,
minor_version: config.minor_version,
compatible_brands: config.compatible_brands.clone(),
};
ftyp.write_box(&mut writer)?;