org.jaudiotagger.tag.mp4
Class Mp4Tag

java.lang.Object
  extended by org.jaudiotagger.audio.generic.AbstractTag
      extended by org.jaudiotagger.tag.mp4.Mp4Tag
All Implemented Interfaces:
Tag

public class Mp4Tag
extends AbstractTag

A Logical representation of Mp4Tag, i.e the meta information stored in an Mp4 file underneath the moov.udt.meta.ilst atom.


Field Summary
private static java.util.EnumMap<FieldKey,Mp4FieldKey> tagFieldToMp4Field
           
 
Fields inherited from class org.jaudiotagger.audio.generic.AbstractTag
commonNumber, fields
 
Constructor Summary
Mp4Tag()
           
 
Method Summary
 TagField createArtworkField(byte[] data)
          Create artwork field
 TagField createDiscNoField(java.lang.String content)
          Create discno field
 TagField createField(Artwork artwork)
          Create artwork field
 TagField createField(FieldKey genericKey, java.lang.String value)
          Create Tag Field using generic key

This should use the correct subclass for the key

private  TagField createGenreField(java.lang.String content)
          Create genre field

 TagField createTagField(Mp4FieldKey mp4FieldKey, java.lang.String value)
          Create Tag Field using mp4 key

Uses the correct subclass for the key

 void deleteField(FieldKey genericKey)
          Delete fields with this generic key
 void deleteTagField(Mp4FieldKey mp4Key)
          Delete fields with this mp4key
 java.util.List<TagField> get(Mp4FieldKey mp4FieldKey)
          Retrieve the values that exists for this mp4keyId (this is the internalid actually used)

 java.util.List<Artwork> getArtworkList()
           
 java.util.List<TagField> getFields(FieldKey genericKey)
          Maps the generic key to the mp4 key and return the list of values for this field
 java.lang.String getFirst(FieldKey genericKey)
          Retrieve the first value that exists for this generic key
 java.lang.String getFirst(Mp4FieldKey mp4Key)
          Retrieve the first value that exists for this mp4key
 Mp4TagField getFirstField(FieldKey genericKey)
           
 Mp4TagField getFirstField(Mp4FieldKey mp4Key)
           
protected  boolean isAllowedEncoding(java.lang.String enc)
          Determines whether the given charset encoding may be used for the represented tagging system.
 void setField(TagField field)
          Set field, special handling for track and disc because they hold two fields
 java.lang.String toString()
          (overridden)
 
Methods inherited from class org.jaudiotagger.audio.generic.AbstractTag
addField, addField, addField, deleteArtworkField, deleteField, get, getFieldCount, getFields, getFirst, getFirstArtwork, getFirstField, hasCommonFields, hasField, isEmpty, setEncoding, setField, setField
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

tagFieldToMp4Field

private static final java.util.EnumMap<FieldKey,Mp4FieldKey> tagFieldToMp4Field
Constructor Detail

Mp4Tag

public Mp4Tag()
Method Detail

createGenreField

private TagField createGenreField(java.lang.String content)
Create genre field

If the content can be parsed to one of the known values use the genre field otherwise use the custom field.

Parameters:
content -
Returns:

isAllowedEncoding

protected boolean isAllowedEncoding(java.lang.String enc)
Description copied from class: AbstractTag
Determines whether the given charset encoding may be used for the represented tagging system.

Specified by:
isAllowedEncoding in class AbstractTag
Parameters:
enc - charset encoding.
Returns:
true if the given encoding can be used.

toString

public java.lang.String toString()
Description copied from class: AbstractTag
(overridden)

Specified by:
toString in interface Tag
Overrides:
toString in class AbstractTag
See Also:
Object.toString()

getFields

public java.util.List<TagField> getFields(FieldKey genericKey)
                                   throws KeyNotFoundException
Maps the generic key to the mp4 key and return the list of values for this field

Specified by:
getFields in interface Tag
Overrides:
getFields in class AbstractTag
Parameters:
genericKey -
Returns:
A list of TagField objects with the given "id".
Throws:
KeyNotFoundException

get

public java.util.List<TagField> get(Mp4FieldKey mp4FieldKey)
                             throws KeyNotFoundException
Retrieve the values that exists for this mp4keyId (this is the internalid actually used)

Parameters:
mp4FieldKey -
Returns:
Throws:
KeyNotFoundException

getFirst

public java.lang.String getFirst(FieldKey genericKey)
                          throws KeyNotFoundException
Retrieve the first value that exists for this generic key

Specified by:
getFirst in interface Tag
Specified by:
getFirst in class AbstractTag
Parameters:
genericKey -
Returns:
Throws:
KeyNotFoundException

getFirst

public java.lang.String getFirst(Mp4FieldKey mp4Key)
                          throws KeyNotFoundException
Retrieve the first value that exists for this mp4key

Parameters:
mp4Key -
Returns:
Throws:
KeyNotFoundException

getFirstField

public Mp4TagField getFirstField(FieldKey genericKey)
                          throws KeyNotFoundException
Specified by:
getFirstField in interface Tag
Specified by:
getFirstField in class AbstractTag
Returns:
the first field that matches this generic key
Throws:
KeyNotFoundException

getFirstField

public Mp4TagField getFirstField(Mp4FieldKey mp4Key)
                          throws KeyNotFoundException
Throws:
KeyNotFoundException

deleteField

public void deleteField(FieldKey genericKey)
                 throws KeyNotFoundException
Delete fields with this generic key

Specified by:
deleteField in interface Tag
Specified by:
deleteField in class AbstractTag
Parameters:
genericKey -
Throws:
KeyNotFoundException

deleteTagField

public void deleteTagField(Mp4FieldKey mp4Key)
                    throws KeyNotFoundException
Delete fields with this mp4key

Parameters:
mp4Key -
Throws:
KeyNotFoundException

createDiscNoField

public TagField createDiscNoField(java.lang.String content)
                           throws FieldDataInvalidException
Create discno field

Parameters:
content - can be any of the following 1 1/10
Returns:
Throws:
FieldDataInvalidException

createArtworkField

public TagField createArtworkField(byte[] data)
Create artwork field

Parameters:
data - raw image data
Returns:
Throws:
FieldDataInvalidException

createField

public TagField createField(Artwork artwork)
                     throws FieldDataInvalidException
Create artwork field

Returns:
Throws:
FieldDataInvalidException

createField

public TagField createField(FieldKey genericKey,
                            java.lang.String value)
                     throws KeyNotFoundException,
                            FieldDataInvalidException
Create Tag Field using generic key

This should use the correct subclass for the key

Specified by:
createField in interface Tag
Specified by:
createField in class AbstractTag
Parameters:
genericKey -
value -
Returns:
Throws:
KeyNotFoundException
FieldDataInvalidException

setField

public void setField(TagField field)
Set field, special handling for track and disc because they hold two fields

Specified by:
setField in interface Tag
Overrides:
setField in class AbstractTag
Parameters:
field -
See Also:
Tag.setField(org.jaudiotagger.tag.TagField)

createTagField

public TagField createTagField(Mp4FieldKey mp4FieldKey,
                               java.lang.String value)
                        throws KeyNotFoundException,
                               FieldDataInvalidException
Create Tag Field using mp4 key

Uses the correct subclass for the key

Parameters:
mp4FieldKey -
value -
Returns:
Throws:
KeyNotFoundException
FieldDataInvalidException

getArtworkList

public java.util.List<Artwork> getArtworkList()
Returns:
a list of all artwork in this file using the format indepedent Artwork class