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


Java RtspResponseStatuses类代码示例

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


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

示例1: getcSeq

import org.jboss.netty.handler.codec.rtsp.RtspResponseStatuses; //导入依赖的package包/类
/**
 * Metodo que extrae la cabecera de una peticion el CSeq
 */
private int getcSeq(HttpRequest request) throws RtspRequestException {

	int cSeq;
	String str_cSeq;


	str_cSeq = request.getHeader("CSeq");

	if(str_cSeq==null){
		throw new RtspRequestException("Request not contains CSeq header", RtspResponseStatuses.BAD_REQUEST);
	}

	try {
		cSeq = Integer.parseInt(str_cSeq);
	}
	catch(Exception e) {
		throw new RtspRequestException("CSeq header must be a number", RtspResponseStatuses.BAD_REQUEST);
	}

	return cSeq;	
}
 
开发者ID:laggc,项目名称:rtsp_multicast_pfc,代码行数:25,代码来源:RtspServerListener.java

示例2: messageReceived

import org.jboss.netty.handler.codec.rtsp.RtspResponseStatuses; //导入依赖的package包/类
@Override
public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent evt) throws Exception {
	final HttpRequest req = (HttpRequest)evt.getMessage();

	s_logger.warning("Method " + req.getMethod() + " is not supported");

	final HttpResponse response = new DefaultHttpResponse(RtspVersions.RTSP_1_0,  RtspResponseStatuses.METHOD_NOT_VALID);
	ctx.getChannel().write(response);
}
 
开发者ID:SergioChan,项目名称:Android-Airplay-Server,代码行数:10,代码来源:RtspUnsupportedResponseHandler.java

示例3: recordReceived

import org.jboss.netty.handler.codec.rtsp.RtspResponseStatuses; //导入依赖的package包/类
/**
 * Handles RECORD request. We did all the work during ANNOUNCE and SETUP, so there's nothing
 * more to do.
 * 
 * iTunes reports the initial RTP sequence and playback time here, which would actually be
 * helpful. But iOS doesn't, so we ignore it all together.
 */
public synchronized void recordReceived(final ChannelHandlerContext ctx, final HttpRequest req) throws Exception {
	if (audioStreamInformationProvider == null){
		throw new ProtocolException("Audio stream not configured, cannot start recording");
	}		
	LOG.info("Client started streaming");
	
	audioOutputQueue.startAudioProcessing();
	timingHandler.startTimeSync();
	
	final HttpResponse response = new DefaultHttpResponse(RtspVersions.RTSP_1_0,  RtspResponseStatuses.OK);
	ctx.getChannel().write(response);
}
 
开发者ID:SergioChan,项目名称:Android-Airplay-Server,代码行数:20,代码来源:RaopAudioHandler.java

示例4: flushReceived

import org.jboss.netty.handler.codec.rtsp.RtspResponseStatuses; //导入依赖的package包/类
/**
 * Handle FLUSH requests.
 * 
 * iTunes reports the last RTP sequence and playback time here, which would actually be
 * helpful. But iOS doesn't, so we ignore it all together.
 */
private synchronized void flushReceived(final ChannelHandlerContext ctx, final HttpRequest req) {
	if (audioOutputQueue != null){
		audioOutputQueue.flush();
	}

	LOG.info("Client paused streaming, flushed audio output queue");

	final HttpResponse response = new DefaultHttpResponse(RtspVersions.RTSP_1_0,  RtspResponseStatuses.OK);
	ctx.getChannel().write(response);
}
 
开发者ID:SergioChan,项目名称:Android-Airplay-Server,代码行数:17,代码来源:RaopAudioHandler.java

示例5: teardownReceived

import org.jboss.netty.handler.codec.rtsp.RtspResponseStatuses; //导入依赖的package包/类
/**
 * Handle TEARDOWN requests. 
 */
private synchronized void teardownReceived(final ChannelHandlerContext ctx, final HttpRequest req) {
	final HttpResponse response = new DefaultHttpResponse(RtspVersions.RTSP_1_0,  RtspResponseStatuses.OK);
	ctx.getChannel().setReadable(false);
	ctx.getChannel().write(response).addListener(new ChannelFutureListener() {
		@Override
		public void operationComplete(final ChannelFuture future) throws Exception {
			future.getChannel().close();
			LOG.info("RTSP connection closed after client initiated teardown");
		}
	});
}
 
开发者ID:SergioChan,项目名称:Android-Airplay-Server,代码行数:15,代码来源:RaopAudioHandler.java

示例6: setParameterReceived

import org.jboss.netty.handler.codec.rtsp.RtspResponseStatuses; //导入依赖的package包/类
/**
 * Handle SET_PARAMETER request. Currently only {@code volume} is supported
 */
public synchronized void setParameterReceived(final ChannelHandlerContext ctx, final HttpRequest req) throws ProtocolException {
	/* Body in ASCII encoding with unix newlines */
	final String body = req.getContent().toString(Charset.forName("ASCII")).replace("\r", "");

	/* Handle parameters */
	for(final String line: body.split("\n")) {
		try {
			/* Split parameter into name and value */
			final Matcher m_parameter = s_pattern_parameter.matcher(line);
			if (!m_parameter.matches()){
				throw new ProtocolException("Cannot parse line " + line);
			}

			final String name = m_parameter.group(1);
			final String value = m_parameter.group(2);

			if ("volume".equals(name)) {
				if (audioOutputQueue != null){
					float vol = Math.abs(Float.parseFloat(value));
					vol = (float) (1.0 - (vol / 29.0));
					audioOutputQueue.setRequestedVolume(vol);
				}
			}
		}
		catch (final Throwable e) {
			throw new ProtocolException("Unable to parse line " + line);
		}
	}

	final HttpResponse response = new DefaultHttpResponse(RtspVersions.RTSP_1_0,  RtspResponseStatuses.OK);
	ctx.getChannel().write(response);
}
 
开发者ID:SergioChan,项目名称:Android-Airplay-Server,代码行数:36,代码来源:RaopAudioHandler.java

示例7: getParameterReceived

import org.jboss.netty.handler.codec.rtsp.RtspResponseStatuses; //导入依赖的package包/类
/**
 * Handle GET_PARAMETER request. Currently only {@code volume} is supported
 */
public synchronized void getParameterReceived(final ChannelHandlerContext ctx, final HttpRequest req) throws ProtocolException {
	final StringBuilder body = new StringBuilder();

	if (audioOutputQueue != null) {
		/* Report output gain */
		body.append("volume: ");
		body.append(audioOutputQueue.getRequestedVolume());
		body.append("\r\n");
	}

	final HttpResponse response = new DefaultHttpResponse(RtspVersions.RTSP_1_0,  RtspResponseStatuses.OK);
	response.setContent(ChannelBuffers.wrappedBuffer(body.toString().getBytes(Charset.forName("ASCII"))));
	ctx.getChannel().write(response);
}
 
开发者ID:SergioChan,项目名称:Android-Airplay-Server,代码行数:18,代码来源:RaopAudioHandler.java

示例8: recordReceived

import org.jboss.netty.handler.codec.rtsp.RtspResponseStatuses; //导入依赖的package包/类
/**
 * Handles RECORD request. We did all the work during ANNOUNCE and SETUP, so there's nothing
 * more to do.
 * 
 * iTunes reports the initial RTP sequence and playback time here, which would actually be
 * helpful. But iOS doesn't, so we ignore it all together.
 */
public synchronized void recordReceived(final ChannelHandlerContext ctx, final HttpRequest req) throws Exception {
	if (audioStreamInformationProvider == null){
		throw new ProtocolException("Audio stream not configured, cannot start recording");
	}		
	LogManager.w("Client started streaming");
	
	audioOutputQueue.startAudioProcessing();
	timingHandler.startTimeSync();
	
	final HttpResponse response = new DefaultHttpResponse(RtspVersions.RTSP_1_0,  RtspResponseStatuses.OK);
	ctx.getChannel().write(response);
}
 
开发者ID:lukeqsun,项目名称:AirSpeakerMobile,代码行数:20,代码来源:RaopAudioHandler.java

示例9: flushReceived

import org.jboss.netty.handler.codec.rtsp.RtspResponseStatuses; //导入依赖的package包/类
/**
 * Handle FLUSH requests.
 * 
 * iTunes reports the last RTP sequence and playback time here, which would actually be
 * helpful. But iOS doesn't, so we ignore it all together.
 */
private synchronized void flushReceived(final ChannelHandlerContext ctx, final HttpRequest req) {
	if (audioOutputQueue != null){
		audioOutputQueue.flush();
	}

	LogManager.w("Client paused streaming, flushed audio output queue");

	final HttpResponse response = new DefaultHttpResponse(RtspVersions.RTSP_1_0,  RtspResponseStatuses.OK);
	ctx.getChannel().write(response);
}
 
开发者ID:lukeqsun,项目名称:AirSpeakerMobile,代码行数:17,代码来源:RaopAudioHandler.java

示例10: teardownReceived

import org.jboss.netty.handler.codec.rtsp.RtspResponseStatuses; //导入依赖的package包/类
/**
 * Handle TEARDOWN requests. 
 */
private synchronized void teardownReceived(final ChannelHandlerContext ctx, final HttpRequest req) {
	final HttpResponse response = new DefaultHttpResponse(RtspVersions.RTSP_1_0,  RtspResponseStatuses.OK);
	ctx.getChannel().setReadable(false);
	ctx.getChannel().write(response).addListener(new ChannelFutureListener() {
		@Override
		public void operationComplete(final ChannelFuture future) throws Exception {
			future.getChannel().close();
			LogManager.w("RTSP connection closed after client initiated teardown");
		}
	});
}
 
开发者ID:lukeqsun,项目名称:AirSpeakerMobile,代码行数:15,代码来源:RaopAudioHandler.java

示例11: getParameterReceived

import org.jboss.netty.handler.codec.rtsp.RtspResponseStatuses; //导入依赖的package包/类
/**
 * Handle GET_PARAMETER request. Currently only {@code volume} is supported
 */
public synchronized void getParameterReceived(final ChannelHandlerContext ctx, final HttpRequest req) throws ProtocolException {
	final StringBuilder body = new StringBuilder();
	 LogManager.e("====================getParameterReceived:"+req.toString());
	if (audioOutputQueue != null) {
		/* Report output gain */
		body.append("volume: ");
		body.append(audioOutputQueue.getRequestedVolume());
		body.append("\r\n");
	}

	final HttpResponse response = new DefaultHttpResponse(RtspVersions.RTSP_1_0,  RtspResponseStatuses.OK);
	response.setContent(ChannelBuffers.wrappedBuffer(body.toString().getBytes(Charset.forName("ASCII"))));
	ctx.getChannel().write(response);
}
 
开发者ID:lukeqsun,项目名称:AirSpeakerMobile,代码行数:18,代码来源:RaopAudioHandler.java

示例12: describeRequest

import org.jboss.netty.handler.codec.rtsp.RtspResponseStatuses; //导入依赖的package包/类
/**
 * Se ejecutará cuando recibamos una peticion de DESCRIBE.
 * Si hay algun error lanzará una RtspRequestException que será capturada
 * por el método onRtspRequest que lanzará un mensaje de error al cliente.
 * @param request
 * @param channel
 * @param cSeq
 * @throws RtspRequestException
 */
private void describeRequest(HttpRequest request, Channel channel, int cSeq) throws RtspRequestException  {

	//Extraemos la URI
	String uri = request.getUri();

	//Extraemos el media de la URI
	Media media = getMedia(uri);

	logger.info("Describe request a: " + uri);

	if(media==null){
		throw new RtspRequestException("Media not found",RtspResponseStatuses.SERVICE_UNAVAILABLE);	
	}

	//Extraemos el SDP
	String sdp = media.getSdp();

	//Creamos la respuesta afirmativa.
	RtspResponse response = new DefaultRtspResponse(RtspResponseStatuses.OK);
	response.addHeader("CSeq",cSeq);
	response.addHeader("Content-Type", "application/sdp");
	response.addHeader("Content-Length", sdp.length());
	ChannelBuffer sdpBuffer = ChannelBuffers.copiedBuffer(sdp, Charset.defaultCharset());
	response.setContent(sdpBuffer);

	//Enviamos la respuesta afirmativa.
	sendResponse(response, channel);
}
 
开发者ID:laggc,项目名称:rtsp_multicast_pfc,代码行数:38,代码来源:RtspServerListener.java

示例13: setupRequest

import org.jboss.netty.handler.codec.rtsp.RtspResponseStatuses; //导入依赖的package包/类
/**
 * Se ejecutará cuando recibamos una peticion de SETUP
 * Si hay algun error lanzará una RtspRequestException que será capturada
 * por el método onRtspRequest que lanzará un mensaje de error al cliente.
 * @param request
 * @param channel
 * @param cSeq
 * @throws RtspRequestException
 */
private void setupRequest(HttpRequest request, Channel channel, int cSeq) throws RtspRequestException {

	//Extreemos la URI
	String uri = request.getUri();

	//Comprobamos que la cabecera transport que se envia en la peticion es de tipo MULTICAST
	checkTransport(request);

	//Generamos el contenido de la cabecera de transporte que enviaremos
	String transport = generateTransport(uri);

	//Extraemos la sesion en caso de que ya haya un ID de sesión, y si no  genera una nueva
	String session= getSession(request, RtspMethods.SETUP );

	logger.info("Setup request a: " + uri);

	//Comprobamos que el ID de sesión esta en la lista del servidor.
	if(!checkSession(session)) {
		throw new RtspRequestException("Session not found",RtspResponseStatuses.SESSION_NOT_FOUND);
	}

	//En caso de que el transport generado sea null, es que no se ha encontrado el media.
	if(transport==null){
		throw new RtspRequestException("Stream not found",RtspResponseStatuses.SERVICE_UNAVAILABLE);	
	}

	//Generamos la respuesta positiva al SETUP
	RtspResponse response = new DefaultRtspResponse(RtspResponseStatuses.OK);
	response.addHeader("CSeq",cSeq);
	response.addHeader("Transport", transport);
	response.addHeader("Session", session);

	//Enviamos la respuesta
	sendResponse(response, channel);
}
 
开发者ID:laggc,项目名称:rtsp_multicast_pfc,代码行数:45,代码来源:RtspServerListener.java

示例14: playRequest

import org.jboss.netty.handler.codec.rtsp.RtspResponseStatuses; //导入依赖的package包/类
/**
 * Se ejecutará cuando recibamos una petición de PLAY
 * Si hay algun error lanzará una RtspRequestException que será capturada
 * por el método onRtspRequest que lanzará un mensaje de error al cliente.
 * @param request
 * @param channel
 * @param cSeq
 * @throws RtspRequestException
 */
private void playRequest(HttpRequest request, Channel channel, int cSeq) throws RtspRequestException {

	//Extraemos la URI
	String uri = request.getUri();

	//Extraemos el ID de sesión
	String session= getSession(request, RtspMethods.PLAY);

	//Comprobamos que existe el stream que se pdie
	if(!checkStream(uri)) {
		throw new RtspRequestException("Stream not found.",RtspResponseStatuses.SERVICE_UNAVAILABLE);
	}

	//Comprobamos que el ID de sesión existe
	if(!checkSession(session)) {
		throw new RtspRequestException("Session not found.",RtspResponseStatuses.SESSION_NOT_FOUND);
	}

	//Generamos la respuesta positiva al SETUP
	RtspResponse response = new DefaultRtspResponse(RtspResponseStatuses.OK);
	response.addHeader("CSeq",cSeq);
	response.addHeader("Session", session);

	//Enviamos la respuesta
	sendResponse(response, channel);	
}
 
开发者ID:laggc,项目名称:rtsp_multicast_pfc,代码行数:36,代码来源:RtspServerListener.java

示例15: checkProtocol

import org.jboss.netty.handler.codec.rtsp.RtspResponseStatuses; //导入依赖的package包/类
/**
 * Comprobamos en las peticiones que el protocolo RTSP es aceptado.
 * @param request
 * @throws RtspRequestException
 */
private void checkProtocol(HttpRequest request) throws RtspRequestException {

	if(request.getProtocolVersion() != RtspVersions.RTSP_1_0) {
		throw new RtspRequestException("RTSP Version not supported", RtspResponseStatuses.RTSP_VERSION_NOT_SUPPORTED);
	}
}
 
开发者ID:laggc,项目名称:rtsp_multicast_pfc,代码行数:12,代码来源:RtspServerListener.java


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