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


Java Track.getSamples方法代码示例

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


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

示例1: getBitrate

import com.googlecode.mp4parser.authoring.Track; //导入方法依赖的package包/类
public long getBitrate(Track track) {
    long bitrate = 0;
    for (ByteBuffer sample : track.getSamples()) {
        bitrate += sample.limit();
    }
    bitrate *= 8; // from bytes to bits
    bitrate /= ((double) getDuration(track)) / track.getTrackMetaData().getTimescale(); // per second
    return bitrate;
}
 
开发者ID:begeekmyfriend,项目名称:mp4parser_android,代码行数:10,代码来源:AbstractManifestWriter.java

示例2: build

import com.googlecode.mp4parser.authoring.Track; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
public IsoFile build(Movie movie) {
    LOG.fine("Creating movie " + movie);
    for (Track track : movie.getTracks()) {
        // getting the samples may be a time consuming activity
        List<ByteBuffer> samples = track.getSamples();
        putSamples(track, samples);
        long[] sizes = new long[samples.size()];
        for (int i = 0; i < sizes.length; i++) {
            sizes[i] = samples.get(i).limit();
        }
        putSampleSizes(track, sizes);
    }

    IsoFile isoFile = new IsoFile();
    // ouch that is ugly but I don't know how to do it else
    List<String> minorBrands = new LinkedList<String>();
    minorBrands.add("isom");
    minorBrands.add("iso2");
    minorBrands.add("avc1");

    isoFile.addBox(new FileTypeBox("isom", 0, minorBrands));
    isoFile.addBox(createMovieBox(movie));
    InterleaveChunkMdat mdat = new InterleaveChunkMdat(movie);
    isoFile.addBox(mdat);

    /*
    dataOffset is where the first sample starts. In this special mdat the samples always start
    at offset 16 so that we can use the same offset for large boxes and small boxes
     */
    long dataOffset = mdat.getDataOffset();
    for (StaticChunkOffsetBox chunkOffsetBox : chunkOffsetBoxes) {
        long[] offsets = chunkOffsetBox.getChunkOffsets();
        for (int i = 0; i < offsets.length; i++) {
            offsets[i] += dataOffset;
        }
    }


    return isoFile;
}
 
开发者ID:begeekmyfriend,项目名称:mp4parser_android,代码行数:44,代码来源:DefaultMp4Builder.java


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