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


Java Header.setDataType方法代码示例

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


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

示例1: write

import org.red5.server.net.rtmp.message.Header; //导入方法依赖的package包/类
/**
 * Writes packet from event data to RTMP connection and stream id.
 *
 * @param event
 *            Event data
 * @param streamId
 *            Stream id
 */
private void write(IRTMPEvent event, Number streamId) {
    log.trace("write to stream id: {} channel: {}", streamId, id);
    final Header header = new Header();
    final Packet packet = new Packet(header, event);
    // set the channel id
    header.setChannelId(id);
    int ts = event.getTimestamp();
    if (ts != 0) {
        header.setTimer(event.getTimestamp());
    }
    header.setStreamId(streamId);
    header.setDataType(event.getDataType());
    // should use RTMPConnection specific method.. 
    //log.trace("Connection type for write: {}", connection.getClass().getName());
    connection.write(packet);
}
 
开发者ID:Red5,项目名称:red5-server-common,代码行数:25,代码来源:Channel.java

示例2: write

import org.red5.server.net.rtmp.message.Header; //导入方法依赖的package包/类
/**
	 * Writes packet from event data to RTMP connection and stream id.
	 *
	 * @param event           Event data
	 * @param streamId        Stream id
	 */
	private void write(IRTMPEvent event, int streamId) {
		log.trace("write channel: {} stream id: {}", id, streamId);
		final Header header = new Header();
		final Packet packet = new Packet(header, event);
		header.setChannelId(id);
		int ts = event.getTimestamp();
		if (ts != 0) {
			header.setTimer(event.getTimestamp());			
		} else {
			// TODO may need to add generated timestamps at some point
//			int timestamp = connection.getTimer();
//			header.setTimerBase(timestamp);
//			event.setTimestamp(timestamp);
		}
		header.setStreamId(streamId);
		header.setDataType(event.getDataType());
		// should use RTMPConnection specific method.. 
		//log.trace("Connection type for write: {}", connection.getClass().getName());
		connection.write(packet);
	}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:27,代码来源:Channel.java

示例3: handleBadRequest

import org.red5.server.net.rtmp.message.Header; //导入方法依赖的package包/类
/**
 * Return an error message to the client.
 * 
 * @param message
 *            Message
 * @param resp
 *            Servlet response
 * @throws IOException
 *             on IO error
 */
protected void handleBadRequest(String message, HttpServletResponse resp) throws IOException {
    log.debug("handleBadRequest {}", message);
    //		resp.setStatus(HttpServletResponse.SC_BAD_REQUEST);
    //		resp.setHeader("Connection", "Keep-Alive");
    //		resp.setHeader("Cache-Control", "no-cache");
    //		resp.setContentType("text/plain");
    //		resp.setContentLength(message.length());
    //		resp.getWriter().write(message);
    //		resp.flushBuffer();

    // create and send a rejected status
    Status status = new Status(StatusCodes.NC_CONNECT_REJECTED, Status.ERROR, message);
    PendingCall call = new PendingCall(null, "onStatus", new Object[] { status });
    Invoke event = new Invoke();
    event.setCall(call);
    Header header = new Header();
    Packet packet = new Packet(header, event);
    header.setDataType(event.getDataType());
    // create dummy connection if local is empty
    RTMPConnection conn = (RTMPConnection) Red5.getConnectionLocal();
    if (conn == null) {
        try {
            conn = ((RTMPConnManager) manager).createConnectionInstance(RTMPTConnection.class);
            Red5.setConnectionLocal(conn);
        } catch (Exception e) {
        }
    }
    // encode the data
    RTMPProtocolEncoder encoder = new RTMPProtocolEncoder();
    IoBuffer out = encoder.encodePacket(packet);
    // send the response
    returnMessage(null, out, resp);
    // clear local
    Red5.setConnectionLocal(null);
}
 
开发者ID:Red5,项目名称:red5-server,代码行数:46,代码来源:RTMPTServlet.java

示例4: testHeaders

import org.red5.server.net.rtmp.message.Header; //导入方法依赖的package包/类
public void testHeaders() {
	RTMP rtmp = new RTMP();
	Header header = new Header();
	header.setChannelId((byte) 0x12);
	header.setDataType(TYPE_INVOKE);
	header.setStreamId(100);
	header.setTimer(2);
	header.setSize(320);
	IoBuffer buf = encoder.encodeHeader(rtmp, header, null);
	buf.flip();
	log.debug(buf.getHexDump());
	Assert.assertNotNull(buf);
	Header result = decoder.decodeHeader(buf, null);
	Assert.assertEquals(header, result);
}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:16,代码来源:RTMPTestCase.java


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