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


Java FLVHeader类代码示例

本文整理汇总了Java中org.red5.io.flv.FLVHeader的典型用法代码示例。如果您正苦于以下问题:Java FLVHeader类的具体用法?Java FLVHeader怎么用?Java FLVHeader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: writeHeader

import org.red5.io.flv.FLVHeader; //导入依赖的package包/类
/**
 * Writes the header bytes
 *
 * @throws IOException
 *             Any I/O exception
 */
@Override
public void writeHeader() throws IOException {
    // create a buffer
    ByteBuffer buf = ByteBuffer.allocate(HEADER_LENGTH + 4); // FLVHeader (9 bytes) + PreviousTagSize0 (4 bytes)
    // instance an flv header
    FLVHeader flvHeader = new FLVHeader();
    flvHeader.setFlagAudio(audioCodecId != -1 ? true : false);
    flvHeader.setFlagVideo(videoCodecId != -1 ? true : false);
    // write the flv header in the buffer
    flvHeader.write(buf);
    // the final version of the file will go here
    createOutputFile();
    // write header to output channel
    bytesWritten = fileChannel.write(buf);
    assert ((HEADER_LENGTH + 4) - bytesWritten == 0);
    log.debug("Header size: {} bytes written: {}", (HEADER_LENGTH + 4), bytesWritten);
    buf.clear();
    buf = null;
}
 
开发者ID:Red5,项目名称:red5-io,代码行数:26,代码来源:FLVWriter.java

示例2: writeHeader

import org.red5.io.flv.FLVHeader; //导入依赖的package包/类
/**
 * Writes the header bytes
 *
 * @throws IOException      Any I/O exception
 */
public void writeHeader() throws IOException {
	FLVHeader flvHeader = new FLVHeader();
	flvHeader.setFlagAudio(audioCodecId != -1 ? true : false);
	flvHeader.setFlagVideo(videoCodecId != -1 ? true : false);
	// create a buffer
	ByteBuffer header = ByteBuffer.allocate(HEADER_LENGTH + 4); // FLVHeader (9 bytes) + PreviousTagSize0 (4 bytes)
	flvHeader.write(header);
	// the final version of the file will go here
	this.file = new RandomAccessFile(filePath, "rw");
	// write header to output channel
	file.setLength(HEADER_LENGTH + 4);
	if (header.hasArray()) {
		log.debug("Header bytebuffer has a backing array");
		file.write(header.array());
	} else {
		log.debug("Header bytebuffer does not have a backing array");
		byte[] tmp = new byte[HEADER_LENGTH + 4];
		header.get(tmp);
		file.write(tmp);
	}
	bytesWritten = file.length();
	assert ((HEADER_LENGTH + 4) - bytesWritten == 0);
	log.debug("Header size: {} bytes written: {}", (HEADER_LENGTH + 4), bytesWritten);
	header.clear();
	header = null;
}
 
开发者ID:Kyunghwa-Yoo,项目名称:StitchRTSP,代码行数:32,代码来源:FLVWriter.java

示例3: decodeHeader

import org.red5.io.flv.FLVHeader; //导入依赖的package包/类
/** {@inheritDoc} */
public void decodeHeader() {
	// flv header is 9 bytes
	fillBuffer(9);
	header = new FLVHeader();
	// skip signature
	in.skip(4);
	header.setTypeFlags(in.get());
	header.setDataOffset(in.getInt());
	if (log.isDebugEnabled()) {
		log.debug("Header: {}", header.toString());
	}
}
 
开发者ID:Kyunghwa-Yoo,项目名称:StitchRTSP,代码行数:14,代码来源:FLVReader.java

示例4: decodeHeader

import org.red5.io.flv.FLVHeader; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public void decodeHeader() {
    // flv header is 9 bytes
    fillBuffer(9);
    header = new FLVHeader();
    // skip signature
    in.skip(4);
    header.setTypeFlags(in.get());
    header.setDataOffset(in.getInt());
    if (log.isDebugEnabled()) {
        log.debug("Header: {}", header.toString());
    }
}
 
开发者ID:Red5,项目名称:red5-io,代码行数:15,代码来源:FLVReader.java


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