1
0
Fork 0
mirror of https://github.com/alfg/mp4-rust.git synced 2024-05-20 09:18:16 +00:00
Commit graph

17 commits

Author SHA1 Message Date
emkman99 19e4eaa3c8
Extract esds box from wave box (#96)
* Extract esds from wave box

* Allow empty, multi-byte, and arbitrary NUL terminated strings

* Skip unsupported avc1 sub-boxes

* Fixed non-integer framerates

* Fixed bitrate calculation

* Fixed format issue

* Public read sample offset

* Fix lint warning.

---------

Co-authored-by: Alfred Gutierrez <alfg@users.noreply.github.com>
2023-08-02 21:13:58 -07:00
jensenn b4fca8a199
Fix writing SLConfigDescriptor (#107)
Co-authored-by: Alfred Gutierrez <alfg@users.noreply.github.com>
2023-08-02 21:05:09 -07:00
oftheforest 7cfdffbd71
Fix several overflows in box and track processing (#94)
* Fix several overflows in box and track processing

* Use size_of::<Type>() instead of magic numbers

* Fix a panic in Mp4Track::read_sample() for one-past-the-end

This appears to be a bug unmasked by other changes. read_sample() calls
sample_offset() then sample_size(), and assumes that if the former returns Ok
then the latter does as well. However, if the sample_id is one past the end,
sample_offset() might succeed (it only checks samples _up to_ the given
sample_id but not _including_ it) while sample_size() fails (because the sample
doesn't exist). read_sample() will then panic.

Fix this by duplicating the error propagation (that is currently done for
sample_offset) for sample_size, instead of unwrapping. This is a cautious
change that fixes the bug; alternatively, having sample_offset() call
sample_size() on the given sample_id and propagate any error might also work.

* Account for header size in box processing overflow fixes

* Ensure that boxes aren't bigger than their containers

Together with the entry_count checks, this eliminates several OOMs when reading
incorrect mp4 files.

* Fix order of arithmetic operations

This was due to an incorrect transcription when switching to checked
arithmetic, and fixes a bug that could cause attempted lookups of the wrong
chunk_id.
2023-02-18 11:46:51 -08:00
Alfred Gutierrez 9f10bd335e
clippy: fix warnings from latest stable rust 1.67.0 (#93) 2023-01-30 20:33:32 -08:00
rolleifx c26bdcab59
fix "mdat size too large" (#80)
* fix "mdat size too large"

* fix clippy

* Fix clippy::derive-partial-eq-without-eq
2023-01-05 18:19:47 -08:00
Ririsoft 5d648f1a72
fix clippy & enhance CI/CD (#78)
* fix clippy::unused_io_amount

See related clippy documentation,
but in short some partial reads can occur
in particular with io on the networl.
read_exact/write_all transparently handle such errors.

The fix actually revealed a bug
in 'mp4a' atom parsing, but this is a dangerous change:
Parsing bugs that were transparently ignored
are now failing with error (unattended io eof).

* fix trivial clippy errors

* fix clippy error with always 0 value

* run ci/cd with clippy and latest rust version
2022-07-07 20:02:00 -07:00
Data Retriever 3ecfd0cc9d
Cargo fmt and clippy (#73)
* Run cargo clippy --fix

* Run cargo fmt --all
2022-05-31 20:50:49 -07:00
Alex 12ba304023
Support profiles > 31 in DecoderSpecificDescriptor (#69) 2022-03-25 20:02:50 -07:00
Jun, Byungwan 8af11652f1
Fix the playback bug in QuickTime and Safari (#34)
* Add dinf box

* Fix desc size bug

* Default value of track flag is TrackEnabled

* Set optional UrlBox in DrefBox
2020-11-23 13:38:05 -08:00
Alfred Gutierrez 0f373b03db
Box summary and to_json traits. (#29)
* Add Mp4Box traits for getting json or text summary for each box.

* fix test and serde version.

* skip serializing entries

* skip serializing sample_sizes

* Add custom serializer for FixedPoint types.
2020-09-08 22:24:34 -07:00
Alf 05e20124e0 Add support for parsing subtitle tracks (tx3g box). 2020-09-04 23:09:33 -07:00
Alf 71f0f78ae6 remove duplicated code. 2020-08-24 22:00:48 -07:00
Alf 4df1097948 Update mp4dump example and update box_size to method in all boxes. 2020-08-24 21:49:58 -07:00
Alf d51a193272 Add mp4dump example and update all mp4boxes with get_type and get_size methods. 2020-08-23 22:11:59 -07:00
Alfred Gutierrez c4ff8627b0
Set optional EsdsBox in Mp4aBox. (#23)
* Make EsdsBox in Mp4aBox optional, instead of error when parsing. Also update mp4info example with some missing info that was removed.

* Update Mp4aBox test to check for optional EsdsBox.
2020-08-23 13:38:25 -07:00
Ian Jun 0abb242037
Refactoring (#17)
* Add ReadBox trait

* Add boxtype macro

* Remove offset in BoxHeader

* Fix parsing error when box has largesize

* Remove duplicated codes reading version and flags

* Update examples

* Fix test failure

* Rename I/O position moving functions

* skip_read() to skip_bytes()
* skip_read_to() to skip_bytes_to()
* skip_write() to write_zeros()

* Rename I/O position moving functions

* skip_read() to skip_bytes()
* skip_read_to() to skip_bytes_to()

* Ensure skip_bytes() does not go back.

Co-authored-by: Byungwan Jun <unipro.kr@gmail.com>
2020-08-06 20:35:08 -07:00
Ian Jun 3104a2d95b
Feature/mp4copy (#14)
* Add ReadBox trait

* Add boxtype macro

* Remove offset in BoxHeader

* Fix parsing error when box has largesize

* Remove duplicated codes reading version and flags

* Add avc1 box

* Add mp4a box

* Add mp4a box

* Add DecoderSpecificDescriptor in esds box

* Add necessary sub-boxes to stbl box

* Improve ReadBox::read_box()

* Add smhd box

* Refactor BoxHeader

* Refactor BMFF

* Refactor

* Add some functions to get offset and size of sample

* Add Mp4Reader::read_sample() that read media samples

* Move Mp4Reader to reader.rs

* Add mandatory check when reading boxes

Add some methods to Mp4Reader, TrackReader
Format codes

* Update mp4info

* Refactor common types

* Add FixedPointX types

* Add media configuration, profile, ...

* Add initial Mp4Writer

* Run cargo fmt

* Add Mp4Writer and examples/mp4copy

* Add test codes for Avc1Box and Mp4aBox

* Remove prefix "get_" from method names

* Rename atoms to mp4box

* Fix some bugs

Co-authored-by: Byungwan Jun <unipro.kr@gmail.com>
2020-08-04 16:56:59 -07:00