mirror of
https://github.com/alfg/mp4-rust.git
synced 2024-12-22 20:16:27 +00:00
Fix clippy warnings
This commit is contained in:
parent
eac3d14f85
commit
c7bea273a0
3 changed files with 5 additions and 5 deletions
|
@ -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> {
|
fn write_desc<W: Write>(writer: &mut W, tag: u8, size: u32) -> Result<u64> {
|
||||||
writer.write_u8(tag)?;
|
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"));
|
return Err(Error::InvalidData("invalid descriptor length range"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -281,7 +281,7 @@ impl Mp4Track {
|
||||||
|
|
||||||
pub fn sequence_parameter_set(&self) -> Result<&[u8]> {
|
pub fn sequence_parameter_set(&self) -> Result<&[u8]> {
|
||||||
if let Some(ref avc1) = self.trak.mdia.minf.stbl.stsd.avc1 {
|
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()),
|
Some(nal) => Ok(nal.bytes.as_ref()),
|
||||||
None => Err(Error::EntryInStblNotFound(
|
None => Err(Error::EntryInStblNotFound(
|
||||||
self.track_id(),
|
self.track_id(),
|
||||||
|
@ -296,7 +296,7 @@ impl Mp4Track {
|
||||||
|
|
||||||
pub fn picture_parameter_set(&self) -> Result<&[u8]> {
|
pub fn picture_parameter_set(&self) -> Result<&[u8]> {
|
||||||
if let Some(ref avc1) = self.trak.mdia.minf.stbl.stsd.avc1 {
|
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()),
|
Some(nal) => Ok(nal.bytes.as_ref()),
|
||||||
None => Err(Error::EntryInStblNotFound(
|
None => Err(Error::EntryInStblNotFound(
|
||||||
self.track_id(),
|
self.track_id(),
|
||||||
|
@ -665,7 +665,7 @@ impl Mp4TrackWriter {
|
||||||
let mut trak = TrakBox::default();
|
let mut trak = TrakBox::default();
|
||||||
trak.tkhd.track_id = track_id;
|
trak.tkhd.track_id = track_id;
|
||||||
trak.mdia.mdhd.timescale = config.timescale;
|
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.hdlr.handler_type = config.track_type.into();
|
||||||
trak.mdia.minf.stbl.co64 = Some(Co64Box::default());
|
trak.mdia.minf.stbl.co64 = Some(Co64Box::default());
|
||||||
match config.media_conf {
|
match config.media_conf {
|
||||||
|
|
|
@ -117,7 +117,7 @@ impl<W: Write + Seek> Mp4Writer<W> {
|
||||||
fn update_mdat_size(&mut self) -> Result<()> {
|
fn update_mdat_size(&mut self) -> Result<()> {
|
||||||
let mdat_end = self.writer.stream_position()?;
|
let mdat_end = self.writer.stream_position()?;
|
||||||
let mdat_size = mdat_end - self.mdat_pos;
|
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.seek(SeekFrom::Start(self.mdat_pos))?;
|
||||||
self.writer.write_u32::<BigEndian>(1)?;
|
self.writer.write_u32::<BigEndian>(1)?;
|
||||||
self.writer.seek(SeekFrom::Start(self.mdat_pos + 8))?;
|
self.writer.seek(SeekFrom::Start(self.mdat_pos + 8))?;
|
||||||
|
|
Loading…
Reference in a new issue