2
* @author : Paul Taylor
5
* Version @version:$Id: FrameBodyCRM.java,v 1.11 2008/07/21 10:45:42 paultaylor Exp $
7
* MusicTag Copyright (C)2003,2004
9
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser
10
* General Public License as published by the Free Software Foundation; either version 2.1 of the License,
11
* or (at your option) any later version.
13
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
14
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15
* See the GNU Lesser General Public License for more details.
17
* You should have received a copy of the GNU Lesser General Public License along with this library; if not,
18
* you can get a copy from http://www.opensource.org/licenses/lgpl-license.php or write to the Free Software
19
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24
package org.jaudiotagger.tag.id3.framebody;
26
import org.jaudiotagger.tag.InvalidTagException;
27
import org.jaudiotagger.tag.datatype.ByteArraySizeTerminated;
28
import org.jaudiotagger.tag.datatype.DataTypes;
29
import org.jaudiotagger.tag.datatype.StringNullTerminated;
30
import org.jaudiotagger.tag.id3.ID3v22Frames;
32
import java.nio.ByteBuffer;
35
* Encrypted meta frame
37
* This frame contains one or more encrypted frames. This enables
38
* protection of copyrighted information such as pictures and text, that
39
* people might want to pay extra for. Since standardisation of such an
40
* encryption scheme is beyond this document, all "CRM" frames begin with
41
* a terminated string with a URL [URL] containing an email address, or a
42
* link to a location where an email adress can be found, that belongs to
43
* the organisation responsible for this specific encrypted meta frame.
45
* Questions regarding the encrypted frame should be sent to the
46
* indicated email address. If a $00 is found directly after the 'Frame
47
* size', the whole frame should be ignored, and preferably be removed.
48
* The 'Owner identifier' is then followed by a short content description
49
* and explanation as to why it's encrypted. After the
50
* 'content/explanation' description, the actual encrypted block follows.
52
* When an ID3v2 decoder encounters a "CRM" frame, it should send the
53
* datablock to the 'plugin' with the corresponding 'owner identifier'
54
* and expect to receive either a datablock with one or several ID3v2
55
* frames after each other or an error. There may be more than one "CRM"
56
* frames in a tag, but only one with the same 'owner identifier'.
58
* Encrypted meta frame "CRM"
59
* Frame size $xx xx xx
60
* Owner identifier <textstring> $00 (00)
61
* Content/explanation <textstring> $00 (00)
62
* Encrypted datablock <binary data>
64
public class FrameBodyCRM extends AbstractID3v2FrameBody implements ID3v22FrameBody
67
* Creates a new FrameBodyCRM datatype.
71
// this.setObject(ObjectTypes.OBJ_OWNER, "");
72
// this.setObject(ObjectTypes.OBJ_DESCRIPTION, "");
73
// this.setObject("Encrypted datablock", new byte[0]);
76
public FrameBodyCRM(FrameBodyCRM body)
82
* Creates a new FrameBodyCRM datatype.
88
public FrameBodyCRM(String owner, String description, byte[] data)
90
this.setObjectValue(DataTypes.OBJ_OWNER, owner);
91
this.setObjectValue(DataTypes.OBJ_DESCRIPTION, description);
92
this.setObjectValue(DataTypes.OBJ_ENCRYPTED_DATABLOCK, data);
96
* Creates a new FrameBodyCRM datatype.
98
* @throws InvalidTagException if unable to create framebody from buffer
100
public FrameBodyCRM(ByteBuffer byteBuffer, int frameSize) throws InvalidTagException
102
super(byteBuffer, frameSize);
106
* The ID3v2 frame identifier
108
* @return the ID3v2 frame identifier for this frame type
110
public String getIdentifier()
112
return ID3v22Frames.FRAME_ID_V2_ENCRYPTED_FRAME;
118
public String getOwner()
120
return (String) getObjectValue(DataTypes.OBJ_OWNER);
126
public void getOwner(String description)
128
setObjectValue(DataTypes.OBJ_OWNER, description);
134
protected void setupObjectList()
136
objectList.add(new StringNullTerminated(DataTypes.OBJ_OWNER, this));
137
objectList.add(new StringNullTerminated(DataTypes.OBJ_DESCRIPTION, this));
138
objectList.add(new ByteArraySizeTerminated(DataTypes.OBJ_ENCRYPTED_DATABLOCK, this));