edith
Clone
https://git.tahinli.com/Tahinli/edith.git
0 watching0 forksRust18.3 MiBff99ad6Tahinli6 days ago1055 commits
| 1 | //! Edith's access to an mp4 track's audio, over `ec-mp4`'s demuxer. |
| 2 | //! |
| 3 | //! The audio readers ask an mp4 the same few questions -- which tracks are |
| 4 | //! audio, what each one's config says, how long its sample table is, where its |
| 5 | //! edit list starts the presentation -- and this is where those answers come |
| 6 | //! from. Stream numbers are `ec-mp4`'s: [`ec_mp4::TrackInfo::stream`] for a |
| 7 | //! track, [`ec_mp4::Mp4Demuxer::samples`] for its table. |
| 8 | |
| 9 | use File; |
| 10 | use BufReader; |
| 11 | use Path; |
| 12 | |
| 13 | use ; |
| 14 | use Mp4Demuxer; |
| 15 | |
| 16 | /// An mp4 file open for reading: its sample tables are its index, and sample |
| 17 | /// bytes are read on demand. |
| 18 | pub type Reader = ; |
| 19 | |
| 20 | /// Opens `path` as an mp4 (or QuickTime) file and reads its movie header and |
| 21 | /// sample tables. |
| 22 | pub |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | /// The audio tracks of `reader`, in file order (the order a stream index |
| 29 | /// counts in), as `(track id, stream)`. `stream` is [`None`] for a track this |
| 30 | /// build has no codec for. Read from the `moov`, not a `HashMap`, so "stream 0" |
| 31 | /// is the same track from one run to the next. |
| 32 | pub |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | /// The codec of `stream`, [`None`] for a stream that does not exist. |
| 46 | pub |
| 47 | |
| 48 | |
| 49 | |
| 50 | /// The fourcc of `track_id`'s first sample entry: `mp4a`, `ac-3`, `alac`, ... |
| 51 | pub |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | /// The sample rate of an audio `stream`, in Hz (for AAC, the rate the decoder |
| 60 | /// produces: the SBR extension rate where the config states one). |
| 61 | pub |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | /// The channel count of an audio `stream`, from its config. |
| 69 | pub |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | /// The codec configuration bytes of `stream` as the file states them: an AAC |
| 77 | /// track's `AudioSpecificConfig` verbatim, extension frequency and all. |
| 78 | pub |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | |
| 84 | /// Ticks per second of `stream`'s time base: its media timescale. |
| 85 | pub |
| 86 | |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 | /// The `mdhd` duration of `stream`, in its timescale, [`None`] where the file |
| 93 | /// states none. |
| 94 | pub |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | /// The ISO 639-2 language of `track_id`, [`None`] for the `und` a muxer writes |
| 101 | /// when it was never told. |
| 102 | pub |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | /// `media_time` of `track_id`'s first real edit-list entry, in its timescale: |
| 111 | /// where the presentation starts inside the media. [`None`] with no edit list, |
| 112 | /// or only empty entries, which shift the timeline rather than trim the media. |
| 113 | pub |
| 114 | |
| 115 | |
| 116 | |
| 117 | |
| 118 | |
| 119 | |
| 120 | |
| 121 | |
| 122 | /// How many samples `stream` has. |
| 123 | pub |
| 124 | |
| 125 | |
| 126 | |
| 127 | /// The bytes of `stream`'s samples in all: what its byte rate is measured from. |
| 128 | pub |
| 129 | |
| 130 | |
| 131 | |
| 132 | |
| 133 | |
| 134 | |
| 135 | |
| 136 | /// The decode durations of `stream` as `(sample count, duration)` runs, the |
| 137 | /// shape of an `stts` table, for [`crate::audio::packet_at`]. |
| 138 | pub |
| 139 | |
| 140 | |
| 141 | |
| 142 | |
| 143 | |
| 144 | |
| 145 | |
| 146 | |
| 147 | |
| 148 | |
| 149 | /// Sample `id` of `stream`, counted from 1 as an mp4 counts them, read without |
| 150 | /// moving any other cursor. [`None`] past the end of the track. |
| 151 | pub |
| 152 | |
| 153 | |
| 154 | |
| 155 | |
| 156 | |
| 157 | |
| 158 | |
| 159 | |
| 160 |