org.jaudiotagger.audio.mp4
Class Mp4TagWriter

java.lang.Object
  extended by org.jaudiotagger.audio.mp4.Mp4TagWriter

public class Mp4TagWriter
extends java.lang.Object

Writes metadata from mp4, the metadata tags are held under the ilst atom as shown below

When writing changes the size of all the atoms upto ilst has to be recalculated, then if the size of the metadata is increased the size of the free atom (below meta) should be reduced accordingly or vice versa. If the size of the metadata has increased by more than the size of the free atom then the size of 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 atom has to have its offsets to mdat chunks table adjusted accordingly.

 |--- ftyp
 |--- moov
 |......|
 |......|----- mvdh
 |......|----- trak
 |......|----- udta
 |..............|
 |..............|-- meta
 |....................|
 |....................|-- hdlr
 |....................|-- ilst
 |....................|.. ..|
 |....................|.....|---- @nam (Optional for each metadatafield)
 |....................|.....|.......|-- data
 |....................|.....|....... ecetera
 |....................|.....|---- ---- (Optional for reverse dns field)
 |....................|.............|-- mean
 |....................|.............|-- name
 |....................|.............|-- data
 |....................|................ ecetere
 |....................|-- free
 |--- free
 |--- mdat
 


Field Summary
static java.util.logging.Logger logger
           
 
Constructor Summary
Mp4TagWriter()
           
 
Method Summary
 void delete(java.io.RandomAccessFile raf, java.io.RandomAccessFile rafTemp)
          Delete the tag

 void write(Tag tag, java.io.RandomAccessFile raf, java.io.RandomAccessFile rafTemp)
          Write tag to rafTemp file
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

public static java.util.logging.Logger logger
Constructor Detail

Mp4TagWriter

public Mp4TagWriter()
Method Detail

write

public void write(Tag tag,
                  java.io.RandomAccessFile raf,
                  java.io.RandomAccessFile rafTemp)
           throws CannotWriteException,
                  java.io.IOException
Write tag to rafTemp file

Parameters:
tag - tag data
raf - current file
rafTemp - temporary file for writing
Throws:
CannotWriteException
java.io.IOException

delete

public void delete(java.io.RandomAccessFile raf,
                   java.io.RandomAccessFile rafTemp)
            throws java.io.IOException
Delete the tag

This is achieved by writing an empty ilst atom

Parameters:
raf -
rafTemp -
Throws:
java.io.IOException