当前位置: 首页>>代码示例>>Java>>正文


Java Clock类代码示例

本文整理汇总了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;
	}
}
 
开发者ID:synergynet,项目名称:synergynet3.1,代码行数:22,代码来源:JMEVideo.java

示例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;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:12,代码来源:ADecoder.java

示例3: setMasterClock

import com.jme3.video.Clock; //导入依赖的package包/类
public void setMasterClock(Clock masterClock) {
    this.masterClock = masterClock;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:4,代码来源:VDecoder.java

示例4: getTimeSeconds

import com.jme3.video.Clock; //导入依赖的package包/类
public double getTimeSeconds(){
    return (double) getTime() / Clock.SECONDS_TO_NANOS;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:4,代码来源:VDecoder.java

示例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++;
    }
 
开发者ID:mleoking,项目名称:PhET,代码行数:60,代码来源:VDecoder.java

示例6: getMasterClock

import com.jme3.video.Clock; //导入依赖的package包/类
public Clock getMasterClock(){
    return masterClock;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:4,代码来源:AVThread.java

示例7: getSystemClock

import com.jme3.video.Clock; //导入依赖的package包/类
public Clock getSystemClock(){
    return systemClock;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:4,代码来源:AVThread.java

示例8: getVideoClock

import com.jme3.video.Clock; //导入依赖的package包/类
public Clock getVideoClock(){
    return videoDecoder;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:4,代码来源:AVThread.java

示例9: getAudioClock

import com.jme3.video.Clock; //导入依赖的package包/类
public Clock getAudioClock(){
    return audioDecoder;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:4,代码来源:AVThread.java


注:本文中的com.jme3.video.Clock类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。