1 | package org.farng.mp3.id3; |
2 | |
3 | import org.farng.mp3.InvalidTagException; |
4 | import org.farng.mp3.object.ObjectByteArraySizeTerminated; |
5 | |
6 | import java.io.IOException; |
7 | import java.io.RandomAccessFile; |
8 | |
9 | /** |
10 | * <h3>4.4. Music CD identifier</h3> |
11 | * <p/> |
12 | * <p> This frame is intended for music that comes from a CD, so that the CD<br> |
13 | * <p/> |
14 | * can be identified in databases such as the CDDB [CDDB]. The frame<br> consists of a binary |
15 | * dump of the Table Of Contents, TOC, from the CD,<br> which is a header of 4 bytes and then 8 bytes/track |
16 | * on the CD plus 8<br> bytes for the 'lead out', making a maximum of 804 bytes. The offset<br> |
17 | * to the beginning of every track on the CD should be described with a<br> |
18 | * <p/> |
19 | * four bytes absolute CD-frame address per track, and not with absolute<br> time. When this |
20 | * frame is used the presence of a valid "TRCK" frame is<br> REQUIRED, even if the CD's only got |
21 | * one track. It is recommended that<br> this frame is always added to tags originating from CDs. There |
22 | * may<br> |
23 | * <p/> |
24 | * only be one "MCDI" frame in each tag.</p> |
25 | * <p/> |
26 | * <p> <Header for 'Music CD identifier', ID: "MCDI"><br> |
27 | * CD TOC |
28 | * <binary data><br> |
29 | * <p/> |
30 | * </p> |
31 | * |
32 | * @author Eric Farng |
33 | * @version $Revision: 1.4 $ |
34 | */ |
35 | public class FrameBodyMCDI extends AbstractID3v2FrameBody { |
36 | |
37 | /** |
38 | * Creates a new FrameBodyMCDI object. |
39 | */ |
40 | public FrameBodyMCDI() { |
41 | super(); |
42 | } |
43 | |
44 | /** |
45 | * Creates a new FrameBodyMCDI object. |
46 | */ |
47 | public FrameBodyMCDI(final FrameBodyMCDI body) { |
48 | super(body); |
49 | } |
50 | |
51 | /** |
52 | * Creates a new FrameBodyMCDI object. |
53 | */ |
54 | public FrameBodyMCDI(final byte[] cdTOC) { |
55 | setObject("CD Table of Contents", cdTOC); |
56 | } |
57 | |
58 | /** |
59 | * Creates a new FrameBodyMCDI object. |
60 | */ |
61 | public FrameBodyMCDI(final RandomAccessFile file) throws IOException, InvalidTagException { |
62 | this.read(file); |
63 | } |
64 | |
65 | public String getIdentifier() { |
66 | return "MCDI"; |
67 | } |
68 | |
69 | protected void setupObjectList() { |
70 | appendToObjectList(new ObjectByteArraySizeTerminated("CD Table of Contents")); |
71 | } |
72 | } |