/*
 * TocEntry.java
 *
 * Copyright (c) 2007  Vreixo Formoso
 *
 * This library is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * See COPYING file for details.
 */

package org.pykix.libburnia.libburn;

/**
 * Information about a track on a disc - this is from the q sub channel of 
 * the lead-in area of a disc.  The documentation here is very terse.
 * See a document such as mmc3 for proper information.
 * 
 * @author Vreixo Formoso
 * @since 0.1
 */
/*
 * Note that this class is not a Proxy. Information is kept on Java side,
 * and propertly copied form or to C struct when needed.
 * 
 * FIXME: I take all C "unsigned char" as byte, but in some cases an int
 * is a better option.
 * 
 * TODO: define setters??
 */
public class TocEntry {
	
	/** Session the track is in */
	private byte session;
	
	/** Type of data.  for this struct to be valid, it must be 1 */
	private byte adr;
	
	/** Type of data in the track */
	private byte control;
	
	/** Zero.  Always.  Really. */
	private byte tno;
	
	/** Track number or special information */
	private byte point;
	private byte min;
	private byte sec;
	private byte frame;
	private byte zero;
	
	/** Track start time minutes for normal tracks */
	private byte pmin;
	
	/** Track start time seconds for normal tracks */
	private byte psec;
	
	/** Track start time frames for normal tracks */
	private byte pframe;

	/* 
	 * Indicates wether extension data are valid and eventually override
	 * older elements in this structure:
	 * bit0= DVD extension is valid
	 */
	private byte extensionsValid;  

	/* ts A70201 : DVD extension.
	 * If invalid the members are guaranteed to be 0. 
	 */
	/* Tracks and session numbers are 16 bit. Here are the high bytes. */
	private byte sessionMsb;
	
	private byte pointMsb;
	
	/* pmin, psec, and pframe may be too small if DVD extension is valid */
	private int startLba; 
	
	/* min, sec, and frame may be too small if DVD extension is valid */
	private int trackBlocks;

	public TocEntry(byte session, byte adr, byte control, byte tno, 
			byte point, byte min, byte sec, byte frame, byte zero, byte pmin, 
			byte psec, byte pframe, byte extensionsValid, byte sessionMsb, 
			byte pointMsb, int startLba, int trackBlocks) {
		
		super();
		this.session = session;
		this.adr = adr;
		this.control = control;
		this.tno = tno;
		this.point = point;
		this.min = min;
		this.sec = sec;
		this.frame = frame;
		this.zero = zero;
		this.pmin = pmin;
		this.psec = psec;
		this.pframe = pframe;
		this.extensionsValid = extensionsValid;
		this.sessionMsb = sessionMsb;
		this.pointMsb = pointMsb;
		this.startLba = startLba;
		this.trackBlocks = trackBlocks;
	}

	public byte getAdr() {
		return adr;
	}

	public byte getControl() {
		return control;
	}

	public byte getExtensionsValid() {
		return extensionsValid;
	}

	public byte getFrame() {
		return frame;
	}

	public byte getMin() {
		return min;
	}

	public byte getPframe() {
		return pframe;
	}

	public byte getPmin() {
		return pmin;
	}

	public byte getPoint() {
		return point;
	}

	public byte getPointMsb() {
		return pointMsb;
	}

	public byte getPsec() {
		return psec;
	}

	public byte getSec() {
		return sec;
	}

	public byte getSession() {
		return session;
	}

	public byte getSessionMsb() {
		return sessionMsb;
	}

	public int getStartLba() {
		return startLba;
	}

	public byte getTno() {
		return tno;
	}

	public int getTrackBlocks() {
		return trackBlocks;
	}

	public byte getZero() {
		return zero;
	}

}
