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


Java NIOUtils.readableFileChannel方法代码示例

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


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

示例1: webOptimize

import org.jcodec.common.NIOUtils; //导入方法依赖的package包/类
public static void webOptimize(String path) throws IOException {
    File orig = new File(path);
    SeekableByteChannel input = NIOUtils.readableFileChannel(orig);
    MovieBox movie = MP4Util.createRefMovie(input, "file://" + orig.getCanonicalPath());

    File optim = new File(path + "_optim");
    new Flattern().flattern(movie, optim);
    input.close();

    Files.move(Paths.get(path + "_optim"), Paths.get(path), StandardCopyOption.REPLACE_EXISTING); // doesn't work on DOS
}
 
开发者ID:Helioviewer-Project,项目名称:JHelioviewer-SWHV,代码行数:12,代码来源:JCodecUtils.java

示例2: JCodecAccess

import org.jcodec.common.NIOUtils; //导入方法依赖的package包/类
public JCodecAccess(URLVideoSource src, int numPlays) throws IOException, URISyntaxException {
	super(src, numPlays);
	this.channel = NIOUtils.readableFileChannel(new File(src.getURL().toURI()));
	try {
		this.grab = new FrameGrab(channel);
	} catch(JCodecException e) {
		throw new IOException(e);
	}
}
 
开发者ID:arisona,项目名称:ether,代码行数:10,代码来源:JCodecAccess.java

示例3: MP4VideoDemuxer

import org.jcodec.common.NIOUtils; //导入方法依赖的package包/类
/**
 * Create a new demuxer
 * 
 * @param file File to oper
 * @throws IOException
 */
public MP4VideoDemuxer(File file) throws IOException
{
   SeekableByteChannel input = NIOUtils.readableFileChannel(file);
   MP4Demuxer demuxer = new MP4Demuxer(input);
   videoTrack = demuxer.getVideoTrack();
   if(videoTrack instanceof FramesMP4DemuxerTrack)
   {
      buffer = ByteBuffer.allocateDirect(((FramesMP4DemuxerTrack) videoTrack).getMaxSize());
   }
   else
   {
      throw new IOException("Incompatible video track");
   }
   
   String fourcc = videoTrack.getFourcc();

   if (fourcc.equals("avc1"))
   {
      demuxerHelper = new AVCDemuxerHelper(videoTrack.getSampleEntries());
   }
   else if (fourcc.equals("jpeg"))
   {
      demuxerHelper = new JPEGDemuxerHelper(videoTrack.getSampleEntries());
   }
   else
   {
      throw new IOException("Cannot decode fourcc " + fourcc);
   }
}
 
开发者ID:ihmcrobotics,项目名称:ihmc-video-codecs,代码行数:36,代码来源:MP4VideoDemuxer.java

示例4: getFrame

import org.jcodec.common.NIOUtils; //导入方法依赖的package包/类
/**
 * Get frame at a specified second as AWT image
 * 
 * @param file
 * @param second
 * @return
 * @throws IOException
 * @throws JCodecException
 */
public static BufferedImage getFrame(File file, double second) throws IOException, JCodecException {
    FileChannelWrapper ch = null;
    try {
        ch = NIOUtils.readableFileChannel(file);
        return ((FrameGrab) new FrameGrab(ch).seekToSecondPrecise(second)).getFrame();
    } finally {
        NIOUtils.closeQuietly(ch);
    }
}
 
开发者ID:PenoaksDev,项目名称:OpenSpaceDVR,代码行数:19,代码来源:FrameGrab.java

示例5: getNativeFrame

import org.jcodec.common.NIOUtils; //导入方法依赖的package包/类
/**
 * Get frame at a specified second as JCodec image
 * 
 * @param file
 * @param second
 * @return
 * @throws IOException
 * @throws JCodecException
 */
public static Picture getNativeFrame(File file, double second) throws IOException, JCodecException {
    FileChannelWrapper ch = null;
    try {
        ch = NIOUtils.readableFileChannel(file);
        return new FrameGrab(ch).seekToSecondPrecise(second).getNativeFrame();
    } finally {
        NIOUtils.closeQuietly(ch);
    }
}
 
开发者ID:PenoaksDev,项目名称:OpenSpaceDVR,代码行数:19,代码来源:FrameGrab.java

示例6: main

import org.jcodec.common.NIOUtils; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
    FileChannelWrapper ch = null;
    FileChannelWrapper out = null;
    try {
        ch = NIOUtils.readableFileChannel(new File(args[0]));
        out = NIOUtils.writableFileChannel(new File(args[1]));
        new MKVShiftTimecodes(Integer.parseInt(args[2])).run(ch, out);
    } finally {
        NIOUtils.closeQuietly(ch);
        NIOUtils.closeQuietly(out);
    }
}
 
开发者ID:PenoaksDev,项目名称:OpenSpaceDVR,代码行数:13,代码来源:MKVShiftTimecodes.java

示例7: getPrograms

import org.jcodec.common.NIOUtils; //导入方法依赖的package包/类
public static List<PMTStream> getPrograms(File src) throws IOException {
    SeekableByteChannel ch = null;
    try {
        ch = NIOUtils.readableFileChannel(src);
        return getProgramGuids(ch);
    } finally {
        NIOUtils.closeQuietly(ch);
    }
}
 
开发者ID:PenoaksDev,项目名称:OpenSpaceDVR,代码行数:10,代码来源:MTSUtils.java

示例8: getPrograms

import org.jcodec.common.NIOUtils; //导入方法依赖的package包/类
public static Set<Integer> getPrograms(File file) throws IOException {
    FileChannelWrapper fc = null;
    try {
        fc = NIOUtils.readableFileChannel(file);
        return getPrograms(fc);
    } finally {
        NIOUtils.closeQuietly(fc);
    }
}
 
开发者ID:PenoaksDev,项目名称:OpenSpaceDVR,代码行数:10,代码来源:MTSDemuxer.java

示例9: getMediaInfo

import org.jcodec.common.NIOUtils; //导入方法依赖的package包/类
public List<MPEGTrackMetadata> getMediaInfo(File f) throws IOException {
    FileChannelWrapper ch = null;
    final List<MTSUtils.PMT> pmtSections = new ArrayList<MTSUtils.PMT>();
    final Map<Integer, MPSMediaInfo> pids = new HashMap<Integer, MPSMediaInfo>();
    final List<MPEGTrackMetadata> result = new ArrayList<MPEGTrackMetadata>();
    try {
        ch = NIOUtils.readableFileChannel(f);
        new MTSUtils.TSReader() {
            private ByteBuffer pmtBuffer;
            private int pmtPid = -1;
            private boolean pmtDone;

            protected boolean onPkt(int guid, boolean payloadStart, ByteBuffer tsBuf, long filePos) {
                if (guid == 0) {
                    pmtPid = MTSUtils.parsePAT(tsBuf);
                } else if (guid == pmtPid && !pmtDone) {
                    if (pmtBuffer == null) {
                        pmtBuffer = ByteBuffer.allocate(((tsBuf.duplicate().getInt() >> 8) & 0x3ff) + 3);
                    } else if (pmtBuffer.hasRemaining()) {
                        NIOUtils.write(pmtBuffer, tsBuf, Math.min(pmtBuffer.remaining(), tsBuf.remaining()));
                    }

                    if (!pmtBuffer.hasRemaining()) {
                        pmtBuffer.flip();
                        PMT pmt = MTSUtils.parsePMT(pmtBuffer);
                        pmtSections.add(pmt);
                        for (PMTStream stream : pmt.getStreams()) {
                            if (!pids.containsKey(stream.getPid()))
                                pids.put(stream.getPid(), new MPSMediaInfo());
                        }
                        pmtDone = pmt.getSectionNumber() == pmt.getLastSectionNumber();
                        pmtBuffer = null;
                    }
                } else if (pids.containsKey(guid)) {
                    try {
                        pids.get(guid).analyseBuffer(tsBuf, filePos);
                    } catch (MediaInfoDone e) {
                        result.addAll(pids.get(guid).getInfos());
                        pids.remove(guid);
                        if (pids.size() == 0)
                            return false;
                    }
                }
                return true;
            }
        }.readTsFile(ch);
    } finally {
        NIOUtils.closeQuietly(ch);
    }

    return result;
}
 
开发者ID:PenoaksDev,项目名称:OpenSpaceDVR,代码行数:53,代码来源:MTSMediaInfo.java

示例10: newChannel

import org.jcodec.common.NIOUtils; //导入方法依赖的package包/类
protected SeekableByteChannel newChannel(File file) throws FileNotFoundException {
    return NIOUtils.readableFileChannel(file);
}
 
开发者ID:PenoaksDev,项目名称:OpenSpaceDVR,代码行数:4,代码来源:FilePool.java


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