Methods Summary |
---|
protected boolean | audioEnabled()
return true;
|
public java.lang.String | convertToMsf(int f, int s, int m)
if (f > 74) {
f %= 75;
s++;
}
if (s > 59) {
s %= 60;
m++;
}
String st = ""+m+":"+ s+":"+f;
return st;
|
public void | doClose()
super.doClose();
if (eomThread != null)
eomThread.kill();
|
protected boolean | doRealize()
PullSourceStream pss = (PullSourceStream)
(((PullDataSource)source).getStreams())[0];
buffer = new byte[44];
int count = 0;
int tst;
try {
count = pss.read(buffer, 0, 44);
} catch(IOException e) {}
if (count < 0) {
abortRealize();
return false;
}
frames = buffer[40];
seconds = buffer[41];
minutes = buffer[42];
hours = buffer[43];
track = (((int)buffer[22]) & 0xff);
nanos = 60 * minutes + seconds; //seconds
nanos *= 75; //frames
nanos += frames;
nanos *= 40; //nanos
nanos = nanos * 333333;
setMediaLength(nanos);
//System.out.println("track "+track+" mins "+minutes+" secs "+seconds+
// " frames "+frames+" nanos "+nanos);
//System.out.println(track);
track |= ((((int) buffer[23]) & 0xff) << 8);
//System.out.println(track);
//System.out.println("Audio opened");
mci.ssendString("open cdaudio shareable wait");
mci.ssendString("stop cdaudio wait");
mci.ssendString("close cdaudio wait");
if (eomThread == null) {
eomThread = new EomThread(this);
eomThread.start();
} else
eomThread.start();
return true;
|
public void | doSetMediaTime(javax.media.Time time)
long now = time.getNanoseconds();
secs =(int)( now / 1000000000);
hrs = secs / 3600;
mins = secs / 60;
secs = secs % 60;
now %= 1000000000;
frms = (int) (now / (40 *333333));
//System.out.println("Setting time to "+mins+":"+secs+":"+frms);
|
public void | doStart()
if (eomThread != null)
eomThread.start();
mci.sendString("set cdaudio time format msf wait");
String st = convertToMsf(buffer[36]+frms, secs+buffer[37], buffer[38]+mins);
String et = convertToMsf(buffer[36]+buffer[40], buffer[37]+buffer[41]-1,
buffer[38]+buffer[42]);
mci.ssendString("open cdaudio shareable wait");
String comm = "play cdaudio from "+st+" to "+et;
mci.ssendString(comm);
mci.ssendString("close cdaudio wait");
isPlaying = true;
|
public void | doStop()
isPlaying = false;
doSetMediaTime(getMediaTime());
mci.ssendString("open cdaudio shareable wait");
mci.ssendString("pause cdaudio wait");
mci.ssendString("close cdaudio wait");
if (eomThread != null)
eomThread.pause();
|
public void | gainChange(javax.media.GainChangeEvent gce)
|
public javax.media.Time | getDuration()
//System.out.println("getDuration is called: "+nanos);
return new Time(nanos);
|
public javax.media.TimeBase | getMasterTimeBase()
return null;
|
public void | handleEom()
setTargetState(Prefetched);
processEndOfMedia();
|
public void | muteChange(boolean state)
if ( state != muted ) {
muted = state;
mci.ssendString("open cdaudio shareable wait");
if (state)
mci.ssendString("set cdaudio audio all off wait");
else
mci.ssendString("set cdaudio audio all on wait");
mci.ssendString("close cdaudio wait");
}
|
public void | setSource(javax.media.protocol.DataSource source)
if (source instanceof com.sun.media.protocol.file.DataSource) {
this.source = source;
} else {
System.out.println("Unsupported data source: "+ source);
throw new IncompatibleSourceException(this+": doesn't support "+source);
}
|
public void | updateStats()
|
protected boolean | videoEnabled()
return false;
|