/*
* (C) Copyright 2013 Kurento (http://kurento.org/)
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser General Public License
* (LGPL) version 2.1 which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-2.1.html
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*/
package com.kurento.kmf.content.internal.rtp;
import javax.servlet.AsyncContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.kurento.kmf.content.ContentCommand;
import com.kurento.kmf.content.ContentCommandResult;
import com.kurento.kmf.content.RtpContentHandler;
import com.kurento.kmf.content.RtpContentSession;
import com.kurento.kmf.content.internal.ContentSessionManager;
import com.kurento.kmf.content.internal.base.AbstractSdpContentSession;
import com.kurento.kmf.media.MediaPipeline;
import com.kurento.kmf.media.RtpEndpoint;
import com.kurento.kmf.media.SdpEndpoint;
/**
*
* Request implementation for a Player.
*
* @author Luis López (llopez@gsyc.es)
* @version 1.0.0
*/
public class RtpContentSessionImpl extends AbstractSdpContentSession implements
RtpContentSession {
/**
* Logger.
*/
private static final Logger log = LoggerFactory
.getLogger(RtpContentSessionImpl.class);
public RtpContentSessionImpl(RtpContentHandler handler,
ContentSessionManager manager, AsyncContext asyncContext,
String contentId) {
super(handler, manager, asyncContext, contentId);
}
@Override
protected SdpEndpoint buildSdpEndpoint(MediaPipeline mediaPipeline) {
return mediaPipeline.newRtpEndpoint().build();
}
@Override
public void start(RtpEndpoint rtpEndpoint) {
internalStart(rtpEndpoint);
}
/**
* Logger accessor (getter).
*/
@Override
protected Logger getLogger() {
return log;
}
@Override
public RtpContentHandler getHandler() {
return (RtpContentHandler) super.getHandler();
}
@Override
protected void interalRawCallToOnSessionTerminated(int code,
String description) throws Exception {
getHandler().onSessionTerminated(this, code, description);
}
@Override
protected void interalRawCallToOnContentStarted() throws Exception {
getHandler().onContentStarted(this);
}
@Override
protected void interalRawCallToOnContentError(int code, String description)
throws Exception {
getHandler().onSessionError(this, code, description);
}
@Override
protected void internalRawCallToOnContentRequest() throws Exception {
getHandler().onContentRequest(this);
}
@Override
protected void internalRawCallToOnUncaughtExceptionThrown(Throwable t)
throws Exception {
getHandler().onUncaughtException(this, t);
}
@Override
protected ContentCommandResult interalRawCallToOnContentCommand(
ContentCommand command) throws Exception {
return getHandler().onContentCommand(this, command);
}
}