comments: containers IsoBmff Mux / Meta, Iso9660
This commit is contained in:
1 parent
3cda652143
commit
24cbddaafa
3 files changed
+8
-44
No files matched your search
@@ -32,7 +32,6 @@ local function uint(r: Bytes.Reader, size: number): number
|
||||
return 0
|
||||
end
|
||||
|
||||
-- ------------------------------------------------------------------------------------------------ HEIF items
|
||||
export type Property = { type: string, box: Box.Box, [string]: any }
|
||||
export type Item = {
|
||||
id: number,
|
||||
@@ -103,7 +102,6 @@ local function property(b: buffer, box: Box.Box): Property
|
||||
return p
|
||||
end
|
||||
|
||||
-- items(buf, meta) -> Items | nil, Err (meta: a top-level 'meta' box)
|
||||
function Meta.items(b: buffer, meta: Box.Box): (Items?, Err.Err?)
|
||||
local out: Items = { items = {}, order = {}, properties = {} }
|
||||
local pitm = Box.child(meta, "pitm")
|
||||
@@ -253,8 +251,6 @@ function Meta.items(b: buffer, meta: Box.Box): (Items?, Err.Err?)
|
||||
return out, nil
|
||||
end
|
||||
|
||||
-- itemData(buf, base, limit, items, id) -> buffer | nil, Err: the item's bytes (extents concatenated); base / limit
|
||||
-- bound the file in the buffer
|
||||
function Meta.itemData(b: buffer, base: number, limit: number, items: Items, id: number): (buffer?, Err.Err?)
|
||||
local it = items.items[id]
|
||||
if not it then
|
||||
@@ -296,7 +292,6 @@ function Meta.itemData(b: buffer, base: number, limit: number, items: Items, id:
|
||||
return out, nil
|
||||
end
|
||||
|
||||
-- ------------------------------------------------------------------------------------------------ iTunes tags
|
||||
-- ilst item -> standard tag name
|
||||
local TAG: { [string]: string } = {
|
||||
["\169nam"] = "title", ["\169ART"] = "artist", aART = "albumartist", ["\169alb"] = "album", ["\169day"] = "date",
|
||||
@@ -330,7 +325,6 @@ local GENRES = {
|
||||
|
||||
export type Picture = { mime: string, data: buffer }
|
||||
|
||||
-- tags(buf, ilst) -> Tags, { Picture }
|
||||
function Meta.tags(b: buffer, ilst: Box.Box?): ({ [string]: string }, { Picture })
|
||||
local tags: { [string]: string } = {}
|
||||
local pics: { Picture } = {}
|
||||
@@ -396,7 +390,6 @@ function Meta.tags(b: buffer, ilst: Box.Box?): ({ [string]: string }, { Picture
|
||||
return tags, pics
|
||||
end
|
||||
|
||||
-- ------------------------------------------------------------------------------------------------ ilst writer
|
||||
local function box(w: Bytes.Writer, typ: string, body: (Bytes.Writer) -> ())
|
||||
local start = w:tell()
|
||||
w:u32be(0)
|
||||
@@ -426,8 +419,6 @@ local function num(s: string?): number
|
||||
return math.clamp(math.floor(v), 0, 65535)
|
||||
end
|
||||
|
||||
-- writeIlst(w, tags, pictures?): an ilst box with the tags (standard names -> iTunes atoms; unknown names -> '----'
|
||||
-- freeform com.apple.iTunes items) and cover pictures
|
||||
function Meta.writeIlst(w: Bytes.Writer, tags: { [string]: string }, pictures: { Picture }?)
|
||||
box(w, "ilst", function()
|
||||
local keys = {}
|
||||
@@ -506,7 +497,7 @@ function Meta.writeIlst(w: Bytes.Writer, tags: { [string]: string }, pictures: {
|
||||
end)
|
||||
end
|
||||
|
||||
-- writeUdta(w, tags, pictures?): udta / meta (hdlr mdir) / ilst
|
||||
-- udta / meta (hdlr mdir) / ilst
|
||||
function Meta.writeUdta(w: Bytes.Writer, tags: { [string]: string }, pictures: { Picture }?)
|
||||
box(w, "udta", function()
|
||||
box(w, "meta", function()
|
||||
|
||||
Reference in new issue
Block a user