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.


Constructor Summary
Mp4Tag()
           
 
Method Summary
 TagField createAlbumField(java.lang.String content)
          Creates a field which represents the "album".
The field will already contain the given content.
 TagField createArtistField(java.lang.String content)
          Creates a field which represents the "artist".
The field will already contain the given content.
 TagField createArtworkField(byte[] data)
          Create artwork field
 TagField createCommentField(java.lang.String content)
          Creates a field which represents the "comment".
The field will already contain the given content.
 TagField createDiscNoField(java.lang.String content)
          Create discno field
 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

 TagField createTagField(TagFieldKey genericKey, java.lang.String value)
          Create Tag Field using generic key

This should use the correct subclass for the key

 TagField createTitleField(java.lang.String content)
          Creates a field which represents the "title".
The field will already contain the given content.
 TagField createTrackField(java.lang.String content)
          Creates a field which represents the "track".
The field will already contain the given content.
 TagField createYearField(java.lang.String content)
          Creates a field which represents the "year".
The field will already contain the given content.
 void deleteTagField(Mp4FieldKey mp4Key)
          Delete fields with this mp4key
 void deleteTagField(TagFieldKey genericKey)
          Delete fields with this generic key
 java.util.List<TagField> get(Mp4FieldKey mp4FieldKey)
          Retrieve the values that exists for this mp4keyId (this is the internalid actually used)

 java.util.List<TagField> get(TagFieldKey genericKey)
          Maps the generic key to the mp4 key and return the list of values for this field
 java.lang.String getFirst(Mp4FieldKey mp4Key)
          Retrieve the first value that exists for this mp4key
 java.lang.String getFirst(TagFieldKey genericKey)
          Retrieve the first value that exists for this generic key
 Mp4TagField getFirstField(Mp4FieldKey mp4Key)
           
 java.util.List<TagField> getGenre()
          There are two genres fields in mp4 files, but only one can be used at a time, so this method tries to make things easier by checking both and returning the populated one (if any)
 java.lang.String toString()
          (overridden)
 
Methods inherited from class org.jaudiotagger.audio.generic.AbstractTag
add, addAlbum, addArtist, addComment, addGenre, addTitle, addTrack, addYear, get, getAlbum, getArtist, getComment, getFieldCount, getFields, getFirst, getFirstAlbum, getFirstArtist, getFirstComment, getFirstField, getFirstGenre, getFirstTitle, getFirstTrack, getFirstYear, getTitle, getTrack, getYear, hasCommonFields, hasField, isEmpty, set, setAlbum, setArtist, setComment, setEncoding, setGenre, setTitle, setTrack, setYear
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Mp4Tag

public Mp4Tag()
Method Detail

getGenre

public java.util.List<TagField> getGenre()
There are two genres fields in mp4 files, but only one can be used at a time, so this method tries to make things easier by checking both and returning the populated one (if any)

Specified by:
getGenre in interface Tag
Overrides:
getGenre in class AbstractTag
Returns:
See Also:
Tag.getGenre()

createArtistField

public TagField createArtistField(java.lang.String content)
Description copied from class: AbstractTag
Creates a field which represents the "artist".
The field will already contain the given content.

Specified by:
createArtistField in class AbstractTag
Parameters:
content - The content of the created field.
Returns:
tagfield representing the "artist"

createAlbumField

public TagField createAlbumField(java.lang.String content)
Description copied from class: AbstractTag
Creates a field which represents the "album".
The field will already contain the given content.

Specified by:
createAlbumField in class AbstractTag
Parameters:
content - The content of the created field.
Returns:
tagfield representing the "album"

createTitleField

public TagField createTitleField(java.lang.String content)
Description copied from class: AbstractTag
Creates a field which represents the "title".
The field will already contain the given content.

Specified by:
createTitleField in class AbstractTag
Parameters:
content - The content of the created field.
Returns:
tagfield representing the "title"

createTrackField

public TagField createTrackField(java.lang.String content)
                          throws FieldDataInvalidException
Description copied from class: AbstractTag
Creates a field which represents the "track".
The field will already contain the given content.

Specified by:
createTrackField in class AbstractTag
Parameters:
content - The content of the created field.
Returns:
tagfield representing the "track"
Throws:
FieldDataInvalidException

createYearField

public TagField createYearField(java.lang.String content)
Description copied from class: AbstractTag
Creates a field which represents the "year".
The field will already contain the given content.

Specified by:
createYearField in class AbstractTag
Parameters:
content - The content of the created field.
Returns:
tagfield representing the "year"

createCommentField

public TagField createCommentField(java.lang.String content)
Description copied from class: AbstractTag
Creates a field which represents the "comment".
The field will already contain the given content.

Specified by:
createCommentField in class AbstractTag
Parameters:
content - The content of the created field.
Returns:
tagfield representing the "comment"

createGenreField

public 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.

Specified by:
createGenreField in class AbstractTag
Parameters:
content -
Returns:

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()

get

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

Specified by:
get in interface Tag
Overrides:
get 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 -
Throws:
KeyNotFoundException

getFirst

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

Specified by:
getFirst in interface Tag
Overrides:
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(Mp4FieldKey mp4Key)
                          throws KeyNotFoundException
Throws:
KeyNotFoundException

deleteTagField

public void deleteTagField(TagFieldKey genericKey)
                    throws KeyNotFoundException
Delete fields with this generic key

Specified by:
deleteTagField in interface Tag
Overrides:
deleteTagField 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)
                            throws FieldDataInvalidException
Create artwork field

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

createTagField

public TagField createTagField(TagFieldKey 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:
createTagField in interface Tag
Overrides:
createTagField in class AbstractTag
Parameters:
genericKey -
value -
Returns:
Throws:
KeyNotFoundException
FieldDataInvalidException

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