• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2008 CoreMedia AG, Hamburg
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.coremedia.iso.boxes.vodafone;
18 
19 
20 import com.coremedia.iso.IsoTypeReader;
21 import com.coremedia.iso.IsoTypeWriter;
22 import com.coremedia.iso.Utf8;
23 import com.googlecode.mp4parser.AbstractFullBox;
24 
25 import java.nio.ByteBuffer;
26 
27 /**
28  * Special box used by Vodafone in their DCF containing information about the artist. Mainly used for OMA DCF files
29  * containing music. Resides in the {@link com.coremedia.iso.boxes.UserDataBox}.
30  */
31 public class AlbumArtistBox extends AbstractFullBox {
32     public static final String TYPE = "albr";
33 
34     private String language;
35     private String albumArtist;
36 
AlbumArtistBox()37     public AlbumArtistBox() {
38         super(TYPE);
39     }
40 
getLanguage()41     public String getLanguage() {
42         return language;
43     }
44 
getAlbumArtist()45     public String getAlbumArtist() {
46         return albumArtist;
47     }
48 
setLanguage(String language)49     public void setLanguage(String language) {
50         this.language = language;
51     }
52 
setAlbumArtist(String albumArtist)53     public void setAlbumArtist(String albumArtist) {
54         this.albumArtist = albumArtist;
55     }
56 
getContentSize()57     protected long getContentSize() {
58         return 6 + Utf8.utf8StringLengthInBytes(albumArtist) + 1;
59     }
60 
61     @Override
_parseDetails(ByteBuffer content)62     public void _parseDetails(ByteBuffer content) {
63         parseVersionAndFlags(content);
64         language = IsoTypeReader.readIso639(content);
65         albumArtist = IsoTypeReader.readString(content);
66     }
67 
getContent(ByteBuffer byteBuffer)68     protected void getContent(ByteBuffer byteBuffer) {
69         writeVersionAndFlags(byteBuffer);
70         IsoTypeWriter.writeIso639(byteBuffer, language);
71         byteBuffer.put(Utf8.convert(albumArtist));
72         byteBuffer.put((byte) 0);
73     }
74 
toString()75     public String toString() {
76         return "AlbumArtistBox[language=" + getLanguage() + ";albumArtist=" + getAlbumArtist() + "]";
77     }
78 }
79