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


Java Track.getDecodingTimeEntries方法代码示例

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


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

示例1: calculateFragmentDurations

import com.googlecode.mp4parser.authoring.Track; //导入方法依赖的package包/类
/**
 * Calculates the length of each fragment in the given <code>track</code> (as part of <code>movie</code>).
 *
 * @param track target of calculation
 * @param movie the <code>track</code> must be part of this <code>movie</code>
 * @return the duration of each fragment in track timescale
 */
public long[] calculateFragmentDurations(Track track, Movie movie) {
    long[] startSamples = intersectionFinder.sampleNumbers(track, movie);
    long[] durations = new long[startSamples.length];
    int currentFragment = 0;
    int currentSample = 1; // sync samples start with 1 !

    for (TimeToSampleBox.Entry entry : track.getDecodingTimeEntries()) {
        for (int max = currentSample + l2i(entry.getCount()); currentSample < max; currentSample++) {
            // in this loop we go through the entry.getCount() samples starting from current sample.
            // the next entry.getCount() samples have the same decoding time.
            if (currentFragment != startSamples.length - 1 && currentSample == startSamples[currentFragment + 1]) {
                // we are not in the last fragment && the current sample is the start sample of the next fragment
                currentFragment++;
            }
            durations[currentFragment] += entry.getDelta();


        }
    }
    return durations;

}
 
开发者ID:begeekmyfriend,项目名称:mp4parser_android,代码行数:30,代码来源:AbstractManifestWriter.java

示例2: getTimes

import com.googlecode.mp4parser.authoring.Track; //导入方法依赖的package包/类
private static long[] getTimes(Track track, long[] syncSamples, long targetTimeScale) {
    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;


    while (currentSample <= syncSamples[syncSamples.length - 1]) {
        if (currentSample++ == syncSamples[currentSyncSampleIndex]) {
            syncSampleTimes[currentSyncSampleIndex++] = (currentDuration * targetTimeScale) / track.getTrackMetaData().getTimescale();
        }
        if (left-- == 0) {
            TimeToSampleBox.Entry entry = timeQueue.poll();
            left = entry.getCount() - 1;
            currentDelta = entry.getDelta();
        }
        currentDuration += currentDelta;
    }
    return syncSampleTimes;

}
 
开发者ID:begeekmyfriend,项目名称:mp4parser_android,代码行数:26,代码来源:ChangeTimeScaleTrack.java

示例3: getDuration

import com.googlecode.mp4parser.authoring.Track; //导入方法依赖的package包/类
protected static long getDuration(Track track) {
    long duration = 0;
    for (TimeToSampleBox.Entry entry : track.getDecodingTimeEntries()) {
        duration += entry.getCount() * entry.getDelta();
    }
    return duration;
}
 
开发者ID:begeekmyfriend,项目名称:mp4parser_android,代码行数:8,代码来源:AbstractManifestWriter.java

示例4: 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

示例5: getDuration

import com.googlecode.mp4parser.authoring.Track; //导入方法依赖的package包/类
protected long getDuration(Track track) {
    long duration = 0;
    for (TimeToSampleBox.Entry entry : track.getDecodingTimeEntries()) {
        duration += entry.getCount() * entry.getDelta();
    }
    return duration;
}
 
开发者ID:begeekmyfriend,项目名称:mp4parser_android,代码行数:8,代码来源:FragmentedMp4Builder.java

示例6: sampleNumbers

import com.googlecode.mp4parser.authoring.Track; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
public long[] sampleNumbers(Track track, Movie movie) {
    List<TimeToSampleBox.Entry> entries = track.getDecodingTimeEntries();

    double trackLength = 0;
    for (Track thisTrack : movie.getTracks()) {
        double thisTracksLength = getDuration(thisTrack) / thisTrack.getTrackMetaData().getTimescale();
        if (trackLength < thisTracksLength) {
            trackLength = thisTracksLength;
        }
    }

    int fragmentCount = (int)Math.ceil(trackLength / 2) - 1;
    if (fragmentCount < 1) {
        fragmentCount = 1;
    }

    long fragments[] = new long[fragmentCount];
    Arrays.fill(fragments, -1);
    fragments[0] = 1;

    long time = 0;
    int samples = 0;
    for (TimeToSampleBox.Entry entry : entries) {
        for (int i = 0; i < entry.getCount(); i++) {
            int currentFragment = (int) (time / track.getTrackMetaData().getTimescale() / 2) + 1;
            if (currentFragment >= fragments.length) {
                break;
            }
            fragments[currentFragment] = samples++ + 1;
            time += entry.getDelta();
        }
    }
    long last = samples + 1;
    // fill all -1 ones.
    for (int i = fragments.length - 1; i >= 0; i--) {
        if (fragments[i] == -1) {
            fragments[i] = last ;
        }
        last = fragments[i];
    }
    return fragments;

}
 
开发者ID:begeekmyfriend,项目名称:mp4parser_android,代码行数:47,代码来源:TwoSecondIntersectionFinder.java


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