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


Java Movie.setTracks方法代码示例

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


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

示例1: startMuteUsingMp4Parser

import com.googlecode.mp4parser.authoring.Movie; //导入方法依赖的package包/类
private static void startMuteUsingMp4Parser(String filePath,
        SaveVideoFileInfo dstFileInfo) throws FileNotFoundException, IOException {
    File dst = dstFileInfo.mFile;
    File src = new File(filePath);
    RandomAccessFile randomAccessFile = new RandomAccessFile(src, "r");
    Movie movie = MovieCreator.build(randomAccessFile.getChannel());

    // remove all tracks we will create new tracks from the old
    List<Track> tracks = movie.getTracks();
    movie.setTracks(new LinkedList<Track>());

    for (Track track : tracks) {
        if (track.getHandler().equals("vide")) {
            movie.addTrack(track);
        }
    }
    writeMovieIntoFile(dst, movie);
    randomAccessFile.close();
}
 
开发者ID:asm-products,项目名称:nexus-gallery,代码行数:20,代码来源:VideoUtils.java

示例2: startTrim

import com.googlecode.mp4parser.authoring.Movie; //导入方法依赖的package包/类
public static void startTrim(File src, File dst, double startTime, double endTime) throws IOException {
    FileDataSourceImpl file = new FileDataSourceImpl(src);
    Movie movie = MovieCreator.build(file);
    List<Track> tracks = movie.getTracks();
    movie.setTracks(new LinkedList<Track>());

    Log.d(TAG, "startTrim: " + startTime + " " + endTime);
    for (Track track : tracks) {
        long currentSample = 0;
        double currentTime = 0;
        long startSample = -1;
        long endSample = -1;
        for (int i = 0; i < track.getSampleDurations().length; i++) {
            if (currentTime <= startTime) {

                // current sample is still before the new starttime
                startSample = currentSample;
            }
            if (currentTime <= endTime) {
                // current sample is after the new start time and still before the new endtime
                endSample = currentSample;
            } else {
                // current sample is after the end of the cropped video
                break;
            }
            currentTime += (double) track.getSampleDurations()[i] / (double) track.getTrackMetaData().getTimescale();
            currentSample++;
        }
        movie.addTrack(new CroppedTrack(track, startSample, endSample));
    }
    Container out = new DefaultMp4Builder().build(movie);
    MovieHeaderBox mvhd = Path.getPath(out, "moov/mvhd");
    mvhd.setMatrix(Matrix.ROTATE_180);
    if (!dst.exists()) {
        dst.createNewFile();
    }
    FileOutputStream fos = new FileOutputStream(dst);
    WritableByteChannel fc = fos.getChannel();
    try {
        out.writeContainer(fc);
    }catch (Exception e){
        e.printStackTrace();
    } finally {
        fc.close();
        fos.close();
        file.close();
    }
}
 
开发者ID:stfalcon-studio,项目名称:patrol-android,代码行数:49,代码来源:ProcessVideoUtils.java

示例3: removeUnknownTracks

import com.googlecode.mp4parser.authoring.Movie; //导入方法依赖的package包/类
private Movie removeUnknownTracks(Movie source) {
    List<Track> tracks = new LinkedList<Track>();
    for (Track track : source.getTracks()) {
        if ("vide".equals(track.getHandler()) || "soun".equals(track.getHandler())) {
            tracks.add(track);
        } else {
            LOG.fine("Removed track " + track);
        }
    }
    source.setTracks(tracks);
    return source;
}
 
开发者ID:sannies,项目名称:mp4parser-smooth-streaming,代码行数:13,代码来源:FlatPackageWriterImpl.java

示例4: correctTimescale

import com.googlecode.mp4parser.authoring.Movie; //导入方法依赖的package包/类
/**
 * Returns a new <code>Movie</code> in that all tracks have the timescale 10000000. CTS &amp; DTS are modified
 * in a way that even with more than one framerate the fragments exactly begin at the same time.
 *
 * @param movie original movie
 * @return a movie with timescales suitable for smooth streaming manifests
 */
public Movie correctTimescale(Movie movie) {
    List<Track> tracks = new LinkedList<Track>();
    for (Track track : movie.getTracks()) {
        tracks.add(new ChangeTimeScaleTrack(track, timeScale, ismvBuilder.getFragmentIntersectionFinder().sampleNumbers(track)));
    }
    movie.setTracks(tracks);
    return movie;

}
 
开发者ID:sannies,项目名称:mp4parser-smooth-streaming,代码行数:17,代码来源:FlatPackageWriterImpl.java


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