• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java IError类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: create

import com.xuggle.xuggler.IError; //导入依赖的package包/类
/**
 * Create the necessary reader
 */
synchronized private void create(InputStream stream) {
	setupReader();

	// Check whether the string we have is a valid URI
	final IContainer container = IContainer.make();
	final int openResult = container.open(stream, null, true, true);

	if (openResult < 0) {
		logger.error("Error opening container. Error " + openResult +
				" (" + IError.errorNumberToType(openResult).toString() + ")");
		return;
	}

	setupReader(container);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:19,代码来源:XuggleVideo.java


示例2: makeContainer

import com.xuggle.xuggler.IError; //导入依赖的package包/类
public static IContainer makeContainer( String input )  {
    
    IContainer container = IContainer.make();
    
    LOG.debug( input );
    
 //if (container.open(dis, null ) < 0)
    int r = container.open(input, IContainer.Type.READ, null);
    if( r < 0)
    {
      IError error = IError.make( r );
   throw new IllegalArgumentException("could not open container from " + input + ", error = " + error.getDescription() );
    }
    
    return container;
    
}
 
开发者ID:openpreserve,项目名称:video-batch,代码行数:18,代码来源:XugglerAnalyzer.java


示例3: getErrorMessage

import com.xuggle.xuggler.IError; //导入依赖的package包/类
private static String getErrorMessage(int rv) {
	String errorString = "";
	IError error = IError.make(rv);
	if (error != null) {
		errorString = error.toString();
		error.delete();
	}
	return errorString;
}
 
开发者ID:BigMarker,项目名称:deskshare-public,代码行数:10,代码来源:ScreenCap.java


示例4: playVideo

import com.xuggle.xuggler.IError; //导入依赖的package包/类
private void playVideo() {
	new Thread(() -> {
		IError ret = mediaReader.readPacket();
		while (isPlaying && ret == null) {
			ret = mediaReader.readPacket();
		}

		// ret is null if movie was paused
		if (ret != null && ret.getType() == IError.Type.ERROR_EOF) {
			isPlaying = false;
			lastTimestamp = getDuration();
			Platform.runLater(() -> listener.frameUpdated(getDuration()));
		}
	}, "PlayVideo").start();
}
 
开发者ID:phrack,项目名称:ShootOFF,代码行数:16,代码来源:VideoPlayerController.java


示例5: readXugglerFlac

import com.xuggle.xuggler.IError; //导入依赖的package包/类
private void readXugglerFlac(Binary binary, AudioFormat format, File file) {
	IMediaListener myListener = new MediaListenerAdapter() {
		public void onOpen(IMediaGenerator pipe) {
			log.info("opened: " + ((IMediaReader) pipe).getUrl());
		}

		@Override
		public void onAudioSamples(IAudioSamplesEvent event) {
			IAudioSamples samples = event.getAudioSamples();
			// log.info("onaudiosamples " + samples.getNumSamples() + " "+
			// " fs:" + getFS().length() + " " + samples);
			ShortBuffer sb = samples.getByteBuffer().asShortBuffer();

			for (int i = 0; i < sb.limit()
					&& getFS().length() < audioinfo.getSampleCount(); i++) {
				short num = sb.get(i);
				getFS().add(1.0f * num / Short.MAX_VALUE);
			}
			//
			super.onAudioSamples(event);
		}
	};

	IMediaReader r = ToolFactory.makeReader(file.getAbsolutePath());
	r.addListener(myListener);

	while (true) {
		IError p;
		p = r.readPacket();
		if (p != null) {
			break;
		}
	}
	//
	log.info("read flac done");
}
 
开发者ID:jeukku,项目名称:waazdoh.music.common,代码行数:37,代码来源:MWave.java


示例6: start

import com.xuggle.xuggler.IError; //导入依赖的package包/类
@SuppressWarnings("deprecation")
public void start() {
	log.debug("start {}", outputUrl);
	// open coders
	int rv = -1;
	if (outputStreamInfo.hasAudio()) {
		rv = audioCoder.open();
		if (rv < 0) {
			throw new RuntimeException("Could not open stream " + audioStream + ": " + getErrorMessage(rv));
		}
		log.debug("Audio coder opened");
	}
	if (outputStreamInfo.hasVideo()) {
		rv = videoCoder.open();
		if (rv < 0) {
			throw new RuntimeException("Could not open stream " + videoStream + ": " + getErrorMessage(rv));
		}
		log.debug("Video coder opened");
	}
	// write the header
	rv = container.writeHeader();
	if (rv >= 0) {
		log.debug("Wrote header {}", outputUrl);
	} else {
		throw new RuntimeException("Error " + IError.make(rv) + ", failed to write header to container " + container);
	}
}
 
开发者ID:Red5,项目名称:red5-hls-plugin,代码行数:28,代码来源:HLSStreamWriter.java


示例7: run

import com.xuggle.xuggler.IError; //导入依赖的package包/类
public void run() {
	log.debug("RTMPReader - run");
	// read and decode packets from the source
	log.trace("Starting reader loop");

	//		IContainer container = reader.getContainer();
	//		IPacket packet = IPacket.make();
	//      while (container.readNextPacket(packet) >= 0 && !packet.isKeyPacket()) {
	//			log.debug("Looking for key packet..");        	
	//      }
	//      packet.delete();

	// track start time
	startTime = System.currentTimeMillis();
	// open for business
	closed = false;
	//
	int packetsRead = 0;
	// error holder
	IError err = null;
	try {
		// packet read loop
		while ((err = reader.readPacket()) == null) {
			long elapsedMillis = (System.currentTimeMillis() - startTime);
			log.debug("Reads - frames: {} samples: {}", videoFramesRead, audioSamplesRead);
			if (log.isTraceEnabled()) {
				log.trace("Reads - packets: {} elapsed: {} ms", packetsRead++, elapsedMillis);
			}
		}
	} catch (Throwable t) {
		log.warn("Exception closing reader", t);
	}
	if (err != null) {
		log.warn("{}", err.toString());
	}
	log.trace("End of reader loop");
	stop();
	log.trace("RTMPReader - end");
}
 
开发者ID:Red5,项目名称:red5-hls-plugin,代码行数:40,代码来源:RTMPReader.java


示例8: loop

import com.xuggle.xuggler.IError; //导入依赖的package包/类
/**
	 * Called when the reader needs to be reset to the beginning of the media.
	 * @return boolean true if the media was reset successfully
	 */
	public boolean loop() {
		if (this.container != null) {
			int r = this.container.seekKeyFrame(-1, 0, this.container.getStartTime(), this.container.getStartTime(), IContainer.SEEK_FLAG_BACKWARDS | IContainer.SEEK_FLAG_ANY);
			if (r < 0) {
				IError error = IError.make(r);
				LOGGER.error(error);
			} else {
				return true;
			}
//			if (this.videoCoder != null) {
//				int r = this.container.seekKeyFrame(
//						this.videoCoder.getStream().getIndex(), 
//						this.videoCoder.getStream().getStartTime(), 
//						this.videoCoder.getStream().getStartTime(), 
//						0, 
//						IContainer.SEEK_FLAG_BACKWARDS | IContainer.SEEK_FLAG_ANY);
//				if (r < 0) {
//					IError error = IError.make(r);
//					LOGGER.error(error);
//					return false;
//				}
//			} else
//			// seek the audio, if available
//			if (audioCoder != null) {
//				int r = this.container.seekKeyFrame(
//						this.audioCoder.getStream().getIndex(), 
//						this.audioCoder.getStream().getStartTime(), 
//						this.audioCoder.getStream().getStartTime(), 
//						0, 
//						IContainer.SEEK_FLAG_BACKWARDS | IContainer.SEEK_FLAG_ANY);
//				if (r < 0) {
//					IError error = IError.make(r);
//					LOGGER.error(error);
//					return false;
//				}
//			}
//			return true;
		}
		return false;
	}
 
开发者ID:wnbittle,项目名称:praisenter,代码行数:45,代码来源:XugglerMediaReaderThread.java


示例9: readFrame

import com.xuggle.xuggler.IError; //导入依赖的package包/类
/**
 * Reads a frame from the stream, or returns null if no frame could be read.
 * If preserveCurrent is true, then the frame is read into the nextFrame
 * member rather than the currentMBFImage member and the nextFrame is
 * returned (while currentMBFImage will still contain the previous frame).
 * Note that if preserveCurrent is true, it will invoke a copy between
 * images. If preserveCurrent is false and nextFrame is set, this method may
 * have unexpected results as it does not swap current and next back. See
 * {@link #getNextFrame()} which swaps back when a frame has been pre-read
 * from the stream.
 *
 * @param preserveCurrent
 *            Whether to preserve the current frame
 * @return The frame that was read, or NULL if no frame could be read.
 */
synchronized private MBFImage readFrame(final boolean preserveCurrent) {
	// System.out.println( "readFrame( "+preserveCurrent+" )");

	if (this.reader == null)
		return null;

	// If we need to preserve the current frame, we need to copy the frame
	// because the readPacket() will cause the frame to be overwritten
	final long currentTimestamp = this.timestamp;
	final boolean currentKeyFrameFlag = this.currentFrameIsKeyFrame;
	if (preserveCurrent && this.nextFrame == null) {
		// We make a copy of the current image and set the current image
		// to point to that (thereby preserving it). We then set the next
		// frame image to point to the buffer that the readPacket() will
		// fill.
		if (this.currentMBFImage != null) {
			final MBFImage tmp = this.currentMBFImage.clone();
			this.nextFrame = this.currentMBFImage;
			this.currentMBFImage = tmp;
		}
	}
	// If nextFrame wasn't null, we can just write into it as must be
	// pointing to the current frame buffer

	IError e = null;
	boolean tryAgain = false;
	do {
		tryAgain = false;

		// Read packets until we have a new frame.
		while ((e = this.reader.readPacket()) == null && !this.currentFrameUpdated)
			;

		if (e != null && e.getType() == IError.Type.ERROR_EOF && this.loop) {
			// We're looping, so we update the timestamp offset.
			this.timestampOffset += (this.timestamp - this.timestampOffset);
			tryAgain = true;
			this.seekToBeginning();
		}
	} while (tryAgain);

	// Check if we're at the end of the file
	if (!this.currentFrameUpdated || e != null) {
		// Logger.error( "Got video demux error: "+e.getType() );
		return null;
	}

	// We've read a frame so we're done looping
	this.currentFrameUpdated = false;

	if (preserveCurrent) {
		// Swap the current values into the next-frame values
		this.nextFrameIsKeyFrame = this.currentFrameIsKeyFrame;
		this.currentFrameIsKeyFrame = currentKeyFrameFlag;
		this.nextFrameTimestamp = this.timestamp;
		this.timestamp = currentTimestamp;

		// Return the next frame
		if (this.nextFrame != null)
			return this.nextFrame;
		return this.currentMBFImage;
	}
	// Not preserving anything, so just return the frame
	else
		return this.currentMBFImage;
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:82,代码来源:XuggleVideo.java


示例10: XugglerInputStream

import com.xuggle.xuggler.IError; //导入依赖的package包/类
public XugglerInputStream(InputStream in, long start, long end, long frame_offset, XugglerDecompressor dec)
        throws IOException {
    super(in, start, end);
    
    this.frame_offset = frame_offset;

    decompressor = dec;
    
    FSDataInputStream fIn = (FSDataInputStream) in;
    
    int header_size = (int) dec.getHeaderSize();
    byte[] header = new byte[header_size];
    
    // read header 
    fIn.seek(0);
    int b = fIn.read(header, 0, header_size);
    LOG.debug( "header read, count bytes: " + b );
    LOG.debug( "after header reading, fIn.pos = " + fIn.getPos() );
    
    xfsdis = new XugglerFSDataInputStream(in, start, end);
    
    xfsdis.setHeader( header );
    
    this.container = IContainer.make();

    // IMetaData metadata = container.getMetaData();
    // format.setInputFlag(IContainerFormat.Flags.FLAG_GLOBALHEADER, true);
    // this.container.setParameters(parameters);
    int r = this.container.open( xfsdis, null);
    
    LOG.debug("container.open = " + r);

    if (r < 0) {
        IError error = IError.make(r);
        LOG.debug("error: " + error.getDescription());
        throw new IOException( "Could not create Container from given InputStream");
    }
    
    // store container info: streams, coders ... whatever is needed later for decoding
    int numStreams = this.container.getNumStreams();
    this.streams = new IStream[numStreams];
    this.coder = new IStreamCoder[numStreams];
    this.streamTypes = new Type[numStreams];
    
    for (int s = 0; s < this.streams.length; s++) {
        this.streams[s] = this.container.getStream(s);
        printStreamInfo(streams[s]);
        this.coder[s] = this.streams[s] != null ? this.streams[s].getStreamCoder() : null;
        this.streamTypes[s] = this.coder[s] != null ? this.coder[s].getCodecType() : null;
    }
    //testDecoding();
}
 
开发者ID:openpreserve,项目名称:video-batch,代码行数:53,代码来源:XugglerInputStream.java


示例11: init

import com.xuggle.xuggler.IError; //导入依赖的package包/类
public void init(URI file) throws RuntimeException {

        LOG.debug( "Input file: " + file );

        if( file.toString().startsWith("hdfs"))
            mgr.registerFactory("hdfs", new HDFSProtocolHandlerFactory());

        container = IContainer.make();
        
        int r = container.open(file.toString(), IContainer.Type.READ, null);

        if( r < 0)
        {
          IError error = IError.make( r );
	      throw new IllegalArgumentException("could not open container from " + file + ", error = " + error.getDescription() );
        }

	    numStreams = container.getNumStreams();
	    
	    if( numStreams <= 0 )
	        throw new IllegalArgumentException( "No streams found in container." );
    }
 
开发者ID:openpreserve,项目名称:video-batch,代码行数:23,代码来源:XugglerMediaFramework.java


示例12: close

import com.xuggle.xuggler.IError; //导入依赖的package包/类
/** {@inheritDoc} */
public void close() {
	log.debug("close {}", outputUrl);
	MpegTsHandlerFactory.getFactory().deleteStream(outputUrl);
	int rv;
	// flush coders
	flush();
	// write the trailer on the output container
	if ((rv = container.writeTrailer()) < 0) {
		log.error("Error {}, failed to write trailer to {}", IError.make(rv), outputUrl);
	}
	// close the coders opened by this MediaWriter
	if (outputStreamInfo.hasVideo()) {
		try {
			if ((rv = videoCoder.close()) < 0) {
				log.error("Error {}, failed close coder {}", getErrorMessage(rv), videoCoder);
			}
		} finally {
			videoCoder.delete();
		}
	}
	if (outputStreamInfo.hasAudio()) {
		try {
			if ((rv = audioCoder.close()) < 0) {
				log.error("Error {}, failed close coder {}", getErrorMessage(rv), audioCoder);
			}
		} finally {
			audioCoder.delete();
		}
	}
	// if we're supposed to, close the container
	if ((rv = container.close()) < 0) {
		throw new RuntimeException("error " + IError.make(rv) + ", failed close IContainer " + container + " for " + outputUrl);
	}
	// get the current segment, if one exists
	Segment segment = facade.getSegment();
	// mark it as "last" and close
	if (segment != null && !segment.isLast()) {
		// mark it as the last
		segment.setLast(true);
		segment.close();
	}
}
 
开发者ID:Red5,项目名称:red5-hls-plugin,代码行数:44,代码来源:HLSStreamWriter.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java OpenJPAEntityManagerFactorySPI类代码示例发布时间:2022-05-23
下一篇:
Java XmlRegistryWriter类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap