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

57 commits

Author SHA1 Message Date
Nathan Fiedler
56cc260a5c
fix: minimize assertions in non-test code (#56)
Initial effort to reduce or eliminate the use of assertions in the
production code (i.e. not test code). See issue 43 for an example of how
this can cause an application (thread) to panic when reading an unusual
file. Not all of the changes were as simple as returning an Err, since some
functions did not return a Result. Also, the error type used (InvalidData)
is just a catch-all with a message, and in some cases a more refined error
type may be in order.

cargo test passes
2021-07-12 17:28:39 -07:00
Alfred Gutierrez
28dd9e0a27
feat: add more audio object types (#52) 2021-04-04 11:56:02 -07:00
Alfred Gutierrez
0d2d2547d1
bugfix: fix size when parsing largesize box header (#49) 2021-01-31 11:47:28 -08:00
Alfred Gutierrez
75599fe561
feat: add Freq7350 to SampleFreqIndex enum (#47) 2021-01-30 00:14:40 -08:00
ninthakeey
eedccec776
Example/mp4sample supports fragmented mp4 (#46)
* feat: mvex box中的mehd box改为可选,支持fmp4的解析

* feat: example/mp4sample supports fragmented mp4

* feat: utilize function sample_count(), extract duplicated codes as a new function

* feat: field data_offset in TrunBox is optional

* feat: remove an ".expect()"

* feat: remove an ".expect()"

* chore: re-style code
2021-01-28 19:52:35 -08:00
Alf
4d2b5acf9e Update and add example for Mp4Writer<W>.into_writer. 2021-01-27 18:53:24 -08:00
John-John Tedro
8fd133eccf
Store 4 bytes in FourCC instead of a String (#45) 2021-01-27 18:51:03 -08:00
John-John Tedro
d73e80107d
Add Mp4Writer::into_writer (#44) 2021-01-27 18:07:21 -08:00
ninthakeey
00b50636b6
example/copy supports vp9-in-mp4 and example/dump supports fmp4 (#41)
* feat: mvex box中的mehd box改为可选,支持fmp4的解析

* feat: support to copy mp4 with vp9 codec, but not support to copy fmp4 with vp9 codec

* Update types.rs

undo unnecessary changes.

* Update types.rs

undo reduce unnecessary changes.

* Update types.rs

* Update mp4copy.rs

Add vp9 code after h265

* Update stsd.rs

Add vp09 after the Hevc

* Update types.rs

Add after the HevcConfig.

* fix: Track.rs add vp9 support

* feat: mp4 writer set vp09 box into stsd box
2021-01-26 19:31:32 -08:00
Alfred Gutierrez
9c43838793
bugfix: fix update_sync_samples in Mp4TrackWriter where sync is not properly set in stss box #38 (#39) 2020-12-24 17:35:13 -08:00
Alf
4bf4a98414 0.7.1 2020-11-23 13:55:31 -08: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
fba770a00e
Updating docs (#32)
* Updating docs.

* Fix docs tests and update to 0.7.0.
2020-09-14 19:48:00 -07:00
Alfred Gutierrez
6ec013b7b9
Fragmented tracks (#31)
* Add trun box.

* Adding Movie Extends Box and subboxes (mvex, mehd, trex).

* Adding more support for parsing fragmented tracks. Add mp4sample example.

* cleanup

* Set default_sample_duration from moov.mvex.trex for getting fragmented samples.

* fix trex box parsing/writing.
2020-09-14 18:05:34 -07:00
Alfred Gutierrez
f8f767dc07
Fragmented boxes (#30)
* Add trun box.

* Adding Movie Extends Box and subboxes (mvex, mehd, trex).
2020-09-13 00:25:08 -07:00
Alf
a1f7902c6c Skip serializing edts if Option::is_none. 2020-09-09 21:02:38 -07:00
Alf
dd2eae6eed Skip serializing vmhd/smhd if Option::is_none. 2020-09-09 20:04:06 -07: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
9822589734 fix is_fragmented method. 2020-09-06 13:00:34 -07:00
Alf
e879500c1a update mp4info example and track. 2020-09-05 13:15:31 -07:00
Alf
421d9e7606 More tx3g box parsing/writing and update tests. 2020-09-05 00:57:15 -07:00
Alf
05e20124e0 Add support for parsing subtitle tracks (tx3g box). 2020-09-04 23:09:33 -07:00
Alf
8def228352 Add support for reading/writing fragmented mp4 (fMP4) boxes. 2020-09-03 21:33:45 -07:00
Alf
3b5a728a30 fix tests and update mp4copy example. 2020-09-01 21:15:56 -07:00
Alf
b4b4dbd49f add support for hev1 box 2020-09-01 20:41:34 -07:00
Alf
b016ac3b47 add top level public function mp4::read_mp4 for using the Mp4Reader with a file path. Added simple example. 2020-08-24 22:38:05 -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
Alfred Gutierrez
6cd4f72d28
Mp4Reader and update README example (#21)
* Make ftyp and moov on Mp4Reader public. Also update README.md with working example.

* update readme
2020-08-19 21:38:57 -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
b5367032a7
Update examples (#16)
* 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

Co-authored-by: Byungwan Jun <unipro.kr@gmail.com>
2020-08-05 23:00:53 -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
Ian Jun
0df82aec5f
Feature/mp4reader (#13)
* 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

Co-authored-by: Byungwan Jun <unipro.kr@gmail.com>
2020-07-31 10:12:26 -07:00
Ian Jun
4df9fa1bd4
Feature/test write box (#12)
* 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 test code for all leaves in box tree

* Remove entry_count that is duplacated with entries.len()

* Change volume type to Ratio<u16>

Co-authored-by: Byungwan Jun <unipro.kr@gmail.com>
2020-07-28 21:29:04 -07:00
Ian Jun
8f56200dd0
Feature/writebox trait (#11)
* Add ReadBox trait

* Add boxtype macro

* Remove offset in BoxHeader

* Fix parsing error when box has largesize

* Remove duplicated codes reading version and flags

* Simplify all box size types as largesize

* Add WriteBox trait and improve compatibility with large box

* Split large atoms file into smaller ones

* Refator Error

Co-authored-by: Byungwan Jun <unipro.kr@gmail.com>
2020-07-28 09:36:17 -07:00
Ian Jun
1e86e4edab
Remove deprecated codes (#9)
* Add ReadBox trait

* Add boxtype macro

* Remove offset in BoxHeader

* Fix parsing error when box has largesize

* Remove duplicated codes reading version and flags

Co-authored-by: Byungwan Jun <unipro.kr@gmail.com>
2020-07-25 20:11:47 -07:00
Ian Jun
85a65ea596
Add ReadBox trait (#7) 2020-07-24 19:57:46 -07:00
Nathan Fiedler
e875c7da44
Skip over unknown boxes (#4)
* Skip over unknown boxes

If the box size is non-zero, skip over it and continue reading. Otherwise if
the box size is zero, exit the loop.

* Add comment clarifying the box skipping
2020-05-27 18:29:41 -07:00
Alf
f04ebb4b61 Add skip fn for skipping remaining bytes in a box. 2020-02-05 20:22:08 -08:00
Alfred Gutierrez
ec53b03673
Cleanup and some minor restructuring. (#2)
* Cleanup and some minor restructuring.

* Update readme.
2020-02-03 21:52:23 -08:00
Alf
4a8c4f57b4 cleanup. 2020-01-27 21:58:19 -08:00
Alfred Gutierrez
e9936e5f78
Sample boxes and mp4info example updates (#1)
* more sample boxes

* stts and sample box parsing. Update mp4info example with more details.
2020-01-27 21:32:53 -08:00
Alf
b345450e19 cleanup on lib and add more mp4info example output. 2020-01-21 21:41:51 -08:00
Alf
56e49bea57 mdia/mdhd/hdlr box parsing. 2020-01-19 23:17:03 -08:00
Alf
b50097b784 edts/elst box parsing 2020-01-19 20:34:22 -08:00
Alf
b400b02aee TKHD box parsing. 2020-01-16 22:43:41 -08:00
Alf
4acb2cd93f add trak/tkhd box. 2020-01-15 22:53:42 -08:00
Alf
c4123f721a Add moov box builder and skip remaining bytes. 2020-01-13 21:10:25 -08:00