public class Mp4TagWriter extends Object
ilst
atom as shown below, (note all free atoms are
optional).
When writing changes the size of all the atoms up to ilst
has to be recalculated, then if the size of
the
If the size of the metadata has increased by more than the size of the free
atom then the size of its parents
have to be recalculated. This means meta
, udta
and moov
should be recalculated and the top
level free
atom reduced accordingly.
If there is not enough space even if using both of the free
atoms, then the mdat
atom has to be
shifted down accordingly to make space, and the stco
atoms have to have their offsets to mdat
chunks table adjusted accordingly.
Exceptions are that the meta/udta/ilst do not currently exist, in which udta/meta/ilst are created. Note it is valid
to have meta/ilst without udta but this is less common so we always try to write files according to the Apple/iTunes
specification. *
|--- ftyp |--- free |--- moov |......| |......|----- mvdh |......|----- trak (there may be more than one trak atom, e.g. Native Instrument STEM files) |......|.......| |......|.......|-- tkhd |......|.......|-- mdia |......|............| |......|............|-- mdhd |......|............|-- hdlr |......|............|-- minf |......|.................| |......|.................|-- smhd |......|.................|-- dinf |......|.................|-- stbl |......|......................| |......|......................|-- stsd |......|......................|-- stts |......|......................|-- stsc |......|......................|-- stsz |......|......................|-- stco (important! may need to be adjusted.) |......| |......|----- udta |..............| |..............|-- meta |....................| |....................|-- hdlr |....................|-- ilst |....................|.. ..| |....................|.....|---- @nam (Optional for each metadatafield) |....................|.....|.......|-- data |....................|.....|....... ecetera |....................|.....|---- ---- (Optional for reverse dns field) |....................|.............|-- mean |....................|.............|-- name |....................|.............|-- data |....................|................ ecetera |....................|-- free |--- free |--- mdat
Constructor and Description |
---|
Mp4TagWriter(String loggingName) |
Modifier and Type | Method and Description |
---|---|
void |
delete(Tag tag,
Path file)
Delete the tag.
|
void |
write(Tag tag,
Path file)
Write tag to file.
|
public static Logger logger
public Mp4TagWriter(String loggingName)
public void write(Tag tag, Path file) throws CannotWriteException
tag
- tag datafile
- current fileCannotWriteException
IOException
public void delete(Tag tag, Path file) throws CannotWriteException
This is achieved by writing an empty ilst
atom.
file
- IOException
CannotWriteException
Copyright © 2005–2020 jthink.net. All rights reserved.