本文整理汇总了Java中com.jme3.video.Clock类的典型用法代码示例。如果您正苦于以下问题:Java Clock类的具体用法?Java Clock怎么用?Java Clock使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Clock类属于com.jme3.video包,在下文中一共展示了Clock类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: waitNanos
import com.jme3.video.Clock; //导入依赖的package包/类
/**
* Wait nanos.
*
* @param time
* the time
*/
private void waitNanos(long time)
{
long millis = time / Clock.MILLIS_TO_NANOS;
int nanos = (int) (time - (millis * Clock.MILLIS_TO_NANOS));
try
{
Thread.sleep(millis, nanos);
}
catch (InterruptedException ex)
{
// stop(); // would stop app
return;
}
}
示例2: getTime
import com.jme3.video.Clock; //导入依赖的package包/类
public long getTime(){
long bytesRead = ringBuffer.getTotalRead();
if (bytesRead == 0)
return 0;
//long diff = bytesRead - lastWritten;
long diff = bytesRead;
long diffNs = (diff * Clock.SECONDS_TO_NANOS) / (2 * info.channels * info.rate);
long timeSinceLastRead = System.nanoTime() - lastPtsRead;
return /*lastPts +*/ diffNs + timeSinceLastRead;
}
示例3: setMasterClock
import com.jme3.video.Clock; //导入依赖的package包/类
public void setMasterClock(Clock masterClock) {
this.masterClock = masterClock;
}
示例4: getTimeSeconds
import com.jme3.video.Clock; //导入依赖的package包/类
public double getTimeSeconds(){
return (double) getTime() / Clock.SECONDS_TO_NANOS;
}
示例5: decode
import com.jme3.video.Clock; //导入依赖的package包/类
public void decode(Packet packet) {
//System.out.println ("creating packet");
if (packetIndex < 3) {
//System.out.println ("decoding header");
if (info.decodeHeader(comment, packet) < 0) {
// error case; not a theora header
System.err.println("does not contain Theora video data.");
return;
}
if (packetIndex == 2) {
state.decodeInit(info);
System.out.println("theora frame: " + info.frame_width + "x" + info.frame_height);
System.out.println("theora resolution: " + info.width + "x" + info.height);
System.out.println("theora aspect: " + info.aspect_numerator + "x" + info.aspect_denominator);
System.out.println("theora framerate: " + info.fps_numerator + "x" + info.fps_denominator);
xOff = info.offset_x;
yOff = info.offset_y;
width = info.frame_width;
height = info.frame_height;
initializeFrames();
if (masterClock instanceof SystemClock){
SystemClock clock = (SystemClock) masterClock;
if (clock.needReset()){
clock.reset();
System.out.println("Note: master clock was reset by video");
}
}
}
} else {
// convert to nanos
long granulePos = packet.granulepos;
long time = (long) (state.granuleTime(granulePos) * Clock.SECONDS_TO_NANOS);
long oneFrameTime = (long) ((Clock.SECONDS_TO_NANOS * info.fps_denominator) / info.fps_numerator);
if (time >= 0){
lastTs = time;
}else{
lastTs += oneFrameTime;
time = lastTs;
}
lastUpdateTime = System.nanoTime();
if (state.decodePacketin(packet) != 0) {
System.err.println("Error Decoding Theora.");
return;
}
// if (time >= 0){
if (state.decodeYUVout(yuv) != 0) {
System.err.println("Error getting the picture.");
return;
}
decodeRgbFromBuffer( time );
// }
}
packetIndex++;
}
示例6: getMasterClock
import com.jme3.video.Clock; //导入依赖的package包/类
public Clock getMasterClock(){
return masterClock;
}
示例7: getSystemClock
import com.jme3.video.Clock; //导入依赖的package包/类
public Clock getSystemClock(){
return systemClock;
}
示例8: getVideoClock
import com.jme3.video.Clock; //导入依赖的package包/类
public Clock getVideoClock(){
return videoDecoder;
}
示例9: getAudioClock
import com.jme3.video.Clock; //导入依赖的package包/类
public Clock getAudioClock(){
return audioDecoder;
}