本文整理汇总了Java中com.xuggle.xuggler.IPacket.getStreamIndex方法的典型用法代码示例。如果您正苦于以下问题:Java IPacket.getStreamIndex方法的具体用法?Java IPacket.getStreamIndex怎么用?Java IPacket.getStreamIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.xuggle.xuggler.IPacket
的用法示例。
在下文中一共展示了IPacket.getStreamIndex方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readPacket
import com.xuggle.xuggler.IPacket; //导入方法依赖的package包/类
public AVPacket readPacket() {
IPacket packet = IPacket.make();
XugglerPacket xpacket = null;
if (this.container.readNextPacket(packet) >= 0) {
printPacketInfo(packet);
xpacket = new XugglerPacket(packet,
streamTypes[packet.getStreamIndex()]);
} else
finished = true;
if (xpacket != null) {
// calc position of the packet relative to the whole video
long pos = xpacket.getPosition() - decompressor.getHeaderSize()
+ getAdjustedStart();
xpacket.setPosition(pos);
xpacket.setFrameNo(xpacket.getFrameNo() + getFrameOffset());
LOG.debug("readPacket, frame no " + xpacket.getFrameNo());
}
return xpacket;
}
示例2: encode
import com.xuggle.xuggler.IPacket; //导入方法依赖的package包/类
public void encode( AVPacket packet ) {
IPacket ipacket = (IPacket)packet.getPacket();
int streamNum = ipacket.getStreamIndex();
ipacket = IPacket.make();
printPacketInfo(ipacket);
IVideoPicture picture = (IVideoPicture)packet.getDecodedObject();
if( picture == null ) {
LOG.debug("Picture is null" );
return;
} else
{
printPictureInfo(picture);
}
if( streamNum < outStreams.length ) {
LOG.debug( "Coder Bitrate: " + outStreams[streamNum].getStreamCoder().getBitRate());
LOG.debug( "Coder Name: " + outStreams[streamNum].getStreamCoder().getCodec().getName());
int retVal = outStreams[streamNum].getStreamCoder().encodeVideo( ipacket, picture, -1);
LOG.debug("encoding, retval = " + retVal );
if( ipacket.isComplete() )
{
//packet = new XugglerPacket( ipacket, ICodec.Type.CODEC_TYPE_VIDEO );
packet.setPacket( ipacket );
}
}
}
示例3: loadFirstFrame
import com.xuggle.xuggler.IPacket; //导入方法依赖的package包/类
/**
* Loads the first frame of the given video and then seeks back to the beginning of the stream.
* @param container the video container
* @param videoCoder the video stream coder
* @return BufferedImage
* @throws MediaException thrown if an error occurs during decoding
*/
private BufferedImage loadFirstFrame(IContainer container, IStreamCoder videoCoder) throws MediaException {
// walk through each packet of the container format
IPacket packet = IPacket.make();
while (container.readNextPacket(packet) >= 0) {
// make sure the packet belongs to the stream we care about
if (packet.getStreamIndex() == videoCoder.getStream().getIndex()) {
// create a new picture for the video data to be stored in
IVideoPicture picture = IVideoPicture.make(videoCoder.getPixelType(), videoCoder.getWidth(), videoCoder.getHeight());
int offset = 0;
// decode the video
while (offset < packet.getSize()) {
int bytesDecoded = videoCoder.decodeVideo(picture, packet, offset);
if (bytesDecoded < 0) {
LOGGER.error("No bytes found in container.");
throw new MediaException();
}
offset += bytesDecoded;
// make sure that we have a full picture from the video first
if (picture.isComplete()) {
// convert the picture to an Java buffered image
BufferedImage target = new BufferedImage(picture.getWidth(), picture.getHeight(), BufferedImage.TYPE_3BYTE_BGR);
IConverter converter = ConverterFactory.createConverter(target, picture.getPixelType());
return converter.toImage(picture);
}
}
}
}
return null;
}
示例4: isVideoPacket
import com.xuggle.xuggler.IPacket; //导入方法依赖的package包/类
/**
* Determines if a packet is a video packet.
*
* @param packet the packet
* @return true if packet is in the video stream
*/
private boolean isVideoPacket(IPacket packet) {
if (packet.getStreamIndex() == streamIndex) {
return true;
}
return false;
}
示例5: decodePacket
import com.xuggle.xuggler.IPacket; //导入方法依赖的package包/类
public Object decodePacket(IPacket packet) {
LOG.debug("decodePacket");
if (streamTypes[packet.getStreamIndex()] == ICodec.Type.CODEC_TYPE_VIDEO)
return decodeVideoPacket(packet);
if (streamTypes[packet.getStreamIndex()] == ICodec.Type.CODEC_TYPE_AUDIO)
return decodeAudioPacket(packet);
return null;
}
示例6: getFrameNumber
import com.xuggle.xuggler.IPacket; //导入方法依赖的package包/类
/**
* Gets the frame number for a specified packet.
*
* @param packet the packet
* @return the frame number, or -2 if not a video packet
*/
private int getFrameNumber(IPacket packet) {
if (packet.getStreamIndex() != streamIndex)
return -2;
return getFrameNumber(packet.getTimeStamp());
}