本文整理汇总了Java中javax.media.Format类的典型用法代码示例。如果您正苦于以下问题:Java Format类的具体用法?Java Format怎么用?Java Format使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Format类属于javax.media包,在下文中一共展示了Format类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: BasicTrack
import javax.media.Format; //导入依赖的package包/类
/**
* Note to implementors who want to use this class.
* If the maxLocation is not known, then
* specify Long.MAX_VALUE for this parameter
*/
public BasicTrack(GsmParser parser,
Format format, boolean enabled,
Time duration, Time startTime,
int numBuffers, int dataSize,
PullSourceStream stream,
long minLocation, long maxLocation) {
this.parser = parser;
this.format = format;
this.enabled = enabled;
this.duration = duration;
this.startTime = startTime;
this.numBuffers = numBuffers;
this.dataSize = dataSize;
this.stream = stream;
this.minLocation = minLocation;
this.maxLocation = maxLocation;
maxStartLocation = maxLocation - dataSize;
}
示例2: PowerMeter
import javax.media.Format; //导入依赖的package包/类
public PowerMeter(int nPowersPerSec) {
this.nPowersPerSec = nPowersPerSec;
timeStamps = new long[nPowersPerSec * NUM_SECONDS];
powers = new float[nPowersPerSec * NUM_SECONDS];
inputFormats = new Format[] {new AudioFormat(AudioFormat.LINEAR,
Format.NOT_SPECIFIED,
16,
Format.NOT_SPECIFIED,
Format.NOT_SPECIFIED,
Format.NOT_SPECIFIED,
Format.NOT_SPECIFIED,
Format.NOT_SPECIFIED,
Format.byteArray)};
outputFormats = new Format[] {new AudioFormat(AudioFormat.LINEAR,
Format.NOT_SPECIFIED,
16,
Format.NOT_SPECIFIED,
Format.NOT_SPECIFIED,
Format.NOT_SPECIFIED,
Format.NOT_SPECIFIED,
Format.NOT_SPECIFIED,
Format.byteArray)};
}
示例3: read
import javax.media.Format; //导入依赖的package包/类
public void read(Buffer buffer) throws IOException {
synchronized (this) {
Object outdata = buffer.getData();
if (outdata == null || !(outdata.getClass() == Format.intArray) ||
((int[])outdata).length < maxDataLength) {
outdata = new int[maxDataLength];
buffer.setData(outdata);
}
buffer.setFormat( rgbFormat );
buffer.setTimeStamp( (long) (seqNo * (1000 / frameRate) * 1000000) );
BufferedImage bi = robot.createScreenCapture(
new Rectangle(x, y, width, height));
bi.getRGB(0, 0, width, height,
(int[])outdata, 0, width);
buffer.setSequenceNumber( seqNo );
buffer.setLength(maxDataLength);
buffer.setFlags(Buffer.FLAG_KEY_FRAME);
buffer.setHeader( null );
seqNo++;
}
}
示例4: setTrackFormats
import javax.media.Format; //导入依赖的package包/类
/**
* Set the target transcode format on the processor.
*/
boolean setTrackFormats(Processor p, Format fmts[]) {
if (fmts.length == 0)
return true;
TrackControl tcs[];
if ((tcs = p.getTrackControls()) == null) {
// The processor does not support any track control.
System.err.println("The Processor cannot transcode the tracks to the given formats");
return false;
}
for (int i = 0; i < fmts.length; i++) {
System.err.println("- set track format to: " + fmts[i]);
if (!setEachTrackFormat(p, tcs, fmts[i])) {
System.err.println("Cannot transcode any track to: " + fmts[i]);
return false;
}
}
return true;
}
示例5: tryTranscode
import javax.media.Format; //导入依赖的package包/类
/**
* Try different transcoded formats for concatenation.
*/
public boolean tryTranscode(ProcInfo pInfo[], int procID, int type,
int trackID, Format candidate) {
if (procID >= pInfo.length)
return true;
boolean matched = false;
TrackControl tc = pInfo[procID].tracksByType[type][trackID].tc;
Format supported[] = tc.getSupportedFormats();
for (int i = 0; i < supported.length; i++) {
if (candidate.matches(supported[i]) &&
tryTranscode(pInfo, procID+1, type, trackID, candidate)) {
matched = true;
break;
}
}
return matched;
}
示例6: nextDataType
import javax.media.Format; //导入依赖的package包/类
public Class<?> nextDataType() throws ParseException
{
String s = nextString();
if (s == null)
return null;
if (s.equals(NOT_SPECIFIED))
return null;
s = s.toUpperCase();
if (s.equals(BYTE_ARRAY))
return Format.byteArray;
else if (s.equals(SHORT_ARRAY))
return Format.shortArray;
else if (s.equals(INT_ARRAY))
return Format.intArray;
else
throw new ParseException("Expected one of [" + BYTE_ARRAY + ","
+ SHORT_ARRAY + "," + INT_ARRAY + "]: " + s, -1);
}
示例7: nextDouble
import javax.media.Format; //导入依赖的package包/类
public double nextDouble() throws ParseException
{
final String s = nextString();
if (s == null)
return Format.NOT_SPECIFIED;
if (s.equals(NOT_SPECIFIED))
return Format.NOT_SPECIFIED;
try
{
return Double.parseDouble(s);
} catch (NumberFormatException e)
{
throw new ParseException("Expected double: " + s, -1);
}
}
示例8: nextEndian
import javax.media.Format; //导入依赖的package包/类
public int nextEndian() throws ParseException
{
String s = nextString();
if (s == null)
return Format.NOT_SPECIFIED;
if (s.equals(NOT_SPECIFIED))
return Format.NOT_SPECIFIED;
s = s.toUpperCase();
if (s.equals(BIG_ENDIAN))
return AudioFormat.BIG_ENDIAN;
else if (s.equals(LITTLE_ENDIAN))
return AudioFormat.LITTLE_ENDIAN;
else
throw new ParseException("Expected one of [" + BIG_ENDIAN + ","
+ LITTLE_ENDIAN + "]: " + s, -1);
}
示例9: nextFloat
import javax.media.Format; //导入依赖的package包/类
public float nextFloat() throws ParseException
{
final String s = nextString();
if (s == null)
return Format.NOT_SPECIFIED;
if (s.equals(NOT_SPECIFIED))
return Format.NOT_SPECIFIED;
try
{
return Float.parseFloat(s);
} catch (NumberFormatException e)
{
throw new ParseException("Expected float: " + s, -1);
}
}
示例10: nextInt
import javax.media.Format; //导入依赖的package包/类
public int nextInt() throws ParseException
{
final String s = nextString();
if (s == null)
return Format.NOT_SPECIFIED;
if (s.equals(NOT_SPECIFIED))
return Format.NOT_SPECIFIED;
try
{
return Integer.parseInt(s);
} catch (NumberFormatException e)
{
throw new ParseException("Expected integer: " + s, -1);
}
}
示例11: nextRGBFormatEndian
import javax.media.Format; //导入依赖的package包/类
public int nextRGBFormatEndian() throws ParseException
{
String s = nextString();
if (s == null)
return Format.NOT_SPECIFIED;
if (s.equals(NOT_SPECIFIED))
return Format.NOT_SPECIFIED;
s = s.toUpperCase();
if (s.equals(BIG_ENDIAN))
return RGBFormat.BIG_ENDIAN;
else if (s.equals(LITTLE_ENDIAN))
return RGBFormat.LITTLE_ENDIAN;
else
throw new ParseException("Expected one of [" + BIG_ENDIAN + ","
+ LITTLE_ENDIAN + "]: " + s, -1);
}
示例12: nextSigned
import javax.media.Format; //导入依赖的package包/类
public int nextSigned() throws ParseException
{
String s = nextString();
if (s == null)
return Format.NOT_SPECIFIED;
if (s.equals(NOT_SPECIFIED))
return Format.NOT_SPECIFIED;
s = s.toUpperCase();
if (s.equals(UNSIGNED))
return AudioFormat.UNSIGNED;
else if (s.equals(SIGNED))
return AudioFormat.SIGNED;
else
throw new ParseException("Expected one of [" + UNSIGNED + ","
+ UNSIGNED + "]: " + s, -1);
}
示例13: dataTypeToStr
import javax.media.Format; //导入依赖的package包/类
private static final String dataTypeToStr(Class<?> clazz)
{
if (clazz == null)
{
return NOT_SPECIFIED;
}
if (clazz == Format.byteArray)
{
return BYTE_ARRAY;
}
if (clazz == Format.shortArray)
{
return SHORT_ARRAY;
}
if (clazz == Format.intArray)
{
return INT_ARRAY;
}
throw new IllegalArgumentException("" + clazz);
}
示例14: testAudio
import javax.media.Format; //导入依赖的package包/类
public void testAudio() throws ParseException
{
test(new AudioFormat(AudioFormat.LINEAR, 44100.0, 16, 2));
test(new AudioFormat(AudioFormat.LINEAR, 44100.0, 16, 2,
AudioFormat.BIG_ENDIAN, AudioFormat.UNSIGNED));
test(new AudioFormat(AudioFormat.LINEAR, 44100.0, 16, 2,
AudioFormat.LITTLE_ENDIAN, AudioFormat.UNSIGNED));
test(new AudioFormat(AudioFormat.ULAW_RTP, 8000, 8, 1));
test(new AudioFormat(AudioFormat.GSM_RTP, 8000, Format.NOT_SPECIFIED, 1));
test(new AudioFormat(AudioFormat.G723_RTP, 8000, Format.NOT_SPECIFIED,
1));
test(new AudioFormat(AudioFormat.DVI_RTP, 8000, 4, 1));
test(new AudioFormat(AudioFormat.MPEG_RTP));
test(new AudioFormat(AudioFormat.G728_RTP, 8000.0,
Format.NOT_SPECIFIED, 1));
test(new AudioFormat(AudioFormat.DVI_RTP, 11025, 4, 1));
test(new AudioFormat(AudioFormat.DVI_RTP, 22050, 4, 1));
test(new AudioFormat(AudioFormat.G729_RTP, 8000.0,
Format.NOT_SPECIFIED, 1));
}
示例15: AudioChannel
import javax.media.Format; //导入依赖的package包/类
/**
* Creates an Audio Channel for a desired jmf locator. For instance: new MediaLocator("dsound://")
*
* @param locator media locator
* @param localIpAddress local IP address
* @param remoteIpAddress remote IP address
* @param localPort local port number
* @param remotePort remote port number
* @param format audio format
*/
public AudioChannel(MediaLocator locator,
String localIpAddress,
String remoteIpAddress,
int localPort,
int remotePort,
Format format, JingleMediaSession jingleMediaSession) {
this.locator = locator;
this.localIpAddress = localIpAddress;
this.remoteIpAddress = remoteIpAddress;
this.localPort = localPort;
this.portBase = remotePort;
this.format = format;
this.jingleMediaSession = jingleMediaSession;
}