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


Java TimeToSampleBox.Entry方法代码示例

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


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

示例1: calculateFragmentDurations

import com.coremedia.iso.boxes.TimeToSampleBox; //导入方法依赖的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: createStts

import com.coremedia.iso.boxes.TimeToSampleBox; //导入方法依赖的package包/类
protected void createStts(Track track, SampleTableBox stbl) {
    TimeToSampleBox.Entry lastEntry = null;
    List<TimeToSampleBox.Entry> entries = new ArrayList<>();

    for (long delta : track.getSampleDurations()) {
        if (lastEntry != null && lastEntry.getDelta() == delta) {
            lastEntry.setCount(lastEntry.getCount() + 1);
        } else {
            lastEntry = new TimeToSampleBox.Entry(1, delta);
            entries.add(lastEntry);
        }
    }
    TimeToSampleBox stts = new TimeToSampleBox();
    stts.setEntries(entries);
    stbl.addBox(stts);
}
 
开发者ID:fishwjy,项目名称:VideoCompressor,代码行数:17,代码来源:MP4Builder.java

示例3: createStts

import com.coremedia.iso.boxes.TimeToSampleBox; //导入方法依赖的package包/类
private void createStts(Track track, SampleTableBox stbl) {
    TimeToSampleBox.Entry lastEntry = null;
    List<TimeToSampleBox.Entry> entries = new ArrayList<>();

    for (long delta : track.getSampleDurations()) {
        if (lastEntry != null && lastEntry.getDelta() == delta) {
            lastEntry.setCount(lastEntry.getCount() + 1);
        } else {
            lastEntry = new TimeToSampleBox.Entry(1, delta);
            entries.add(lastEntry);
        }
    }
    TimeToSampleBox stts = new TimeToSampleBox();
    stts.setEntries(entries);
    stbl.addBox(stts);
}
 
开发者ID:lisnstatic,项目名称:live_master,代码行数:17,代码来源:SrsMp4Muxer.java

示例4: getTimes

import com.coremedia.iso.boxes.TimeToSampleBox; //导入方法依赖的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:lisnstatic,项目名称:live_master,代码行数:26,代码来源:ChangeTimeScaleTrack.java

示例5: getDecodingTimeEntries

import com.coremedia.iso.boxes.TimeToSampleBox; //导入方法依赖的package包/类
public List<TimeToSampleBox.Entry> getDecodingTimeEntries() {
    LinkedList<TimeToSampleBox.Entry> timesToSample = new LinkedList<TimeToSampleBox.Entry>();
    LinkedList<Long> keys = new LinkedList<Long>(rawSamples.keySet());
    Collections.sort(keys);
    long lastTimeStamp = 0;
    for (Long key : keys) {
        long delta = key - lastTimeStamp;
        if (timesToSample.size() > 0 && timesToSample.peek().getDelta() == delta) {
            timesToSample.peek().setCount(timesToSample.peek().getCount() + 1);
        } else {
            timesToSample.add(new TimeToSampleBox.Entry(1, delta));
        }
        lastTimeStamp = key;
    }
    return timesToSample;
}
 
开发者ID:lisnstatic,项目名称:live_master,代码行数:17,代码来源:Amf0Track.java

示例6: createStts

import com.coremedia.iso.boxes.TimeToSampleBox; //导入方法依赖的package包/类
protected void createStts(Track track, SampleTableBox stbl) {
    TimeToSampleBox.Entry lastEntry = null;
    List<TimeToSampleBox.Entry> entries = new ArrayList<>();
    long[] deltas = track.getSampleDurations();

    for (int a = 0; a < deltas.length; a++) {
        long delta = deltas[a];
        if (lastEntry != null && lastEntry.getDelta() == delta) {
            lastEntry.setCount(lastEntry.getCount() + 1);
        } else {
            lastEntry = new TimeToSampleBox.Entry(1, delta);
            entries.add(lastEntry);
        }
    }
    TimeToSampleBox stts = new TimeToSampleBox();
    stts.setEntries(entries);
    stbl.addBox(stts);
}
 
开发者ID:DrKLO,项目名称:Telegram,代码行数:19,代码来源:MP4Builder.java

示例7: getDuration

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

示例8: getDuration

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

示例9: getDecodingTimeEntries

import com.coremedia.iso.boxes.TimeToSampleBox; //导入方法依赖的package包/类
public List<TimeToSampleBox.Entry> getDecodingTimeEntries() {
    List<TimeToSampleBox.Entry> stts = new LinkedList<TimeToSampleBox.Entry>();
    long lastEnd = 0;
    for (Line sub : subs) {
        long silentTime = sub.from - lastEnd;
        if (silentTime > 0) {
            stts.add(new TimeToSampleBox.Entry(1, silentTime));
        } else if (silentTime < 0) {
            throw new Error("Subtitle display times may not intersect");
        }
        stts.add(new TimeToSampleBox.Entry(1, sub.to - sub.from));
        lastEnd = sub.to;
    }
    return stts;
}
 
开发者ID:lisnstatic,项目名称:live_master,代码行数:16,代码来源:TextTrackImpl.java

示例10: getTimes

import com.coremedia.iso.boxes.TimeToSampleBox; //导入方法依赖的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:lisnstatic,项目名称:live_master,代码行数:34,代码来源:SyncSampleIntersectFinderImpl.java

示例11: correctTimeToSyncSample

import com.coremedia.iso.boxes.TimeToSampleBox; //导入方法依赖的package包/类
private static double correctTimeToSyncSample(Track track, double cutHere,
        boolean next) {
    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++;
        }
    }
    double previous = 0;
    for (double timeOfSyncSample : timeOfSyncSamples) {
        if (timeOfSyncSample > cutHere) {
            if (next) {
                return timeOfSyncSample;
            } else {
                return previous;
            }
        }
        previous = timeOfSyncSample;
    }
    return timeOfSyncSamples[timeOfSyncSamples.length - 1];
}
 
开发者ID:asm-products,项目名称:nexus-gallery,代码行数:33,代码来源:VideoUtils.java

示例12: LoadSpecificBox

import com.coremedia.iso.boxes.TimeToSampleBox; //导入方法依赖的package包/类
private void LoadSpecificBox( TimeToSampleBox box ) {
   addViewForValue( "Entries:", box.getEntries().size() );

   int skippedRows = 0;

   GridLayout gridLayout = addTableHeader( "Count", "Delta" );
   for ( TimeToSampleBox.Entry entry : box.getEntries() ) {
      addTableRow( gridLayout, getDisplayForObject( entry.getCount() ), getDisplayForObject( entry.getDelta() ) );

      if ( gridLayout.getRowCount() > 200 ) {
         skippedRows = box.getEntries().size() - 200;
         break;
      }
   }

   HorizontalScrollView scrollView = new HorizontalScrollView( getContext() );
   scrollView.addView( gridLayout );
   mBaseLayout.addView( scrollView );

   if ( skippedRows > 0 ) {

      RobotoTextView text = new RobotoTextView( getContext() );
      text.setTextAppearance( getContext(), R.style.CardValue );
      text.setText( String.format( Locale.US, "%d entries emmited", skippedRows ) );
      mBaseLayout.addView( text );
   }
}
 
开发者ID:hoolrory,项目名称:VideoInfoViewer,代码行数:28,代码来源:BoxInfoView.java

示例13: correctTimeToSyncSample

import com.coremedia.iso.boxes.TimeToSampleBox; //导入方法依赖的package包/类
/**
 * Correct time with sync sample
 * 
 * @param track
 * @param cutHere
 * @param next
 * @return
 */
private static double correctTimeToSyncSample(Track track, double cutHere, boolean next) {
       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++;
           }
       }
       double previous = 0;
       for (double timeOfSyncSample : timeOfSyncSamples) {
           if (timeOfSyncSample > cutHere) {
               if (next) {
                   return timeOfSyncSample;
               } else {
                   return previous;
               }
           }
           previous = timeOfSyncSample;
       }
       return timeOfSyncSamples[timeOfSyncSamples.length - 1];
   }
 
开发者ID:Noterik,项目名称:Rafael,代码行数:37,代码来源:Fragment.java

示例14: getDecodingTimeEntries

import com.coremedia.iso.boxes.TimeToSampleBox; //导入方法依赖的package包/类
public List<TimeToSampleBox.Entry> getDecodingTimeEntries() {
    return stts;
}
 
开发者ID:lisnstatic,项目名称:live_master,代码行数:4,代码来源:AC3TrackImpl.java

示例15: parse

import com.coremedia.iso.boxes.TimeToSampleBox; //导入方法依赖的package包/类
private void parse(InputStream inputStream) throws IOException {
    this.reader = new ReaderWrapper(inputStream);
    stts = new LinkedList<TimeToSampleBox.Entry>();
    ctts = new LinkedList<CompositionTimeToSample.Entry>();
    sdtp = new LinkedList<SampleDependencyTypeBox.Entry>();
    stss = new LinkedList<Integer>();

    samples = new LinkedList<ByteBuffer>();
    if (!readSamples()) {
        throw new IOException();
    }

    if (!readVariables()) {
        throw new IOException();
    }

    sampleDescriptionBox = new SampleDescriptionBox();
    VisualSampleEntry visualSampleEntry = new VisualSampleEntry("avc1");
    visualSampleEntry.setDataReferenceIndex(1);
    visualSampleEntry.setDepth(24);
    visualSampleEntry.setFrameCount(1);
    visualSampleEntry.setHorizresolution(72);
    visualSampleEntry.setVertresolution(72);
    visualSampleEntry.setWidth(width);
    visualSampleEntry.setHeight(height);
    visualSampleEntry.setCompressorname("AVC Coding");

    AvcConfigurationBox avcConfigurationBox = new AvcConfigurationBox();

    avcConfigurationBox.setSequenceParameterSets(seqParameterSetList);
    avcConfigurationBox.setPictureParameterSets(pictureParameterSetList);
    avcConfigurationBox.setAvcLevelIndication(seqParameterSet.level_idc);
    avcConfigurationBox.setAvcProfileIndication(seqParameterSet.profile_idc);
    avcConfigurationBox.setBitDepthLumaMinus8(seqParameterSet.bit_depth_luma_minus8);
    avcConfigurationBox.setBitDepthChromaMinus8(seqParameterSet.bit_depth_chroma_minus8);
    avcConfigurationBox.setChromaFormat(seqParameterSet.chroma_format_idc.getId());
    avcConfigurationBox.setConfigurationVersion(1);
    avcConfigurationBox.setLengthSizeMinusOne(3);
    avcConfigurationBox.setProfileCompatibility(seqParameterSetList.get(0)[1]);

    visualSampleEntry.addBox(avcConfigurationBox);
    sampleDescriptionBox.addBox(visualSampleEntry);

    trackMetaData.setCreationTime(new Date());
    trackMetaData.setModificationTime(new Date());
    trackMetaData.setLanguage(lang);
    trackMetaData.setTimescale(timescale);
    trackMetaData.setWidth(width);
    trackMetaData.setHeight(height);
}
 
开发者ID:lisnstatic,项目名称:live_master,代码行数:51,代码来源:H264TrackImpl.java


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