本文整理汇总了Java中org.red5.io.ITag类的典型用法代码示例。如果您正苦于以下问题:Java ITag类的具体用法?Java ITag怎么用?Java ITag使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ITag类属于org.red5.io包,在下文中一共展示了ITag类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createPreStreamingTags
import org.red5.io.ITag; //导入依赖的package包/类
/**
* Tag sequence
* MetaData, Audio config, remaining audio
*
* Packet prefixes:
* af 00 ... 06 = Audio extra data (first audio packet)
* af 01 = Audio frame
*
* Audio extra data(s):
* af 00 = Prefix
* 11 90 4f 14 = AAC Main = aottype 0
* 12 10 = AAC LC = aottype 1
* 13 90 56 e5 a5 48 00 = HE-AAC SBR = aottype 2
* 06 = Suffix
*
* Still not absolutely certain about this order or the bytes - need to verify later
*/
private void createPreStreamingTags() {
log.debug("Creating pre-streaming tags");
if (audioDecoderBytes != null) {
IoBuffer body = IoBuffer.allocate(audioDecoderBytes.length + 3);
body.put(new byte[] { (byte) 0xaf, (byte) 0 }); //prefix
if (log.isDebugEnabled()) {
log.debug("Audio decoder bytes: {}", HexDump.byteArrayToHexString(audioDecoderBytes));
}
body.put(audioDecoderBytes);
body.put((byte) 0x06); //suffix
ITag tag = new Tag(IoConstants.TYPE_AUDIO, 0, body.position(), null, prevFrameSize);
body.flip();
tag.setBody(body);
//add tag
firstTags.add(tag);
} else {
//default to aac-lc when the esds doesnt contain descripter bytes
log.warn("Audio decoder bytes were not available");
}
}
开发者ID:Kyunghwa-Yoo,项目名称:StitchRTSP,代码行数:38,代码来源:M4AReader.java
示例2: testFLVReaderFileWithPreProcessInfo
import org.red5.io.ITag; //导入依赖的package包/类
@Test
public void testFLVReaderFileWithPreProcessInfo() {
File file = new File("target/test-classes/fixtures/131647.flv");
//File file = new File("target/test-classes/fixtures/test.flv");
try {
FLVReader reader = new FLVReader(file, true);
KeyFrameMeta meta = reader.analyzeKeyFrames();
log.debug("Meta: {}", meta);
ITag tag = null;
for (int t = 0; t < 6; t++) {
tag = reader.readTag();
log.debug("Tag: {}", tag);
}
reader.close();
log.info("----------------------------------------------------------------------------------");
} catch (IOException e) {
e.printStackTrace();
}
}
开发者ID:Kyunghwa-Yoo,项目名称:StitchRTSP,代码行数:20,代码来源:FLVReaderTest.java
示例3: testFLVReaderFile
import org.red5.io.ITag; //导入依赖的package包/类
@Test
public void testFLVReaderFile() {
File[] files = new File[] { new File("target/test-classes/fixtures/h264_aac.flv"), new File("target/test-classes/fixtures/h264_mp3.flv"),
new File("target/test-classes/fixtures/h264_speex.flv") };
try {
for (File file : files) {
FLVReader reader = new FLVReader(file, true);
KeyFrameMeta meta = reader.analyzeKeyFrames();
log.debug("Meta: {}", meta);
ITag tag = null;
for (int t = 0; t < 6; t++) {
tag = reader.readTag();
log.debug("Tag: {}", tag);
}
reader.close();
log.info("----------------------------------------------------------------------------------");
}
} catch (IOException e) {
e.printStackTrace();
}
}
开发者ID:Kyunghwa-Yoo,项目名称:StitchRTSP,代码行数:24,代码来源:FLVReaderTest.java
示例4: processAudio
import org.red5.io.ITag; //导入依赖的package包/类
public boolean processAudio(byte[] buf, int timestamp) {
boolean result = false;
if (started.get()) {
try {
lock.acquire();
result = writer.writeTag(ImmutableTag.build(ITag.TYPE_AUDIO, timestamp, buf, previousTagSize));
this.previousTagSize = buf.length + 11; // add 11 for the tag header length (fixed for flv at 11)
} catch (Exception e) {
log.warn("Exception processing audio", e);
} finally {
lock.release();
}
} else {
log.debug("Not started");
}
return result;
}
开发者ID:mondain,项目名称:h264app,代码行数:18,代码来源:FLVRecorder.java
示例5: processVideo
import org.red5.io.ITag; //导入依赖的package包/类
public boolean processVideo(byte[] buf, int timestamp) {
boolean result = false;
if (started.get()) {
try {
lock.acquire();
result = writer.writeTag(ImmutableTag.build(ITag.TYPE_VIDEO, timestamp, buf, previousTagSize));
this.previousTagSize = buf.length + 11; // add 11 for the tag header length (fixed for flv at 11)
} catch (Exception e) {
log.warn("Exception processing audio", e);
} finally {
lock.release();
}
} else {
log.debug("Not started");
}
return result;
}
开发者ID:mondain,项目名称:h264app,代码行数:18,代码来源:FLVRecorder.java
示例6: setData
import org.red5.io.ITag; //导入依赖的package包/类
public void setData(IoBuffer data) {
this.data = data;
if (data != null && data.limit() > 0) {
data.mark();
int firstByte = data.get(0) & 0xff;
codecId = firstByte & ITag.MASK_VIDEO_CODEC;
if (codecId == VideoCodec.AVC.getId()) {
int secondByte = data.get(1) & 0xff;
config = (secondByte == 0);
endOfSequence = (secondByte == 2);
}
data.reset();
int frameType = (firstByte & MASK_VIDEO_FRAMETYPE) >> 4;
if (frameType == FLAG_FRAMETYPE_KEYFRAME) {
this.frameType = FrameType.KEYFRAME;
} else if (frameType == FLAG_FRAMETYPE_INTERFRAME) {
this.frameType = FrameType.INTERFRAME;
} else if (frameType == FLAG_FRAMETYPE_DISPOSABLE) {
this.frameType = FrameType.DISPOSABLE_INTERFRAME;
} else {
this.frameType = FrameType.UNKNOWN;
}
}
}
开发者ID:Red5,项目名称:red5-server-common,代码行数:25,代码来源:VideoData.java
示例7: createPreStreamingTags
import org.red5.io.ITag; //导入依赖的package包/类
/**
* Tag sequence MetaData, Audio config, remaining audio
*
* Packet prefixes: af 00 ... 06 = Audio extra data (first audio packet) af 01 = Audio frame
*
* Audio extra data(s): af 00 = Prefix 11 90 4f 14 = AAC Main = aottype 0 12 10 = AAC LC = aottype 1 13 90 56 e5 a5 48 00 = HE-AAC SBR =
* aottype 2 06 = Suffix
*
* Still not absolutely certain about this order or the bytes - need to verify later
*/
private void createPreStreamingTags() {
log.debug("Creating pre-streaming tags");
if (audioDecoderBytes != null) {
IoBuffer body = IoBuffer.allocate(audioDecoderBytes.length + 3);
body.put(new byte[] { (byte) 0xaf, (byte) 0 }); //prefix
if (log.isDebugEnabled()) {
log.debug("Audio decoder bytes: {}", HexDump.byteArrayToHexString(audioDecoderBytes));
}
body.put(audioDecoderBytes);
body.put((byte) 0x06); //suffix
ITag tag = new Tag(IoConstants.TYPE_AUDIO, 0, body.position(), null, prevFrameSize);
body.flip();
tag.setBody(body);
//add tag
firstTags.add(tag);
} else {
//default to aac-lc when the esds doesnt contain descripter bytes
log.warn("Audio decoder bytes were not available");
}
}
开发者ID:Red5,项目名称:red5-io,代码行数:31,代码来源:M4AReader.java
示例8: testFLVReaderFileWithPreProcessInfo
import org.red5.io.ITag; //导入依赖的package包/类
@Test
public void testFLVReaderFileWithPreProcessInfo() {
log.info("\n testFLVReaderFileWithPreProcessInfo");
//Path path = Paths.get("target/test-classes/fixtures/flv1_nelly.flv");
Path path = Paths.get("target/test-classes/fixtures/webrtctestrecord.flv");
try {
File file = path.toFile();
log.info("Reading: {}", file.getName());
FLVReader reader = new FLVReader(file, true);
//KeyFrameMeta meta = reader.analyzeKeyFrames();
//log.debug("Meta: {}", meta);
ITag tag = null;
for (int t = 0; t < 6; t++) {
tag = reader.readTag();
log.debug("Tag: {}", tag);
assertNotNull(tag.getBody());
}
reader.close();
log.info("Finished reading: {}\n", file.getName());
} catch (IOException e) {
e.printStackTrace();
}
}
开发者ID:Red5,项目名称:red5-io,代码行数:24,代码来源:FLVReaderTest.java
示例9: testCtor
import org.red5.io.ITag; //导入依赖的package包/类
@Test
public void testCtor() throws Exception {
log.debug("\n testCtor");
File file = new File("target/test-classes/fixtures/p-ok.mp3");
@SuppressWarnings("unused")
File file2 = new File("target/test-classes/fixtures/p-err.mp3");
//File file = new File("target/test-classes/fixtures/01 Cherub Rock.mp3");
//File file = new File("target/test-classes/fixtures/CodeMonkey.mp3");
MP3Reader reader = new MP3Reader(file);
ITag tag = reader.readTag();
log.info("Tag: {}", tag);
assertEquals(IoConstants.TYPE_METADATA, tag.getDataType());
assertFalse(reader.hasVideo());
assertEquals(3228578, reader.getTotalBytes());
do {
tag = reader.readTag();
log.info("Tag: {}", tag);
} while (reader.hasMoreTags());
}
开发者ID:Red5,项目名称:red5-io,代码行数:21,代码来源:MP3ReaderTest.java
示例10: testFLVReaderFile
import org.red5.io.ITag; //导入依赖的package包/类
@Test
public void testFLVReaderFile() {
File[] files = new File[] { new File("test/fixtures/h264_aac.flv"), new File("test/fixtures/h264_mp3.flv"), new File("test/fixtures/h264_speex.flv") };
try {
for (File file : files) {
FLVReader reader = new FLVReader(file, true);
KeyFrameMeta meta = reader.analyzeKeyFrames();
log.debug("Meta: {}", meta);
ITag tag = null;
for (int t = 0; t < 32; t++) {
tag = reader.readTag();
log.debug("Tag: {}", tag);
}
reader.close();
log.info("----------------------------------------------------------------------------------");
}
} catch (IOException e) {
e.printStackTrace();
}
}
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:26,代码来源:FLVReaderTest.java
示例11: testFLVFile
import org.red5.io.ITag; //导入依赖的package包/类
/**
* Tests: getFLVFile(File f)
*
* @throws IOException if io error
* @throws FileNotFoundException if file not found
*/
public void testFLVFile() throws FileNotFoundException, IOException {
File f = new File("fixtures/test.flv");
System.out.println("test: " + f);
IFLV flv = (IFLV) service.getStreamableFile(f);
flv.setCache(NoCacheImpl.getInstance());
System.out.println("test: " + flv);
ITagReader reader = flv.getReader();
System.out.println("test: " + reader);
ITag tag = null;
System.out.println("test: " + reader.hasMoreTags());
while (reader.hasMoreTags()) {
tag = reader.readTag();
// System.out.println("test: " + f);
printTag(tag);
}
// simply tests to see if the last tag of the flv file
// has a timestamp of 2500
// Assert.assertEquals(4166,tag.getTimestamp());
Assert.assertEquals(true, true);
}
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:28,代码来源:FLVServiceImplTest.java
示例12: injectCuePoint
import org.red5.io.ITag; //导入依赖的package包/类
/**
* Injects metadata (Cue Points) into a tag
*
* @param cue
* @param writer
* @param tag
* @return ITag tag
*/
private ITag injectCuePoint(Object cue, ITag tag) {
IMetaCue cp = (MetaCue<?, ?>) cue;
Output out = new Output(IoBuffer.allocate(1000));
Serializer ser = new Serializer();
ser.serialize(out, "onCuePoint");
ser.serialize(out, cp);
IoBuffer tmpBody = out.buf().flip();
int tmpBodySize = out.buf().limit();
//int tmpPreviousTagSize = tag.getPreviousTagSize();
int tmpTimestamp = getTimeInMilliseconds(cp);
//return new Tag(tmpDataType, tmpTimestamp, tmpBodySize, tmpBody, tmpPreviousTagSize);
return new Tag(IoConstants.TYPE_METADATA, tmpTimestamp, tmpBodySize, tmpBody, 0);
}
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:24,代码来源:CuePointInjectionTest.java
示例13: injectMetaData
import org.red5.io.ITag; //导入依赖的package包/类
/**
* Injects metadata (Cue Points) into a tag
* @param cue
* @param writer
* @param tag
* @return ITag tag
*/
private ITag injectMetaData(Object cue, ITag tag) {
IMetaCue cp = (MetaCue<?, ?>) cue;
Output out = new Output(IoBuffer.allocate(1000));
Serializer ser = new Serializer();
ser.serialize(out,"onCuePoint");
ser.serialize(out,cp);
IoBuffer tmpBody = out.buf().flip();
int tmpBodySize = out.buf().limit();
int tmpPreviousTagSize = tag.getPreviousTagSize();
byte tmpDataType = IoConstants.TYPE_METADATA;
int tmpTimestamp = getTimeInMilliseconds(cp);
return new Tag(tmpDataType, tmpTimestamp, tmpBodySize, tmpBody, tmpPreviousTagSize);
}
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:25,代码来源:MetaDataInjectionTest.java
示例14: createFileMeta
import org.red5.io.ITag; //导入依赖的package包/类
/**
* Create tag for metadata event.
*
* @return Metadata event tag
*/
ITag createFileMeta() {
log.debug("Creating onMetaData");
// Create tag for onMetaData event
IoBuffer buf = IoBuffer.allocate(1024);
buf.setAutoExpand(true);
Output out = new Output(buf);
out.writeString("onMetaData");
Map<Object, Object> props = new HashMap<Object, Object>();
// Duration property
props.put("duration", ((double) duration / (double) timeScale));
// Audio codec id - watch for mp3 instead of aac
props.put("audiocodecid", audioCodecId);
props.put("aacaot", audioCodecType);
props.put("audiosamplerate", audioTimeScale);
props.put("audiochannels", audioChannels);
props.put("canSeekToEnd", false);
out.writeMap(props);
buf.flip();
//now that all the meta properties are done, update the duration
duration = Math.round(duration * 1000d);
ITag result = new Tag(IoConstants.TYPE_METADATA, 0, buf.limit(), null, 0);
result.setBody(buf);
return result;
}
开发者ID:Kyunghwa-Yoo,项目名称:StitchRTSP,代码行数:33,代码来源:M4AReader.java
示例15: injectMetaData
import org.red5.io.ITag; //导入依赖的package包/类
/**
* Injects metadata (other than Cue points) into a tag
*
* @param meta
* Metadata
* @param tag
* Tag
* @return New tag with injected metadata
*/
private ITag injectMetaData(IMetaData<?, ?> meta, ITag tag) {
IoBuffer bb = IoBuffer.allocate(1000);
bb.setAutoExpand(true);
Output out = new Output(bb);
Serializer.serialize(out, "onMetaData");
Serializer.serialize(out, meta);
IoBuffer tmpBody = out.buf().flip();
int tmpBodySize = out.buf().limit();
int tmpPreviousTagSize = tag.getPreviousTagSize();
return new Tag(IoConstants.TYPE_METADATA, 0, tmpBodySize, tmpBody, tmpPreviousTagSize);
}
开发者ID:Kyunghwa-Yoo,项目名称:StitchRTSP,代码行数:21,代码来源:MetaService.java
示例16: injectMetaCue
import org.red5.io.ITag; //导入依赖的package包/类
/**
* Injects metadata (Cue Points) into a tag
*
* @param meta
* Metadata (cue points)
* @param tag
* Tag
* @return ITag tag New tag with injected metadata
*/
private ITag injectMetaCue(IMetaCue meta, ITag tag) {
// IMeta meta = (MetaCue) cue;
Output out = new Output(IoBuffer.allocate(1000));
Serializer.serialize(out, "onCuePoint");
Serializer.serialize(out, meta);
IoBuffer tmpBody = out.buf().flip();
int tmpBodySize = out.buf().limit();
int tmpPreviousTagSize = tag.getPreviousTagSize();
int tmpTimestamp = getTimeInMilliseconds(meta);
return new Tag(IoConstants.TYPE_METADATA, tmpTimestamp, tmpBodySize, tmpBody, tmpPreviousTagSize);
}
开发者ID:Kyunghwa-Yoo,项目名称:StitchRTSP,代码行数:23,代码来源:MetaService.java
示例17: createFileMeta
import org.red5.io.ITag; //导入依赖的package包/类
/**
* Creates file metadata object
*
* @return Tag
*/
private ITag createFileMeta() {
log.debug("createFileMeta");
// create tag for onMetaData event
IoBuffer in = IoBuffer.allocate(1024);
in.setAutoExpand(true);
Output out = new Output(in);
out.writeString("onMetaData");
Map<Object, Object> props = new HashMap<Object, Object>();
props.put("duration", frameMeta.timestamps[frameMeta.timestamps.length - 1] / 1000.0);
props.put("audiocodecid", IoConstants.FLAG_FORMAT_MP3);
if (dataRate > 0) {
props.put("audiodatarate", dataRate);
}
props.put("canSeekToEnd", true);
//set id3 meta data if it exists
if (metaData != null) {
props.put("artist", metaData.getArtist());
props.put("album", metaData.getAlbum());
props.put("songName", metaData.getSongName());
props.put("genre", metaData.getGenre());
props.put("year", metaData.getYear());
props.put("track", metaData.getTrack());
props.put("comment", metaData.getComment());
if (metaData.hasCoverImage()) {
Map<Object, Object> covr = new HashMap<Object, Object>(1);
covr.put("covr", new Object[] { metaData.getCovr() });
props.put("tags", covr);
}
//clear meta for gc
metaData = null;
}
out.writeMap(props);
in.flip();
ITag result = new Tag(IoConstants.TYPE_METADATA, 0, in.limit(), null, prevSize);
result.setBody(in);
return result;
}
开发者ID:Kyunghwa-Yoo,项目名称:StitchRTSP,代码行数:44,代码来源:MP3Reader.java
示例18: testCtor
import org.red5.io.ITag; //导入依赖的package包/类
@Test
public void testCtor() throws Exception {
File file = new File("target/test-classes/fixtures/sample.m4a");
M4AReader reader = new M4AReader(file);
ITag tag = reader.readTag();
log.debug("Tag: {}", tag);
tag = reader.readTag();
log.debug("Tag: {}", tag);
}
开发者ID:Kyunghwa-Yoo,项目名称:StitchRTSP,代码行数:13,代码来源:M4AReaderTest.java
示例19: testCtor
import org.red5.io.ITag; //导入依赖的package包/类
@Test
public void testCtor() throws Exception {
// use for the internal unit tests
//File file = new File("target/test-classes/fixtures/sample.mp4");
// test clips for issues/bugs
// https://code.google.com/p/red5/issues/detail?id=141
File file = new File("target/test-classes/fixtures/test_480_aac.f4v");
//File file = new File("M:/backup/media/test_clips/ratatouille.mp4");
//File file = new File("M:/backup/media/test_clips/0608071221.3g2");
//File file = new File("M:/backup/media/test_clips/test1.3gp");
//File file = new File("M:/backup/media/test_clips/ANewHope.mov");
//File file = new File("M:/Movies/Hitman.m4v"); // has pasp atom
MP4Reader reader = new MP4Reader(file);
KeyFrameMeta meta = reader.analyzeKeyFrames();
log.debug("Meta: {}", meta);
ITag tag = null;
for (int t = 0; t < 32; t++) {
tag = reader.readTag();
log.debug("Tag: {}", tag);
}
log.info("----------------------------------------------------------------------------------");
//File file2 = new File("E:/media/test_clips/IronMan.mov");
//MP4Reader reader2 = new MP4Reader(file2, false);
}
开发者ID:Kyunghwa-Yoo,项目名称:StitchRTSP,代码行数:31,代码来源:MP4ReaderTest.java
示例20: write
import org.red5.io.ITag; //导入依赖的package包/类
protected void write(int timeStamp, byte type, IoBuffer data) throws IOException {
log.trace("timeStamp :: {}", timeStamp);
ITag tag = new Tag();
tag.setDataType(type);
tag.setBodySize(data.limit());
tag.setTimestamp(timeStamp);
tag.setBody(data);
writer.writeTag(tag);
}
开发者ID:apache,项目名称:openmeetings,代码行数:12,代码来源:BaseStreamWriter.java
注:本文中的org.red5.io.ITag类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论