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


Java Track.getSyncSamples方法代码示例

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


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

示例1: correctTimeToNextSyncSample

import com.googlecode.mp4parser.authoring.Track; //导入方法依赖的package包/类
private double correctTimeToNextSyncSample(Track track, double cutHere) {
    double[] timeOfSyncSamples = new double[track.getSyncSamples().length];
    long currentSample = 0;
    double currentTime = 0;
    for (int i = 0; i < track.getDecodingTimeEntries().size(); i++) {
        TimeToSampleBox.Entry entry = track.getDecodingTimeEntries().get(i);
        for (int j = 0; j < entry.getCount(); j++) {
            if (Arrays.binarySearch(track.getSyncSamples(), currentSample + 1) >= 0) {
                // samples always start with 1 but we start with zero therefore +1
                timeOfSyncSamples[Arrays.binarySearch(track.getSyncSamples(), currentSample + 1)] = currentTime;
            }
            currentTime += (double) entry.getDelta() / (double) track.getTrackMetaData().getTimescale();
            currentSample++;
        }
    }
    for (double timeOfSyncSample : timeOfSyncSamples) {
        if (timeOfSyncSample > cutHere) {
            return timeOfSyncSample;
        }
    }
    return timeOfSyncSamples[timeOfSyncSamples.length - 1];
}
 
开发者ID:smartbeng,项目名称:PaoMovie,代码行数:23,代码来源:TrimmVideo.java

示例2: getSyncSamplesTimestamps

import com.googlecode.mp4parser.authoring.Track; //导入方法依赖的package包/类
/**
 * Calculates the timestamp of all tracks' sync samples.
 *
 * @param movie
 * @param track
 * @return
 */
public static List<long[]> getSyncSamplesTimestamps(Movie movie, Track track) {
    List<long[]> times = new LinkedList<long[]>();
    for (Track currentTrack : movie.getTracks()) {
        if (currentTrack.getHandler().equals(track.getHandler())) {
            long[] currentTrackSyncSamples = currentTrack.getSyncSamples();
            if (currentTrackSyncSamples != null && currentTrackSyncSamples.length > 0) {
                final long[] currentTrackTimes = getTimes(currentTrack, movie);
                times.add(currentTrackTimes);
            }
        }
    }
    return times;
}
 
开发者ID:begeekmyfriend,项目名称:mp4parser_android,代码行数:21,代码来源:SyncSampleIntersectFinderImpl.java

示例3: getTimes

import com.googlecode.mp4parser.authoring.Track; //导入方法依赖的package包/类
private static long[] getTimes(Track track, Movie m) {
    final CacheTuple key = new CacheTuple(track, m);
    final long[] result = getTimesCache.get(key);
    if (result != null) {
        return result;
    }

    long[] syncSamples = track.getSyncSamples();
    long[] syncSampleTimes = new long[syncSamples.length];
    Queue<TimeToSampleBox.Entry> timeQueue = new LinkedList<TimeToSampleBox.Entry>(track.getDecodingTimeEntries());

    int currentSample = 1;  // first syncsample is 1
    long currentDuration = 0;
    long currentDelta = 0;
    int currentSyncSampleIndex = 0;
    long left = 0;

    final long scalingFactor = calculateTracktimesScalingFactor(m, track);

    while (currentSample <= syncSamples[syncSamples.length - 1]) {
        if (currentSample++ == syncSamples[currentSyncSampleIndex]) {
            syncSampleTimes[currentSyncSampleIndex++] = currentDuration * scalingFactor;
        }
        if (left-- == 0) {
            TimeToSampleBox.Entry entry = timeQueue.poll();
            left = entry.getCount() - 1;
            currentDelta = entry.getDelta();
        }
        currentDuration += currentDelta;
    }
    getTimesCache.put(key, syncSampleTimes);
    return syncSampleTimes;
}
 
开发者ID:begeekmyfriend,项目名称:mp4parser_android,代码行数:34,代码来源:SyncSampleIntersectFinderImpl.java


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