List of usage examples for io.netty.handler.codec.rtsp RtspMethods PLAY
HttpMethod PLAY
To view the source code for io.netty.handler.codec.rtsp RtspMethods PLAY.
Click Source Link
From source file:sas.systems.imflux.session.rtsp.SimpleRtspSession.java
License:Apache License
/** * {@inheritDoc}//w w w. j a va 2s . c o m */ @Override public void requestReceived(Channel channel, HttpRequest request) { if (!request.getDecoderResult().isSuccess()) return; LOG.debug("RTSP request received: {}", request); if (request.getMethod().equals(RtspMethods.OPTIONS)) { handleOptionsRequest(channel, request); } if (request.getMethod().equals(RtspMethods.DESCRIBE)) { if (this.requestListener.isEmpty()) { LOG.warn( "No requestListener registered, sending NOT_IMPLEMENTED as response of a DESCRIBE request!"); sendNotImplemented(channel, request); } // forward message (resource description is application specific) for (RtspRequestListener listener : this.requestListener) { listener.describeRequestReceived(request, RtspParticipant.newInstance(channel)); } } if (request.getMethod().equals(RtspMethods.ANNOUNCE)) { if (this.requestListener.isEmpty()) { LOG.warn( "No requestListener registered, sending NOT_IMPLEMENTED as response of an ANNOUNCE request!"); sendNotImplemented(channel, request); } // forward message (resource description is again application specific) for (RtspRequestListener listener : this.requestListener) { listener.announceRequestReceived(request, RtspParticipant.newInstance(channel)); } } if (request.getMethod().equals(RtspMethods.SETUP)) { handleSetupRequest(channel, request); } if (request.getMethod().equals(RtspMethods.PLAY)) { if (!automatedRtspHandling) { // forward message for (RtspRequestListener listener : this.requestListener) { listener.playRequestReceived(request, RtspParticipant.newInstance(channel)); } } else { sendNotImplemented(channel, request); } } if (request.getMethod().equals(RtspMethods.PAUSE)) { if (!automatedRtspHandling) { // forward message for (RtspRequestListener listener : this.requestListener) { listener.pauseRequestReceived(request, RtspParticipant.newInstance(channel)); } } else { sendNotImplemented(channel, request); } } if (request.getMethod().equals(RtspMethods.TEARDOWN)) { handleTeardownRequest(channel, request); } if (request.getMethod().equals(RtspMethods.GET_PARAMETER)) { if (this.requestListener.isEmpty()) { // RTSP assumes an empty body if content-length header is missing if (!request.headers().contains(RtspHeaders.Names.CONTENT_LENGTH)) { // assume this is a ping HttpResponse response = new DefaultHttpResponse(rtspVersion, RtspResponseStatuses.OK); response.headers().add(RtspHeaders.Names.CSEQ, request.headers().get(RtspHeaders.Names.CSEQ)); sendResponse(response, channel); } LOG.warn( "No requestListener registered, sending NOT_IMPLEMENTED as response of a GET_PARAMETER request!"); sendNotImplemented(channel, request); } // forward message (GET_PARAMETER is application specific) for (RtspRequestListener listener : this.requestListener) { listener.getParameterRequestReceived(request, RtspParticipant.newInstance(channel)); } } if (request.getMethod().equals(RtspMethods.SET_PARAMETER)) { if (this.requestListener.isEmpty()) { LOG.warn( "No requestListener registered, sending NOT_IMPLEMENTED as response of a SET_PARAMETER request!"); sendNotImplemented(channel, request); } // forward message (SET_PARAMETER is application specific) for (RtspRequestListener listener : this.requestListener) { listener.setParameterRequestReceived(request, RtspParticipant.newInstance(channel)); } } if (request.getMethod().equals(RtspMethods.REDIRECT)) { if (!automatedRtspHandling) { // forward message for (RtspRequestListener listener : this.requestListener) { listener.redirectRequestReceived(request, RtspParticipant.newInstance(channel)); } } else { sendNotImplemented(channel, request); } } if (request.getMethod().equals(RtspMethods.RECORD)) { if (!automatedRtspHandling) { // forward message for (RtspRequestListener listener : this.requestListener) { listener.recordRequestReceived(request, RtspParticipant.newInstance(channel)); } } else { sendNotImplemented(channel, request); } } }