if (this.pipe == pipe) {
if (reader == null) {
init();
}
if (reader.hasMoreTags()) {
IRTMPEvent msg = null;
ITag tag = reader.readTag();
if (tag != null) {
int timestamp = tag.getTimestamp();
switch (tag.getDataType()) {
case Constants.TYPE_AUDIO_DATA:
msg = new AudioData(tag.getBody());
break;
case Constants.TYPE_VIDEO_DATA:
msg = new VideoData(tag.getBody());
break;
case Constants.TYPE_INVOKE:
msg = new Invoke(tag.getBody());
break;
case Constants.TYPE_NOTIFY:
msg = new Notify(tag.getBody());
break;
case Constants.TYPE_FLEX_STREAM_SEND:
msg = new FlexStreamSend(tag.getBody());
break;
default:
log.warn("Unexpected type? {}", tag.getDataType());
msg = new Unknown(tag.getDataType(), tag.getBody());
}
msg.setTimestamp(timestamp);
RTMPMessage rtmpMsg = RTMPMessage.build(msg);
return rtmpMsg;
} else {
log.debug("Tag was null");
}