本文整理汇总了Java中com.xuggle.xuggler.IStream.getIndexEntries方法的典型用法代码示例。如果您正苦于以下问题:Java IStream.getIndexEntries方法的具体用法?Java IStream.getIndexEntries怎么用?Java IStream.getIndexEntries使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.xuggle.xuggler.IStream
的用法示例。
在下文中一共展示了IStream.getIndexEntries方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMeanGOPLength
import com.xuggle.xuggler.IStream; //导入方法依赖的package包/类
public static int getMeanGOPLength(IContainer container) throws CannotProceedException, IOException {
int numStreams = container.getNumStreams();
if( numStreams <= 0 )
throw new IOException( "No streams found in container." );
List<IIndexEntry> index_list = null;
for( int j = 0; j < container.getNumStreams(); j++ ) {
IStream stream = container.getStream(j);
IStreamCoder coder = stream.getStreamCoder();
if( coder.getCodecType() != ICodec.Type.CODEC_TYPE_VIDEO)
continue;
index_list = stream.getIndexEntries();
}
if( index_list == null || index_list.size() == 0)
throw new CannotProceedException( "No index entries found!" );
int k = 0;
for( int i = 0; i < index_list.size(); i++ )
if ( index_list.get(i).isKeyFrame() ) k++;
return index_list.size() / k;
}
示例2: getAvgGOPLength
import com.xuggle.xuggler.IStream; //导入方法依赖的package包/类
public long getAvgGOPLength(){
List<IIndexEntry> index_list = null;
IStream videostream = null;
for( int j = 0; j < container.getNumStreams(); j++ ) {
IStream stream = container.getStream(j);
IStreamCoder coder = stream.getStreamCoder();
if( coder.getCodecType() != ICodec.Type.CODEC_TYPE_VIDEO)
continue;
index_list = stream.getIndexEntries();
videostream = stream;
}
// TODO: generalize MediaFramework interface to deal with audio too (where not videostream is contained)
if( index_list == null || index_list.isEmpty() )
return videostream.getNumFrames();
int k = 0;
for( int i = 0; i < index_list.size(); i++ )
if ( index_list.get(i).isKeyFrame() ) k++;
return index_list.size() / k;
}
示例3: getMeanVideoFrameSize
import com.xuggle.xuggler.IStream; //导入方法依赖的package包/类
/**
* Calculates average frame size in bytes of the video stream of the given container.
* @param container
* @return
* @throws IOException
* @throws CannotProceedException
*/
public static int getMeanVideoFrameSize( IContainer container ) throws IOException, CannotProceedException {
int numStreams = container.getNumStreams();
if( numStreams <= 0 )
throw new IOException( "No streams found in container." );
List<IIndexEntry> index_list = null;
for( int j = 0; j < container.getNumStreams(); j++ ) {
IStream stream = container.getStream(j);
IStreamCoder coder = stream.getStreamCoder();
if( coder.getCodecType() != ICodec.Type.CODEC_TYPE_VIDEO)
continue;
index_list = stream.getIndexEntries();
}
if( index_list == null || index_list.size() == 0)
throw new CannotProceedException( "No index entries found!" );
BigInteger avg_size = new BigInteger("0");
for( int i = 0; i < index_list.size(); i++ )
avg_size = avg_size.add( new BigInteger( index_list.get(i).getSize() + "") );
avg_size = avg_size.divide( new BigInteger( index_list.size() + "" ));
return avg_size.intValue();
}