當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。