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


Java IVideoPicture.getPixelType方法代码示例

本文整理汇总了Java中com.xuggle.xuggler.IVideoPicture.getPixelType方法的典型用法代码示例。如果您正苦于以下问题:Java IVideoPicture.getPixelType方法的具体用法?Java IVideoPicture.getPixelType怎么用?Java IVideoPicture.getPixelType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.xuggle.xuggler.IVideoPicture的用法示例。


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

示例1: getHostImage

import com.xuggle.xuggler.IVideoPicture; //导入方法依赖的package包/类
@Override
public IHostImage getHostImage(BlockingQueue<float[]> audioData) {
	IHostImage result = null;
	try {
		final int w = getWidth();
		final int h = getHeight();
		IVideoPicture newPic = currentPicture.get();
		if (resampler != null) {
			if(tmpPicture == null)
				tmpPicture = IVideoPicture.make(resampler.getOutputPixelFormat(), w, h); 
			newPic = tmpPicture;
			if (resampler.resample(newPic, currentPicture.get()) < 0) {
				log.warning("could not resample video");
				return null;
			}
		}
		if (newPic.getPixelType() != IPixelFormat.Type.RGB24) {
			log.warning("could not decode video as RGB24 bit data");
			return null;
		}
		ByteBuffer dstBuffer = BufferUtils.createByteBuffer(w * h * 3);
		flip(newPic.getByteBuffer(), dstBuffer, w, h);
		result = IHostImage.create(w, h, ComponentType.BYTE, ComponentFormat.RGB, dstBuffer);
		if(!(this.audioData.isEmpty())) {
			while(audioData.size() > (2  * this.audioData.size()) + 128)
				audioData.take();

			while(!(this.audioData.isEmpty())) 
				audioData.add(this.audioData.take());
		}
	} catch(Throwable t) {
		log.warning(t);
	}
	return result;
}
 
开发者ID:arisona,项目名称:ether,代码行数:36,代码来源:XuggleAccess.java

示例2: getBufferedImage

import com.xuggle.xuggler.IVideoPicture; //导入方法依赖的package包/类
/**
  * Gets the BufferedImage for a specified Xuggle picture.
  *
  * @param picture the picture
  * @return the image, or null if unable to resample
  */
private BufferedImage getBufferedImage(IVideoPicture picture) {
   // if needed, convert picture into BGR24 format
	if (picture.getPixelType() != IPixelFormat.Type.BGR24) {
		if (resampler == null) {
      resampler = IVideoResampler.make(
      		picture.getWidth(), picture.getHeight(), IPixelFormat.Type.BGR24,
      		picture.getWidth(), picture.getHeight(), picture.getPixelType());
      if (resampler == null) {
      	OSPLog.warning("Could not create color space resampler"); //$NON-NLS-1$
      	return null;
      }
		}
     IVideoPicture newPic = IVideoPicture.make(resampler.getOutputPixelFormat(),
         picture.getWidth(), picture.getHeight());
     if (resampler.resample(newPic, picture) < 0
     		|| newPic.getPixelType() != IPixelFormat.Type.BGR24) {
     	OSPLog.warning("Could not encode video as BGR24"); //$NON-NLS-1$
     	return null;
     }
     picture = newPic;
	}

	// use IConverter to convert picture to buffered image
	if (converter==null) {
		ConverterFactory.Type type = ConverterFactory.findRegisteredConverter(
				ConverterFactory.XUGGLER_BGR_24);	  	
		converter = ConverterFactory.createConverter(type.getDescriptor(), picture);			
	}
	BufferedImage image = converter.toImage(picture);
	// garbage collect to play smoothly--but slows down playback speed significantly!
	if (playSmoothly)
		System.gc();
 	return image;		
}
 
开发者ID:OpenSourcePhysics,项目名称:video-engines,代码行数:41,代码来源:XuggleVideo.java


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