comments: containers Chunks / MacFile / MpegEs / Ogg / IsoBmff (part) down to specs

This commit is contained in:
4DBug committed 2026-11-01 01:57:14 -05:00
1 parent 9427e6e5fb
commit e5a8e62fbc
8 files changed
+8 -92

No files matched your search

-9
View File
@@ -7,7 +7,6 @@ local readu8 = buffer.readu8
local MpegEs = {}
-- next start code (00 00 01 xx) at or after p, before limit: position of the 00 00 01 | nil
function MpegEs.findStart(b: buffer, p: number, limit: number): number?
local i = p
while i + 3 <= limit do
@@ -40,7 +39,6 @@ export type Picture = {
}
export type Info = { width: number, height: number, frameRate: number, mpeg2: boolean }
-- info(b, off, limit) -> the first sequence header's facts | nil
function MpegEs.info(b: buffer, off: number, limit: number): Info?
local p = MpegEs.findStart(b, off, limit)
local info: Info? = nil
@@ -64,7 +62,6 @@ function MpegEs.info(b: buffer, off: number, limit: number): Info?
return info
end
-- pictureType(b, off, limit) -> the type (1 I, 2 P, 3 B) and temporal reference of the first picture header | 0
function MpegEs.pictureType(b: buffer, off: number, limit: number): (number, number)
local p = MpegEs.findStart(b, off, limit)
local count = 0
@@ -79,8 +76,6 @@ function MpegEs.pictureType(b: buffer, off: number, limit: number): (number, num
return 0, 0
end
-- pictureStructure(b, p, limit) -> the picture_structure of the picture whose start code is at p, from its picture
-- coding extension (3 = frame when there is none: MPEG-1)
function MpegEs.pictureStructure(b: buffer, p: number, limit: number): number
local q = MpegEs.findStart(b, p + 4, limit)
local count = 0
@@ -100,9 +95,6 @@ function MpegEs.pictureStructure(b: buffer, p: number, limit: number): number
return 3
end
-- pictures(b, off, limit) -> access units of an MPEG-1 / 2 video elementary stream: each picture starts at its
-- sequence / GOP header when one precedes it and runs to the next unit's start; a frame coded as two field pictures
-- is one unit (fields = 2)
function MpegEs.pictures(b: buffer, off: number, limit: number): { Picture }
local out: { Picture } = {}
local unitStart: number? = nil
@@ -151,7 +143,6 @@ function MpegEs.pictures(b: buffer, off: number, limit: number): { Picture }
return out
end
-- h264Key(b, off, limit) -> an Annex B access unit holds an IDR slice (NAL type 5)
function MpegEs.h264Key(b: buffer, off: number, limit: number): boolean
local p = MpegEs.findStart(b, off, limit)
local count = 0