Skip to content

Commit

Permalink
Fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
willkelleher committed Aug 28, 2024
1 parent ed1c47d commit 394e296
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/mp4box/mp4a.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ fn size_of_length(size: u32) -> u32 {
fn write_desc<W: Write>(writer: &mut W, tag: u8, size: u32) -> Result<u64> {
writer.write_u8(tag)?;

if size as u64 > std::u32::MAX as u64 {
if size as u64 > u32::MAX as u64 {
return Err(Error::InvalidData("invalid descriptor length range"));
}

Expand Down
6 changes: 3 additions & 3 deletions src/track.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,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) {
match avc1.avcc.sequence_parameter_sets.first() {
Some(nal) => Ok(nal.bytes.as_ref()),
None => Err(Error::EntryInStblNotFound(
self.track_id(),
Expand All @@ -296,7 +296,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) {
match avc1.avcc.picture_parameter_sets.first() {
Some(nal) => Ok(nal.bytes.as_ref()),
None => Err(Error::EntryInStblNotFound(
self.track_id(),
Expand Down Expand Up @@ -665,7 +665,7 @@ impl Mp4TrackWriter {
let mut trak = TrakBox::default();
trak.tkhd.track_id = track_id;
trak.mdia.mdhd.timescale = config.timescale;
trak.mdia.mdhd.language = config.language.to_owned();
config.language.clone_into(&mut trak.mdia.mdhd.language);
trak.mdia.hdlr.handler_type = config.track_type.into();
trak.mdia.minf.stbl.co64 = Some(Co64Box::default());
match config.media_conf {
Expand Down
2 changes: 1 addition & 1 deletion src/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ impl<W: Write + Seek> Mp4Writer<W> {
fn update_mdat_size(&mut self) -> Result<()> {
let mdat_end = self.writer.stream_position()?;
let mdat_size = mdat_end - self.mdat_pos;
if mdat_size > std::u32::MAX as u64 {
if mdat_size > u32::MAX as u64 {
self.writer.seek(SeekFrom::Start(self.mdat_pos))?;
self.writer.write_u32::<BigEndian>(1)?;
self.writer.seek(SeekFrom::Start(self.mdat_pos + 8))?;
Expand Down

0 comments on commit 394e296

Please sign in to comment.