~ubuntu-branches/ubuntu/utopic/libjaudiotagger-java/utopic

« back to all changes in this revision

Viewing changes to org/jaudiotagger/tag/mp4/atom/Mp4NameBox.java

  • Committer: Bazaar Package Importer
  • Author(s): Varun Hiremath, Damien Raude-Morvan, Varun Hiremath
  • Date: 2009-04-01 19:17:56 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090401191756-bygniim270guy7o1
Tags: 1.0.9-1
[ Damien Raude-Morvan ]
* New upstream release
* debian/watch: Use java.net repository (which contains new releases!)
* debian/control:
  - Build-Depends on default-jdk-builddep
  - Bump Standards-Version to 3.8.1 (no changes needed)
  - Change section to "java"
* debian/rules: use default-java as JAVA_HOME
* debina/orig-tar.{sh|excludes}: strip audio and others binary files from ZIP
* debian/build.xml:
  - compile with "nowarn" to keep build log readable
  - exclude LogFormatter from build (use com.sun classes)
* debian/ant.properties: new source directory is "src" in orig.tar.gz
* Add myself as Uploaders

[ Varun Hiremath ]
* Accept changes made by Damien Raude-Morvan (Closes: #522130)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
package org.jaudiotagger.tag.mp4.atom;
2
 
 
3
 
import org.jaudiotagger.audio.mp4.atom.Mp4BoxHeader;
4
 
import org.jaudiotagger.audio.mp4.atom.AbstractMp4Box;
5
 
import org.jaudiotagger.audio.generic.Utils;
6
 
 
7
 
import java.nio.ByteBuffer;
8
 
 
9
 
/**
10
 
 * This box is used within ---- boxes to hold the data name/descriptor
11
 
 */
12
 
public class Mp4NameBox extends AbstractMp4Box
13
 
{
14
 
    public static final String IDENTIFIER = "name";
15
 
 
16
 
    private String          name;
17
 
 
18
 
    //TODO Are these misnamed, are these version flag bytes or just null bytes
19
 
    public static final int VERSION_LENGTH = 1;
20
 
    public static final int FLAGS_LENGTH = 3;
21
 
    public static final int PRE_DATA_LENGTH = VERSION_LENGTH + FLAGS_LENGTH;
22
 
 
23
 
    /**
24
 
     *
25
 
     * @param header header info
26
 
     * @param dataBuffer data of box (doesnt include header data)
27
 
     */
28
 
    public Mp4NameBox(Mp4BoxHeader header, ByteBuffer dataBuffer)
29
 
    {
30
 
        this.header     = header;
31
 
 
32
 
        //Double check
33
 
        if(!header.getId().equals(IDENTIFIER))
34
 
        {
35
 
            throw new RuntimeException("Unable to process data box because identifier is:"+header.getId());
36
 
        }
37
 
 
38
 
        //Make slice so operations here don't effect position of main buffer
39
 
        this.dataBuffer = dataBuffer.slice();
40
 
 
41
 
        //issuer
42
 
        this.name= Utils.getString(this.dataBuffer, PRE_DATA_LENGTH, header.getDataLength() - PRE_DATA_LENGTH, header.getEncoding());
43
 
    }
44
 
 
45
 
    public String getName()
46
 
    {
47
 
        return name;
48
 
    }
49
 
}