Methods Summary |
---|
public javax.media.Time | getDuration()
if ( duration.equals(Duration.DURATION_UNKNOWN) &&
( tracks[0] != null ) ) {
long mediaSizeAtEOM = ((BasicTrack) tracks[0]).getMediaSizeAtEOM();
if (mediaSizeAtEOM > 0) {
double durationSeconds = mediaSizeAtEOM / bytesPerSecond;
duration = new Time(durationSeconds);
}
}
return duration;
|
public javax.media.Time | getMediaTime()
return null;
|
public java.lang.String | getName()Returns a descriptive name for the plug-in.
This is a user readable string.
return "G.729A Parser";
|
public javax.media.protocol.ContentDescriptor[] | getSupportedInputContentDescriptors()
return supportedFormat;
|
public javax.media.Track[] | getTracks()
if (tracks[0] != null)
return tracks;
stream = (PullSourceStream) streams[0];
// Since the readHeader doesn't read anything there
// is no need to disable buffering
readHeader();
// get data a frame at a time
bufferSize = CODEFRAMESIZE;
tracks[0] = new G729ATrack((AudioFormat) format,
/*enabled=*/ true,
new Time(0),
numBuffers,
bufferSize,
minLocation,
maxLocation
);
return tracks;
|
private void | readHeader()
minLocation = getLocation(stream); // Should be zero
long contentLength = stream.getContentLength();
if ( contentLength != SourceStream.LENGTH_UNKNOWN ) {
double durationSeconds = contentLength / bytesPerSecond;
duration = new Time(durationSeconds);
maxLocation = contentLength;
} else {
maxLocation = Long.MAX_VALUE;
}
format = new AudioFormat(AudioFormat.G729A,
8000,
16,
1,
AudioFormat.BIG_ENDIAN,
AudioFormat.SIGNED,
(CODEFRAMESIZE * 8),
FRAMERATE,
Format.byteArray);
|
public javax.media.Time | setPosition(javax.media.Time where, int rounding)
if (! seekable ) {
return getMediaTime();
}
long time = where.getNanoseconds();
long newPos;
if (time < 0)
time = 0;
double newPosd = time * bytesPerSecond / 1000000000.0;
double remainder = (newPosd % blockSize);
newPos = (long) (newPosd - remainder);
if (remainder > 0) {
switch (rounding) {
case Positionable.RoundUp:
newPos += blockSize;
break;
case Positionable.RoundNearest:
if (remainder > (blockSize / 2.0))
newPos += blockSize;
break;
}
}
// if ( newPos > maxLocation )
// newPos = maxLocation;
newPos += minLocation;
((BasicTrack) tracks[0]).setSeekLocation(newPos);
if (cacheStream != null) {
synchronized(this) {
// cacheStream.setPosition(where.getNanoseconds());
cacheStream.abortRead();
}
}
return where; // TODO: return the actual time value
|