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


Java Global类代码示例

本文整理汇总了Java中com.xuggle.xuggler.Global的典型用法代码示例。如果您正苦于以下问题:Java Global类的具体用法?Java Global怎么用?Java Global使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Global类属于com.xuggle.xuggler包,在下文中一共展示了Global类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSynchronizationTime

import com.xuggle.xuggler.Global; //导入依赖的package包/类
/**
 * Returns the time to sleep in milliseconds.
 * @param timestamp the timestamp
 * @param isVideoStream true if the media we are sync-ing is a video stream
 * @return long
 */
public long getSynchronizationTime(long timestamp, boolean isVideoStream) {
    if (this.firstTimestamp == Global.NO_PTS) {
    	// initialize the clock
    	this.firstTimestamp = timestamp;
    	this.startTime = System.currentTimeMillis();
    } else {
    	// compute the estimated sleep time for the current thread
        long systemClockCurrentTime = System.currentTimeMillis();
        long millisecondsClockTimeSinceStartofVideo = systemClockCurrentTime - startTime;
        long millisecondsStreamTimeSinceStartOfVideo = (long)Math.ceil((double)(timestamp - firstTimestamp) / 1000.0);
        // allow 50 milliseconds of tolerance
        final long millisecondsTolerance = isVideoStream ? 50 : 0;
        final long millisecondsToSleep = (millisecondsStreamTimeSinceStartOfVideo - (millisecondsClockTimeSinceStartofVideo + millisecondsTolerance));
        if (millisecondsToSleep > 0) {
        	return millisecondsToSleep;
        }
    }
    return 0;
}
 
开发者ID:wnbittle,项目名称:praisenter,代码行数:26,代码来源:XugglerMediaClock.java

示例2: setupReader

import com.xuggle.xuggler.Global; //导入依赖的package包/类
private void setupReader(IContainer container) {
	// Set up a new reader using the container that reads the images.
	this.reader = ToolFactory.makeReader(container);
	this.reader.setBufferedImageTypeToGenerate(BufferedImage.TYPE_3BYTE_BGR);
	this.reader.addListener(new FrameGetter());

	// Find the video stream.
	IStream s = null;
	int i = 0;
	while (i < container.getNumStreams()) {
		s = container.getStream(i);
		if (s != null && s.getStreamCoder().getCodecType() == ICodec.Type.CODEC_TYPE_VIDEO) {
			// Save the stream index so that we only get frames from
			// this stream in the FrameGetter
			this.streamIndex = i;
			break;
		}
		i++;
	}

	if (container.getDuration() == Global.NO_PTS)
		this.totalFrames = -1;
	else
		this.totalFrames = (long) (s.getDuration() *
				s.getTimeBase().getDouble() * s.getFrameRate().getDouble());

	// If we found the video stream, set the FPS
	if (s != null)
		this.fps = s.getFrameRate().getDouble();

	// If we found a video stream, setup the MBFImage buffer.
	if (s != null) {
		final int w = s.getStreamCoder().getWidth();
		final int h = s.getStreamCoder().getHeight();
		this.width = w;
		this.height = h;
	}
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:39,代码来源:XuggleVideo.java

示例3: printStreamInfo

import com.xuggle.xuggler.Global; //导入依赖的package包/类
private void printStreamInfo(IStream stream) {
    IStreamCoder coder = stream.getStreamCoder();
    IContainer container = stream.getContainer();
    String info = "";

    info += (String.format("type: %s; ", coder.getCodecType()));
    info += (String.format("codec: %s; ", coder.getCodecID()));
    info += String.format(
            "duration: %s; ",
            stream.getDuration() == Global.NO_PTS ? "unknown" : ""
                    + stream.getDuration());
    info += String.format("start time: %s; ",
            container.getStartTime() == Global.NO_PTS ? "unknown" : ""
                    + stream.getStartTime());
    info += String
            .format("language: %s; ",
                    stream.getLanguage() == null ? "unknown" : stream
                            .getLanguage());
    info += String.format("timebase: %d/%d; ", stream.getTimeBase()
            .getNumerator(), stream.getTimeBase().getDenominator());
    info += String.format("coder tb: %d/%d; ", coder.getTimeBase()
            .getNumerator(), coder.getTimeBase().getDenominator());

    if (coder.getCodecType() == ICodec.Type.CODEC_TYPE_AUDIO) {
        info += String.format("sample rate: %d; ", coder.getSampleRate());
        info += String.format("channels: %d; ", coder.getChannels());
        info += String.format("format: %s", coder.getSampleFormat());
    } else if (coder.getCodecType() == ICodec.Type.CODEC_TYPE_VIDEO) {
        info += String.format("width: %d; ", coder.getWidth());
        info += String.format("height: %d; ", coder.getHeight());
        info += String.format("format: %s; ", coder.getPixelType());
        info += String.format("frame-rate: %5.2f; ", coder.getFrameRate()
                .getDouble());
    }
    LOG.debug(info);
}
 
开发者ID:openpreserve,项目名称:video-batch,代码行数:37,代码来源:XugglerInputStream.java

示例4: feedAudio

import com.xuggle.xuggler.Global; //导入依赖的package包/类
/**
 * Perform muxing of tracks and feed them to the facade.
 * 
 * @param feedAmount
 * @param clock
 * @return
 */
private double feedAudio(double feedAmount, double clock) {
	int requestedSamplesAmount = (int) ((feedAmount / 1000000d) * samplingRate);
	short[] samples = popMuxedData(requestedSamplesAmount);
	if (samples == null) {
		return 0;
	}
	facade.queueAudio(samples, (int) clock, Global.DEFAULT_TIME_UNIT);
	double result = samples.length / 2;
	result = (double)result / (double) samplingRate;
	result *= 1000000d;
	return result;
}
 
开发者ID:Red5,项目名称:red5-hls-plugin,代码行数:20,代码来源:AudioMux.java

示例5: afterPropertiesSet

import com.xuggle.xuggler.Global; //导入依赖的package包/类
public void afterPropertiesSet() throws Exception {
	// put xuggle into turbo mode
	ToolFactory.setTurboCharged(true);
	if (log.isDebugEnabled()) {
		Global.setFFmpegLoggingLevel(99);
	}
	log.debug("Executor - prefers short tasks: {} daemon: {}", segmentExecutor.prefersShortLivedTasks(), segmentExecutor.isDaemon());
}
 
开发者ID:Red5,项目名称:red5-hls-plugin,代码行数:9,代码来源:SegmenterService.java

示例6: encodeVideo

import com.xuggle.xuggler.Global; //导入依赖的package包/类
public void encodeVideo(IVideoPicture picture, long timeStamp, TimeUnit timeUnit) {
	log.debug("encodeVideo {}", outputUrl);
	// establish the stream, return silently if no stream returned
	if (null != picture) {
		IPacket videoPacket = IPacket.make();
		// encode video picture
		int result = videoCoder.encodeVideo(videoPacket, picture, 0);
		//System.out.printf("Flags v: %08x\n", videoCoder.getFlags());
		if (result < 0) {
			log.error("{} Failed to encode video: {} picture: {}", new Object[] { result, getErrorMessage(result), picture });
			videoPacket.delete();
			return;
		}
		videoComplete = videoPacket.isComplete();
		if (videoComplete) {
			final long timeStampMicro;
			if (timeUnit == null) {
				timeStampMicro = Global.NO_PTS;
			} else {
				timeStampMicro = MICROSECONDS.convert(timeStamp, timeUnit);
			}
			log.trace("Video timestamp {} us", timeStampMicro);
			// write packet
			writePacket(videoPacket);
			// add the duration of our video
			double dur = (timeStampMicro + videoPacket.getDuration() - prevVideoTime) / 1000000d;
			videoDuration += dur;
			log.trace("Duration - video: {}", dur);
			//double videoPts = (double) videoPacket.getDuration() * videoCoder.getTimeBase().getNumerator() / videoCoder.getTimeBase().getDenominator();
			//log.trace("Video pts - calculated: {} reported: {}", videoPts, videoPacket.getPts());
			prevVideoTime = timeStampMicro;
			videoPacket.delete();
		} else {
			log.warn("Video packet was not complete");
		}
	} else {
		throw new IllegalArgumentException("No picture");
	}
}
 
开发者ID:Red5,项目名称:red5-hls-plugin,代码行数:40,代码来源:HLSStreamWriter.java

示例7: getDuration

import com.xuggle.xuggler.Global; //导入依赖的package包/类
@Override
public double getDuration() {
	IRational timeBase = videoStream.getTimeBase();
	long      duration = videoStream.getDuration();
	return duration == Global.NO_PTS ? AbstractFrameSource.LENGTH_UNKNOWN : (duration * timeBase.getNumerator()) / (double)timeBase.getDenominator();
}
 
开发者ID:arisona,项目名称:ether,代码行数:7,代码来源:XuggleAccess.java

示例8: XugglerMediaClock

import com.xuggle.xuggler.Global; //导入依赖的package包/类
/**
 * Default constructor.
 */
public XugglerMediaClock() {
	this.firstTimestamp = Global.NO_PTS;
}
 
开发者ID:wnbittle,项目名称:praisenter,代码行数:7,代码来源:XugglerMediaClock.java

示例9: reset

import com.xuggle.xuggler.Global; //导入依赖的package包/类
/**
 * Resets the clock.
 */
public void reset() {
    this.firstTimestamp = Global.NO_PTS;
}
 
开发者ID:wnbittle,项目名称:praisenter,代码行数:7,代码来源:XugglerMediaClock.java

示例10: SampleData

import com.xuggle.xuggler.Global; //导入依赖的package包/类
private SampleData(short[] buffer) {
	this.id = index.getAndIncrement();
	this.buffer = ShortBuffer.wrap(buffer);
	this.pts = Global.NO_PTS;
}
 
开发者ID:Red5,项目名称:red5-hls-plugin,代码行数:6,代码来源:SampleData.java


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