|
Class: ISOBMFFReader
Object
|
+--ISOBMFFReader
- Package:
- stx:libview2
- Category:
- System-Support-FileFormats
- Version:
- rev:
1.34
date: 2024/03/26 13:06:45
- user: cg
- file: ISOBMFFReader.st directory: libview2
- module: stx stc-classLibrary: libview2
Helper class to read ISO 15444-12 files (HEIF/HEIC files, among others).
See users of me (clients).
ISOBMFF is the base-format used for a whole bunch of concrete file formats:
QuickTime etc.
Apple recently changed their default camera format to HEIC.
Concrete formats must be parsed by concrete readers.
Use:
Define your reader as a client to this reader, and let it process boxes.
See HEICReader for a concrete example.
This is in an experimental state and not yet finished.
The protocol may change.
Typical layouts:
QuickTime movie (test.mp4):
|--ftyp
|--moov
| |--mvhd
| |--trak -- track_ID: 1, duration: 1294.267s
| | |--tkhd
| | |--mdia
| | |--mdhd
| | |--hdlr -- Video track
| | |--minf
| | |--dinf
| | | |--dref
| | |--stbl
| | | |--stsd -- avc1@640x360
| | | | |--avc1
| | | | |--avcC
| | | |--stts
| | | |--stsc
| | | |--stco
| | | |--stsz
| | | |--stss
| | |--vmhd
| |--trak -- track_ID: 2, duration: 1294.350s
| | |--tkhd
| | |--mdia
| | |--mdhd
| | |--hdlr -- Audio track
| | |--minf
| | |--dinf
| | | |--dref
| | |--stbl
| | | |--stsd -- mp4a@44100HZ
| | | | |--mp4a
| | | | |--esds
| | | |--stts
| | | |--stsc
| | | |--stco
| | | |--stsz
| | |--smhd
| |--udta
| |--meta
| |--hdlr
| |--ilst
|--mdat
image (IMG_4917.HEIC):
|--ftyp
|--meta
| |--hdlr
| |--dinf
| | |--dref
| |--pitm
| |--iinf
| |--iref
| |--iprp
| |--idat
| |--iloc
|--mdat
AVIF (test.avif),
|--ftyp
|--meta
| |--hdlr
| |--pitm
| |--iinf
| |--iloc
| |--iprp
| |--iref
|--free
|--mdat
Box types:
-----------Box Type--------------Manda--------------------------Description--------------------------
|--ftyp * file type and compatibility
|--pdin progressive download information
|--moov * container for all the metadata
| |--mvhd * movie header, overall declarations
| |--trak * container for an individual track or stream
| | |--tkhd * track header, overall information about the track
| | |--tref track reference container
| | |--trgr track grouping indication
| | |--edts edit list container
| | | |--elst an edit list
| | |--mdia * container for the media information in a track
| | | |--mdhd * media header, overall information about the media
| | | |--hdlr * handler, declares the media (handler) type
| | | |--minf * media information container
| | | |--vmhd video media header, overall information (video track only)
| | | |--smhd sound media header, overall information (sound track only)
| | | |--hmhd hint media header, overall information (hint track only)
| | | |--nmhd Null media header, overall information (some tracks only)
| | | |--dinf * data information box, container
| | | | |--dref * data reference box, declares source(s) of media data in track
| | | |--stbl * sample table box, container for the time/space map
| | | |--stsd * sample descriptions (codec types, initialization etc.)
| | | |--stts * (decoding) time-to-sample
| | | |--ctts (composition) time to sample
| | | |--cslg composition to decode timeline mapping
| | | |--stsc * sample-to-chunk, partial data-offset information
| | | |--stsz sample sizes (framing)
| | | |--stz2 compact sample sizes (framing)
| | | |--stco * chunk offset, partial data-offset information
| | | |--co64 64-bit chunk offset
| | | |--stss sync sample table
| | | |--stsh shadow sync sample table
| | | |--padb sample padding bits
| | | |--stdp sample degradation priority
| | | |--sdtp independent and disposable samples
| | | |--sbgp sample-to-group
| | | |--sgpd sample group description
| | | |--subs sub-sample information
| | | |--saiz sample auxiliary information sizes
| | | |--saio sample auxiliary information offsets
| | |--udta user-data
| |--mvex movie extends box
| |--mehd movie extends header box
| |--trex * track extends defaults
| |--leva level assignment
|--moof movie fragment
| |--mfhd * movie fragment header
| |--traf track fragment
| |--tfhd * track fragment header
| |--trun track fragment run
| |--sbgp sample-to-group
| |--sgpd sample group description
| |--subs sub-sample information
| |--saiz sample auxiliary information sizes
| |--saio sample auxiliary information offsets
| |--tfdt track fragment decode time
|--mfra movie fragment random access
| |--tfra track fragment random access
| |--mfro * movie fragment random access offset
|--mdat media data container
|--free free space
|--skip free space
| |--udta user-data
| |--cprt copyright etc.
| |--tsel track selection box
| |--strk sub track box
| |--stri sub track information box
| |--strd sub track definition box
|--meta metadata
| |--hdlr * handler, declares the media (handler) type
| |--dinf data information box, container
| | |--dref data reference box, declares source(s) of media data in track
| |--iloc item location
| |--ipro item protection
| | |--sinf protection scheme information box
| | |--frma original format box
| | |--schm scheme type box
| | |--schi scheme information box
| |--iinf item information
| |--xml XML container
| |--bxml binary XML container
| |--pitm primary item reference
| |--fiin file delivery item information
| | |--paen partition entry
| | | |--fire file reservoir
| | | |--fpar file partition
| | | |--fecr FEC reservoir
| | |--segr file delivery session group
| | |--gitn group id to name
| |--idat item data
| |--iref item reference
|--meco additional metadata container
| |--mere metabox relation
|--styp segment type
|--sidx segment index
|--ssix subsegment index
|--prft producer reference time
ISOBMFFReader fromFile:('stx:goodies' asPackageId packageDirectory / 'bitmaps/heifBitmaps/dwsample-heif-640.heif')
ISOBMFFReader fromFile:('stx:goodies' asPackageId packageDirectory / 'bitmaps/heifBitmaps/dwsample-heif-1280.heif')
ISOBMFFReader fromFile:('stx:goodies' asPackageId packageDirectory / 'bitmaps/heifBitmaps/dwsample-heif-1920.heif')
ISOBMFFReader fromFile:('stx:goodies' asPackageId packageDirectory / 'bitmaps/heifBitmaps/dwsample-heic-640.heic')
ISOBMFFReader fromFile:('stx:goodies' asPackageId packageDirectory / 'bitmaps/heifBitmaps/dwsample-heic-1280.heic')
ISOBMFFReader fromFile:('stx:goodies' asPackageId packageDirectory / 'bitmaps/heifBitmaps/dwsample-heic-1920.heic')
ISOBMFFReader fromFile:('stx:goodies' asPackageId packageDirectory / 'bitmaps/heifBitmaps/dwsample-heic-4k.heic')
ISOBMFFReader fromFile:('stx:goodies' asPackageId packageDirectory / 'bitmaps/heifBitmaps/sample.qtif')
copyrightCOPYRIGHT (c) 2023 by eXept Software AG
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
known4CCs<<END
Video FOURCCs
'raw '
'rle '
'smc '
'rpza'
'8bps'
'qdrw'
'cvid'
'svq1'
'svq3'
'DIVX'
'h263'
'mp4v'
'mx5p': MPEG2 IMX 635/50 50mb/s produced by Final Cut Pro
'mx3n': MPEG2 IMX 635/50 30mb/s produced by Final Cut Pro
'dvpp': DVCPRO PAL produced by Final Cut Pro
'dv5p': DVCPRO50 produced by Final Cut Pro
'hdv3': HDV produced by Final Cut Pro
8BPS "Apple Planar RGB"
SVQ1 "Sorenson Video¬ Compressor"
SVQ3 "Sorenson Video 3 Compressor"
WRLE "Apple BMP"
avc1 "H.264 Encoder"
cvid "Apple Cinepak"
dv5n "Apple DVCPRO50 - NTSC"
dv5p "Apple DVCPRO50 - PAL"
dvc "Apple DV/DVCPRO - NTSC"
dvcp "Apple DV - PAL"
dvpp "Apple DVCPRO - PAL"
h261 "Apple H.261"
h263 "H.263"
h263 "Apple VC H.263"
icod "Apple Intermediate Codec"
jpeg "Apple Photo - JPEG"
mjp2 "JPEG 2000 Encoder"
mjpa "Apple Motion JPEG A"
mjpb "Apple Motion JPEG B"
mp4v "Apple MPEG4 Compressor"
png "Apple PNG"
pxlt "Apple Pixlet Video"
raw "Apple None"
rle "Apple Animation"
rpza "Apple Video"
smc "Apple Graphics"
tga "Apple TGA"
tiff "Apple TIFF"
yuv2 "Apple Component Video - YUV422"
.... "DivX 4 Decoder"
.SGI "Apple SGI"
2vuy "Apple YUV422 Codec (2vuy)"
2vuy "YUV 4:2:2 Hardware Acceleration Codec (yuvs)"
3IV2 "3ivx Decoder"
3IVD "3ivx Decoder"
3iv2 "3ivx Decoder"
3ivd "3ivx Decoder"
8BPS "Apple Planar RGB"
AP41 "DivX 3 Decoder"
BLZ0 "XVID Decoder"
COL0 "DivX 3 Decoder"
COL1 "DivX 3 Decoder"
DAVC "H264 Decoder"
DIV1 "MS-MPEG4 v1 Decoder"
DIV2 "MS-MPEG4 v2 Decoder"
DIV3 "DivX 3 Decoder"
DIV4 "DivX 3 Decoder"
DIV5 "DivX 3 Decoder"
DIV6 "DivX 3 Decoder"
DIVX "DivX 4 Decoder"
DX50 "DivX 5 Decoder"
FLV1 "Sorenson H.263 Decoder"
FMP4 "MPEG-4 Decoder"
FSV1 "Flash Screen Video Decoder"
H264 "H264 Decoder"
M4S2 "DivX 4 Decoder"
M4s2 "WMV Image Codec"
MP42 "MS-MPEG4 v2 Decoder"
MP43 "DivX 3 Decoder"
MP4S "DivX 4 Decoder"
MPG3 "DivX 3 Decoder"
MPG4 "MS-MPEG4 v1 Decoder"
Mjpg "VCM Image Codec"
Mp42 "WMV Image Codec"
Mp43 "WMV Image Codec"
Mp4S "WMV Image Codec"
PNTG "Apple MacPaint"
RMP4 "MPEG-4 Decoder"
SEDG "MPEG-4 Decoder"
SMP4 "MPEG-4 Decoder"
SVQ1 "Sorenson Video¬ Decompressor"
SVQ3 "Sorenson Video 3 Decompressor"
UMP4 "DivX 4 Decoder"
VP62 "TrueMotion VP6 Decoder"
VP6F "TrueMotion VP6 Decoder"
VSSH "H264 Decoder"
WMV1 "WMV Image Codec"
WMV2 "WMV Image Codec"
WMV3 "WMV Image Codec"
WRLE "Apple BMP"
WV1F "MPEG-4 Decoder"
X264 "H264 Decoder"
XVID "XVID Decoder"
XVIX "XVID Decoder"
XviD "XVID Decoder"
ac16 "YUV 4:2:2 Hardware Acceleration Codec (yuvs)"
ac32 "YUV 4:2:2 Hardware Acceleration Codec (yuvs)"
acBG "YUV 4:2:2 Hardware Acceleration Codec (yuvs)"
avc1 "H.264 Decoder"
avr "Apple AVR JPEG"
b16g "Apple 16-bit Gray"
b32a "Apple 32-bit Gray with Alpha"
b48r "Apple 48-bit RGB"
b64a "Apple 64-bit ARGB"
base "Apple 64-bit ARGB"
blit "Apple 64-bit ARGB"
blnd "Alpha Compositor"
blur "Blur"
brco "Brightness and Contrast"
chan "Channel Compositor"
ckey "Chroma Key"
clou "Cloud"
cmyk "Apple CMYK"
col0 "DivX 3 Decoder"
col1 "DivX 3 Decoder"
cupa "QTVR Cubic Codec"
cvid "Apple Cinepak"
div1 "MS-MPEG4 v1 Decoder"
div2 "MS-MPEG4 v2 Decoder"
div3 "DivX 3 Decoder"
div4 "DivX 3 Decoder"
div5 "DivX 3 Decoder"
div6 "DivX 3 Decoder"
divx "DivX 4 Decoder"
dmb1 "Apple OpenDML JPEG"
drmi "AVC0 Media"
dslv "Cross Fade"
dv5n "Apple DVCPRO50"
dv5n "DVCPRO50"
dv5p "Apple DVCPRO50"
dv5p "DVCPRO50"
dvc "Apple DV"
dvcp "Apple DV"
dvpp "Apple DVCPRO"
edge "Edge Detection"
embs "Emboss"
fire "Fire"
flic "Apple FLC"
fmns "Film Noise"
fpix "FlashPix Image"
gain "Alpha Gain"
geff "Special Effects and Filters"
genk "General Convolution"
gif "Apple GIF"
glas "Glass"
h261 "Apple H.261"
h263 "H.263"
h263 "Apple VC H.263"
h264 "H264 Decoder"
hslb "HSL Balance"
j420 "Apple YUV420 Codec"
jpeg "Apple Photo - JPEG"
kpcd "Apple Photo CD"
lens "Lens Flare"
ltpa "QTVR Cylindrical Codec"
m4s2 "DivX 4 Decoder"
matt "Gradient Wipe"
mjp2 "JPEG 2000 Decoder"
mjpa "Apple Motion JPEG A"
mjpb "Apple Motion JPEG B"
mp42 "MS-MPEG4 v2 Decoder"
mp43 "DivX 3 Decoder"
mp4s "DivX 4 Decoder"
mp4v "Apple MPEG4 Decompressor"
mpg3 "DivX 3 Decoder"
mpg4 "MS-MPEG4 v1 Decoder"
mplo "Implode"
msvc "Apple - Microsoft Video 1"
myuv "Apple YUV420 Codec"
path "Apple Curve"
pdf "PDF Image"
png "Apple PNG"
push "Push"
pxlt "Apple Pixlet Video"
qdrw "Apple QuickDraw"
r408 "Apple r408"
raw "Apple None"
raw "DV"
raw "Apple RGB to YUV"
rgbb "RGB Balance"
ripl "Ripple"
rle "Apple Animation"
rpza "Apple Video"
scal "Apple Scaling Codec"
shrp "Sharpen"
slid "Slide"
smc "Apple Graphics"
smp2 "Iris"
smp3 "Radial"
smp4 "Matrix Wipe"
smpt "Wipe"
solr "Color Style"
sync "ColorSync"
syv9 "Apple Sorenson YUV9 Codec"
text "Apple Text ATSUI Codec"
tga "Apple TGA"
tiff "Apple TIFF"
tint "Color Tint"
trav "Traveling Matte"
v408 "Apple v408"
x264 "H264 Decoder"
xplo "Explode"
xvid "XVID Decoder"
y420 "Apple YUV420 Codec"
yuv2 "Apple Component Video - YUV422"
yuvs "Apple YUV422 Codec (yuvs)"
yuvs "YUV 4:2:2 Hardware Acceleration Codec (yuvs)"
yuvu "Apple YUV422 Codec (yuvu)"
yuvx "Apple YUV422 Codec"
zoom "Zoom"
imdc:2Vuy:Ajav "AJA Kona 2Vuy Codec"
imdc:2vuy:AjaV "AJA Kona 2vuy VideoOut Codec"
imdc:2Vuy:AjaV "AJA Kona 2Vuy VideoOut Codec"
imdc:2vuy:appl "Digital Cinema Desktop Transfer Codec"
imdc:2vuy:AVSI "Aurora 8bit eXtreme? UC"
imdc:2Vuy:AVSS "Aurora 8bit Advanced UC"
imdc:2VUY:AVSS "Aurora 8bit UC Legacy"
imdc:2Vuy:BMAG "Blackmagic 2Vuy 8 Bit"
imdc:2vuy:BMAG "Blackmagic 8 Bit"
imdc:2vuy:DV64 "Digital Voodoo SD? 8 Bit"
imdc:2vuy:KeyG "Apple FCP Uncompressed 8-bit 4:2:2"
imdc:BGGR:ASC "ASC Bayer Decompressor"
imdc:C310:GL3N "10-bit Cineon Decompressor"
imdc:cini:bsmt "Cineon Codec"
imdc:D210:GL3N "DPX 10-bit Y'CbCr 4:2:2 Decompressor"
imdc:DV10:AVSS "Aurora DV 10 Bit UC"
imdc:DV10:BMAG "Blackmagic DV10 10 Bit"
imdc:DV10:DV64 "Digital Voodoo SD 10 Bit"
imdc:DV10:DVOO "Digital Voodoo SD 10 Bit"
imdc:DVOO:AVSS "Aurora DV 8 Bit UC"
imdc:DVOO:BMAG "Blackmagic DVOO 8 Bit"
imdc:DVOO:DV64 "Digital Voodoo SD? 8 Bit"
imdc:DVOO:DVOO "Digital Voodoo SD? 8 Bit"
imdc:dx45:DARC "DivX 6.0"
imdc:DX45:DARC "DivX 6.0"
imdc:Mczm:Thry "Microcosm Codec"
imdc:MIFF:Maya "Maya IFF Image Codec"
imdc:NO16:Thry "None16 Codec"
imdc:pRiz:appl "LiveType Codec Decompressor"
imdc:R10g:Ajav "AJA Kona 10-bit Log RGB Codec"
imdc:R10k:Ajav "AJA Kona 10-bit RGB Codec"
imdc:r408:AVSI "Aurora r408 Transfer Decompressor"
imdc:Shr0:BtJz "Sheer"
imdc:Shr1:BtJz "Sheer RGB[A] 8b"
imdc:Shr2:BtJz "Sheer Y'CbCr[A] 8bv 4:4:4[:4]"
imdc:Shr3:BtJz "Sheer Y'CbCr[A] 8bv 4:2:2[:4]"
imdc:Shr4:BtJz "Sheer Y'CbCr 8bw 4:2:2"
imdc:Shr5:BtJz "Sheer Y'CbCr[A] 10bv 4:4:4[:4]"
imdc:Shr6:BtJz "Sheer Y'CbCr[A] 10bv 4:2:2[:4]"
imdc:Shr7:BtJz "Sheer RGB[A] 10b"
imdc:v408:AVSI "Aurora v408 Transfer Decompressor"
Audio FOURCCs
'raw '
'twos'
'sowt'
'mac3'
'mac6'
'ima4'
'ulaw'
'alaw'
'.mp3'
'OggS'
'QDMC'
'QDM2'
'mp4a'
'drms'
'in24'
'in32'
'fl32'
'fl64'
'Qclp'
'agsm'
MAC3:appl "MACE 3:1"
MAC6:appl "MACE 6:1"
QDM2:QDes "QDesign Music 2"
Qclp:QCOM "Qualcomm PureVoice¬"
alac:appl "Apple Lossless"
alaw:appl "ALaw 2:1"
fl32:appl "32-bit Floating Point"
fl64:appl "64-bit Floating Point"
ima4:appl "IMA 4:1"
in24:appl "24-bit Integer"
in32:appl "32-bit Integer"
mp4a:appl "MPEG-4 Audio"
samr:appl "AMR Narrowband"
sowt:appl "16-bit Little Endian"
twos:appl "16-bit Big Endian"
ulaw:appl "uLaw 2:1"
.mp3:FhG "MPEG Layer-3 Audio"
MAC3:appl "MACE 3:1"
MAC6:appl "MACE 6:1"
QDM2:QDes "QDesign Music 2"
QDMC:QDes "QDesign Music 1 Decoder"
Qclp:QCOM "Qualcomm PureVoice¬"
Qclq:QCOM "Qualcomm QCELP"
TS..:TELE "Microsoft ADPCM"
TS..:TELE "Microsoft G.711 aLaw"
TS..:TELE "Microsoft G.711 uLaw"
TS..:TELE "Microsoft IMA ADPCM"
TS.E:TELE "Microsoft G.726"
TS.U:TELE "Microsoft MPEG Layer-3"
WMA1:TELE "Windows Media Audio 7"
WMA2:TELE "Windows Media Audio 9 Standard"
WMA3:TELE "Windows Media Audio 9 Professional"
agsm:appl "Apple GSM 10:1"
alac:appl "Apple Lossless"
alaw:appl "ALaw 2:1"
drms:appl "DRM"
dvca:appl "DV"
dvi :appl "DVI 4:1"
fl32:appl "32-bit Floating Point"
fl64:appl "64-bit Floating Point"
ima4:appl "IMA 4:1"
in24:appl "24-bit Integer"
in32:appl "32-bit Integer"
lpc :appl "LPC 23:1"
mp4a:appl "MPEG-4 Audio"
ms..:appl "MS ADPCM"
ms..:appl "DVI IMA"
ms.1:appl "MS-GSM 6.10"
ms.U:FhG "MPEG Layer-3 Audio"
samr:appl "AMR Narrowband"
sowt:appl "16-bit Little Endian"
twos:appl "16-bit Big Endian"
ulaw:appl "?Law 2:1"
vdva:appl "DV"
Microsoft ID FOURCCs
These FOURCCs indicate that the audio information stsd atom also transports a Microsoft-style WAVEFORMATEX header.
'm', 's', 0x00, 0x02: Microsoft ADPCM
'm', 's', 0x00, 0x11: Microsoft IMA ADPCM
'm', 's', 0x00, 0x55: MP3
[ttps]
END"
class initialization
-
initialize
-
ISOBMFFReader initialize
initialization
-
initializeBoxClasses
-
Invoked when a new instance is created.
Usage example(s):
ISOBMFFReader initializeBoxClasses
|
instance creation
-
fromFile: aFilename
-
ISOBMFFReader fromFile:('stx:goodies' asPackageId packageDirectory / 'bitmaps/heifBitmaps/dwsample-heif-640.heif')
-
new
-
return an initialized instance
accessing
-
boxes
-
after reading a file/stream, return the collected boxes,
unless there was a client who processed them
-
client: something
-
set the client; that one gets the scanned box instances to be processed
-
compatible_brands
-
-
fileType
-
-
inStream: aStream
-
Modified (format): / 07-08-2023 / 13:18:55 / cg
-
major_brand
-
-
metaBoxIsFullBox
-
a special hack: older Quicktime idsc files have meta boxes which are
simple (not full) boxes
-
metaBoxIsFullBox: aBoolean
-
a special hack: older Quicktime idsc files have meta boxes which are
simple (not full) boxes
-
minor_version
-
initialization
-
initialize
-
Invoked when a new instance is created.
private
-
addBox: aBox
-
queries
-
isQT_idsc_file
-
is this an older Quicktime idsc file?
(these have meta boxes which are simple (not full) boxes)
-
isValidTopLevelBoxType: type
-
reading from stream
-
fromStream: aStream
-
read boxes from aStream.
Each box is processed by myself as a client (i.e. added to my boxes collection)
-
getBoxFrom: inStream
-
read and return a single box
-
getBoxFrom: inStream for: aContainerBoxOrNil
-
read and return a single box
-
processStream: aStream into: container
-
read boxes from aStream.
If there is a current containerBox, add the new box(es) to it;
otherwise, if there is a client, let it handle the box;
otherwise, add it to the container, which is initially myself
(to add them to my own boxes collection), but for fullBoxes will be
the container box.
-
skipBox: restSize from: inStream
-
marked as obsolete by exept MBP at 25-08-2023
** This is an obsolete interface - do not use it (it may vanish in future versions) **
AuxiliaryTypeInfoBox
Box
ColrBox
DataInformationBox
FileTypeBox
FreeBox
FullBox
HandlerBox
HvcCBox
IdscBox
IpmaBox
IspeBox
ItemDataBox
ItemInfoBox
ItemInfoEntryBox
ItemLocationBox
ItemPropertiesBox
ItemPropertyContainerBox
ItemReferenceBox
MediaDataBox
MetaBox
MovieHeaderBox
PaspBox
PixelInformationBox
PrimaryItemBox
ProgressiveDownloadInformationBox
SkipBox
UnknownBox
WideBox
XMLBox
|