aboutsummaryrefslogtreecommitdiff
path: root/reader.go
diff options
context:
space:
mode:
authorOnur Gündüz <ogunduz@gmail.com>2026-06-30 15:35:01 +0200
committerOnur Gündüz <ogunduz@gmail.com>2026-06-30 15:35:01 +0200
commit0f5c3761970cdf122da63a2454dfcce545ab357c (patch)
tree3f050071c6b41c900dfba3e346c8216fc1b14593 /reader.go
parent3535c58b2104bc9efe377aadadf6ee8577137c0b (diff)
downloadmp4-0f5c3761970cdf122da63a2454dfcce545ab357c.tar.gz
mp4-0f5c3761970cdf122da63a2454dfcce545ab357c.zip
track: add AV1 support, edit list parsing, and sync flag packing
Diffstat (limited to 'reader.go')
-rw-r--r--reader.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/reader.go b/reader.go
index 3a96a04..86902e9 100644
--- a/reader.go
+++ b/reader.go
@@ -312,6 +312,25 @@ func (r *Reader) ReadMehd() (fragmentDuration uint64) {
return
}
+// ReadElst extracts the media time of the first edit list entry, in the media
+// timescale. It returns the media time and whether an entry was present.
+func (r *Reader) ReadElst() (mediaTime int64, ok bool) {
+ data := r.Data()
+ if len(data) < 4 || be.Uint32(data[0:4]) == 0 {
+ return 0, false
+ }
+ if r.version == 1 {
+ if len(data) < 20 {
+ return 0, false
+ }
+ return int64(be.Uint64(data[12:20])), true
+ }
+ if len(data) < 16 {
+ return 0, false
+ }
+ return int64(int32(be.Uint32(data[8:12]))), true
+}
+
// ReadTrex extracts fields from a trex box.
// Returns trackId, default sample description index, default sample duration,
// default sample size, and default sample flags.