Skip to content
Yoshihiro Yamazaki edited this page Nov 27, 2026 · 1 revision

Home > 機能

機能

IO_ISOBMFF の公開メソッドとプロパティの一覧です。box の配列のキーと propTree / itemTree の形は 設計、コード例は 利用方 にあります。 IO_HEIF と IO_AVIF でも、ここのメソッドがすべてそのまま使えます (IO_AVIF は足したメソッドが無いので、機能のページを持ちません)。

読み書き

メソッド 内容
parse($isobmffData, $opts = array()) データを読み、boxTree を作る。$opts の restrict, debug
build($opts = array()) boxTree から書き出したバイト列を返す。iloc のオフセットを mdat の新しい位置に合わせる。$opts の debug

表示

メソッド 内容
dump($opts = array()) box の木を表示する。$opts の typeonly, hexdump
dumpBox($box, $opts) box を 1 つ (子を含めて) 表示する。$opts["indent"] (字下げの深さ) が要る
dumpBoxList($boxList, $opts) box の配列を表示する
tree($opts = array()) property と item の一覧を表示する。propTree / itemTree が無ければ先に analyze() する
analyze() propTree と itemTree を作る

探す

メソッド 内容
getBoxesByTypes($types) $types (type の配列) のどれかに当たる box を、木全体から順に集めて返す
getItemBoxesByItemID($itemID = null) item に関わる box (infe, pitm, thmb, cdsc, auxl, dimg) の配列。無ければ null。null を渡すと、どれかの item に関わる box をすべて返す
getPropBoxesByItemID($itemID = null) item に結びついた property の box の配列 (ipma の順)。null なら getPropBoxesByPropIndex(null) と同じ。ipma が 1 つでないと例外
getPropBoxesByPropIndex($propIndex = null) ipco の $propIndex 番目 (1 から) の box を [box] で返す。null なら全部 (0 番目は空の配列)。ipco が 1 つでないと例外
IO_ISOBMFF::getItemIDs($box) box が関わる item ID の配列 (infe, pitm は itemID、thmb, cdsc, auxl は fromItemID、dimg は itemArray の ID、それ以外は空)

編集

メソッド 内容
removeBoxByType($removeTypeList) $removeTypeList (type の配列) の box を木全体から消す。ipco の property を消したときは、ipma の結びつきを消し、残りの番号を詰める
appendICCProfile($iccpData) ipco の最後に colr (subtype が prof) を足し、ipma の全 item に essential で結びつける
applyFunctionToBoxTree(&$boxTree, $callback, &$userdata) 木の全 box について $callback($box, $userdata) を呼ぶ (親から子の順)。参照で受け取れば書き換えられる
applyFunctionToBoxTree2(&$boxTree, $callback) 全 box の組について $callback($box1, $box2) を呼ぶ (iloc と mdat の対応づけに使う)

内部で使うもの

メソッド 内容
parseBoxList($bit, $length, $parentType, $opts) / parseBox($bit, $parentType, $opts, $parentEnd = null) box の列 / box を 1 つ読む
buildBoxList($bit, $boxList, $parentType, $opts) / buildBox($bit, $box, $parentType, $opts) box の列 / box を 1 つ書く
analyzeProps($boxList) / analyzeItems($boxList) propTree / itemTree を作る (引数は使わず、boxTree を見る)
cacheItemBoxesByItemID() / cachePropBoxByPropIndex() 探すための表を作る (2 回目からは何もしない)
printfBox($box, $format) name:%d の形の書式で box の値を表示する (%h はバイト列の 16 進)
printTableRecursive($indentSpace, $table) 配列をキーと値で表示する
IO_ISOBMFF::hexDump($data, $offset, $length, $maxLength) / mdatHexDump() / idatHexDump() tree() の先頭バイトの表示

プロパティ

プロパティ 内容
boxTree 最上位の box の配列
_isobmffData parse() に渡したデータ
propTree / itemTree analyze() の結果 (初めは null)
ilocOffsetFieldList / mdatOffsetList build 中の作業用

グローバル関数

関数 内容
getTypeDescription($type) box の説明 ("Item Location" など)。知らない type は null
getChromeFormatDescription($format) hvcC の chromaFormat の名前 (0: Grayscale, 1: YUV420, 2: YUV422, 3: YUV444)
getProfileIdcDescription($idc) hvcC の profileIdc の名前 (1: Main profile 〜 4)

Clone this wiki locally