Search in sources :

Example 1 with Mp4MeanBox

use of org.jaudiotagger.tag.mp4.atom.Mp4MeanBox in project MusicDNA by harjot-oberai.

the class Mp4TagReverseDnsField method build.

protected void build(ByteBuffer data) throws UnsupportedEncodingException {
    //Read mean box, set the issuer and skip over data
    Mp4BoxHeader meanBoxHeader = new Mp4BoxHeader(data);
    Mp4MeanBox meanBox = new Mp4MeanBox(meanBoxHeader, data);
    setIssuer(meanBox.getIssuer());
    data.position(data.position() + meanBoxHeader.getDataLength());
    //Read name box, identify what type of field it is
    Mp4BoxHeader nameBoxHeader = new Mp4BoxHeader(data);
    Mp4NameBox nameBox = new Mp4NameBox(nameBoxHeader, data);
    setDescriptor(nameBox.getName());
    data.position(data.position() + nameBoxHeader.getDataLength());
    //Issue 198:There is not actually a data atom there cannot cant be because no room for one
    if (parentHeader.getDataLength() == meanBoxHeader.getLength() + nameBoxHeader.getLength()) {
        id = IDENTIFIER + ":" + issuer + ":" + descriptor;
        setContent("");
        logger.warning(ErrorMessage.MP4_REVERSE_DNS_FIELD_HAS_NO_DATA.getMsg(id));
    } else //Usual Case
    {
        //Read data box, identify the data
        Mp4BoxHeader dataBoxHeader = new Mp4BoxHeader(data);
        Mp4DataBox dataBox = new Mp4DataBox(dataBoxHeader, data);
        setContent(dataBox.getContent());
        data.position(data.position() + dataBoxHeader.getDataLength());
        //Now calculate the id which in order to be unique needs to use all htree values
        id = IDENTIFIER + ":" + issuer + ":" + descriptor;
    }
}
Also used : Mp4NameBox(org.jaudiotagger.tag.mp4.atom.Mp4NameBox) Mp4MeanBox(org.jaudiotagger.tag.mp4.atom.Mp4MeanBox) Mp4DataBox(org.jaudiotagger.tag.mp4.atom.Mp4DataBox) Mp4BoxHeader(org.jaudiotagger.audio.mp4.atom.Mp4BoxHeader)

Aggregations

Mp4BoxHeader (org.jaudiotagger.audio.mp4.atom.Mp4BoxHeader)1 Mp4DataBox (org.jaudiotagger.tag.mp4.atom.Mp4DataBox)1 Mp4MeanBox (org.jaudiotagger.tag.mp4.atom.Mp4MeanBox)1 Mp4NameBox (org.jaudiotagger.tag.mp4.atom.Mp4NameBox)1