org.stanwood.media.store.mp4.atomicparsley
Class MP4AtomicParsleyManager

java.lang.Object
  extended by org.stanwood.media.store.mp4.atomicparsley.MP4AtomicParsleyManager
All Implemented Interfaces:
IMP4Manager

public class MP4AtomicParsleyManager
extends java.lang.Object
implements IMP4Manager

A MP4 Manager class that uses atomic parsley "https://bitbucket.org/shield007/atomicparsley" command line application to control the atoms in the file.


Constructor Summary
MP4AtomicParsleyManager()
           
 
Method Summary
 IAtom createAtom(MP4AtomKey name, boolean value)
          Used to create a atom
 IAtom createAtom(MP4AtomKey name, int value)
          Used to create a number atom
 IAtom createAtom(MP4AtomKey name, MP4ArtworkType type, int size, byte[] data)
          Used to create a artwork atom
 IAtom createAtom(MP4AtomKey name, short number, short total)
          Used to create a range atom
 IAtom createAtom(MP4AtomKey name, java.lang.String value)
          Used to create a atom
 java.io.File getArtworkFile(java.net.URL imageUrl)
          Used to download the artwork from a URL to a file
 void init(java.io.File nativeDir)
          This checks that the stores system commands can be found before the store is used.
 java.util.List<IAtom> listAtoms(java.io.File mp4File)
          Used to get a list of atoms in the MP4 file.
 void setParameter(java.lang.String key, java.lang.String value)
          Used to set the managers parameters.
 void update(java.io.File mp4File, java.util.List<IAtom> atoms)
          Used to add atoms to a MP4 file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MP4AtomicParsleyManager

public MP4AtomicParsleyManager()
Method Detail

init

public void init(java.io.File nativeDir)
          throws MP4Exception
This checks that the stores system commands can be found before the store is used.

Specified by:
init in interface IMP4Manager
Parameters:
nativeDir - The native folder been used or configured. Null if can't be found
Throws:
MP4Exception - Thrown if their is a problem locating the commands

listAtoms

public java.util.List<IAtom> listAtoms(java.io.File mp4File)
                                throws MP4Exception
Used to get a list of atoms in the MP4 file.

Specified by:
listAtoms in interface IMP4Manager
Parameters:
mp4File - The MP4 file
Returns:
A list of atoms
Throws:
MP4Exception - Thrown if their is a problem reading the MP4 file

update

public void update(java.io.File mp4File,
                   java.util.List<IAtom> atoms)
            throws MP4Exception
Used to add atoms to a MP4 file.

Specified by:
update in interface IMP4Manager
Parameters:
mp4File - The MP4 file
atoms - The atoms to add to the file
Throws:
MP4Exception - Thrown if their is a problem updating the atoms

createAtom

public IAtom createAtom(MP4AtomKey name,
                        java.lang.String value)
Used to create a atom

Specified by:
createAtom in interface IMP4Manager
Parameters:
name - The name of the atom
value - The value of the atom
Returns:
the atom

createAtom

public IAtom createAtom(MP4AtomKey name,
                        boolean value)
Used to create a atom

Specified by:
createAtom in interface IMP4Manager
Parameters:
name - The name of the atom
value - The value of the atom
Returns:
the atom

createAtom

public IAtom createAtom(MP4AtomKey name,
                        int value)
Used to create a number atom

Specified by:
createAtom in interface IMP4Manager
Parameters:
name - The name of the atom
value - The value of the atom
Returns:
The atom

createAtom

public IAtom createAtom(MP4AtomKey name,
                        short number,
                        short total)
Used to create a range atom

Specified by:
createAtom in interface IMP4Manager
Parameters:
name - The name of the atom
number - The number of items in the rage
total - The total number possible
Returns:
The atom

createAtom

public IAtom createAtom(MP4AtomKey name,
                        MP4ArtworkType type,
                        int size,
                        byte[] data)
Used to create a artwork atom

Specified by:
createAtom in interface IMP4Manager
Parameters:
name - The name of the atom
type - The artwork type
size - The size of the artwork
data - The data in the artwork
Returns:
The atom

setParameter

public void setParameter(java.lang.String key,
                         java.lang.String value)

Used to set the managers parameters.

This manager has following optional parameters:

Specified by:
setParameter in interface IMP4Manager
Parameters:
key - The name of the parameter
value - The value of the parameter

getArtworkFile

public java.io.File getArtworkFile(java.net.URL imageUrl)
                            throws java.io.IOException
Used to download the artwork from a URL to a file

Specified by:
getArtworkFile in interface IMP4Manager
Parameters:
imageUrl - The file URL
Returns:
The file
Throws:
java.io.IOException - Thrown if their are any problems downloading the file