red5-1.0~svn4374.orig-plugins/0000755000175000017500000000000011760512622015774 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/jetty/0000755000175000017500000000000011760512612017132 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/jetty/build.xml0000644000175000017500000000716511430427735020771 0ustar drazzibdrazzib java.home is ${java.home} and the target version is ${java.target_version} red5.root is ${red5.root} javac version: ${java.version} Type ant -p for available targets" red5-1.0~svn4374.orig-plugins/jetty/ivy.xml0000644000175000017500000000541411431604103020457 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/jetty/lib/0000755000175000017500000000000011760512612017700 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/jetty/ivysettings.xml0000644000175000017500000000250711273707437022262 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/jetty/.classpath0000644000175000017500000000106011273707437021124 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/jetty/.project0000644000175000017500000000062411273707437020615 0ustar drazzibdrazzib jettyplugin Jetty Red5 plugin org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature red5-1.0~svn4374.orig-plugins/jetty/build.bat0000644000175000017500000000000311431604103020702 0ustar drazzibdrazzibantred5-1.0~svn4374.orig-plugins/jetty/build.properties0000644000175000017500000000024111430370560022342 0ustar drazzibdrazzib# Let the scripts know where your red5 is (ie. the location of the red5.jar) red5.root=c:/red5 debug.state=true # Jetty plugin version plugin.version=1.0 red5-1.0~svn4374.orig-plugins/jetty/src/0000755000175000017500000000000011760512612017721 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/jetty/src/jee-container.xml0000644000175000017500000001347511431604103023170 0ustar drazzibdrazzib java.lang.System getProperties getProperty red5.webapp.root getProperty http.host getProperty http.port getProperty https.port ${http.host} ${http.port} ${https.port} red5-1.0~svn4374.orig-plugins/jetty/src/jetty-web.xml0000644000175000017500000004771011431604103022356 0ustar drazzibdrazzib Default web.xml file. This file is applied to a Web application before it's own WEB_INF/web.xml file default org.mortbay.jetty.servlet.DefaultServlet acceptRanges true dirAllowed true redirectWelcome false maxCacheSize 4000000 maxCachedFileSize 260000 maxCachedFiles 100 useFileMappedBuffer false 0 gateway org.red5.server.net.servlet.AMFGatewayServlet 1 default / gateway /gateway jsp org.apache.jasper.servlet.JspServlet logVerbosityLevel DEBUG fork false xpoweredBy false 0 jsp *.jsp *.jspf *.jspx *.xsp *.JSP *.JSPF *.JSPX *.XSP 30 index.html index.htm index.jsp arISO-8859-6 beISO-8859-5 bgISO-8859-5 caISO-8859-1 csISO-8859-2 daISO-8859-1 deISO-8859-1 elISO-8859-7 enISO-8859-1 esISO-8859-1 etISO-8859-1 fiISO-8859-1 frISO-8859-1 hrISO-8859-2 huISO-8859-2 isISO-8859-1 itISO-8859-1 iwISO-8859-8 jaShift_JIS koEUC-KR ltISO-8859-2 lvISO-8859-2 mkISO-8859-5 nlISO-8859-1 noISO-8859-1 plISO-8859-2 ptISO-8859-1 roISO-8859-2 ruISO-8859-5 shISO-8859-5 skISO-8859-2 slISO-8859-2 sqISO-8859-2 srISO-8859-5 svISO-8859-1 trISO-8859-9 ukISO-8859-5 zhGB2312 zh_TWBig5 Forbidden /WEB-INF/* Forbidden /persistence/* red5-1.0~svn4374.orig-plugins/jetty/src/org/0000755000175000017500000000000011760512612020510 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/jetty/src/org/red5/0000755000175000017500000000000011760512612021347 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/jetty/src/org/red5/server/0000755000175000017500000000000011760512612022655 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/jetty/src/org/red5/server/net/0000755000175000017500000000000011760512612023443 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/jetty/src/org/red5/server/net/servlet/0000755000175000017500000000000011760512612025127 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/jetty/src/org/red5/server/net/servlet/ZAMFGatewayServlet.java0000644000175000017500000001002711273735254031426 0ustar drazzibdrazzibpackage org.red5.server.net.servlet; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.mina.core.buffer.IoBuffer; import org.apache.mina.core.future.ConnectFuture; import org.apache.mina.core.service.IoHandler; import org.apache.mina.core.service.IoHandlerAdapter; import org.apache.mina.core.session.IoSession; import org.apache.mina.transport.vmpipe.VmPipeAddress; import org.apache.mina.transport.vmpipe.VmPipeConnector; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class ZAMFGatewayServlet extends HttpServlet { private static final long serialVersionUID = 8763226003362000834L; @SuppressWarnings("all") protected static Logger log = LoggerFactory.getLogger(ZAMFGatewayServlet.class .getName()); public static final String APPLICATION_AMF = "application/x-amf"; /** {@inheritDoc} */ @Override protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { // Continuation cont = ContinuationSupport.getContinuation(req, this); log.info("Service"); if (req.getContentLength() == 0 || req.getContentType() == null || !req.getContentType().equals(APPLICATION_AMF)) { resp.setStatus(HttpServletResponse.SC_OK); resp.getWriter().write("Gateway"); resp.flushBuffer(); return; } IoBuffer reqBuffer = null; try { // req.getSession().getAttribute(REMOTING_CONNECTOR); reqBuffer = IoBuffer.allocate(req.getContentLength()); ServletUtils.copy(req.getInputStream(), reqBuffer.asOutputStream()); reqBuffer.flip(); // Connect to the server. VmPipeConnector connector = new VmPipeConnector(); IoHandler handler = new Handler(req, resp); connector.setHandler(handler); ConnectFuture connectFuture = connector.connect(new VmPipeAddress(5080)); connectFuture.awaitUninterruptibly(); IoSession session = connectFuture.getSession(); session.setAttribute("response", resp); session.write(reqBuffer); } catch (IOException e) { log.error("", e); } log.info("End"); } protected class Handler extends IoHandlerAdapter { protected HttpServletResponse resp; protected HttpServletRequest req; public Handler(HttpServletRequest req, HttpServletResponse resp) { this.req = req; this.resp = resp; } /** {@inheritDoc} */ @Override public void messageReceived(IoSession session, Object message) throws Exception { log.info("<< message " + message); if (message instanceof IoBuffer) { try { final ServletOutputStream out = resp.getOutputStream(); IoBuffer buf = (IoBuffer) message; resp.setStatus(HttpServletResponse.SC_OK); resp.setContentType(req.getContentType()); resp.setContentLength(buf.limit()); ServletUtils.copy(buf.asInputStream(), out); out.flush(); out.close(); } catch (IOException e) { log.error("Error sending response", e); } } } } } red5-1.0~svn4374.orig-plugins/jetty/src/org/red5/server/jetty/0000755000175000017500000000000011760512612024014 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/jetty/src/org/red5/server/jetty/rtmpt/0000755000175000017500000000000011760512612025162 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/jetty/src/org/red5/server/jetty/rtmpt/RTMPTLoader.java0000644000175000017500000000534411273735254030100 0ustar drazzibdrazzibpackage org.red5.server.jetty.rtmpt; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import org.eclipse.jetty.server.Server; import org.red5.logging.Red5LoggerFactory; import org.red5.server.api.IServer; import org.slf4j.Logger; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.context.support.ClassPathXmlApplicationContext; /** * Loader for the RTMPT server. * * @author The Red5 Project (red5@osflash.org) * @author Joachim Bauch (jojo@struktur.de) */ public class RTMPTLoader implements ApplicationContextAware { /** * Logger */ protected static Logger log = Red5LoggerFactory.getLogger(RTMPTLoader.class); /** * Application context */ protected ApplicationContext applicationContext; /** * RTMP config path */ protected String rtmptConfig = "classpath:/red5-rtmpt.xml"; /** * RTMP server */ protected Server rtmptServer; /** * Red5 server instance */ protected IServer server; /** * Setter for server * * @param server Server instance */ public void setServer(IServer server) { this.server = server; } /** {@inheritDoc} */ public void setApplicationContext(ApplicationContext context) throws BeansException { applicationContext = context; } /** * Initialization * @throws Exception Exception */ public void init() throws Exception { // So this class is left just starting jetty log.info("Loading RTMPT context from: " + rtmptConfig); ApplicationContext appCtx = new ClassPathXmlApplicationContext(rtmptConfig); Server rtmptServer = (Server) appCtx.getBean("Server"); log.info("Starting RTMPT server"); rtmptServer.start(); } } red5-1.0~svn4374.orig-plugins/jetty/src/org/red5/server/jetty/JettyApplicationContext.java0000644000175000017500000000371011273735254031520 0ustar drazzibdrazzibpackage org.red5.server.jetty; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import org.eclipse.jetty.webapp.WebAppContext; import org.red5.server.api.IApplicationContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Class that wraps a Jetty webapp context. * * @author The Red5 Project (red5@osflash.org) * @author Joachim Bauch (jojo@struktur.de) */ public class JettyApplicationContext implements IApplicationContext { /** * Logger */ protected static Logger log = LoggerFactory .getLogger(JettyApplicationContext.class); /** Store a reference to the Jetty webapp context. */ private WebAppContext context; /** * Wrap the passed Jetty webapp context. * * @param context */ protected JettyApplicationContext(WebAppContext context) { this.context = context; } /** {@inheritDoc} */ public void stop() { if (context.isRunning()) { try { context.stop(); } catch (Exception e) { log.error("Could not stop application context.", e); } } else { log.debug("Application context already stopped."); } } } red5-1.0~svn4374.orig-plugins/jetty/src/org/red5/server/jetty/Red5WebPropertiesConfiguration.java0000644000175000017500000001647711431604103032730 0ustar drazzibdrazzibpackage org.red5.server.jetty; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.util.EventListener; import java.util.Properties; import org.eclipse.jetty.server.handler.ContextHandler; import org.eclipse.jetty.util.resource.Resource; import org.eclipse.jetty.webapp.Configuration; import org.eclipse.jetty.webapp.WebAppContext; import org.red5.server.Context; import org.red5.server.ContextLoader; import org.red5.server.LoaderBase; import org.red5.server.WebScope; import org.red5.server.adapter.ApplicationAdapter; import org.red5.server.api.IClientRegistry; import org.red5.server.api.IMappingStrategy; import org.red5.server.api.IScopeResolver; import org.red5.server.api.IServer; import org.red5.server.api.service.IServiceInvoker; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.access.BeanFactoryLocator; import org.springframework.beans.factory.access.BeanFactoryReference; import org.springframework.context.ApplicationContext; import org.springframework.context.access.ContextSingletonBeanFactoryLocator; import org.springframework.web.context.support.GenericWebApplicationContext; /** * Red web properties configuration */ public class Red5WebPropertiesConfiguration implements Configuration, EventListener { private static final long serialVersionUID = 951479449391784526L; /** * Logger */ protected static Logger log = LoggerFactory.getLogger(Red5WebPropertiesConfiguration.class); /** * Web application context */ protected WebAppContext _context; /** {@inheritDoc} */ public void setWebAppContext(WebAppContext context) { _context = context; } /** {@inheritDoc} */ public WebAppContext getWebAppContext() { return _context; } /** {@inheritDoc} */ public void configureClassLoader() throws Exception { // Try to load classes from WEB-INF directory first before looking in the // system classpath. This fixes problems when using extended spring features // like mail and only having the additional .jar files in the WEB-INF/lib // directory. Please note that for example the spring-support.jar file must // be copied to the WEB-INF/lib directory, too as it's classloader is used // to load the additional classes. _context.setParentLoaderPriority(false); } /** {@inheritDoc} */ public void configureDefaults() throws Exception { } /** {@inheritDoc} */ public void configureWebApp() throws Exception { // Get context WebAppContext context = getWebAppContext(); this.configure(context); } @Override public void configure(WebAppContext context) throws Exception { log.debug("Configuring Jetty webapp"); // If app is already started... if (context.isStarted()) { log.debug("Cannot configure webapp after it is started"); return; } // Get WEB_INF directory Resource webInf = context.getWebInf(); if (webInf != null && webInf.isDirectory()) { // Get properties file with virtualHosts and context path Resource config = webInf.addPath("red5-web.properties"); if (config.exists()) { log.debug("Configuring red5-web.properties"); // Load configuration properties Properties props = new Properties(); props.load(config.getInputStream()); // Get context path and virtual hosts String contextPath = props.getProperty("webapp.contextPath"); String virtualHosts = props.getProperty("webapp.virtualHosts"); // Get hostnames String[] hostnames = virtualHosts.split(","); for (int i = 0; i < hostnames.length; i++) { hostnames[i] = hostnames[i].trim(); if (hostnames[i].equals("*")) { // A virtual host "null" must be used so requests for // any host will be served. hostnames = null; break; } } // Set virtual hosts and context path to context context.setVirtualHosts(hostnames); context.setContextPath(contextPath); LoaderBase.setRed5ApplicationContext(contextPath, new JettyApplicationContext(context)); } } else if (webInf == null) { // No WEB-INF directory found, register as default application log.info("No WEB-INF directory found for " + context.getContextPath() + ", creating default application."); BeanFactoryLocator bfl = ContextSingletonBeanFactoryLocator.getInstance("red5.xml"); BeanFactoryReference bfr = bfl.useBeanFactory("red5.common"); // Create WebScope dynamically WebScope scope = new WebScope(); IServer server = (IServer) bfr.getFactory().getBean(IServer.ID); scope.setServer(server); scope.setGlobalScope(server.getGlobal("default")); // Get default Red5 context from context loader that is JettyLoader in this case ApplicationContext appCtx = JettyLoader.getApplicationContext(); ContextLoader loader = (ContextLoader) appCtx.getBean("context.loader"); appCtx = loader.getContext("default.context"); // Create context for the WebScope and initialize Context scopeContext = new Context(); scopeContext.setContextPath("/"); scopeContext.setClientRegistry((IClientRegistry) appCtx.getBean("global.clientRegistry")); scopeContext.setMappingStrategy((IMappingStrategy) appCtx.getBean("global.mappingStrategy")); scopeContext.setServiceInvoker((IServiceInvoker) appCtx.getBean("global.serviceInvoker")); scopeContext.setScopeResolver((IScopeResolver) appCtx.getBean("red5.scopeResolver")); // The context needs an ApplicationContext so resources can be // resolved GenericWebApplicationContext webCtx = new GenericWebApplicationContext(); webCtx.setDisplayName("Automatic generated WebAppContext"); webCtx.setParent(appCtx); webCtx.setServletContext(ContextHandler.getCurrentContext()); scopeContext.setApplicationContext(webCtx); // Store context in scope scope.setContext(scopeContext); // Use default ApplicationAdapter as handler scope.setHandler(new ApplicationAdapter()); // Make available as "/" and allow access from all // hosts scope.setContextPath(context.getContextPath()); scope.setVirtualHosts("*"); LoaderBase.setRed5ApplicationContext(context.getContextPath(), new JettyApplicationContext(context)); // Register WebScope in server scope.register(); } } @Override public void deconfigure(WebAppContext context) throws Exception { } @Override public void postConfigure(WebAppContext context) throws Exception { } @Override public void preConfigure(WebAppContext context) throws Exception { } } red5-1.0~svn4374.orig-plugins/jetty/src/org/red5/server/jetty/JettyLoader.java0000644000175000017500000001406611431604103027104 0ustar drazzibdrazzibpackage org.red5.server.jetty; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.io.File; import org.eclipse.jetty.deploy.WebAppDeployer; import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.handler.ContextHandler; import org.eclipse.jetty.server.handler.ContextHandlerCollection; import org.eclipse.jetty.server.handler.HandlerCollection; import org.eclipse.jetty.util.thread.ThreadPool; import org.red5.server.LoaderBase; import org.red5.server.api.IApplicationContext; import org.red5.server.jmx.JMXAgent; import org.red5.server.jmx.mxbeans.LoaderMXBean; import org.red5.server.util.FileUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Class that loads Red5 applications using Jetty. */ public class JettyLoader extends LoaderBase implements LoaderMXBean { /** * Logger */ protected static Logger log = LoggerFactory.getLogger(JettyLoader.class); /** * Default web config filename */ protected String defaultWebConfig = "plugins/jetty-web.xml"; /** * IServer implementation */ protected Server jetty; protected Connector[] connectors; protected ThreadPool threadPool; protected HandlerCollection handlers; /** * Remove context from the current host. * * @param path Path */ @Override public void removeContext(String path) { Handler[] handlers = jetty.getHandlers(); for (Handler handler : handlers) { if (handler instanceof ContextHandler && ((ContextHandler) handler).getContextPath().equals(path)) { try { ((ContextHandler) handler).stop(); jetty.removeBean(handler); break; } catch (Exception e) { log.error("Could not remove context: {}", path, e); } } } IApplicationContext ctx = LoaderBase.removeRed5ApplicationContext(path); if (ctx != null) { ctx.stop(); } else { log.warn("Red5 application context could not be stopped, it was null for path: {}", path); } } /** * */ @SuppressWarnings("all") public void init() { log.info("Loading Jetty context"); // So this class is left just starting jetty try { if (webappFolder == null) { // Use default webapps directory webappFolder = FileUtil.formatPath(System.getProperty("red5.root"), "/webapps"); } System.setProperty("red5.webapp.root", webappFolder); log.info("Application root: {}", webappFolder); // root location for servlet container String serverRoot = System.getProperty("red5.root"); log.debug("Server root: {}", serverRoot); // set in the system for tomcat classes System.setProperty("jetty.home", serverRoot); System.setProperty("jetty.class.path", String.format("%s/lib%s%s/plugins", serverRoot, File.separator, serverRoot)); String[] handlersArr = new String[] { "org.eclipse.jetty.webapp.WebInfConfiguration", "org.eclipse.jetty.webapp.WebXmlConfiguration", "org.eclipse.jetty.webapp.JettyWebXmlConfiguration", "org.eclipse.jetty.webapp.TagLibConfiguration", "org.red5.server.jetty.Red5WebPropertiesConfiguration" }; // instance a new org.mortbay.jetty.Server log.info("Starting jetty servlet engine"); jetty = new Server(); jetty.setConnectors(connectors); jetty.setHandler(handlers); jetty.setThreadPool(threadPool); jetty.setStopAtShutdown(true); LoaderBase.setApplicationLoader(new JettyApplicationLoader(jetty, applicationContext)); try { // Add web applications from web app root with web config HandlerCollection contexts = (HandlerCollection) jetty.getChildHandlerByClass(ContextHandlerCollection.class); if (contexts == null) { contexts = (HandlerCollection) jetty.getChildHandlerByClass(HandlerCollection.class); } WebAppDeployer deployer = new WebAppDeployer(); deployer.setContexts(contexts); deployer.setWebAppDir(webappFolder); deployer.setDefaultsDescriptor(defaultWebConfig); deployer.setConfigurationClasses(handlersArr); deployer.setExtract(true); deployer.setParentLoaderPriority(true); deployer.start(); } catch (Exception e) { log.error("Error deploying web applications", e); } // Start Jetty jetty.start(); } catch (Exception e) { log.error("Error loading jetty", e); } finally { registerJMX(); } } //TODO: Implement this for those who want to use Jetty public boolean startWebApplication(String applicationName) { return false; } public void registerJMX() { JMXAgent.registerMBean(this, this.getClass().getName(), LoaderMXBean.class); } public Connector[] getConnectors() { return connectors; } public void setConnectors(Connector[] connectors) { this.connectors = connectors; } public void setThreadPool(ThreadPool threadPool) { this.threadPool = threadPool; } public void setHandlers(HandlerCollection handlers) { this.handlers = handlers; } /** * Shut server down */ public void shutdown() { log.info("Shutting down Jetty context"); JMXAgent.shutdown(); try { jetty.stop(); System.exit(0); } catch (Exception e) { log.warn("Jetty could not be stopped", e); System.exit(1); } } } red5-1.0~svn4374.orig-plugins/jetty/src/org/red5/server/jetty/JettyApplicationLoader.java0000644000175000017500000000642711273735254031312 0ustar drazzibdrazzibpackage org.red5.server.jetty; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import org.eclipse.jetty.server.Server; import org.eclipse.jetty.webapp.WebAppContext; import org.red5.server.api.IApplicationLoader; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.ApplicationContext; /** * Class that can load new applications in Jetty. * * @author The Red5 Project (red5@osflash.org) * @author Joachim Bauch (jojo@struktur.de) */ public class JettyApplicationLoader implements IApplicationLoader { /** * Logger */ protected static Logger log = LoggerFactory.getLogger(JettyApplicationContext.class); /** Stores reference to the Jetty server. */ private Server server; /** Stores reference to the root ApplicationContext. */ private ApplicationContext rootCtx; /** * Create new application loader for Jetty servers. * * @param server */ protected JettyApplicationLoader(Server server, ApplicationContext rootCtx) { this.server = server; this.rootCtx = rootCtx; } /** {@inheritDoc} */ public ApplicationContext getRootContext() { return rootCtx; } /** {@inheritDoc} */ public void loadApplication(String contextPath, String virtualHosts, String directory) throws Exception { String[] handlersArr = new String[] { "org.mortbay.jetty.webapp.WebInfConfiguration", "org.mortbay.jetty.webapp.WebXmlConfiguration", "org.mortbay.jetty.webapp.JettyWebXmlConfiguration", "org.mortbay.jetty.webapp.TagLibConfiguration", "org.red5.server.jetty.Red5WebPropertiesConfiguration" }; WebAppContext context = new WebAppContext(); // Get hostnames String[] hostnames = null; if (virtualHosts != null) { hostnames = virtualHosts.split(","); for (int i = 0; i < hostnames.length; i++) { hostnames[i] = hostnames[i].trim(); if (hostnames[i].equals("*")) { // A virtual host "null" must be used so requests for // any host will be served. hostnames = null; break; } } } context.setContextPath(contextPath); context.setVirtualHosts(hostnames); context.setConfigurationClasses(handlersArr); context.setDefaultsDescriptor("web-default.xml"); context.setExtractWAR(true); context.setWar(directory); context.setParentLoaderPriority(true); context.setServer(server); context.start(); } } red5-1.0~svn4374.orig-plugins/jetty/src/org/red5/server/script/0000755000175000017500000000000011760512612024161 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/jetty/src/org/red5/server/script/jython/0000755000175000017500000000000011760512612025474 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/jetty/src/org/red5/server/script/jython/JythonScriptFactory.java0000644000175000017500000001424411273735254032344 0ustar drazzibdrazzibpackage org.red5.server.script.jython; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.io.File; import java.io.FilenameFilter; import java.io.IOException; import org.eclipse.jetty.server.handler.ContextHandler; import org.eclipse.jetty.webapp.WebAppContext; import org.python.core.Py; import org.python.core.PyFunction; import org.python.core.PyJavaInstance; import org.python.core.PyObject; import org.python.core.PySystemState; import org.python.util.PythonInterpreter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.scripting.ScriptCompilationException; import org.springframework.scripting.ScriptFactory; import org.springframework.scripting.ScriptSource; import org.springframework.util.Assert; /** * {@link org.springframework.scripting.ScriptFactory} implementation for a * Python script. * * @author Yan Weng * @see A prototype of Jython ScriptFactory for Spring Framework */ public class JythonScriptFactory implements ScriptFactory { private static Logger logger = LoggerFactory.getLogger(JythonScriptFactory.class); private final String scriptSourceLocator; @SuppressWarnings("unchecked") private final Class[] scriptInterfaces; private final Object[] arguments; public JythonScriptFactory(String scriptSourceLocator) { Assert.hasText(scriptSourceLocator); this.scriptSourceLocator = scriptSourceLocator; this.scriptInterfaces = new Class[]{}; this.arguments = null; } @SuppressWarnings("unchecked") public JythonScriptFactory(String scriptSourceLocator, Class[] scriptInterfaces) { Assert.hasText(scriptSourceLocator); Assert.notEmpty(scriptInterfaces); this.scriptSourceLocator = scriptSourceLocator; this.scriptInterfaces = scriptInterfaces; this.arguments = null; } @SuppressWarnings("unchecked") public JythonScriptFactory(String scriptSourceLocator, Class[] scriptInterfaces, Object[] arguments) { Assert.hasText(scriptSourceLocator); Assert.notEmpty(scriptInterfaces); this.scriptSourceLocator = scriptSourceLocator; this.scriptInterfaces = scriptInterfaces; if (arguments == null || arguments.length == 0) { this.arguments = null; } else { this.arguments = arguments; } } /** {@inheritDoc} */ public String getScriptSourceLocator() { return scriptSourceLocator; } /** {@inheritDoc} */ @SuppressWarnings("unchecked") public Class[] getScriptInterfaces() { return scriptInterfaces; } /** {@inheritDoc} */ public boolean requiresConfigInterface() { return true; } /** {@inheritDoc} */ @SuppressWarnings("unchecked") public Object getScriptedObject(ScriptSource scriptSourceLocator, Class[] scriptInterfaces) throws IOException, ScriptCompilationException { // TODO: how to do this when running under Tomcat? ContextHandler handler = WebAppContext.getCurrentWebAppContext(); String basePath = ""; if (handler != null) { File root = handler.getBaseResource().getFile(); if (root != null && root.exists()) { basePath = root.getAbsolutePath() + File.separator + "WEB-INF" + File.separator; } } String strScript = scriptSourceLocator.getScriptAsString(); if (scriptInterfaces.length > 0) { try { PySystemState state = new PySystemState(); if (!"".equals(basePath)) { // Add webapp paths that can contain classes and .jar files to python search path state.path.insert(0, Py.newString(basePath + "classes")); File jarRoot = new File(basePath + "lib"); if (jarRoot.exists()) { for (String filename: jarRoot.list(new FilenameFilter() { public boolean accept(File dir, String name) { return (name.endsWith(".jar")); } })) { state.path.insert(1, Py.newString(basePath + "lib" + File.separator + filename)); } } } PythonInterpreter interp = new PythonInterpreter(null, state); interp.exec(strScript); PyObject getInstance = interp.get("getInstance"); if (!(getInstance instanceof PyFunction)) { throw new ScriptCompilationException("\"getInstance\" is not a function."); } PyObject _this; if (arguments == null) { _this = ((PyFunction) getInstance).__call__(); } else { PyObject[] args = new PyObject[arguments.length]; for (int i=0; i java.lang.System getProperties getProperty red5.webapp.root getProperty rtmpt.host getProperty rtmpt.port ${red5.config_root}/realm.properties red5-1.0~svn4374.orig-plugins/jetty/.settings/0000755000175000017500000000000011760512612021050 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/jetty/.settings/org.eclipse.jdt.core.prefs0000644000175000017500000005452611431604103026036 0ustar drazzibdrazzib#Sat Aug 14 11:46:59 PDT 2010 eclipse.preferences.version=1 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 org.eclipse.jdt.core.formatter.blank_lines_after_package=1 org.eclipse.jdt.core.formatter.blank_lines_before_field=1 org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 org.eclipse.jdt.core.formatter.blank_lines_before_method=1 org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 org.eclipse.jdt.core.formatter.blank_lines_before_package=0 org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false org.eclipse.jdt.core.formatter.comment.format_block_comments=false org.eclipse.jdt.core.formatter.comment.format_header=false org.eclipse.jdt.core.formatter.comment.format_html=true org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false org.eclipse.jdt.core.formatter.comment.format_line_comments=false org.eclipse.jdt.core.formatter.comment.format_source_code=true org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true org.eclipse.jdt.core.formatter.comment.indent_root_tags=true org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert org.eclipse.jdt.core.formatter.comment.line_length=80 org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true org.eclipse.jdt.core.formatter.compact_else_if=true org.eclipse.jdt.core.formatter.continuation_indentation=2 org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_empty_lines=false org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true org.eclipse.jdt.core.formatter.indentation.size=4 org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.join_lines_in_comments=true org.eclipse.jdt.core.formatter.join_wrapped_lines=true org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false org.eclipse.jdt.core.formatter.lineSplit=180 org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true org.eclipse.jdt.core.formatter.tabulation.char=mixed org.eclipse.jdt.core.formatter.tabulation.size=4 org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true red5-1.0~svn4374.orig-plugins/jetty/.settings/org.eclipse.jdt.ui.prefs0000644000175000017500000000016611273735254025532 0ustar drazzibdrazzib#Mon Nov 02 20:49:37 PST 2009 eclipse.preferences.version=1 formatter_profile=_Red5 formatter_settings_version=11 red5-1.0~svn4374.orig-plugins/authplugin/0000755000175000017500000000000011760512613020154 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/authplugin/build.xml0000644000175000017500000000664211750062613022004 0ustar drazzibdrazzib java.home is ${java.home} and the target version is ${java.target_version} red5.root is ${red5.root} javac version: ${java.version} Type ant -p for available targets" red5-1.0~svn4374.orig-plugins/authplugin/ivy.xml0000644000175000017500000000320711750062613021506 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/authplugin/lib/0000755000175000017500000000000011760512613020722 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/authplugin/ivysettings.xml0000644000175000017500000000320311750062613023263 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/authplugin/.classpath0000644000175000017500000000125711273707437022155 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/authplugin/.project0000644000175000017500000000060211250376401021616 0ustar drazzibdrazzib authplugin org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature red5-1.0~svn4374.orig-plugins/authplugin/build.properties0000644000175000017500000000013711251314615023367 0ustar drazzibdrazzib# Let the scripts know where your red5 is (ie. the location of the red5.jar) red5.root=c:/red5 red5-1.0~svn4374.orig-plugins/authplugin/src/0000755000175000017500000000000011760512613020743 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/authplugin/src/org/0000755000175000017500000000000011760512613021532 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/authplugin/src/org/red5/0000755000175000017500000000000011760512613022371 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/authplugin/src/org/red5/server/0000755000175000017500000000000011760512613023677 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/authplugin/src/org/red5/server/plugin/0000755000175000017500000000000011760512613025175 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/authplugin/src/org/red5/server/plugin/auth/0000755000175000017500000000000011760512613026136 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/authplugin/src/org/red5/server/plugin/auth/AuthPlugin.java0000644000175000017500000001026611265270000031055 0ustar drazzibdrazzibpackage org.red5.server.plugin.auth; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import org.apache.mina.core.buffer.IoBuffer; import org.red5.io.amf.AMF; import org.red5.io.amf.Output; import org.red5.io.object.Serializer; import org.red5.logging.Red5LoggerFactory; import org.red5.server.api.IConnection; import org.red5.server.net.rtmp.BaseRTMPHandler; import org.red5.server.net.rtmp.RTMPConnection; import org.red5.server.net.rtmp.event.IRTMPEvent; import org.red5.server.net.rtmp.event.Notify; import org.red5.server.net.rtmp.message.Header; import org.red5.server.net.rtmp.message.Packet; import org.red5.server.net.rtmp.status.StatusObject; import org.red5.server.plugin.Red5Plugin; import org.slf4j.Logger; /** * Provides FMS-style authentication features. * * @author Paul Gregoire */ public class AuthPlugin extends Red5Plugin { private static Logger log = Red5LoggerFactory.getLogger(AuthPlugin.class, "plugins"); private static Serializer serializer = new Serializer(); public void doStart() throws Exception { log.debug("Start"); } public void doStop() throws Exception { log.debug("Stop"); } public String getName() { return "authPlugin"; } //methods specific to this plug-in public FMSAuthenticationHandler getFMSAuthenticationHandler() { FMSAuthenticationHandler fah = null; try { fah = (FMSAuthenticationHandler) Class.forName("org.red5.server.plugin.auth.FMSAuthenticationHandler").newInstance(); } catch (Exception e) { log.error("FMSAuthenticationHandler could not be loaded", e); } return fah; } public Red5AuthenticationHandler getRed5AuthenticationHandler() { Red5AuthenticationHandler rah = null; try { rah = (Red5AuthenticationHandler) Class.forName("org.red5.server.plugin.auth.Red5AuthenticationHandler").newInstance(); } catch (Exception e) { log.error("Red5AuthenticationHandler could not be loaded", e); } return rah; } public SecureTokenHandler getSecureTokenHandler() { SecureTokenHandler sth = null; try { sth = (SecureTokenHandler) Class.forName("org.red5.server.plugin.auth.SecureTokenHandler").newInstance(); } catch (Exception e) { log.error("SecureTokenHandler could not be loaded", e); } return sth; } //common methods /** * Invokes the "onStatus" event on the client, passing our derived status. * * @param conn * @param status */ public static void writeStatus(IConnection conn, StatusObject status) { //make a buffer to put our data in IoBuffer buf = IoBuffer.allocate(128); buf.setAutoExpand(true); //create amf output Output out = new Output(buf); //mark it as an amf object buf.put(AMF.TYPE_OBJECT); //serialize our status status.serialize(out, serializer); //write trailer buf.put((byte) 0x00); buf.put((byte) 0x00); buf.put(AMF.TYPE_END_OF_OBJECT); //make the buffer read to be read buf.flip(); //create an RTMP event of Notify type IRTMPEvent event = new Notify(buf); //construct a packet Header header = new Header(); Packet packet = new Packet(header, event); //get our stream id int streamId = BaseRTMPHandler.getStreamId(); //set channel to "data" which im pretty sure is 3 header.setChannelId(3); header.setTimer(event.getTimestamp()); //0 header.setStreamId(streamId); header.setDataType(event.getDataType()); //write to the client ((RTMPConnection) conn).write(packet); } }red5-1.0~svn4374.orig-plugins/authplugin/src/org/red5/server/plugin/auth/SecureTokenHandler.java0000644000175000017500000000357011250376401032530 0ustar drazzibdrazzibpackage org.red5.server.plugin.auth; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import org.red5.logging.Red5LoggerFactory; import org.red5.server.adapter.ApplicationLifecycle; import org.red5.server.api.IConnection; import org.red5.server.net.rtmp.status.StatusCodes; import org.red5.server.net.rtmp.status.StatusObject; import org.slf4j.Logger; /** * Provides secure token capabilities using an application listener. * * @author Paul Gregoire * @author Dan Rossi */ public class SecureTokenHandler extends ApplicationLifecycle { private static Logger log = Red5LoggerFactory.getLogger(SecureTokenHandler.class, "plugins"); @Override public boolean appConnect(IConnection conn, Object[] params) { StatusObject status = new StatusObject(StatusCodes.NC_CONNECT_SUCCESS, StatusObject.STATUS, "Connection succeeded."); status.setAdditional("secureToken", "testing secure token status property from RED5 !!!"); //send the status object log.debug("Status: {}", status); AuthPlugin.writeStatus(conn, status); return true; } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootred5-1.0~svn4374.orig-plugins/authplugin/src/org/red5/server/plugin/auth/FMSAuthenticationHandler.javared5-1.0~svn4374.orig-plugins/authplugin/src/org/red5/server/plugin/auth/FMSAuthenticationHandler.ja0000644000175000017500000001703711305471453033306 0ustar drazzibdrazzibpackage org.red5.server.plugin.auth; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.security.Security; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import org.apache.commons.codec.binary.Base64; import org.bouncycastle.crypto.digests.MD5Digest; import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.red5.logging.Red5LoggerFactory; import org.red5.server.adapter.ApplicationLifecycle; import org.red5.server.api.IConnection; import org.red5.server.exception.ClientRejectedException; import org.red5.server.net.rtmp.status.StatusCodes; import org.red5.server.net.rtmp.status.StatusObject; import org.slf4j.Logger; /** * Provides FMS-style authentication using an application listener. * * @author Paul Gregoire * @author Dan Rossi * @author Gavriloaie Eugen-Andrei */ public class FMSAuthenticationHandler extends ApplicationLifecycle { private static Logger log = Red5LoggerFactory.getLogger(FMSAuthenticationHandler.class, "plugins"); private static StatusObject rejectMissingAuth = new StatusObject(StatusCodes.NC_CONNECT_REJECTED, StatusObject.ERROR, "[ code=403 .need auth; authmod=adobe ]"); private static StatusObject invalidAuthMod = new StatusObject(StatusCodes.NC_CONNECT_REJECTED, StatusObject.ERROR, "[ AccessManager.Reject ] : [ authmod=adobe ] : ?reason=invalid_authmod&opaque=-"); private static StatusObject noSuchUser = new StatusObject(StatusCodes.NC_CONNECT_REJECTED, StatusObject.ERROR, "[ AccessManager.Reject ] : [ authmod=adobe ] : ?reason=nosuchuser&opaque=sTQAAA="); /* private static StatusObject invalidSessionId = new StatusObject(StatusCodes.NC_CONNECT_REJECTED, StatusObject.ERROR, "[ AccessManager.Reject ] : [ authmod=adobe ] : ?reason=invalid_session_id&opaque=-"); */ //test password - testing only - user passwords should be looked up in a real implementation private static final String password = "test"; private static ConcurrentMap sessions = new ConcurrentHashMap(); static { //get security provider Security.addProvider(new BouncyCastleProvider()); } public boolean appConnect(IConnection conn, Object[] params) { log.info("appConnect"); boolean result = false; log.debug("Connection: {}", conn); log.debug("Params: {}", params); StatusObject status = null; Map connectionParams = conn.getConnectParams(); log.debug("Connection params: {}", connectionParams); if (!connectionParams.containsKey("queryString")) { //set as missing auth notification status = rejectMissingAuth; } else { //get the raw query string String rawQueryString = (String) connectionParams.get("queryString"); try { //parse into a usable query string UrlQueryStringMap queryString = UrlQueryStringMap.parse(rawQueryString); //get the values we want String user = queryString.get("user"); log.debug("User: {}", user); String authmod = queryString.get("authmod"); log.debug("Authmod: {}", authmod); //make sure they requested adobe auth if ("adobe".equals(authmod)) { String response = queryString.get("response"); log.debug("Response: {}", response); //no response yet, send salt etc. if (response != null) { //lookup session and remove at the same time AuthSession session = sessions.remove(user); //verify response if (session != null) { //1. construct the first part String str1 = user + session.salt + password; log.trace("Part 1: {}", str1); //2. md5 and base64 encode String hash1 = calculateMD5(str1); log.trace("Hash 1: {}", hash1); //3. construct second part using challenge from client //String str2 = hash1 + session.challenge + queryString.get("challenge"); String str2 = hash1 + queryString.get("opaque") + queryString.get("challenge"); log.trace("Part 2: {}", str2); //4. md5 and base64 encode String hash2 = calculateMD5(str2); log.trace("Hash 2: {}", hash2); //5. compare response with hash2 if (hash2.equals(response)) { log.debug("Response is valid"); //return success result = true; } else { log.info("Response {} did not match hash {}", response, hash2); } } else { status = noSuchUser; } } else { //create auth session AuthSession session = new AuthSession(); sessions.put(user, session); //set as rejected status = new StatusObject(StatusCodes.NC_CONNECT_REJECTED, StatusObject.ERROR, String.format("[ AccessManager.Reject ] : [ authmod=adobe ] : ?reason=needauth&user=%s&salt=%s&challenge=%s&opaque=%s", user, session.salt, session.challenge, session.opaque)); } } else { status = invalidAuthMod; } } catch (Exception e) { log.error("Error authenticating", e); } } //status.setAdditional("secureToken", "testing secure token status property from RED5 !!!"); //send the status object log.debug("Status: {}", status); if (!result) { throw new ClientRejectedException(status); } return result; } /** * Generate an MD5 hash and return encoded with Base64. * * @param input * @return */ private String calculateMD5(String input) { String result = null; MD5Digest md5; try { md5 = new MD5Digest(); byte[] output = null; try { byte[] buf = input.getBytes(); md5.update(buf, 0, buf.length); output = new byte[md5.getDigestSize()]; md5.doFinal(output, 0); } catch (Exception e) { log.error("State error", e); } //encode in b64 and strip any cr/lf byte[] res = Base64.encodeBase64(output); result = new String(res).replaceAll("(\r\n|\r|\n|\n\r)", ""); //result = Base64.encodeBase64String(output).replaceAll("(\r\n|\r|\n|\n\r)", ""); } catch (SecurityException e) { log.error("Security exception when getting MD5", e); } catch (Exception e) { log.error("Error using MD5", e); } return result; } private final class AuthSession { public String salt; public String challenge; public String opaque; @SuppressWarnings("unused") public long created = System.currentTimeMillis(); { salt = calculateMD5("red5rox"); challenge = calculateMD5("red5"); //these are equal for now opaque = challenge; } } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootred5-1.0~svn4374.orig-plugins/authplugin/src/org/red5/server/plugin/auth/Red5AuthenticationHandler.javared5-1.0~svn4374.orig-plugins/authplugin/src/org/red5/server/plugin/auth/Red5AuthenticationHandler.j0000644000175000017500000002074111305471453033313 0ustar drazzibdrazzibpackage org.red5.server.plugin.auth; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.security.Security; import java.util.HashMap; import java.util.Map; import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; import org.apache.commons.codec.binary.Base64; import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.bouncycastle.util.Arrays; import org.red5.logging.Red5LoggerFactory; import org.red5.server.adapter.ApplicationLifecycle; import org.red5.server.api.IConnection; import org.red5.server.exception.ClientRejectedException; import org.red5.server.net.rtmp.RTMPConnection; import org.red5.server.session.SessionManager; import org.slf4j.Logger; /** * Provides Red5 specific authentication using an application listener. * * This handler uses a basic challenge-response protocol: *
    *
  • Client requests a session
  • *
  • Server generates a unique, random ChallengeString (e.g. salt, guid) as well as a SessionID and sends both to client
  • *
  • Client gets UserID and Password from UI. Hashes the password once and call it PasswordHash. * Then combines PasswordHash with the random string received from server in step 2, * and hashes them together again, call this ResponseString
  • *
  • Client sends the server UserID, ResponseString and SessionID
  • *
  • Server looks up user’s stored PasswordHash based on UserID, and the original ChallengeString based on SessionID. * Then computes the ResponseHash by hashing the PasswordHash and ChallengeString. * If its equal to the ResponseString sent by user, then authentication succeeds.
  • *
* * @author Paul Gregoire */ public class Red5AuthenticationHandler extends ApplicationLifecycle { private static Logger log = Red5LoggerFactory.getLogger(Red5AuthenticationHandler.class, "plugins"); private static String rejectMissingAuth = "[ code=403 .need auth; authmod=red5 ]"; private static String invalidAuthMod = "[ AccessManager.Reject ] : [ authmod=red5 ] : ?reason=invalid_authmod"; private static String badAuth = "[ AccessManager.Reject ] : [ authmod=red5 ] : ?reason=badauth"; //private static String noSuchUser = "[ AccessManager.Reject ] : [ authmod=red5 ] : ?reason=nosuchuser"; //private static String invalidSessionId = "[ AccessManager.Reject ] : [ authmod=red5 ] : ?reason=invalid_session_id"; private Mac hmacSHA256; //salt to use for challenge string generation private String salt = "red5isthebeesknees"; //map of challenge strings, keyed by session id private Map sessionChallenges = new HashMap(); //test password - testing only - user passwords should be looked up in a real implementation private static final String password = "test"; static { //get security provider Security.addProvider(new BouncyCastleProvider()); } { try { hmacSHA256 = Mac.getInstance("HmacSHA256"); } catch (SecurityException e) { log.error("Security exception when getting HMAC", e); } catch (NoSuchAlgorithmException e) { log.error("HMAC SHA256 does not exist"); } } public boolean appConnect(IConnection conn, Object[] params) { log.info("appConnect"); boolean result = false; log.debug("Connection: {}", conn); log.debug("Params: {}", params); String status = badAuth; Map connectionParams = conn.getConnectParams(); log.debug("Connection params: {}", connectionParams); if (!connectionParams.containsKey("queryString")) { //set as missing auth notification status = rejectMissingAuth; } else { //get the raw query string String rawQueryString = (String) connectionParams.get("queryString"); try { //parse into a usable query string UrlQueryStringMap queryString = UrlQueryStringMap.parse(rawQueryString); //get the values we want String user = queryString.get("user"); log.debug("User: {}", user); String authmod = queryString.get("authmod"); log.debug("Authmod: {}", authmod); //make sure they requested red5 auth if ("red5".equals(authmod)) { String response = queryString.get("response"); if (response != null) { response = queryString.get("response").replace(' ', '+'); } log.debug("Response: {}", response); //try the querystring first String sessionId = queryString.get("sessionid"); if (sessionId == null) { //get the session id - try conn next sessionId = ((RTMPConnection) conn).getSessionId(); if (sessionId == null) { //use attribute if (conn.hasAttribute("sessionId")) { sessionId = conn.getStringAttribute("sessionId"); } else { sessionId = SessionManager.getSessionId(); conn.setAttribute("sessionId", sessionId); } } } log.debug("Session id: {}", sessionId); String challenge = null; if (response != null) { //look up challenge challenge = sessionChallenges.get(sessionId); //generate response hash to compare String responseHash = calculateHMACSHA256(challenge, password); log.debug("Generated response: {}", responseHash); log.debug("Generated response: {}", response); //decode both hashes before we compare otherwise we will have issues like //4+5WioxdBLhx4qajIybxkBkynDsv7KxtNzqj4V/VbzU != 4+5WioxdBLhx4qajIybxkBkynDsv7KxtNzqj4V/VbzU= if (Arrays.areEqual(Base64.decodeBase64(responseHash.getBytes()), Base64.decodeBase64(response.getBytes()))) { //if (responseHash.equals(response)) { //dont send success or this will override the rest of the listeners, just send true result = true; } } else if (authmod != null && user != null) { //generate a challenge challenge = calculateHMACSHA256(salt, sessionId); //store the generated data sessionChallenges.put(sessionId, challenge); //set as rejected status = String.format("[ AccessManager.Reject ] : [ authmod=red5 ] : ?reason=needauth&user=%s&sessionid=%s&challenge=%s", user, sessionId, challenge); } log.debug("Challenge: {}", challenge); } else { status = invalidAuthMod; } } catch (Exception e) { log.error("Error authenticating", e); } } //send the status object log.debug("Status: {}", status); if (!result) { //AuthPlugin.writeStatus(conn, status); throw new ClientRejectedException(status); } return result; } /** * Generate an HMAC-SHA256 hash and return encoded with Base64. * * @param key * @param input * @return */ private String calculateHMACSHA256(String key, String input) { byte[] output = null; try { hmacSHA256.init(new SecretKeySpec(key.getBytes(), "HmacSHA256")); output = hmacSHA256.doFinal(input.getBytes()); } catch (InvalidKeyException e) { log.error("Invalid key", e); } //String result = Base64.encodeBase64String(output); byte[] res = Base64.encodeBase64(output); String result = new String(res); //strip any cr/lf return result.replaceAll("(\r\n|\r|\n|\n\r)", ""); } public String getSalt() { return salt; } public void setSalt(String salt) { this.salt = salt; } } red5-1.0~svn4374.orig-plugins/authplugin/src/org/red5/server/plugin/auth/UrlQueryStringMap.java0000644000175000017500000000207411750062613032420 0ustar drazzibdrazzibpackage org.red5.server.plugin.auth; import java.util.HashMap; /** * Simple query string to map converter. * * @author Paul Gregoire * * @param * @param */ @SuppressWarnings("serial") public final class UrlQueryStringMap extends HashMap { public UrlQueryStringMap() { super(); } /** * Parse a given query string and return an instance of this class. * * @param queryString * @return */ public static UrlQueryStringMap parse(String queryString) { UrlQueryStringMap map = new UrlQueryStringMap(); // String tmp = queryString; //check if we start with '?' or not if (queryString.charAt(0) != '?') { tmp = queryString.split("\\?")[1]; } else if (queryString.charAt(0) == '?') { tmp = queryString.substring(1); } //now break up into key/value blocks String[] kvs = tmp.split("&"); //take each key/value block and break into its key value parts for (String kv : kvs) { String[] split = kv.split("=", 2); map.put(split[0], split[1]); } return map; } }red5-1.0~svn4374.orig-plugins/authplugin/.settings/0000755000175000017500000000000011760512613022072 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/authplugin/.settings/org.eclipse.jdt.core.prefs0000644000175000017500000005305311250376401027057 0ustar drazzibdrazzib#Sat Aug 29 19:43:09 PDT 2009 eclipse.preferences.version=1 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 org.eclipse.jdt.core.formatter.blank_lines_after_package=1 org.eclipse.jdt.core.formatter.blank_lines_before_field=1 org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 org.eclipse.jdt.core.formatter.blank_lines_before_method=1 org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 org.eclipse.jdt.core.formatter.blank_lines_before_package=0 org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false org.eclipse.jdt.core.formatter.comment.format_block_comments=false org.eclipse.jdt.core.formatter.comment.format_header=false org.eclipse.jdt.core.formatter.comment.format_html=true org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false org.eclipse.jdt.core.formatter.comment.format_line_comments=false org.eclipse.jdt.core.formatter.comment.format_source_code=true org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true org.eclipse.jdt.core.formatter.comment.indent_root_tags=true org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert org.eclipse.jdt.core.formatter.comment.line_length=80 org.eclipse.jdt.core.formatter.compact_else_if=true org.eclipse.jdt.core.formatter.continuation_indentation=2 org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_empty_lines=false org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true org.eclipse.jdt.core.formatter.indentation.size=4 org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false org.eclipse.jdt.core.formatter.lineSplit=120 org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true org.eclipse.jdt.core.formatter.tabulation.char=mixed org.eclipse.jdt.core.formatter.tabulation.size=4 org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true red5-1.0~svn4374.orig-plugins/authplugin/.settings/org.eclipse.jdt.ui.prefs0000644000175000017500000000016611250376401026541 0ustar drazzibdrazzib#Sat Aug 29 19:43:09 PDT 2009 eclipse.preferences.version=1 formatter_profile=_Red5 formatter_settings_version=11 red5-1.0~svn4374.orig-plugins/mpeg-ts/0000755000175000017500000000000011760512622017350 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/mpeg-ts/readme.txt0000644000175000017500000000546711435354552021367 0ustar drazzibdrazzibMPEG-TS Plug-in By: Paul Gregoire The segmenter service must be configured in your red5-web.xml where the mpeg-ts streaming will be used. The segment directory property may be configured with a full path to where your segments will be written if you are using file-based segments. If the "%s" is present when this is parsed, it will be replaced with your applications directory. The web.xml for your application must also have the following servlets defined, which will provide the requested playlist and segments. Serves an HTTP streaming playlist PlayList PlayList org.red5.stream.http.servlet.PlayList minimumSegmentCount 3 startStreamOnRequest true Serves a segment TransportSegment TransportSegment org.red5.stream.http.servlet.TransportSegment PlayList *.m3u8 TransportSegment *.ts Lastly, if the playlist and segments are not defined in the primary web.xml for the server they will need to be defined in your application web.xml as follows. m3u8 application/x-mpegURL ts video/MP2T Special thanks to Infrared5 Inc. for donating the initial code. red5-1.0~svn4374.orig-plugins/mpeg-ts/build.xml0000644000175000017500000000717411435350704021202 0ustar drazzibdrazzib java.home is ${java.home} and the target version is ${java.target_version} red5.root is ${red5.root} javac version: ${java.version} Type ant -p for available targets" red5-1.0~svn4374.orig-plugins/mpeg-ts/ivy.xml0000644000175000017500000000377111435354552020716 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/mpeg-ts/lib/0000755000175000017500000000000011760512622020116 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/mpeg-ts/ivysettings.xml0000644000175000017500000000251011435350704022460 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/mpeg-ts/.classpath0000644000175000017500000000106011435350704021330 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/mpeg-ts/.project0000644000175000017500000000062711435350704021024 0ustar drazzibdrazzib mpegtsplugin MPEG-TS Red5 plugin org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature red5-1.0~svn4374.orig-plugins/mpeg-ts/build.bat0000644000175000017500000000000311435350704021130 0ustar drazzibdrazzibantred5-1.0~svn4374.orig-plugins/mpeg-ts/build.properties0000644000175000017500000000023311435350704022563 0ustar drazzibdrazzib# Let the scripts know where your red5 is (ie. the location of the red5.jar) red5.root=c:/red5 debug.state=true # Plugin version plugin.version=1.0 red5-1.0~svn4374.orig-plugins/mpeg-ts/src/0000755000175000017500000000000011760512622020137 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/mpeg-ts/src/org/0000755000175000017500000000000011760512622020726 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/mpeg-ts/src/org/red5/0000755000175000017500000000000011760512622021565 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/mpeg-ts/src/org/red5/service/0000755000175000017500000000000011760512622023225 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/mpeg-ts/src/org/red5/service/httpstream/0000755000175000017500000000000011760512622025420 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/mpeg-ts/src/org/red5/service/httpstream/mpegts-ipod320.properties0000644000175000017500000000035211435350704032213 0ustar drazzibdrazzibcoder=0 flags=+loop cmp=+chroma partitions=+parti4x4+partp8x8+partb8x8 subq=5 me_range=16 g=30 keyint_min=3 sc_threshold=40 i_qfactor=0.71 qcomp=0.6 qmin=10 qmax=51 qdiff=4 refs=1 trellis=1 rc_eq='blurCplx^(1-qComp)' red5-1.0~svn4374.orig-plugins/mpeg-ts/src/org/red5/service/httpstream/SegmenterService.java0000644000175000017500000004572511435354552031557 0ustar drazzibdrazzibpackage org.red5.service.httpstream; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.List; import java.util.Observable; import java.util.Observer; import java.util.Properties; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.atomic.AtomicInteger; import org.red5.logging.Red5LoggerFactory; import org.red5.service.httpstream.model.MediaFrame; import org.red5.service.httpstream.model.Segment; import org.red5.service.httpstream.model.VideoFrame; import org.red5.stream.http.xuggler.MpegTsHandlerFactory; import org.red5.stream.http.xuggler.MpegTsIoHandler; import org.red5.xuggler.Message; import org.slf4j.Logger; import org.springframework.beans.factory.DisposableBean; import org.springframework.beans.factory.InitializingBean; import com.xuggle.xuggler.Configuration; import com.xuggle.xuggler.ICodec; import com.xuggle.xuggler.IContainer; import com.xuggle.xuggler.IContainerFormat; import com.xuggle.xuggler.IPacket; import com.xuggle.xuggler.IPixelFormat; import com.xuggle.xuggler.IRational; import com.xuggle.xuggler.ISimpleMediaFile; import com.xuggle.xuggler.IStream; import com.xuggle.xuggler.IStreamCoder; import com.xuggle.xuggler.IVideoPicture; import com.xuggle.xuggler.SimpleMediaFile; /** * Creates, updates, locates, and manages media segments. * * @author Paul Gregoire */ public class SegmenterService implements InitializingBean, DisposableBean, Observer { private static Logger log = Red5LoggerFactory.getLogger(SegmenterService.class); // map of currently available (in-memory) segments, keyed by stream name private static ConcurrentMap segmentMap = new ConcurrentHashMap(); // queue to hold the items from the observables private static ConcurrentLinkedQueue queue = new ConcurrentLinkedQueue(); // private volatile boolean shutdown; // length of a segment in milliseconds private long segmentTimeLimit = 2000; //default = 2 seconds // where to write segment files private String segmentDirectory; // whether to use files or memory for segments private boolean memoryMapped; // time to sleep between queue checks private long queueSleepTime = 250L; // maximum number of segments to keep available per stream private int maxSegmentsPerFacade = 3; public long getSegmentTimeLimit() { return segmentTimeLimit; } public void setSegmentTimeLimit(long segmentTimeLimit) { this.segmentTimeLimit = segmentTimeLimit; } public String getSegmentDirectory() { return segmentDirectory; } public void setSegmentDirectory(String segmentDirectory) { this.segmentDirectory = segmentDirectory; } public boolean isMemoryMapped() { return memoryMapped; } public void setMemoryMapped(boolean memoryMapped) { this.memoryMapped = memoryMapped; } public long getQueueSleepTime() { return queueSleepTime; } public void setQueueSleepTime(long queueSleepTime) { this.queueSleepTime = queueSleepTime; } public int getMaxSegmentsPerFacade() { return maxSegmentsPerFacade; } public void setMaxSegmentsPerFacade(int maxSegmentsPerFacade) { this.maxSegmentsPerFacade = maxSegmentsPerFacade; } public int getSegmentCount(String streamName) { SegmentFacade facade = segmentMap.get(streamName); return facade.getSegmentCount(); } public Segment getSegment(String streamName) { SegmentFacade facade = segmentMap.get(streamName); return facade.getSegment(); } public Segment getSegment(String streamName, int index) { SegmentFacade facade = segmentMap.get(streamName); return facade.getSegment(index); } public boolean isAvailable(String streamName) { return segmentMap.containsKey(streamName); } public void afterPropertiesSet() throws Exception { //create our runnable and submit to an executor QueueWorker worker = new QueueWorker(); //Application.executorService.execute(worker); // this worker should check the queue at intervals and route messages } public void destroy() throws Exception { shutdown = true; } /** * Receives a media frame and queues it for later processing by a * worker thread. * * @param observed provider of media frames, usually a ReStreamer * @param frame a media frame */ public void update(Observable observed, Object frame) { //log.trace("Update from {} of {}", observed, frame); if (frame != null) { if (frame instanceof MediaFrame) { //the stream name must be supplied, a good place to pull this from is the //observed class String streamName = "mpegtsstream"; //((MyObservableClass) observed).getStreamName(); //queue the data queue.add(new QueuedItem(streamName, (MediaFrame) frame)); } else { log.warn("Unknown media frame received: {}", frame); } } else { //if we get a null frame, that indicates that the source is done //sending data to us String streamName = "mpegtsstream"; //((MyObservableClass) observed).getStreamName(); SegmentFacade facade = segmentMap.remove(streamName); if (facade != null) { Segment segment = facade.getSegment(); segment.setLast(true); segment.close(); } else { log.warn("Segment facade not found for {}", streamName); } } } /** * Common location for segment related objects. */ private class SegmentFacade { // map of currently available segments ConcurrentLinkedQueue segments = new ConcurrentLinkedQueue(); // segment currently being written to volatile Segment segment; // segment index counter AtomicInteger counter = new AtomicInteger(); final String streamName; MpegTsIoHandler outputHandler; IContainer contOutp; IStream strOutp; IStreamCoder strmCoderOutp; SegmentFacade(String streamName, MediaFrame frame) { this.streamName = streamName; // setup output setupOutput(frame); } public int getSegmentCount() { return segments.size(); } /** * Set up the output using the segment and the first video frame. * * @param segment * @param frame */ private void setupOutput(MediaFrame frame) { log.debug("setupOutput - name: {} frame: {}", streamName, frame); VideoFrame videoFrame = (VideoFrame) frame; ISimpleMediaFile outputStreamInfo = new SimpleMediaFile(); outputStreamInfo.setHasAudio(false); outputStreamInfo.setHasVideo(true); outputStreamInfo.setVideoWidth(videoFrame.getWidth()); outputStreamInfo.setVideoHeight(videoFrame.getHeight()); outputStreamInfo.setVideoBitRate(200000); outputStreamInfo.setVideoCodec(ICodec.ID.CODEC_ID_H264); outputStreamInfo.setVideoGlobalQuality(0); // output to a custom handler String urlOutp = MpegTsHandlerFactory.DEFAULT_PROTOCOL + ':' + streamName; outputStreamInfo.setURL(urlOutp); //setup our rtmp io handler outputHandler = new MpegTsIoHandler(streamName) { // store the latest PAT data ByteBuffer patData = null; @Override public void write(Message message) throws InterruptedException { ByteBuffer data = message.getData(); if (data != null) { log.trace("[{}] Writing message to segment: {}", streamName, data.toString()); //keep track of the latest PAT data if (message.getType() == Message.Type.CONFIG_PAT) { data.mark(); byte[] copy = new byte[data.limit()]; data.get(copy); patData = ByteBuffer.wrap(copy); data.reset(); } // indicates whether or not a new segment was created for this iteration boolean newSegment = false; // check active segment if (segment == null) { log.debug("Segment not found for {}, creating new instance", streamName); // create a segment - default is memory mapped segment = new Segment(segmentDirectory, streamName, counter.getAndIncrement(), memoryMapped); // add to the map for lookup segments.add(segment); // flag that we created a new segment newSegment = true; } else { //see if we need a new segment if (System.currentTimeMillis() - segment.getCreated() >= segmentTimeLimit) { log.debug("Starting a new segment for {} (time limit reached {} ms)", streamName, segmentTimeLimit); // close active segment if (!segment.close()) { log.info("[{}] Problem closing segment, index: {}", streamName, segment.getIndex()); } // create a segment segment = new Segment(segmentDirectory, streamName, counter.getAndIncrement(), memoryMapped); // add the new segment segments.add(segment); // flag that we created a new segment newSegment = true; } } //write the data to the segment if (newSegment) { // write the PAT if (patData != null) { if (!segment.write(patData)) { log.warn("[{}] Write of PAT to segment failed", streamName); } } else { log.debug("[{}] PAT data was null for new segment", streamName); } // enforce segment list length if (segments.size() > maxSegmentsPerFacade) { //get current segments index minux max int index = segment.getIndex() - maxSegmentsPerFacade; for (Segment seg : segments) { if (seg.getIndex() <= index) { segments.remove(seg); // access to the segment is no longer required seg.dispose(); } } } } // prevent writing the PAT twice if (message.getType() != Message.Type.CONFIG_PAT && newSegment) { if (!segment.write(data)) { log.warn("[{}] Write to segment failed", streamName); } } else { if (!segment.write(data)) { log.warn("[{}] Write to segment failed", streamName); } } } else if (message.getType() == Message.Type.END_STREAM) { if (segment != null) { segment.setLast(true); segment.close(); } } } }; MpegTsHandlerFactory.getFactory().registerStream(outputHandler, outputStreamInfo); IContainerFormat contOutpFormat = IContainerFormat.make(); contOutpFormat.setOutputFormat("mpegts", urlOutp, null); if (log.isTraceEnabled()) { log.trace("Codecs for mpeg-ts output type"); for (ICodec.ID id : contOutpFormat.getOutputCodecsSupported()) { log.trace("{}", id); } //log.trace("Container supports H264: {}", contOutpFormat.isCodecSupportedForOutput(ICodec.ID.CODEC_ID_H264)); //contOutpFormat.establishOutputCodecId(ICodec.ID.CODEC_ID_H264); //log.trace("Container supports H264: {}", contOutpFormat.isCodecSupportedForOutput(ICodec.ID.CODEC_ID_H264)); } log.debug("Stream to output: {}", urlOutp); // Open the output container for writing. contOutp = IContainer.make(); int retVal = contOutp.open(urlOutp, IContainer.Type.WRITE, contOutpFormat); if (retVal < 0) { throw new RuntimeException("Could not open output container at URL: " + urlOutp); } // We're only trying to output one video stream, so create it in the // container strOutp = contOutp.addNewStream(0); strmCoderOutp = strOutp.getStreamCoder(); // Setup output stream coder now. After demuxing and decoding, we encode // video data into MPEG-TS format. strmCoderOutp.setCodec(ICodec.ID.CODEC_ID_H264); try { InputStream in = SegmenterService.class.getResourceAsStream("mpegts-ipod320.properties"); Properties props = new Properties(); props.load(in); log.trace("partitions: {}", props.get("partitions")); log.trace("flags: {}", props.get("flags")); int retval = Configuration.configure(props, strmCoderOutp); if (retval < 0) { throw new RuntimeException("Could not configure coder from preset file"); } } catch (IOException e) { e.printStackTrace(); } int origWidth = outputStreamInfo.getVideoWidth(); int origHeight = outputStreamInfo.getVideoHeight(); if (origWidth <= 0 || origHeight <= 0) { throw new RuntimeException("Couldn't find width or height in original video stream: " + streamName); } strmCoderOutp.setBitRate(outputStreamInfo.getVideoBitRate()); strmCoderOutp.setBitRateTolerance(outputStreamInfo.getVideoBitRate() / 8); strmCoderOutp.setProperty("level", 30); strmCoderOutp.setProperty("async", 2); //strmCoderOutp.setProperty("re", true); strmCoderOutp.setProperty("an", true); strmCoderOutp.setWidth(origWidth); strmCoderOutp.setHeight(origHeight); strmCoderOutp.setPixelType(IPixelFormat.Type.YUV420P); strmCoderOutp.setGlobalQuality(outputStreamInfo.getVideoGlobalQuality()); strmCoderOutp.setNumPicturesInGroupOfPictures(3); strmCoderOutp.setFlag(IStreamCoder.Flags.FLAG_QSCALE, true); //dynamic FPS - http://wiki.xuggle.com/Concepts //IRational frameRate = IRational.make(videoFrame.getFps(), 1000); IRational frameRate = IRational.make(10, 1); strmCoderOutp.setFrameRate(frameRate); // use the inverse of the framerate strmCoderOutp.setTimeBase(IRational.make(frameRate.getDenominator(), frameRate.getNumerator())); log.debug("[{}] Output rational values - num: {} denom: {}", new Object[] { streamName, frameRate.getNumerator(), frameRate.getDenominator() }); frameRate = null; if (log.isTraceEnabled()) { log.trace("=== Output coder configured, info: ==="); log.trace("Type: {}", strmCoderOutp.getCodecType()); log.trace("Codec: {}", strmCoderOutp.getCodecID()); log.trace("Stream timebase: {} / {}", strOutp.getTimeBase().getNumerator(), strOutp.getTimeBase() .getDenominator()); log.trace("Coder timebase: {} / {}", strmCoderOutp.getTimeBase().getNumerator(), strmCoderOutp.getTimeBase() .getDenominator()); log.trace("Video width: {}", strmCoderOutp.getWidth()); log.trace("Video height: {}", strmCoderOutp.getHeight()); log.trace("Video pixel type: {}", strmCoderOutp.getPixelType()); log.trace("Frame rate: {}", strmCoderOutp.getFrameRate().getDouble()); log.trace("=== END OF STREAM INFO ==="); } retVal = strmCoderOutp.open(); if (retVal < 0) { throw new RuntimeException("Couldn't open output encoder for stream: " + streamName); } retVal = contOutp.writeHeader(); if (retVal < 0) { throw new RuntimeException("Couldn't write output header: " + streamName); } log.debug("setupOutput - name: {} finished", streamName); } /** * Returns the active segment. * * @return segment currently being written to */ public Segment getSegment() { return segment; } /** * Returns a segment matching the requested index. * * @return segment matching the index or null */ public Segment getSegment(int index) { Segment result = null; for (Segment seg : segments) { if (seg.getIndex() == index) { result = seg; break; } } return result; } public void encode(MediaFrame frame) { IPacket packet = IPacket.make(); if (frame instanceof VideoFrame) { VideoFrame videoFrame = (VideoFrame) frame; ByteBuffer buf = videoFrame.getData(); byte[] data = new byte[buf.limit()]; buf.get(data); IVideoPicture picture = IVideoPicture.make(IPixelFormat.Type.YUV420P, videoFrame.getWidth(), videoFrame.getHeight()); picture.put(data, 0, 0, data.length); picture.setComplete(true, IPixelFormat.Type.YUV420P, videoFrame.getWidth(), videoFrame.getHeight(), videoFrame.getTimestamp()); strmCoderOutp.encodeVideo(packet, picture, 0); //} else if (frame instanceof AudioFrame) { //strmCoderOutp.encodeAudio(packet, audioSamples, sampleToStartFrom) } contOutp.writePacket(packet); } } /** * Stores the data from the observable until it is routed to a segment. */ private class QueuedItem { private String streamName; private MediaFrame frame; public QueuedItem(String streamName, MediaFrame frame) { this.streamName = streamName; this.frame = frame; } public String getStreamName() { return streamName; } public MediaFrame getFrame() { return frame; } } /** * Routes the queued data to the segments. */ private class QueueWorker implements Runnable { String lastLogMessage = null; @Override public void run() { do { if (log.isTraceEnabled()) { String logMessage = String.format("Queue worker running.. queue size: %s", queue.size()); if (!logMessage.equals(lastLogMessage)) { log.trace(logMessage); } lastLogMessage = logMessage; } if (!queue.isEmpty()) { List processedItems = new ArrayList(); for (QueuedItem item : queue) { String streamName = item.getStreamName(); MediaFrame frame = item.getFrame(); // lookup the associated segment SegmentFacade facade = segmentMap.get(streamName); if (facade == null) { log.debug("Segment facade not found for {}, creating new instance", streamName); //create a facade facade = new SegmentFacade(streamName, frame); segmentMap.put(streamName, facade); } //encode and add the frame to the segment facade.encode(frame); //add to removal list processedItems.add(item); } //clean out the queue queue.removeAll(processedItems); } else { try { Thread.sleep(queueSleepTime); } catch (InterruptedException e) { log.error("", e); } } } while (!shutdown); } } } red5-1.0~svn4374.orig-plugins/mpeg-ts/src/org/red5/service/httpstream/model/0000755000175000017500000000000011760512622026520 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/mpeg-ts/src/org/red5/service/httpstream/model/Segment.java0000644000175000017500000002623511435354552031002 0ustar drazzibdrazzibpackage org.red5.service.httpstream.model; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.io.RandomAccessFile; import java.nio.BufferOverflowException; import java.nio.ByteBuffer; import java.nio.channels.FileChannel; import java.util.concurrent.locks.ReentrantLock; import org.apache.mina.core.buffer.IoBuffer; import org.red5.logging.Red5LoggerFactory; import org.slf4j.Logger; /** * Represents an MPEG-TS file segment. * * @author Paul Gregoire */ public class Segment implements Comparable { private static Logger log = Red5LoggerFactory.getLogger(Segment.class); private final static int CHUNK_SIZE = 188; // directory where segment files are written private String segmentDirectory = ""; // name of the segment private String name; // segment index number private int index; // creation time private long created = System.currentTimeMillis(); // queue for holding data if using memory mapped i/o private volatile IoBuffer buffer; // lock used when writing or slicing the buffer private volatile ReentrantLock lock = new ReentrantLock(); // physical ts file private volatile RandomAccessFile file; // allocate a channel to write the file private volatile FileChannel channel; // whether or not this is the last segment private volatile boolean last; // whether or not the segment is closed private boolean closed; // number of chunks written to this segment private int chunksWritten = 0; // holds a threads file channel private ThreadLocal readChannelHolder = new ThreadLocal() { @Override protected FileChannel initialValue() { String fileName = String.format("%s%s_%s.ts", segmentDirectory, name, index); log.debug("initialValue - read channel: {}", fileName); try { RandomAccessFile fileForReading = new RandomAccessFile(fileName, "r"); // get the channel return fileForReading.getChannel(); } catch (IOException e) { e.printStackTrace(); } return null; } }; // holds a threads buffer iterator private ThreadLocal readPositionHolder = new ThreadLocal() { @Override protected Integer initialValue() { log.debug("initialValue - buffer: {}", buffer); return 0; } }; public Segment(String segmentDirectory, String name, int index, boolean memoryMapped) { this.segmentDirectory = segmentDirectory; this.name = name; this.index = index; if (memoryMapped) { log.debug("Using memory mapped files"); //TODO need a good way to guess the initial amount of bytes needed buffer = IoBuffer.allocate(CHUNK_SIZE * (1024 * 4), false); //direct buffers cannot be auto-expanded buffer.setAutoExpand(true); buffer.setAutoShrink(true); } else { log.debug("Using disk based files"); try { file = new RandomAccessFile(String.format("%s%s_%s.ts", segmentDirectory, name, index), "rwd"); // get the channel channel = file.getChannel(); } catch (FileNotFoundException e) { e.printStackTrace(); } } } public String getSegmentDirectory() { return segmentDirectory; } public String getName() { return name; } public int getIndex() { return index; } public long getCreated() { return created; } public boolean isMemoryMapped() { return channel == null; } public boolean isLast() { return last; } public void setLast(boolean last) { this.last = last; } public ByteBuffer read() { ByteBuffer buf = null; if (buffer != null) { Integer readPos = readPositionHolder.get(); log.trace("Current buffer position: {}", readPos); int newPos = readPos + CHUNK_SIZE; int currentPosition = buffer.position(); if (newPos < currentPosition) { byte[] chunk = new byte[CHUNK_SIZE]; if (lock.tryLock()) { try { currentPosition = buffer.position(); IoBuffer slice = buffer.getSlice(readPos, CHUNK_SIZE); //log.trace("Slice - size: {} {}", slice.limit(), slice.getHexDump()); buffer.position(currentPosition); slice.get(chunk); slice.free(); } finally { lock.unlock(); } buf = ByteBuffer.wrap(chunk); } //set back to thread local readPositionHolder.set(newPos); } else { //set previous value back in th readPositionHolder.set(readPos); } } else { FileChannel readChannel = readChannelHolder.get(); try { //size the buffer for an mpegts chunk buf = ByteBuffer.allocate(CHUNK_SIZE); //read from the file readChannel.read(buf); //flip buf.flip(); } catch (IOException e) { e.printStackTrace(); } //set back to thread local readChannelHolder.set(readChannel); } return buf; } public ByteBuffer read(ByteBuffer buf) { if (buffer != null) { Integer readPos = readPositionHolder.get(); log.trace("Current buffer read position: {}", readPos); int newPos = readPos + CHUNK_SIZE; int currentPosition = buffer.position(); if (newPos < currentPosition) { byte[] chunk = new byte[CHUNK_SIZE]; if (lock.tryLock()) { try { currentPosition = buffer.position(); IoBuffer slice = buffer.getSlice(readPos, CHUNK_SIZE); //log.trace("Slice - size: {} {}", slice.limit(), slice.getHexDump()); buffer.position(currentPosition); slice.get(chunk); slice.free(); } finally { lock.unlock(); } buf.put(chunk); buf.flip(); } //set back to thread local readPositionHolder.set(newPos); } else { //set previous value back in th readPositionHolder.set(readPos); //set the position to the end as an indicator buf.position(CHUNK_SIZE - 1); } } else { FileChannel readChannel = readChannelHolder.get(); try { //read from the file readChannel.read(buf); buf.flip(); } catch (IOException e) { e.printStackTrace(); } //set back to thread local readChannelHolder.set(readChannel); } return buf; } public boolean hasMoreData() { boolean hasMore = false; if (buffer != null) { Integer readPos = readPositionHolder.get(); hasMore = (readPos + CHUNK_SIZE) < buffer.position(); readPositionHolder.set(readPos); } else { FileChannel readChannel = readChannelHolder.get(); try { hasMore = (readChannel.size() - readChannel.position()) >= CHUNK_SIZE; } catch (IOException e) { e.printStackTrace(); } //set back to thread local readChannelHolder.set(readChannel); } return hasMore; } public void cleanupThreadLocal() { if (buffer != null) { readPositionHolder.remove(); } else { FileChannel readChannel = readChannelHolder.get(); try { readChannel.close(); } catch (IOException e) { e.printStackTrace(); } readChannelHolder.remove(); } } public boolean write(ByteBuffer data) { boolean result = false; if (!closed) { //if memory mapped, add to the buffer if (buffer != null) { log.trace("Current buffer size before write: {}", buffer.capacity()); if (lock.tryLock()) { try { buffer.put(data); result = true; } catch (BufferOverflowException bofe) { //not sure how this happens when its set for auto-expand, but it is log.warn("Error writing to the buffer", bofe); } finally { lock.unlock(); } } } else { //write to file try { result = channel.write(data) > 0; } catch (IOException e) { log.warn("Exception writing channel", e); } } chunksWritten++; } return result; } public boolean close() { log.debug("Close - name: {} index: {}", name, index); closed = true; log.debug("Chunks written: {}", chunksWritten); boolean result = false; if (buffer != null) { //write to a file for debugging RandomAccessFile raf = null; if (log.isTraceEnabled()) { try { byte[] chunk = new byte[CHUNK_SIZE]; raf = new RandomAccessFile(String.format("%s%s.ts", name, index), "rwd"); log.debug("Close - buffer position: {}", buffer.position()); if (lock.tryLock()) { IoBuffer slice = null; try { buffer.mark(); slice = buffer.getSlice(0, buffer.position()); if (buffer.markValue() != -1) { buffer.reset(); } } finally { lock.unlock(); } log.debug("Close - after slice buffer position: {}", buffer.position()); if (slice != null) { while (slice.position() < slice.limit()) { //log.trace("Pos: {} Limit: {}", slice.position(), slice.limit()); slice.get(chunk); raf.write(chunk); } slice.free(); } } } catch (Exception e) { e.printStackTrace(); } finally { if (raf != null) { try { raf.close(); } catch (IOException e) { } } } } buffer.clear(); result = true; } else if (channel != null && channel.isOpen()) { try { channel.close(); //delete the previous ts file // File prevTsFile = new File(String.format("%s%s_%s.ts", segmentDirectory, name, index - 1)); // if (prevTsFile.exists()) { // if (!prevTsFile.delete()) { // prevTsFile.deleteOnExit(); // } // } // prevTsFile = null; result = true; } catch (IOException e) { log.warn("Exception closing channel", e); } } return result; } /** * Should be called only when we are completely finished with this segment and no longer * want it to be available. */ public void dispose() { if (buffer != null) { buffer.free(); } else { //delete the associated file File tsFile = new File(String.format("%s%s_%s.ts", segmentDirectory, name, index)); if (tsFile.exists()) { if (!tsFile.delete()) { tsFile.deleteOnExit(); } } tsFile = null; } } @Override public String toString() { return "Segment [name=" + name + ", index=" + index + ", created=" + created + "]"; } @Override public int compareTo(Segment otherSegment) { int otherIndex = otherSegment.getIndex(); if (index > otherIndex) { return 1; } else if (index < otherIndex) { return -1; } return 0; } } red5-1.0~svn4374.orig-plugins/mpeg-ts/src/org/red5/service/httpstream/model/AudioFrame.java0000644000175000017500000000304011435354552031401 0ustar drazzibdrazzibpackage org.red5.service.httpstream.model; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.nio.ByteBuffer; public class AudioFrame implements MediaFrame { private ByteBuffer data; public AudioFrame(byte[] audioData) { data = ByteBuffer.wrap(audioData); } public AudioFrame(ByteBuffer audioData) { byte[] buf = new byte[audioData.limit()]; audioData.get(buf); data = ByteBuffer.wrap(buf); audioData.clear(); } public boolean isAudio() { return true; } public boolean isVideo() { return false; } public long getTimestamp() { return 0; } public ByteBuffer getData() { return data.asReadOnlyBuffer(); } } red5-1.0~svn4374.orig-plugins/mpeg-ts/src/org/red5/service/httpstream/model/MediaFrame.java0000644000175000017500000000221411435354552031361 0ustar drazzibdrazzibpackage org.red5.service.httpstream.model; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.nio.ByteBuffer; public interface MediaFrame { public boolean isAudio(); public boolean isVideo(); public long getTimestamp(); public ByteBuffer getData(); } red5-1.0~svn4374.orig-plugins/mpeg-ts/src/org/red5/service/httpstream/model/VideoFrame.java0000644000175000017500000000405511435354552031415 0ustar drazzibdrazzibpackage org.red5.service.httpstream.model; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.nio.ByteBuffer; public class VideoFrame implements MediaFrame { private ByteBuffer data; private int width; private int height; private int fps; private long timestamp; public VideoFrame(byte[] videoData) { data = ByteBuffer.wrap(videoData); } public VideoFrame(ByteBuffer videoData) { byte[] buf = new byte[videoData.limit()]; videoData.get(buf); data = ByteBuffer.wrap(buf); videoData.clear(); } public boolean isAudio() { return false; } public boolean isVideo() { return true; } public long getTimestamp() { return timestamp; } public void setTimestamp(long timestamp) { this.timestamp = timestamp; } public ByteBuffer getData() { return data.asReadOnlyBuffer(); } public int getWidth() { return width; } public void setWidth(int width) { this.width = width; } public int getHeight() { return height; } public void setHeight(int height) { this.height = height; } public int getFps() { return fps; } public void setFps(int fps) { this.fps = fps; } } red5-1.0~svn4374.orig-plugins/mpeg-ts/src/org/red5/stream/0000755000175000017500000000000011760512622023060 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/mpeg-ts/src/org/red5/stream/http/0000755000175000017500000000000011760512622024037 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/mpeg-ts/src/org/red5/stream/http/servlet/0000755000175000017500000000000011760512622025523 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/mpeg-ts/src/org/red5/stream/http/servlet/PlayList.java0000644000175000017500000003066011435354552030141 0ustar drazzibdrazzibpackage org.red5.stream.http.servlet; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.StringUtils; import org.red5.logging.Red5LoggerFactory; import org.red5.service.httpstream.SegmenterService; import org.red5.service.httpstream.model.Segment; import org.slf4j.Logger; import org.springframework.context.ApplicationContext; import org.springframework.web.context.WebApplicationContext; import com.xuggle.xuggler.ICodec; import com.xuggle.xuggler.SimpleMediaFile; /** * Provides an http stream playlist in m3u8 format. * * HTML status codes used by this servlet: *
 *  400 Bad Request
 *  406 Not Acceptable
 *  412 Precondition Failed
 *  417 Expectation Failed
 * 
* * @see * {@link http://tools.ietf.org/html/draft-pantos-http-live-streaming-03} * {@link http://developer.apple.com/iphone/library/documentation/NetworkingInternet/Conceptual/StreamingMediaGuide/HTTPStreamingArchitecture/HTTPStreamingArchitecture.html#//apple_ref/doc/uid/TP40008332-CH101-SW2} * * @author Paul Gregoire */ public class PlayList extends HttpServlet { private static final long serialVersionUID = 978137411L; private static Logger log = Red5LoggerFactory.getLogger(PlayList.class); // create streams upon http request private boolean startStreamOnRequest = false; // number of segments that must exist before displaying any in the playlist private int minimumSegmentCount = 1; // keep track of the streams that have been requested, but that are not available private static volatile List requestedStreams = new ArrayList(3); @Override public void init(ServletConfig config) throws ServletException { super.init(config); /* * To supply a parameter to a servlet, use a config or init param. * The config-param looks like this: *
		 *     
		 *     startStreamOnRequest
		 *     true
		 *     
		 * 
* * And is accessed like so: * config.getServletContext().getInitParameter("startStreamOnRequest") * * An init-param looks like this: *
		 *     
		 *     PlayList
		 *     org.red5.stream.http.servlet.PlayList
		 *     
		 *     startStreamOnRequest
		 *     true
		 *     
		 *     
		 * 
* * And is accessed like so: * getInitParameter("startStreamOnRequest"); * */ String startOnRequestParam = getInitParameter("startStreamOnRequest"); if (!StringUtils.isEmpty(startOnRequestParam)) { if ("true".equals(startOnRequestParam.trim())) { startStreamOnRequest = true; } } log.debug("Start stream on request - param: {} value: {}", startOnRequestParam, startStreamOnRequest); String minimumSegmentCountParam = getInitParameter("minimumSegmentCount"); if (!StringUtils.isEmpty(minimumSegmentCountParam)) { minimumSegmentCount = Integer.valueOf(minimumSegmentCountParam); } log.debug("Minimum segment count - param: {} value: {}", minimumSegmentCountParam, minimumSegmentCount); } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { log.debug("Playlist requested"); /* * EXT-X-MEDIA-SEQUENCE * Each media file URI in a Playlist has a unique sequence number. The sequence number * of a URI is equal to the sequence number of the URI that preceded it plus one. The * EXT-X-MEDIA-SEQUENCE tag indicates the sequence number of the first URI that appears * in a Playlist file. * #EXTM3U #EXT-X-ALLOW-CACHE:NO #EXT-X-MEDIA-SEQUENCE:0 #EXT-X-TARGETDURATION:10 #EXTINF:10, http://media.example.com/segment1.ts #EXTINF:10, http://media.example.com/segment2.ts #EXTINF:10, http://media.example.com/segment3.ts #EXT-X-ENDLIST Using one large file, testing with ipod touch, this worked (149 == 2:29) #EXTM3U #EXT-X-TARGETDURATION:149 #EXT-X-MEDIA-SEQUENCE:0 #EXTINF:149, no desc out0.ts #EXT-X-ENDLIST Using these encoding parameters: ffmpeg -i test.mp4 -re -an -vcodec libx264 -b 96k -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -subq 5 -trellis 1 -refs 1 -coder 0 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt 200k -maxrate 96k -bufsize 96k -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 30 -aspect 320:240 -g 30 -async 2 -s 320x240 -f mpegts out.ts */ //get the requested stream ApplicationContext appCtx = (ApplicationContext) getServletContext().getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE); SegmenterService service = (SegmenterService) appCtx.getBean("segmenter.service"); String servletPath = request.getServletPath(); if (log.isTraceEnabled()) { String serverName = request.getServerName(); int portNumber = request.getServerPort(); String contextPath = request.getContextPath(); log.trace("Request - serverName: {} port: {} contextPath: {} servletPath: {}", new Object[]{serverName, portNumber, contextPath, servletPath}); } //for debugging //String url = String.format("%s:%s%s", serverName, portNumber, contextPath);; final String streamName = servletPath.substring(1, servletPath.indexOf(".m3u8")); log.debug("Request for stream: {} playlist", streamName); //write the playlist PrintWriter writer = response.getWriter(); response.setContentType("application/x-mpegURL"); writer.println("#EXTM3U\n#EXT-X-ALLOW-CACHE:NO\n"); //check for the stream if (service.isAvailable(streamName)) { log.debug("Stream: {} is available", streamName); // remove it from requested list if its there if (requestedStreams.contains(streamName)) { requestedStreams.remove(requestedStreams.indexOf(streamName)); } // get the segment count int count = service.getSegmentCount(streamName); log.debug("Segment count: {}", count); // check for minimum segment count and if we dont match or exceed // wait for (minimum segment count * segment duration) before returning if (count < minimumSegmentCount) { log.debug("Starting wait loop for segment availability"); long maxWaitTime = minimumSegmentCount * service.getSegmentTimeLimit(); long start = System.currentTimeMillis(); do { try { Thread.sleep(500); } catch (InterruptedException e) { } if ((System.currentTimeMillis() - start) >= maxWaitTime) { log.info("Maximum segment wait time exceeded for {}", streamName); break; } } while ((count = service.getSegmentCount(streamName)) < minimumSegmentCount); } // get the count one last time count = service.getSegmentCount(streamName); log.debug("Segment count: {}", count); if (count >= minimumSegmentCount) { //get segment duration in seconds long segmentDuration = service.getSegmentTimeLimit() / 1000; //get the current segment Segment segment = service.getSegment(streamName); //get current sequence number int sequenceNumber = segment.getIndex(); log.trace("Current sequence number: {}", sequenceNumber); /* HTTP streaming spec section 3.2.2 Each media file URI in a Playlist has a unique sequence number. The sequence number of a URI is equal to the sequence number of the URI that preceded it plus one. The EXT-X-MEDIA-SEQUENCE tag indicates the sequence number of the first URI that appears in a Playlist file. */ // determine the lowest sequence number int lowestSequenceNumber = Math.max(-1, sequenceNumber - service.getMaxSegmentsPerFacade()) + 1; log.trace("Lowest sequence number: {}", lowestSequenceNumber); // for logging StringBuilder sb = new StringBuilder(); // create the heading String playListHeading = String.format("#EXT-X-TARGETDURATION:%s\n#EXT-X-MEDIA-SEQUENCE:%s\n", segmentDuration, lowestSequenceNumber); writer.println(playListHeading); sb.append(playListHeading); //loop through the x closest segments for (int s = lowestSequenceNumber; s <= sequenceNumber; s++) { String playListEntry = String.format("#EXTINF:%s, no desc\n%s%s.ts\n", segmentDuration, streamName, s); writer.println(playListEntry); sb.append(playListEntry); } // are we on the last segment? if (segment.isLast()) { log.debug("Last segment"); writer.println("#EXT-X-ENDLIST\n"); sb.append("#EXT-X-ENDLIST\n"); } log.debug(sb.toString()); } else { log.trace("Minimum segment count not yet reached, currently at: {}", count); } } else { log.debug("Stream: {} is not available", streamName); // look for flag to indicate that we should spawn the requested stream if (startStreamOnRequest) { if (requestedStreams.contains(streamName)) { log.debug("Stream has already been requested and is not yet available: {}", streamName); } else { // add to the requested list requestedStreams.add(streamName); // perform the actions required for starting up a stream log.debug("A stream that is not yet available will be spawned"); // TODO create a SimpleMediaFile that represents our stream SimpleMediaFile smf = new SimpleMediaFile(); smf.setHasAudio(false); smf.setHasVideo(true); smf.setVideoCodec(ICodec.ID.CODEC_ID_H264); // TODO if on-demand creation is wanted in your application, the Observed class // must be instanced here and the SegmenterService must be added as an Observer of the class // TODO create a thread to clean up if the stream is not created within x time /* // start a thread to remove the requested stream name from the list after 2 minutes Application.executorService.execute(new Runnable() { public void run() { try { Thread.sleep(120000); } catch (InterruptedException e) { } if (requestedStreams.contains(streamName)) { requestedStreams.remove(requestedStreams.indexOf(streamName)); } } }); */ } } else { writer.println("#EXT-X-ENDLIST\n"); } } writer.flush(); } } red5-1.0~svn4374.orig-plugins/mpeg-ts/src/org/red5/stream/http/servlet/TransportSegment.java0000644000175000017500000001223611435354552031716 0ustar drazzibdrazzibpackage org.red5.stream.http.servlet; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.io.IOException; import java.nio.ByteBuffer; import javax.servlet.ServletException; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.red5.logging.Red5LoggerFactory; import org.red5.service.httpstream.SegmenterService; import org.red5.service.httpstream.model.Segment; import org.slf4j.Logger; import org.springframework.context.ApplicationContext; import org.springframework.web.context.WebApplicationContext; /** * Servlet implementation class TransportSegment */ public class TransportSegment extends HttpServlet { private static final long serialVersionUID = 92227411L; private static Logger log = Red5LoggerFactory.getLogger(TransportSegment.class); /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { log.debug("Segment requested"); //get the requested stream / segment ApplicationContext appCtx = (ApplicationContext) getServletContext().getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE); SegmenterService service = (SegmenterService) appCtx.getBean("segmenter.service"); // http://localhost:5080/httplivestreamingstreaming/test1.ts String servletPath = request.getServletPath(); String[] path = servletPath.split("\\."); log.trace("Path parts: {}", path.length); //fail if they request the same segment HttpSession session = ((HttpServletRequest) request).getSession(false); if (session != null) { String stream = (String) session.getAttribute("stream"); if (path[0].equals(stream)) { log.info("Segment {} was already played by this requester", stream); return; } session.setAttribute("stream", path[0]); } //read alpha characters until we hit a number int digitIndex = path[0].length() - 1; char[] chars = path[0].toCharArray(); for (int i = 0; i < chars.length; i++) { if (Character.isDigit(chars[i])) { digitIndex = i; break; } } String sequenceNumberStr = path[0].substring(digitIndex); String streamName = path[0].substring(1, digitIndex); log.trace("Stream name: {}", streamName); int sequenceNumber = Integer.valueOf(sequenceNumberStr); log.trace("Segment sequence: {}", sequenceNumber); if (service.isAvailable(streamName)) { response.setContentType("video/MP2T"); Segment segment = service.getSegment(streamName, sequenceNumber); if (segment != null) { byte[] buf = new byte[188]; ByteBuffer buffer = ByteBuffer.allocate(188); ServletOutputStream sos = response.getOutputStream(); do { buffer = segment.read(buffer); //log.trace("Limit - position: {}", (buffer.limit() - buffer.position())); if ((buffer.limit() - buffer.position()) == 188) { buffer.get(buf); //write down the output stream sos.write(buf); } else { log.info("Segment result has indicated a problem"); // verifies the currently requested stream segment number against the // currently active segment if (service.getSegment(streamName, sequenceNumber) == null) { log.debug("Requested segment is no longer available"); break; } } buffer.clear(); } while (segment.hasMoreData()); log.trace("Segment {} had no more data", segment.getIndex()); buffer = null; //flush sos.flush(); //segment had no more data segment.cleanupThreadLocal(); } else { log.info("Segment for {} was not found", streamName); } } else { //TODO let requester know that stream segment is not available response.sendError(404, "Segment not found"); } } } red5-1.0~svn4374.orig-plugins/mpeg-ts/src/org/red5/stream/http/xuggler/0000755000175000017500000000000011760512622025514 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/mpeg-ts/src/org/red5/stream/http/xuggler/MpegTsHandler.java0000644000175000017500000001770111435354552031067 0ustar drazzibdrazzibpackage org.red5.stream.http.xuggler; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.io.RandomAccessFile; import java.nio.ByteBuffer; import org.red5.logging.Red5LoggerFactory; import org.red5.xuggler.IEventIOHandler; import org.red5.xuggler.Message; import org.slf4j.Logger; import com.xuggle.xuggler.ISimpleMediaFile; import com.xuggle.xuggler.io.IURLProtocolHandler; /** * An implementation of IURLProtocolHandler that converts into a format that ffmpeg can read. * * {@link http://en.wikipedia.org/wiki/MPEG_transport_stream} * {@link http://wiki.multimedia.cx/index.php?title=MPEG-2_Transport_Stream} * {@link http://neuron2.net/library/mpeg2/iso13818-1.pdf} * * @author Paul Gregoire */ public class MpegTsHandler implements IURLProtocolHandler { private final Logger log = Red5LoggerFactory.getLogger(this.getClass()); //file used for debugging byte stream private RandomAccessFile raf; IEventIOHandler handler; String url; int openFlags; // Only package members can create MpegTsHandler(IEventIOHandler handler, ISimpleMediaFile metaInfo, String url, int flags) { this.handler = handler; this.url = url; this.openFlags = flags; } /** * Packets are normally 188 bytes but may consist of 204 bytes if a 16 byte * Reed-Solomon error correction data block is included. * * @param in * @return */ private Message.Type parsePacket(ByteBuffer in) { log.trace("parsePacket: {}", in); //used to return the packet type Message.Type type = Message.Type.NULL; //start off as null in.mark(); // Sync byte #0 is always 0x47 byte sync = in.get(); // Flags - 3 bits byte flags = in.get(); // Transport error indicator (TEI) int tei = flags >> (8 - (7 + 1)) & 0x0001; // Payload unit start indicator - 1 = start of PES data or PSI, 0 otherwise int psi = flags >> (8 - (6 + 1)) & 0x0001; // Transport priority - 1 = higher priority than packets with same PID int tp = flags >> (8 - (5 + 1)) & 0x0001; log.trace("Packet info - sync: 0x{} tei: {} psi: {} tp: {}", new Object[]{Integer.toHexString(sync), tei, psi, tp}); byte flags2 = in.get(); // Packet id (PID) - 13 bits int pid = ((flags << 8)|(flags2 & 0xff)) & 0x1fff; log.trace("Packet id: {}", Integer.toHexString(pid)); // Continuity counter - 4 bits switch (pid) { case 100: //fairly sure this is an h.264 video packet log.trace("Got video"); //assume they are all key frames for now type = Message.Type.KEY_FRAME; break; case 0x0000: log.trace("Got Program Association Table (PAT)"); type = Message.Type.CONFIG_PAT; break; case 0x0001: log.trace("Got Conditional Access Table"); type = Message.Type.CONFIG; break; case 0x0002: log.trace("Got Transport Stream Description Table"); type = Message.Type.CONFIG; break; case 0x1fff: log.trace("Got Null packet"); break; default: if (pid >= 0x0003 && pid <= 0x000f) { log.trace("Got PID in reserved range"); } else if (pid >= 0x0010 && pid <= 0x1ffe) { log.trace("Got PID from other range"); } else { log.trace("Got unknown PID"); } type = Message.Type.OTHER; } in.reset(); return type; } @SuppressWarnings("unused") private static boolean isBitSet(byte b, int bit) { return (b & (1 << bit)) != 0; } public String toString() { return this.getClass().getName() + ':' + url; } public int open(String url, int flags) { int retval = -1; try { // and send a header message handler.write(new Message(Message.Type.HEADER, null)); // For an open, we assume the ProtocolManager has done it's job correctly and we're working on the // right input and output streams. this.url = url; this.openFlags = flags; retval = 0; } catch (Exception ex) { log.warn("Exception during open: {}", ex); } if (log.isTraceEnabled()) { //write to a file for debugging try { raf = new RandomAccessFile(String.format("test%s.ts", System.currentTimeMillis()), "rwd"); } catch (Exception e) { e.printStackTrace(); } } log.trace("open({}, {}); {}", new Object[] { url, flags, retval }); return retval; } /* * These following methods all wrap the unsafe methods in try {} catch {} * blocks to ensure we don't pass an exception back to the native C++ * function that calls these. */ public int close() { log.debug("Close {}", url); int retval = -1; try { // As a convention, we send a IMediaDataWrapper object wrapping NULL // for end of streams handler.write(new Message(Message.Type.END_STREAM, null)); retval = 0; } catch (Exception ex) { log.warn("Exception during close: {}", ex); } if (log.isTraceEnabled()) { //close debugging file try { raf.close(); } catch (Exception e) { e.printStackTrace(); } } log.trace("close({}); {}", url, retval); return retval; } public int read(byte[] buf, int size) { int retval = -1; try { retval = 0; } catch (Exception ex) { log.warn("Exception during read: {}", ex); } log.trace("read({}, {}); {}", new Object[] { url, size, retval }); return retval; } public long seek(long offset, int whence) { log.trace("seek({}, {}, {});", new Object[] { url, offset, whence }); // Unsupported return -1; } public int write(byte[] buf, int size) { log.debug("Write size: {}", size); int retval = -1; if (log.isDebugEnabled()) { //write to a file for debugging try { raf.write(buf); } catch (Exception e) { e.printStackTrace(); } } try { //expect chunks of 188 bytes from ffmpeg //204 and 208 are also valid but not supported by this version if (size % 188 == 0) { log.debug("Data appears to be of the correct size"); } // make sure we break the data into 188 byte chunks int chunks = size / 188; log.debug("Chunks: {}", chunks); // wrap the bytes that FFMPEG just sent us ByteBuffer buffer = ByteBuffer.wrap(buf); // break it up into chunks byte[] chunk = new byte[188]; for (int i = 0; i < chunks; i++) { buffer.get(chunk); // append the new data to the end of our buffer ByteBuffer chunkBuffer = ByteBuffer.wrap(chunk); Message.Type type = parsePacket(chunkBuffer); if (type != Message.Type.NULL) { //send off to the handler handler.write(new Message(type, chunkBuffer)); if (log.isTraceEnabled()) { log.trace("Chunk: {}", new String(chunk)); } } else { chunkBuffer.clear(); } } buffer.clear(); // return that we read size retval = size; } catch (Exception ex) { log.warn("Exception during write: {}", ex); } log.trace("write({}, {}); {}", new Object[] { url, size, retval }); return retval; } public boolean isStreamed(String url, int flags) { boolean retval = true; log.trace("isStreamed({}, {}); {}", new Object[] { url, flags, retval }); return retval; } } red5-1.0~svn4374.orig-plugins/mpeg-ts/src/org/red5/stream/http/xuggler/MpegTsIoHandler.java0000644000175000017500000000276611435354552031364 0ustar drazzibdrazzibpackage org.red5.stream.http.xuggler; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import org.red5.logging.Red5LoggerFactory; import org.red5.xuggler.IEventIOHandler; import org.red5.xuggler.Message; import org.slf4j.Logger; public abstract class MpegTsIoHandler implements IEventIOHandler { protected Logger log = Red5LoggerFactory.getLogger(this.getClass()); private String id; public MpegTsIoHandler(String id) { this.id = id; log.trace("Id: {}", this.id); } public Message read() throws InterruptedException { return null; } public void write(Message msg) throws InterruptedException { } } red5-1.0~svn4374.orig-plugins/mpeg-ts/src/org/red5/stream/http/xuggler/MpegTsHandlerFactory.java0000644000175000017500000001443011435354552032413 0ustar drazzibdrazzibpackage org.red5.stream.http.xuggler; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.util.HashMap; import java.util.Map; import org.red5.logging.Red5LoggerFactory; import org.red5.xuggler.IEventIOHandler; import org.slf4j.Logger; import com.xuggle.xuggler.ISimpleMediaFile; import com.xuggle.xuggler.io.IURLProtocolHandler; import com.xuggle.xuggler.io.IURLProtocolHandlerFactory; import com.xuggle.xuggler.io.URLProtocolManager; /** * Used by XUGGLE.IO to get a new URLProtocolHandler for an mpeg-ts URL. * * @author Paul Gregoire */ public class MpegTsHandlerFactory implements IURLProtocolHandlerFactory { private static Logger log = Red5LoggerFactory.getLogger(MpegTsHandlerFactory.class); private Map streams; private Map streamsInfo; private static MpegTsHandlerFactory singleton = new MpegTsHandlerFactory(); public static final String DEFAULT_PROTOCOL = "redfivempegts"; /** * Get the default factory used by XUGGLE.IO for mpeg-ts streams to * {@link #DEFAULT_PROTOCOL} (i.e. {@value #DEFAULT_PROTOCOL}). * * @return The factory */ public static MpegTsHandlerFactory getFactory() { return getFactory(DEFAULT_PROTOCOL); } /** * Register a factory that XUGGLE.IO will use for the given protocol. * * NOTE: Protocol can only contain alpha characters. * * @param protocolPrefix * The protocol (e.g. "mpegts"). * @return The factory */ public static MpegTsHandlerFactory getFactory(String protocolPrefix) { if (singleton == null) { throw new NullPointerException("Unexpectedly, there is no factory"); } URLProtocolManager manager = URLProtocolManager.getManager(); manager.registerFactory(protocolPrefix, singleton); return singleton; } /** * The Constructor is package-level only so that test functions can use this * without using the Singleton. */ private MpegTsHandlerFactory() { streams = new HashMap(); streamsInfo = new HashMap(); } /** * Called by XUGGLE.IO to get a a handler for a given URL. The handler * must have been registered via * {@link #registerStream(IEventIOHandler, ISimpleMediaFile)} * * WARNING: It really only makes sense to have one active ProtocolHandler * working on a AVStreamingQueue at a time; it's up to the caller to ensure * this happens; otherwise you may get deadlocks as all the protocol * handlers compete for events. * * @param protocol * The protocol (e.g. "mpegts") * @param url * The url being opened, including the protocol (e.g. "mpegts:stream01") * @param flags * The flags that FFMPEG is opening the file with. * */ public synchronized IURLProtocolHandler getHandler(String protocol, String url, int flags) { log.debug("Get handler - protocol: {} url: {}", protocol, url); IURLProtocolHandler result = null; // Note: We need to remove any protocol markers from the url String streamName = URLProtocolManager.getResourceFromURL(url); MpegTsIoHandler handler = streams.get(streamName); if (handler != null) { result = new MpegTsHandler(handler, streamsInfo.get(streamName), url, flags); } return result; } /** * Register a stream name with this factory. Any handlers returned by this * factory for this streamName will use the passed buffer. * * Note that streamInfo is only used when reading from a registered stream. * When writing IRTMPEvent, we will use whatever MetaData XUGGLE tells us * about the stream. * * @param handler * The handler for that stream name * @param streamInfo * A {@link ISimpleMediaFile} containing meta data about what * kind of stream the {@link IRTMPEventIOHandler} is handling. * This is used by the handler to construct header and meta-data * information. Can be null in which case we'll assume both audio * and video in file. {@link ISimpleMediaFile#getURL()} must * return a non null value. * @return The IRTMPEventIOHandler previously registered for this * streamName, or null if none. */ public synchronized MpegTsIoHandler registerStream(MpegTsIoHandler handler, ISimpleMediaFile streamInfo) { log.debug("Register - handler: {} info: {}", handler, streamInfo); if (streamInfo == null) { throw new IllegalArgumentException("Stream info required"); } String streamURL = streamInfo.getURL(); if (streamURL == null) { throw new IllegalArgumentException("URL required"); } String streamName = URLProtocolManager.getResourceFromURL(streamURL); streamsInfo.put(streamName, streamInfo); return streams.put(streamName, handler); } /** * Stop supporting a given streamName. * * @param streamURL * The stream url to stop supporting. Current files open will * continue to to be used, but future opens will get a file not * found error in ffmpeg. * @return The AVBufferStream previously registered for this streamName, or * null if none. */ public synchronized MpegTsIoHandler deleteStream(String streamURL) { log.debug("Delete - url: {}", streamURL); String streamName = URLProtocolManager.getResourceFromURL(streamURL); streamsInfo.remove(streamName); return streams.remove(streamName); } } red5-1.0~svn4374.orig-plugins/mpeg-ts/src/org/red5/xuggler/0000755000175000017500000000000011760512622023242 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/mpeg-ts/src/org/red5/xuggler/IEventIOHandler.java0000644000175000017500000000276011435354552027037 0ustar drazzibdrazzibpackage org.red5.xuggler; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** * Called by the UrlProtocolHandler to read and write Events. */ public interface IEventIOHandler { /** * Called by a handler to get the next message. * * @return The next IAVMessage; blocks until a message is ready. * @throws InterruptedException if interrupted while waiting */ Message read() throws InterruptedException; /** * Writes the given message. * * @param msg The message to write * @throws InterruptedException if interrupted while waiting */ void write(Message msg) throws InterruptedException; } red5-1.0~svn4374.orig-plugins/mpeg-ts/src/org/red5/xuggler/Message.java0000644000175000017500000000773711435354552025514 0ustar drazzibdrazzibpackage org.red5.xuggler; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.nio.ByteBuffer; import org.red5.server.net.rtmp.event.AudioData; import org.red5.server.net.rtmp.event.Notify; import org.red5.server.net.rtmp.event.VideoData; /** * Adapter class for "message" data, which are passed around via the handlers. * * @author Paul Gregoire */ public class Message { /** * The types of messages that can be put into */ public enum Type { /** * A configuration packet. */ CONFIG, /** * A special configuration packet used in mpeg-ts */ CONFIG_PAT, /** * A HEADER. The payload is usually null. */ HEADER, /** * A Video B or P MPEG frame (interframe). The payload is usually a * {@link VideoData} object. */ INTERFRAME, /** * A Disposable Interframe. The payload is usually a {@link VideoData} * object. * * Note that most FFMPEG decoders seem to choke on these frames, so feel * free to dispose them. */ DISPOSABLE_INTERFRAME, /** * A Video I MPEG frame (key frame). The payload is usually a * {@link VideoData} object. */ KEY_FRAME, /** * An audio packet. The payload is usually a {@link AudioData} object. */ AUDIO, /** * Simple media data, may be audio, video, or special transport data type. */ DATA, /** * Some other type of data. For FLV METADATA can creep in here. The * payload is usually a {@link Notify} object. */ OTHER, /** * A null packet, normally used in mpeg-ts */ NULL, /** * A end of stream marker. The payload is usually null. */ END_STREAM; /** * Is this a bit of configuration? * * @return true if this contains configuration data */ public boolean isConfig() { return this == CONFIG; } /** * Is this message audio data? * * @return true if audio; false if not. */ public boolean isAudio() { return this == AUDIO; } /** * Is this message video data? * * @return true if any type of video; false if not. */ public boolean isVideo() { return (this == INTERFRAME || this == KEY_FRAME || this == DISPOSABLE_INTERFRAME); } /** * Is this message other data? * * @return true if other; false if not. */ public boolean isOther() { return this == OTHER; } /** * Is this an end of stream marker? * * @return true if the end; false if not. */ public boolean isEnd() { return this == END_STREAM; } /** * Is this the beginning of a stream? * * @return true if a header; false if not. */ public boolean isHeader() { return this == HEADER; } } protected Type type; protected ByteBuffer data; public Message() { } public Message(Type type, ByteBuffer data) { this.type = type; this.data = data; } public void setData(ByteBuffer data) { this.data = data; } /** * Returns the data in this message. * * @return The data in this message */ public ByteBuffer getData() { return data; } public void setType(Type type) { this.type = type; } /** * Returns the type of this red5 message * * @return The type */ public Type getType() { return type; } } red5-1.0~svn4374.orig-plugins/mpeg-ts/src/org/red5/xuggler/JavaVideoResampler.java0000644000175000017500000001402611435354552027640 0ustar drazzibdrazzibpackage org.red5.xuggler; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.image.BufferedImage; import org.red5.logging.Red5LoggerFactory; import org.slf4j.Logger; import com.xuggle.xuggler.IPixelFormat; import com.xuggle.xuggler.IVideoPicture; import com.xuggle.xuggler.IVideoResampler; import com.xuggle.xuggler.IPixelFormat.Type; import com.xuggle.xuggler.video.ConverterFactory; import com.xuggle.xuggler.video.IConverter; /** * Resamples video images using AWT. * * @author Paul Gregoire */ public class JavaVideoResampler { protected Logger log = Red5LoggerFactory.getLogger(this.getClass()); private int outWidth; private int outHeight; private Type outFormat = IPixelFormat.Type.YUV420P; private int inWidth; private int inHeight; private Type inFormat = IPixelFormat.Type.YUV420P; private IVideoResampler resampler; private IVideoPicture outFrame; public void init() { resampler = IVideoResampler.make(inWidth, inHeight, IPixelFormat.Type.BGR24, inWidth, inHeight, inFormat); //outgoing frame outFrame = IVideoPicture.make(outFormat, outWidth, outHeight); } public int getInputWidth() { return inWidth; } public int getInputHeight() { return inHeight; } public Type getInputPixelFormat() { return inFormat; } public int getOutputWidth() { return outWidth; } public int getOutputHeight() { return outHeight; } public Type getOutputPixelFormat() { return outFormat; } public void setOutWidth(int outWidth) { this.outWidth = outWidth; } public void setOutHeight(int outHeight) { this.outHeight = outHeight; } public void setOutFormat(Type outFormat) { this.outFormat = outFormat; } public void setInWidth(int inWidth) { this.inWidth = inWidth; } public void setInHeight(int inHeight) { this.inHeight = inHeight; } public void setInFormat(Type inFormat) { this.inFormat = inFormat; } public IVideoPicture resize(IVideoPicture inFrame) { log.debug("Input video picture {}x{}", inFrame.getWidth(), inFrame.getHeight()); //create bgr picture holder IVideoPicture bgrPict = IVideoPicture.make(IPixelFormat.Type.BGR24, inWidth, inHeight); //convert the input to bgr at the same input size - no resize int ret = resampler.resample(bgrPict, inFrame); if (ret < 0) { log.error("Error resampling image: {}", ret); return null; } //converter to turn xuggle picture into a buffered image IConverter bgrConverter = ConverterFactory.createConverter(ConverterFactory.XUGGLER_BGR_24, bgrPict); //convert into a buffered image BufferedImage img = bgrConverter.toImage(bgrPict); log.debug("Buffered image created"); //resize the buffered image BufferedImage out = new BufferedImage(outWidth, outHeight, img.getType()); Graphics2D g = out.createGraphics(); g.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED); g.drawImage(img, 0, 0, outWidth, outHeight, 0, 0, inWidth, inHeight, null); g.dispose(); log.debug("Output image {}x{}", out.getWidth(), out.getHeight()); //convert the buffered image back into xuggle picture BufferedImage worksWithXugglerBufferedImage = convertToType(out, BufferedImage.TYPE_3BYTE_BGR); IConverter yuvConverter = ConverterFactory.createConverter(worksWithXugglerBufferedImage, outFormat); outFrame = yuvConverter.toPicture(out, inFrame.getTimeStamp()); outFrame.setQuality(0); outFrame.setKeyFrame(inFrame.isKeyFrame()); log.debug("Output video picture {}x{}", outFrame.getWidth(), outFrame.getHeight()); log.trace("Output video picture complete: {}", outFrame.isComplete()); bgrPict.delete(); return outFrame; } public static BufferedImage convertToType(BufferedImage sourceImage, int targetType) { BufferedImage image; // if the source image is already the target type, return the source // image if (sourceImage.getType() == targetType) { image = sourceImage; } else { // otherwise create a new image of the target type and draw the new // image image = new BufferedImage(sourceImage.getWidth(), sourceImage .getHeight(), targetType); Graphics g = image.getGraphics(); g.drawImage(sourceImage, 0, 0, null); g.dispose(); } return image; } //use a builder public static JavaVideoResampler make(int outWidth, int outHeight, Type outFormat, int inWidth, int inHeight, Type inFormat) { JavaVideoResampler resampler = new JavaVideoResampler(); resampler.setInFormat(inFormat); resampler.setInHeight(inHeight); resampler.setInWidth(inWidth); resampler.setOutFormat(outFormat); resampler.setOutHeight(outHeight); resampler.setOutWidth(outWidth); return resampler; } public void destroy() { if (resampler != null) { resampler.delete(); resampler = null; } if (outFrame != null) { outFrame.delete(); outFrame = null; } } } red5-1.0~svn4374.orig-plugins/mpeg-ts/.settings/0000755000175000017500000000000011760512622021266 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/mpeg-ts/.settings/org.eclipse.jdt.core.prefs0000644000175000017500000005452611435350704026264 0ustar drazzibdrazzib#Tue Aug 10 20:18:26 PDT 2010 eclipse.preferences.version=1 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 org.eclipse.jdt.core.formatter.blank_lines_after_package=1 org.eclipse.jdt.core.formatter.blank_lines_before_field=1 org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 org.eclipse.jdt.core.formatter.blank_lines_before_method=1 org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 org.eclipse.jdt.core.formatter.blank_lines_before_package=0 org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false org.eclipse.jdt.core.formatter.comment.format_block_comments=false org.eclipse.jdt.core.formatter.comment.format_header=false org.eclipse.jdt.core.formatter.comment.format_html=true org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false org.eclipse.jdt.core.formatter.comment.format_line_comments=false org.eclipse.jdt.core.formatter.comment.format_source_code=true org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true org.eclipse.jdt.core.formatter.comment.indent_root_tags=true org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert org.eclipse.jdt.core.formatter.comment.line_length=80 org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true org.eclipse.jdt.core.formatter.compact_else_if=true org.eclipse.jdt.core.formatter.continuation_indentation=2 org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_empty_lines=false org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true org.eclipse.jdt.core.formatter.indentation.size=4 org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.join_lines_in_comments=true org.eclipse.jdt.core.formatter.join_wrapped_lines=true org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false org.eclipse.jdt.core.formatter.lineSplit=180 org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true org.eclipse.jdt.core.formatter.tabulation.char=mixed org.eclipse.jdt.core.formatter.tabulation.size=4 org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true red5-1.0~svn4374.orig-plugins/mpeg-ts/.settings/org.eclipse.jdt.ui.prefs0000644000175000017500000000016611435350704025740 0ustar drazzibdrazzib#Mon Nov 02 20:49:37 PST 2009 eclipse.preferences.version=1 formatter_profile=_Red5 formatter_settings_version=11 red5-1.0~svn4374.orig-plugins/cluster/0000755000175000017500000000000011760512614017456 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/cluster/build.xml0000644000175000017500000000717311751254704021312 0ustar drazzibdrazzib java.home is ${java.home} and the target version is ${java.target_version} red5.root is ${red5.root} javac version: ${java.version} Type ant -p for available targets" red5-1.0~svn4374.orig-plugins/cluster/build.xml.sample0000644000175000017500000013537011751254704022573 0ustar drazzibdrazzib ${documentation.title}]]> Copyright © ${red5.age} ${red5.name}]]> Edge configured in: ${edgedist.dir} Origin configured in: ${origindist.dir} Making dist for testing Libraries checked: ${library.installed} Verifying Keystore ${keystore.storepass} Export Server Certificate Import Server Certificate into TrustStore Verifying Truststore red5-1.0~svn4374.orig-plugins/cluster/ivy.xml0000644000175000017500000000376011751254704021020 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/cluster/lib/0000755000175000017500000000000011760512614020224 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/cluster/ivysettings.xml0000644000175000017500000000323511751254704022576 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/cluster/.classpath0000644000175000017500000000113611751254704021445 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/cluster/.project0000644000175000017500000000072111751254704021130 0ustar drazzibdrazzib clusterplugin Clustered Red5 plugin org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature org.apache.ivyde.eclipse.ivynature red5-1.0~svn4374.orig-plugins/cluster/build.bat0000644000175000017500000000000311751254704021241 0ustar drazzibdrazzibantred5-1.0~svn4374.orig-plugins/cluster/build.properties0000644000175000017500000000026611751254704022702 0ustar drazzibdrazzib# Let the scripts know where your red5 is (ie. the location of the red5.jar) red5.root=E:/dev/red5/java/server/trunk/dist debug.state=true # Plugin version plugin.version=1.0 red5-1.0~svn4374.orig-plugins/cluster/src/0000755000175000017500000000000011760512614020245 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/cluster/src/red5-origin-core.xml0000644000175000017500000002521411751254704024050 0ustar drazzibdrazzib ${rtmpt.port} false SSLEnabled true sslProtocol TLS clientAuth false keystoreFile conf/keystore keystorePass ${rtmps.keystorepass} keystoreType JKS red5-1.0~svn4374.orig-plugins/cluster/src/cluster.properties0000644000175000017500000000061011751254704024044 0ustar drazzibdrazzib# MRTMP mrtmp.host=0.0.0.0 mrtmp.server=localhost mrtmp.port=9035 mrtmp.event_threads_core=4 mrtmp.event_threads_max=32 # event threads queue: -1 unbounded, 0 direct (no queue), n bounded queue mrtmp.event_threads_queue=0 mrtmp.event_threads_keepalive=60 mrtmp.send_buffer_size=271360 mrtmp.receive_buffer_size=65536 mrtmp.ping_interval=5000 mrtmp.max_inactivity=60000 mrtmp.tcp_nodelay=true red5-1.0~svn4374.orig-plugins/cluster/src/org/0000755000175000017500000000000011760512614021034 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/cluster/src/org/red5/0000755000175000017500000000000011760512614021673 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/cluster/src/org/red5/server/0000755000175000017500000000000011760512614023201 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/cluster/src/org/red5/server/net/0000755000175000017500000000000011760512614023767 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/cluster/src/org/red5/server/net/RTMPConnManager.java0000644000175000017500000000756111751254704027541 0ustar drazzibdrazzib/* * RED5 Open Source Flash Server - http://code.google.com/p/red5/ * * Copyright 2006-2012 by respective authors (see below). All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.red5.server.net.rtmp; import java.util.ArrayList; import java.util.Collection; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; import org.red5.server.BaseConnection; import org.red5.server.api.scheduling.ISchedulingService; import org.red5.server.net.mrtmp.EdgeRTMPMinaConnection; import org.red5.server.net.rtmpt.RTMPTConnection; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; public class RTMPConnManager implements IRTMPConnManager, ApplicationContextAware { private static final Logger log = LoggerFactory.getLogger(RTMPConnManager.class); private ConcurrentMap connMap = new ConcurrentHashMap(); private ReadWriteLock lock = new ReentrantReadWriteLock(); private ApplicationContext appCtx; public RTMPConnection createConnection(Class connCls) { if (!RTMPConnection.class.isAssignableFrom(connCls)) { return null; } try { RTMPConnection conn = createConnectionInstance(connCls); lock.writeLock().lock(); try { int clientId = BaseConnection.getNextClientId(); conn.setId(clientId); connMap.put(clientId, conn); log.debug("Connection created, id: {}", conn.getId()); } finally { lock.writeLock().unlock(); } return conn; } catch (Exception e) { return null; } } public RTMPConnection getConnection(int clientId) { lock.readLock().lock(); try { return connMap.get(clientId); } finally { lock.readLock().unlock(); } } public RTMPConnection removeConnection(int clientId) { lock.writeLock().lock(); try { log.debug("Removing connection with id: {}", clientId); return connMap.remove(clientId); } finally { lock.writeLock().unlock(); } } public Collection removeConnections() { ArrayList list = new ArrayList(connMap.size()); lock.writeLock().lock(); try { list.addAll(connMap.values()); return list; } finally { lock.writeLock().unlock(); } } public void setApplicationContext(ApplicationContext appCtx) throws BeansException { this.appCtx = appCtx; } public RTMPConnection createConnectionInstance(Class cls) throws Exception { RTMPConnection conn = null; if (cls == RTMPMinaConnection.class) { conn = (RTMPMinaConnection) appCtx.getBean("rtmpMinaConnection"); } else if (cls == EdgeRTMPMinaConnection.class) { conn = (EdgeRTMPMinaConnection) appCtx.getBean("rtmpEdgeMinaConnection"); } else if (cls == RTMPTConnection.class) { conn = (RTMPTConnection) appCtx.getBean("rtmptConnection"); } else { conn = (RTMPConnection) cls.newInstance(); } //set the scheduling service for easy access in the connection conn.setSchedulingService((ISchedulingService) appCtx.getBean(ISchedulingService.BEAN_NAME)); return conn; } } red5-1.0~svn4374.orig-plugins/cluster/src/org/red5/server/net/RTMPOriginConnection.java0000644000175000017500000000733111751254704030613 0ustar drazzibdrazzib/* * RED5 Open Source Flash Server - http://code.google.com/p/red5/ * * Copyright 2006-2012 by respective authors (see below). All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.red5.server.net.rtmp; import org.apache.mina.core.buffer.IoBuffer; import org.red5.server.api.scheduling.ISchedulingService; import org.red5.server.net.mrtmp.IMRTMPConnection; import org.red5.server.net.mrtmp.IMRTMPOriginManager; import org.red5.server.net.mrtmp.OriginMRTMPHandler; import org.red5.server.net.rtmp.codec.RTMP; import org.red5.server.net.rtmp.message.Packet; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * A pseudo-connection on Origin that represents a client * on Edge. * * The connection is created behind a MRTMP connection so * no handshake job or keep-alive job is necessary. No raw byte * data write is needed either. * * @author Steven Gong (steven.gong@gmail.com) * @version $Id$ */ public class RTMPOriginConnection extends RTMPConnection { private static final Logger log = LoggerFactory.getLogger(RTMPOriginConnection.class); private int ioSessionId; private IMRTMPOriginManager mrtmpManager; private OriginMRTMPHandler handler; private RTMP state; public RTMPOriginConnection(String type, int clientId) { this(type, clientId, 0); } public RTMPOriginConnection(String type, int clientId, int ioSessionId) { super(type); setId(clientId); this.ioSessionId = ioSessionId; state = new RTMP(RTMP.MODE_SERVER); state.setState(RTMP.STATE_CONNECTED); } public int getIoSessionId() { return ioSessionId; } public void setMrtmpManager(IMRTMPOriginManager mrtmpManager) { this.mrtmpManager = mrtmpManager; } public void setHandler(OriginMRTMPHandler handler) { this.handler = handler; } public RTMP getState() { return state; } @Override protected void onInactive() { // Edge already tracks the activity // no need to do again here. } @Override public void rawWrite(IoBuffer out) { // won't write any raw data on the wire // XXX should we throw exception here // to indicate an abnormal state ? log.warn("Erhhh... Raw write. Shouldn't be in here!"); } @Override public void write(Packet packet) { IMRTMPConnection conn = mrtmpManager.lookupMRTMPConnection(this); if (conn == null) { // the connect is gone log.debug("Client {} is gone!", getId()); return; } if (!type.equals(PERSISTENT)) { mrtmpManager.associate(this, conn); } log.debug("Origin writing packet to client {}:{}", getId(), packet.getMessage()); conn.write(getId(), packet); } @Override public void startRoundTripMeasurement() { // Edge already tracks the RTT // no need to track RTT here. } @Override protected void startWaitForHandshake(ISchedulingService service) { // no handshake in MRTMP, simply ignore } @Override synchronized public void close() { if (state.getState() == RTMP.STATE_DISCONNECTED) { return; } IMRTMPConnection conn = mrtmpManager.lookupMRTMPConnection(this); if (conn != null) { conn.disconnect(getId()); } handler.closeConnection(this); } synchronized public void realClose() { if (state.getState() != RTMP.STATE_DISCONNECTED) { state.setState(RTMP.STATE_DISCONNECTED); super.close(); } } } red5-1.0~svn4374.orig-plugins/cluster/src/org/red5/server/net/mrtmp/0000755000175000017500000000000011760512614025126 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/cluster/src/org/red5/server/net/mrtmp/MRTMPEdgeConnection.java0000644000175000017500000000165011751254704031502 0ustar drazzibdrazzib/* * RED5 Open Source Flash Server - http://code.google.com/p/red5/ * * Copyright 2006-2012 by respective authors (see below). All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.red5.server.net.mrtmp; /** * @author Steven Gong (steven.gong@gmail.com) */ public class MRTMPEdgeConnection extends BaseMRTMPConnection { public static final String EDGE_CONNECTION_KEY = "edge.conn"; } red5-1.0~svn4374.orig-plugins/cluster/src/org/red5/server/net/mrtmp/EdgeRTMPMinaIoHandler.java0000644000175000017500000000214011751254704031733 0ustar drazzibdrazzib/* * RED5 Open Source Flash Server - http://code.google.com/p/red5/ * * Copyright 2006-2012 by respective authors (see below). All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.red5.server.net.mrtmp; import org.red5.server.net.rtmp.RTMPMinaConnection; import org.red5.server.net.rtmp.RTMPMinaIoHandler; public class EdgeRTMPMinaIoHandler extends RTMPMinaIoHandler { @Override protected RTMPMinaConnection createRTMPMinaConnection() { return (RTMPMinaConnection) getRtmpConnManager().createConnection(EdgeRTMPMinaConnection.class); } } red5-1.0~svn4374.orig-plugins/cluster/src/org/red5/server/net/mrtmp/IMRTMPOriginManager.java0000644000175000017500000000303011751254704031443 0ustar drazzibdrazzib/* * RED5 Open Source Flash Server - http://code.google.com/p/red5/ * * Copyright 2006-2012 by respective authors (see below). All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.red5.server.net.mrtmp; import org.red5.server.net.rtmp.RTMPConnection; /** * @author Steven Gong (steven.gong@gmail.com) */ public interface IMRTMPOriginManager extends IMRTMPManager { /** * Associate the client to a MRTMP connection so that the packet * will be sent via this MRTMP connection. * The association has different impacts on persistent and polling * connections. For persistent connection, the mapping is static while * for polling connection, the mapping is dynamic and might not be * honored. * @param rtmpConn rtmp connection * @param mrtmpConn mrtmp connection */ void associate(RTMPConnection rtmpConn, IMRTMPConnection mrtmpConn); /** * Deassociate the client from the MRTMP connection previously * associated to. * @param rtmpConn */ void dissociate(RTMPConnection rtmpConn); } red5-1.0~svn4374.orig-plugins/cluster/src/org/red5/server/net/mrtmp/OriginMRTMPHandler.java0000644000175000017500000002112111751254704031336 0ustar drazzibdrazzib/* * RED5 Open Source Flash Server - http://code.google.com/p/red5/ * * Copyright 2006-2012 by respective authors (see below). All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.red5.server.net.mrtmp; import java.util.HashMap; import java.util.Map; import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; import org.apache.mina.core.service.IoHandlerAdapter; import org.apache.mina.core.session.IoSession; import org.apache.mina.filter.codec.ProtocolCodecFactory; import org.apache.mina.filter.codec.ProtocolCodecFilter; import org.apache.mina.filter.logging.LoggingFilter; import org.red5.server.api.IConnection; import org.red5.server.net.rtmp.IRTMPHandler; import org.red5.server.net.rtmp.RTMPOriginConnection; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * @author Steven Gong (steven.gong@gmail.com) */ public class OriginMRTMPHandler extends IoHandlerAdapter { private Logger log = LoggerFactory.getLogger(OriginMRTMPHandler.class); private IMRTMPOriginManager mrtmpManager; private ProtocolCodecFactory codecFactory; private IRTMPHandler handler; private Map dynConnMap = new HashMap(); private Map statConnMap = new HashMap(); private ReadWriteLock lock = new ReentrantReadWriteLock(); public void setMrtmpManager(IMRTMPOriginManager mrtmpManager) { this.mrtmpManager = mrtmpManager; } public void setHandler(IRTMPHandler handler) { this.handler = handler; } public void setCodecFactory(ProtocolCodecFactory codecFactory) { this.codecFactory = codecFactory; } @Override public void messageReceived(IoSession session, Object message) throws Exception { MRTMPPacket packet = (MRTMPPacket) message; MRTMPPacket.Header header = packet.getHeader(); MRTMPPacket.Body body = packet.getBody(); if (log.isDebugEnabled()) { log.debug(packet.toString()); } int clientId = header.getClientId(); int sessionId = getSessionId(session); MRTMPOriginConnection mrtmpConn = (MRTMPOriginConnection) session.getAttribute(MRTMPOriginConnection.ORIGIN_CONNECTION_KEY); RTMPOriginConnection conn = null; switch (packet.getHeader().getType()) { case MRTMPPacket.CONNECT: lock.writeLock().lock(); try { if (header.isDynamic()) { if (!dynConnMap.containsKey(clientId)) { conn = new RTMPOriginConnection( IConnection.POLLING, header.getClientId() ); conn.setMrtmpManager(mrtmpManager); conn.setHandler(this); dynConnMap.put(clientId, conn); } else { log.warn("Open an already existing RTMPT origin connection!"); } } else { StaticConnId connId = new StaticConnId(); connId.clientId = header.getClientId(); connId.sessionId = sessionId; if (!statConnMap.containsKey(connId)) { conn = new RTMPOriginConnection( IConnection.PERSISTENT, header.getClientId(), sessionId ); conn.setMrtmpManager(mrtmpManager); conn.setHandler(this); statConnMap.put(connId, conn); } else { log.warn("Open an already existing RTMP origin connection!"); } } } finally { lock.writeLock().unlock(); } break; case MRTMPPacket.CLOSE: case MRTMPPacket.RTMP: lock.readLock().lock(); try { if (header.isDynamic()) { conn = dynConnMap.get(clientId); } else { StaticConnId connId = new StaticConnId(); connId.clientId = header.getClientId(); connId.sessionId = sessionId; conn = statConnMap.get(connId); } } finally { lock.readLock().unlock(); } if (conn != null) { if (packet.getHeader().getType() == MRTMPPacket.CLOSE) { closeConnection(conn); conn = null; } else { MRTMPPacket.RTMPBody rtmpBody = (MRTMPPacket.RTMPBody) body; handler.messageReceived(rtmpBody.getRtmpPacket(), session); } } else { log.warn("Handle on a non-existent origin connection!"); } break; default: log.warn("Unknown mrtmp packet received!"); break; } if (conn != null) { mrtmpManager.associate(conn, mrtmpConn); } } @Override public void messageSent(IoSession session, Object message) throws Exception { MRTMPPacket packet = (MRTMPPacket) message; if (packet.getHeader().getType() != MRTMPPacket.RTMP) { return; } MRTMPPacket.Header header = packet.getHeader(); //MRTMPPacket.Body body = packet.getBody(); int clientId = header.getClientId(); int sessionId = getSessionId(session); @SuppressWarnings("unused") RTMPOriginConnection conn = null; lock.readLock().lock(); try { if (header.isDynamic()) { conn = dynConnMap.get(clientId); } else { StaticConnId connId = new StaticConnId(); connId.clientId = header.getClientId(); connId.sessionId = sessionId; conn = statConnMap.get(connId); } } finally { lock.readLock().unlock(); } //if (conn != null) { //MRTMPPacket.RTMPBody rtmpBody = (MRTMPPacket.RTMPBody) body; //final int channelId = rtmpBody.getRtmpPacket().getHeader().getChannelId(); //final IClientStream stream = conn.getStreamByChannelId(channelId); // XXX we'd better use new event model for notification //if (stream != null && (stream instanceof PlaylistSubscriberStream)) { // ((PlaylistSubscriberStream) stream).written(rtmpBody.getRtmpPacket().getMessage()); //} //} else { //log.warn("Handle on a non-existent origin connection!"); //} } @Override public void sessionClosed(IoSession session) throws Exception { MRTMPOriginConnection conn = (MRTMPOriginConnection) session.getAttribute(MRTMPOriginConnection.ORIGIN_CONNECTION_KEY); // TODO we need to handle the case when all MRTMP connection is broken. mrtmpManager.unregisterConnection(conn); conn.close(); log.debug("Closed MRTMP Origin Connection " + conn); } @Override public void sessionCreated(IoSession session) throws Exception { MRTMPOriginConnection conn = new MRTMPOriginConnection(); conn.setIoSession(session); mrtmpManager.registerConnection(conn); session.setAttribute(MRTMPOriginConnection.ORIGIN_CONNECTION_KEY, conn); session.getFilterChain().addFirst("protocolFilter", new ProtocolCodecFilter(this.codecFactory)); if (log.isDebugEnabled()) { session.getFilterChain().addLast("logger", new LoggingFilter()); } log.debug("Created MRTMP Origin Connection {}", conn); } public void closeConnection(RTMPOriginConnection conn) { boolean dynamic = !conn.getType().equals(IConnection.PERSISTENT); lock.writeLock().lock(); try { if (dynamic) { if (dynConnMap.containsKey(conn.getId())) { dynConnMap.remove(conn.getId()); conn.realClose(); } else { log.warn("Close a non-existent origin connection!"); } } else { StaticConnId connId = new StaticConnId(); connId.clientId = conn.getId(); connId.sessionId = conn.getIoSessionId(); if (statConnMap.containsKey(connId)) { statConnMap.remove(connId); conn.realClose(); } else { log.warn("Close a non-existent origin connection!"); } } } finally { lock.writeLock().unlock(); } mrtmpManager.dissociate(conn); } protected int getSessionId(IoSession session) { MRTMPOriginConnection mrtmpConn = (MRTMPOriginConnection) session.getAttribute(MRTMPOriginConnection.ORIGIN_CONNECTION_KEY); if (mrtmpConn != null) { return mrtmpConn.hashCode(); } return 0; } private static class StaticConnId { public int sessionId; public int clientId; @Override public int hashCode() { final int PRIME = 31; int result = 1; result = PRIME * result + clientId; result = PRIME * result + sessionId; return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; final StaticConnId other = (StaticConnId) obj; if (clientId != other.clientId) return false; if (sessionId != other.sessionId) return false; return true; } } } red5-1.0~svn4374.orig-plugins/cluster/src/org/red5/server/net/mrtmp/IMRTMPConnection.java0000644000175000017500000000233011751254704031022 0ustar drazzibdrazzib/* * RED5 Open Source Flash Server - http://code.google.com/p/red5/ * * Copyright 2006-2012 by respective authors (see below). All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.red5.server.net.mrtmp; import org.red5.server.net.rtmp.message.Packet; /** * @author Steven Gong (steven.gong@gmail.com) */ public interface IMRTMPConnection { /** * Send RTMP packet to other side * @param clientId * @param packet */ void write(int clientId, Packet packet); /** * Send connect message to other side * @param clientId */ void connect(int clientId); /** * Send disconnect message to other side * @param clientId */ void disconnect(int clientId); void close(); } red5-1.0~svn4374.orig-plugins/cluster/src/org/red5/server/net/mrtmp/MRTMPClient.java0000644000175000017500000000751211751254704030037 0ustar drazzibdrazzib/* * RED5 Open Source Flash Server - http://code.google.com/p/red5/ * * Copyright 2006-2012 by respective authors (see below). All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.red5.server.net.mrtmp; import java.net.InetSocketAddress; import org.apache.mina.core.future.ConnectFuture; import org.apache.mina.core.service.IoConnector; import org.apache.mina.core.service.IoHandler; import org.apache.mina.core.session.IdleStatus; import org.apache.mina.core.session.IoSession; import org.apache.mina.transport.socket.SocketSessionConfig; import org.apache.mina.transport.socket.nio.NioSocketConnector; /** * @author Steven Gong (steven.gong@gmail.com) */ public class MRTMPClient implements Runnable { private IoHandler ioHandler; private IoHandler ioHandlerWrapper; private String server; private int port; private Thread connectThread; private boolean needReconnect; public String getServer() { return server; } public void setServer(String address) { this.server = address; } public IoHandler getIoHandler() { return ioHandler; } public void setIoHandler(IoHandler ioHandler) { this.ioHandler = ioHandler; } public int getPort() { return port; } public void setPort(int port) { this.port = port; } public void start() { needReconnect = true; ioHandlerWrapper = new IoHandlerWrapper(ioHandler); connectThread = new Thread(this, "MRTMPClient"); connectThread.setDaemon(true); connectThread.start(); } public void run() { while (true) { synchronized (ioHandlerWrapper) { if (needReconnect) { doConnect(); needReconnect = false; } try { ioHandlerWrapper.wait(); } catch (Exception e) {} } } } private void doConnect() { IoConnector connector = new NioSocketConnector(); connector.setHandler(ioHandlerWrapper); SocketSessionConfig sessionConf = (SocketSessionConfig) connector.getSessionConfig(); sessionConf.setTcpNoDelay(true); while (true) { ConnectFuture future = connector.connect(new InetSocketAddress(server, port)); future.awaitUninterruptibly(500); if (future.isConnected()) { break; } try { Thread.sleep(500); } catch (Exception e) {} } } private void reconnect() { synchronized (ioHandlerWrapper) { needReconnect = true; ioHandlerWrapper.notifyAll(); } } private class IoHandlerWrapper implements IoHandler { private IoHandler wrapped; public IoHandlerWrapper(IoHandler wrapped) { this.wrapped = wrapped; } public void exceptionCaught(IoSession session, Throwable cause) throws Exception { wrapped.exceptionCaught(session, cause); MRTMPClient.this.reconnect(); } public void messageReceived(IoSession session, Object message) throws Exception { wrapped.messageReceived(session, message); } public void messageSent(IoSession session, Object message) throws Exception { wrapped.messageSent(session, message); } public void sessionClosed(IoSession session) throws Exception { wrapped.sessionClosed(session); } public void sessionCreated(IoSession session) throws Exception { wrapped.sessionCreated(session); } public void sessionIdle(IoSession session, IdleStatus status) throws Exception { wrapped.sessionIdle(session, status); } public void sessionOpened(IoSession session) throws Exception { wrapped.sessionOpened(session); } } } red5-1.0~svn4374.orig-plugins/cluster/src/org/red5/server/net/mrtmp/MRTMPMinaTransport.java0000644000175000017500000001431111751254704031415 0ustar drazzibdrazzib/* * RED5 Open Source Flash Server - http://code.google.com/p/red5/ * * Copyright 2006-2012 by respective authors (see below). All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.red5.server.net.mrtmp; import java.net.InetSocketAddress; import java.net.SocketAddress; import java.util.HashSet; import java.util.Set; import org.apache.mina.core.buffer.IoBuffer; import org.apache.mina.core.buffer.SimpleBufferAllocator; import org.apache.mina.core.filterchain.IoFilter; import org.apache.mina.core.service.IoHandlerAdapter; import org.apache.mina.filter.logging.LoggingFilter; import org.apache.mina.transport.socket.SocketAcceptor; import org.apache.mina.transport.socket.SocketSessionConfig; import org.apache.mina.transport.socket.nio.NioSocketAcceptor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * @author Steven Gong (steven.gong@gmail.com) */ public class MRTMPMinaTransport { private static final int DEFAULT_EVENT_THREADS_CORE = 16; private static final int DEFAULT_EVENT_THREADS_KEEPALIVE = 60; private static final int DEFAULT_EVENT_THREADS_MAX = 32; private static final int DEFAULT_EVENT_THREADS_QUEUE = -1; private static final int DEFAULT_IO_THREADS = Runtime.getRuntime() .availableProcessors(); private static final int DEFAULT_PORT = 1935; private static final int DEFAULT_RECEIVE_BUFFER_SIZE = 256 * 1024; private static final int DEFAULT_SEND_BUFFER_SIZE = 64 * 1024; private static final boolean DEFAULT_TCP_NO_DELAY = false; private static final boolean DEFAULT_USE_HEAP_BUFFERS = true; private static final Logger log = LoggerFactory.getLogger(MRTMPMinaTransport.class); private SocketAcceptor acceptor; private String address = null; private int eventThreadsCore = DEFAULT_EVENT_THREADS_CORE; private int eventThreadsKeepalive = DEFAULT_EVENT_THREADS_KEEPALIVE; private int eventThreadsMax = DEFAULT_EVENT_THREADS_MAX; private int eventThreadsQueue = DEFAULT_EVENT_THREADS_QUEUE; private IoHandlerAdapter ioHandler; private int ioThreads = DEFAULT_IO_THREADS; private boolean isLoggingTraffic = false; private int port = DEFAULT_PORT; private int receiveBufferSize = DEFAULT_RECEIVE_BUFFER_SIZE; private int sendBufferSize = DEFAULT_SEND_BUFFER_SIZE; private boolean tcpNoDelay = DEFAULT_TCP_NO_DELAY; private boolean useHeapBuffers = DEFAULT_USE_HEAP_BUFFERS; private void initIOHandler() { if (ioHandler == null) { log.info("No rtmp IO Handler associated - using defaults"); ioHandler = new OriginMRTMPHandler(); } } public void setAddress(String address) { if ("*".equals(address) || "0.0.0.0".equals(address)) { address = null; } this.address = address; } public void setEventThreadsCore(int eventThreadsCore) { this.eventThreadsCore = eventThreadsCore; } public void setEventThreadsKeepalive(int eventThreadsKeepalive) { this.eventThreadsKeepalive = eventThreadsKeepalive; } public void setEventThreadsMax(int eventThreadsMax) { this.eventThreadsMax = eventThreadsMax; } public void setEventThreadsQueue(int eventThreadsQueue) { this.eventThreadsQueue = eventThreadsQueue; } public void setIoHandler(IoHandlerAdapter rtmpIOHandler) { this.ioHandler = rtmpIOHandler; } public void setIoThreads(int ioThreads) { this.ioThreads = ioThreads; } public void setIsLoggingTraffic(boolean isLoggingTraffic) { this.isLoggingTraffic = isLoggingTraffic; } public void setPort(int port) { this.port = port; } public void setReceiveBufferSize(int receiveBufferSize) { this.receiveBufferSize = receiveBufferSize; } public void setSendBufferSize(int sendBufferSize) { this.sendBufferSize = sendBufferSize; } public void setTcpNoDelay(boolean tcpNoDelay) { this.tcpNoDelay = tcpNoDelay; } public void setUseHeapBuffers(boolean useHeapBuffers) { this.useHeapBuffers = useHeapBuffers; } public void start() throws Exception { initIOHandler(); IoBuffer.setUseDirectBuffer(!useHeapBuffers); // this is global, oh well. if (useHeapBuffers) { IoBuffer.setAllocator(new SimpleBufferAllocator()); // dont pool for heap buffers. } log.info("MRTMP Mina Transport Settings"); log.info("IO Threads: {}", ioThreads); log.info("Event Threads:" + " core: " + eventThreadsCore + "+1" + " max: " + eventThreadsMax + "+1" + " queue: " + eventThreadsQueue + " keepalive: " + eventThreadsKeepalive); // Executors.newCachedThreadPool() is always preferred by IoService // See http://mina.apache.org/configuring-thread-model.html for details acceptor = new NioSocketAcceptor(ioThreads); acceptor.setHandler(ioHandler); acceptor.setBacklog(100); log.info("TCP No Delay: {}", tcpNoDelay); log.info("Receive Buffer Size: {}", receiveBufferSize); log.info("Send Buffer Size: {}", sendBufferSize); SocketSessionConfig sessionConf = acceptor.getSessionConfig(); sessionConf.setReuseAddress(true); sessionConf.setTcpNoDelay(tcpNoDelay); // XXX ignore the config of buffer settings // sessionConf.setReceiveBufferSize(receiveBufferSize); // sessionConf.setSendBufferSize(sendBufferSize); if (isLoggingTraffic) { log.info("Configuring traffic logging filter"); IoFilter filter = new LoggingFilter(); acceptor.getFilterChain().addFirst("LoggingFilter", filter); } Set addresses = new HashSet(); SocketAddress socketAddress = (address == null) ? new InetSocketAddress(port) : new InetSocketAddress(address, port); addresses.add(socketAddress); acceptor.bind(addresses); log.info("MRTMP Mina Transport bound to {}", socketAddress.toString()); } public void stop() { log.info("MRTMP Mina Transport unbind"); acceptor.unbind(); } public String toString() { return "MRTMP Mina Transport [port=" + port + "]"; } } red5-1.0~svn4374.orig-plugins/cluster/src/org/red5/server/net/mrtmp/SimpleMRTMPOriginManager.java0000644000175000017500000000764511751254704032524 0ustar drazzibdrazzib/* * RED5 Open Source Flash Server - http://code.google.com/p/red5/ * * Copyright 2006-2012 by respective authors (see below). All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.red5.server.net.mrtmp; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.Map; import java.util.Set; import java.util.Map.Entry; import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.red5.server.api.IConnection; import org.red5.server.net.rtmp.RTMPConnection; import org.red5.server.net.rtmp.RTMPOriginConnection; /** * @author Steven Gong (steven.gong@gmail.com) */ public class SimpleMRTMPOriginManager implements IMRTMPOriginManager { private static final Logger log = LoggerFactory.getLogger(SimpleMRTMPOriginManager.class); private ReadWriteLock lock = new ReentrantReadWriteLock(); private Set connSet = new HashSet(); private Map clientToConnMap; private OriginMRTMPHandler originMRTMPHandler; public SimpleMRTMPOriginManager() { // XXX Use HashMap instead of WeakHashMap temporarily // to avoid package routing issue before Terracotta // integration. clientToConnMap = Collections.synchronizedMap( new HashMap()); } public void setOriginMRTMPHandler(OriginMRTMPHandler originMRTMPHandler) { this.originMRTMPHandler = originMRTMPHandler; } public boolean registerConnection(IMRTMPConnection conn) { lock.writeLock().lock(); try { return connSet.add(conn); } finally { lock.writeLock().unlock(); } } public boolean unregisterConnection(IMRTMPConnection conn) { boolean ret; ArrayList list = new ArrayList(); lock.writeLock().lock(); try { ret = connSet.remove(conn); if (ret) { for (Iterator> iter = clientToConnMap.entrySet().iterator(); iter.hasNext(); ) { Entry entry = iter.next(); if (entry.getValue() == conn) { list.add(entry.getKey()); } } } } finally { lock.writeLock().unlock(); } // close all RTMPOriginConnections for (RTMPConnection rtmpConn : list) { log.debug("Close RTMPOriginConnection " + rtmpConn.getId() + " due to MRTMP Connection closed!"); originMRTMPHandler.closeConnection((RTMPOriginConnection) rtmpConn); } return ret; } public void associate(RTMPConnection rtmpConn, IMRTMPConnection mrtmpConn) { clientToConnMap.put(rtmpConn, mrtmpConn); } public void dissociate(RTMPConnection rtmpConn) { clientToConnMap.remove(rtmpConn); } public IMRTMPConnection lookupMRTMPConnection(RTMPConnection rtmpConn) { lock.readLock().lock(); try { IMRTMPConnection conn = clientToConnMap.get(rtmpConn); if (conn != null && !connSet.contains(conn)) { clientToConnMap.remove(rtmpConn); conn = null; } // mrtmp connection not found, we locate the next mrtmp connection // when the connection is not persistent. if (conn == null && !rtmpConn.getType().equals(IConnection.PERSISTENT)) { if (connSet.size() > 0) { conn = connSet.iterator().next(); } } // TODO handle conn == null case return conn; } finally { lock.readLock().unlock(); } } } red5-1.0~svn4374.orig-plugins/cluster/src/org/red5/server/net/mrtmp/BaseMRTMPConnection.java0000644000175000017500000000502311751254704031506 0ustar drazzibdrazzib/* * RED5 Open Source Flash Server - http://code.google.com/p/red5/ * * Copyright 2006-2012 by respective authors (see below). All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.red5.server.net.mrtmp; import org.apache.mina.core.session.IoSession; import org.red5.server.net.rtmp.message.Packet; /** * @author Steven Gong (steven.gong@gmail.com) */ public class BaseMRTMPConnection implements IMRTMPConnection { private IoSession ioSession; public void write(int clientId, Packet packet) { MRTMPPacket mrtmpPacket = new MRTMPPacket(); MRTMPPacket.RTMPHeader header = new MRTMPPacket.RTMPHeader(); MRTMPPacket.RTMPBody body = new MRTMPPacket.RTMPBody(); mrtmpPacket.setHeader(header); mrtmpPacket.setBody(body); header.setType(MRTMPPacket.RTMP); header.setClientId(clientId); // header and body length will be filled in the protocol codec header.setRtmpType(packet.getHeader().getDataType()); body.setRtmpPacket(packet); ioSession.write(mrtmpPacket); } public void connect(int clientId) { MRTMPPacket mrtmpPacket = new MRTMPPacket(); MRTMPPacket.Header header = new MRTMPPacket.Header(); MRTMPPacket.Body body = new MRTMPPacket.Body(); mrtmpPacket.setHeader(header); mrtmpPacket.setBody(body); header.setType(MRTMPPacket.CONNECT); header.setClientId(clientId); // header and body length will be filled in the protocol codec ioSession.write(mrtmpPacket); } public void disconnect(int clientId) { MRTMPPacket mrtmpPacket = new MRTMPPacket(); MRTMPPacket.Header header = new MRTMPPacket.Header(); MRTMPPacket.Body body = new MRTMPPacket.Body(); mrtmpPacket.setHeader(header); mrtmpPacket.setBody(body); header.setType(MRTMPPacket.CLOSE); header.setClientId(clientId); // header and body length will be filled in the protocol codec ioSession.write(mrtmpPacket); } public void close() { ioSession.close(true); } public IoSession getIoSession() { return ioSession; } public void setIoSession(IoSession ioSession) { this.ioSession = ioSession; } } red5-1.0~svn4374.orig-plugins/cluster/src/org/red5/server/net/mrtmp/MRTMPOriginConnection.java0000644000175000017500000000201111751254704032055 0ustar drazzibdrazzib/* * RED5 Open Source Flash Server - http://code.google.com/p/red5/ * * Copyright 2006-2012 by respective authors (see below). All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.red5.server.net.mrtmp; /** * @author Steven Gong (steven.gong@gmail.com) */ public class MRTMPOriginConnection extends BaseMRTMPConnection { public static final String ORIGIN_CONNECTION_KEY = "origin.conn"; @Override public void connect(int clientId) { // server connection, do nothing here } } red5-1.0~svn4374.orig-plugins/cluster/src/org/red5/server/net/mrtmp/IMRTMPManager.java0000644000175000017500000000322711751254704030303 0ustar drazzibdrazzib/* * RED5 Open Source Flash Server - http://code.google.com/p/red5/ * * Copyright 2006-2012 by respective authors (see below). All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.red5.server.net.mrtmp; import org.red5.server.net.rtmp.RTMPConnection; /** * @author Steven Gong (steven.gong@gmail.com) */ public interface IMRTMPManager { /** * Map a client to an Edge/Origin MRTMP connection. * On Edge, the server will find an Origin connection per routing logic. * On Origin, the server will send to the original in-coming connection * if the client connection type is persistent. Or the latest in-coming * connection will be used. * @param conn * @return the IMRTMPConnection */ IMRTMPConnection lookupMRTMPConnection(RTMPConnection conn); /** * Register a MRTMP connection so that it can be later * been looked up. * @param conn * @return whether the registration is successful */ boolean registerConnection(IMRTMPConnection conn); /** * Unregister a MRTMP connection. * @param conn * @return whether the registration is successful */ boolean unregisterConnection(IMRTMPConnection conn); } red5-1.0~svn4374.orig-plugins/cluster/src/org/red5/server/net/mrtmp/IMRTMPEdgeManager.java0000644000175000017500000000160711751254704031070 0ustar drazzibdrazzib/* * RED5 Open Source Flash Server - http://code.google.com/p/red5/ * * Copyright 2006-2012 by respective authors (see below). All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.red5.server.net.mrtmp; /** * A tag interface. * @author Steven Gong (steven.gong@gmail.com) * @version $Id$ */ public interface IMRTMPEdgeManager extends IMRTMPManager { } red5-1.0~svn4374.orig-plugins/cluster/src/org/red5/server/net/mrtmp/SimpleMRTMPEdgeManager.java0000644000175000017500000000376711751254704032142 0ustar drazzibdrazzib/* * RED5 Open Source Flash Server - http://code.google.com/p/red5/ * * Copyright 2006-2012 by respective authors (see below). All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.red5.server.net.mrtmp; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; import org.red5.server.net.rtmp.IRTMPConnManager; import org.red5.server.net.rtmp.RTMPConnection; /** * A simple Edge connection manager that only manages one Edge/Origin connection. * @author Steven Gong (steven.gong@gmail.com) * @version $Id$ */ public class SimpleMRTMPEdgeManager implements IMRTMPEdgeManager { private IRTMPConnManager rtmpConnManager; private List connList = new ArrayList(); public void setRtmpConnManager(IRTMPConnManager rtmpConnManager) { this.rtmpConnManager = rtmpConnManager; } public boolean registerConnection(IMRTMPConnection conn) { return connList.add(conn); } public boolean unregisterConnection(IMRTMPConnection conn) { boolean ret = connList.remove(conn); if (ret) { Collection rtmpConns = rtmpConnManager.removeConnections(); for (Iterator iter = rtmpConns.iterator(); iter.hasNext(); ) { RTMPConnection rtmpConn = iter.next(); rtmpConn.close(); } } return ret; } public IMRTMPConnection lookupMRTMPConnection(RTMPConnection conn) { if (connList.size() > 0) { return connList.get(0); } else { return null; } } } red5-1.0~svn4374.orig-plugins/cluster/src/org/red5/server/net/mrtmp/MRTMPPacket.java0000644000175000017500000000737611751254704030040 0ustar drazzibdrazzib/* * RED5 Open Source Flash Server - http://code.google.com/p/red5/ * * Copyright 2006-2012 by respective authors (see below). All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.red5.server.net.mrtmp; import org.apache.mina.core.buffer.IoBuffer; import org.red5.server.net.rtmp.message.Packet; /** * @author Steven Gong (steven.gong@gmail.com) */ public class MRTMPPacket { public static final short CONNECT = 0; public static final short CLOSE = 1; public static final short RTMP = 2; public static final short JAVA_ENCODING = 0; public static final int COMMON_HEADER_LENGTH = 20; public static final int RTMP_HEADER_LENGTH = COMMON_HEADER_LENGTH + 4; private Header header; private Body body; static public class Header { private short type; private short bodyEncoding; private boolean dynamic; private int clientId; private int headerLength; private int bodyLength; public int getBodyLength() { return bodyLength; } public void setBodyLength(int bodyLength) { this.bodyLength = bodyLength; } public int getClientId() { return clientId; } public void setClientId(int clientId) { this.clientId = clientId; } public int getHeaderLength() { return headerLength; } public void setHeaderLength(int headerLength) { this.headerLength = headerLength; } public short getType() { return type; } public void setType(short type) { this.type = type; } public short getBodyEncoding() { return bodyEncoding; } public void setBodyEncoding(short bodyEncoding) { this.bodyEncoding = bodyEncoding; } public boolean isDynamic() { return dynamic; } public void setDynamic(boolean dynamic) { this.dynamic = dynamic; } } static public class Body { private IoBuffer rawBuf; public IoBuffer getRawBuf() { return rawBuf; } public void setRawBuf(IoBuffer rawBuf) { this.rawBuf = rawBuf; } } static public class RTMPHeader extends Header { private int rtmpType; public int getRtmpType() { return rtmpType; } public void setRtmpType(int rtmpType) { this.rtmpType = rtmpType; } } static public class RTMPBody extends Body { private Packet rtmpPacket; public Packet getRtmpPacket() { return rtmpPacket; } public void setRtmpPacket(Packet rtmpPacket) { this.rtmpPacket = rtmpPacket; } } public Body getBody() { return body; } public void setBody(Body body) { this.body = body; } public Header getHeader() { return header; } public void setHeader(Header header) { this.header = header; } public String toString() { StringBuffer buf = new StringBuffer(); buf.append("MRTMPPacket: type="); switch (header.getType()) { case CONNECT: buf.append("CONNECT"); break; case CLOSE: buf.append("CLOSE"); break; case RTMP: buf.append("RTMP"); break; default: break; } buf.append(",isDynamic=" + header.isDynamic()); buf.append(",clientId=" + header.getClientId()); if (header.getType() == RTMP) { RTMPHeader rtmpHeader = (RTMPHeader) header; buf.append(",rtmpType=" + rtmpHeader.rtmpType); RTMPBody rtmpBody = (RTMPBody) body; buf.append(",rtmpBody=" + rtmpBody.rtmpPacket.getMessage()); } return buf.toString(); } } red5-1.0~svn4374.orig-plugins/cluster/src/org/red5/server/net/mrtmp/EdgeMRTMPHandler.java0000644000175000017500000001156311751254704030764 0ustar drazzibdrazzib/* * RED5 Open Source Flash Server - http://code.google.com/p/red5/ * * Copyright 2006-2012 by respective authors (see below). All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.red5.server.net.mrtmp; import org.apache.mina.core.service.IoHandlerAdapter; import org.apache.mina.core.session.IoSession; import org.apache.mina.filter.codec.ProtocolCodecFactory; import org.apache.mina.filter.codec.ProtocolCodecFilter; import org.apache.mina.filter.logging.LoggingFilter; import org.red5.server.net.mrtmp.MRTMPPacket.RTMPBody; import org.red5.server.net.mrtmp.MRTMPPacket.RTMPHeader; import org.red5.server.net.rtmp.IRTMPConnManager; import org.red5.server.net.rtmp.RTMPConnection; import org.red5.server.net.rtmp.codec.RTMP; import org.red5.server.net.rtmp.event.Invoke; import org.red5.server.net.rtmp.message.Constants; import org.red5.server.service.Call; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * @author Steven Gong (steven.gong@gmail.com) */ public class EdgeMRTMPHandler extends IoHandlerAdapter implements Constants { private static final Logger log = LoggerFactory.getLogger(EdgeMRTMPHandler.class); private IRTMPConnManager rtmpConnManager; private IMRTMPEdgeManager mrtmpManager; private ProtocolCodecFactory codecFactory; public void setCodecFactory(ProtocolCodecFactory codecFactory) { this.codecFactory = codecFactory; } public void setMrtmpManager(IMRTMPEdgeManager mrtmpManager) { this.mrtmpManager = mrtmpManager; } public void setRtmpConnManager(IRTMPConnManager rtmpConnManager) { this.rtmpConnManager = rtmpConnManager; } @Override public void messageReceived(IoSession session, Object message) throws Exception { MRTMPPacket mrtmpPacket = (MRTMPPacket) message; int clientId = mrtmpPacket.getHeader().getClientId(); RTMPConnection conn = rtmpConnManager.getConnection(clientId); if (conn == null) { log.debug("Client " + clientId + " is already closed."); return; } RTMP rtmpState = conn.getState(); switch (mrtmpPacket.getHeader().getType()) { case MRTMPPacket.CLOSE: conn.setStateCode(RTMP.STATE_EDGE_DISCONNECTING); conn.close(); break; case MRTMPPacket.RTMP: RTMPHeader rtmpHeader = (RTMPHeader) mrtmpPacket.getHeader(); RTMPBody rtmpBody = (RTMPBody) mrtmpPacket.getBody(); boolean toDisconnect = false; conn.getWriteLock().lock(); try { if (rtmpState.getState() == RTMP.STATE_ORIGIN_CONNECT_FORWARDED && rtmpHeader.getRtmpType() == TYPE_INVOKE) { // we got the connect invocation result from Origin // parse the result Invoke invoke = (Invoke) rtmpBody.getRtmpPacket().getMessage(); if ("connect".equals(invoke.getCall().getServiceMethodName())) { if (invoke.getCall().getStatus() == Call.STATUS_SUCCESS_RESULT) { rtmpState.setState(RTMP.STATE_CONNECTED); } else { // TODO set EdgeRTMP state to closing ? toDisconnect = true; } } } } finally { conn.getWriteLock().unlock(); } log.debug("Forward packet to client: {}", rtmpBody.getRtmpPacket().getMessage()); // send the packet back to client conn.write(rtmpBody.getRtmpPacket()); if (toDisconnect) { conn.close(); } conn.getWriteLock().lock(); try { if (rtmpState.getState() == RTMP.STATE_CONNECTED) { conn.startRoundTripMeasurement(); } } finally { conn.getWriteLock().unlock(); } break; default: break; } } @Override public void messageSent(IoSession session, Object message) throws Exception { // do nothing } @Override public void sessionClosed(IoSession session) throws Exception { MRTMPEdgeConnection conn = (MRTMPEdgeConnection) session.getAttribute(MRTMPEdgeConnection.EDGE_CONNECTION_KEY); mrtmpManager.unregisterConnection(conn); conn.close(); log.debug("Closed MRTMP Edge Connection " + conn); } @Override public void sessionCreated(IoSession session) throws Exception { MRTMPEdgeConnection conn = new MRTMPEdgeConnection(); conn.setIoSession(session); mrtmpManager.registerConnection(conn); session.setAttribute(MRTMPEdgeConnection.EDGE_CONNECTION_KEY, conn); session.getFilterChain().addFirst("protocolFilter", new ProtocolCodecFilter(this.codecFactory)); if (log.isDebugEnabled()) { session.getFilterChain().addLast("logger", new LoggingFilter()); } log.debug("Created MRTMP Edge Connection {}", conn); } } red5-1.0~svn4374.orig-plugins/cluster/src/org/red5/server/net/mrtmp/codec/0000755000175000017500000000000011760512614026203 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/cluster/src/org/red5/server/net/mrtmp/codec/MRTMPProtocolEncoder.java0000644000175000017500000000561211751254704032776 0ustar drazzibdrazzib/* * RED5 Open Source Flash Server - http://code.google.com/p/red5/ * * Copyright 2006-2012 by respective authors (see below). All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.red5.server.net.mrtmp.codec; import java.io.ByteArrayOutputStream; import java.io.ObjectOutputStream; import org.apache.mina.core.buffer.IoBuffer; import org.apache.mina.core.session.IoSession; import org.apache.mina.filter.codec.ProtocolEncoder; import org.apache.mina.filter.codec.ProtocolEncoderOutput; import org.red5.server.net.mrtmp.MRTMPPacket; /** * @author Steven Gong (steven.gong@gmail.com) */ public class MRTMPProtocolEncoder implements ProtocolEncoder { public void dispose(IoSession session) throws Exception { } public void encode(IoSession session, Object message, ProtocolEncoderOutput out) throws Exception { MRTMPPacket packet = (MRTMPPacket) message; MRTMPPacket.Header header = packet.getHeader(); IoBuffer buf = null; switch (header.getType()) { case MRTMPPacket.CONNECT: case MRTMPPacket.CLOSE: buf = IoBuffer.allocate(MRTMPPacket.COMMON_HEADER_LENGTH); buf.setAutoExpand(true); break; case MRTMPPacket.RTMP: buf = IoBuffer.allocate(MRTMPPacket.RTMP_HEADER_LENGTH); buf.setAutoExpand(true); break; default: break; } if (buf == null) { return; } buf.putShort(header.getType()); buf.putShort(MRTMPPacket.JAVA_ENCODING); int preserved = header.isDynamic() ? 0x80000000 : 0; buf.putInt(preserved); buf.putInt(header.getClientId()); if (header.getType() == MRTMPPacket.CONNECT || header.getType() == MRTMPPacket.CLOSE) { buf.putInt(MRTMPPacket.COMMON_HEADER_LENGTH); buf.putInt(0); } else if (header.getType() == MRTMPPacket.RTMP) { buf.putInt(MRTMPPacket.RTMP_HEADER_LENGTH); int bodyLengthPos = buf.position(); buf.putInt(0); MRTMPPacket.RTMPHeader rtmpHeader = (MRTMPPacket.RTMPHeader) packet.getHeader(); buf.putInt(rtmpHeader.getRtmpType()); MRTMPPacket.RTMPBody body = (MRTMPPacket.RTMPBody) packet.getBody(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(body.getRtmpPacket()); oos.close(); buf.put(baos.toByteArray()); // substract the 8-byte body length field and rtmp type field buf.putInt(bodyLengthPos, buf.position() - bodyLengthPos - 8); } buf.flip(); out.write(buf); } } red5-1.0~svn4374.orig-plugins/cluster/src/org/red5/server/net/mrtmp/codec/MRTMPProtocolDecoder.java0000644000175000017500000001207211751254704032762 0ustar drazzibdrazzib/* * RED5 Open Source Flash Server - http://code.google.com/p/red5/ * * Copyright 2006-2012 by respective authors (see below). All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.red5.server.net.mrtmp.codec; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.ObjectInputStream; import org.apache.mina.core.buffer.IoBuffer; import org.apache.mina.core.session.IoSession; import org.apache.mina.filter.codec.ProtocolDecoder; import org.apache.mina.filter.codec.ProtocolDecoderOutput; import org.red5.server.net.mrtmp.MRTMPPacket; import org.red5.server.net.rtmp.message.Packet; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * @author Steven Gong (steven.gong@gmail.com) */ public class MRTMPProtocolDecoder implements ProtocolDecoder { private static final Logger log = LoggerFactory.getLogger(MRTMPProtocolDecoder.class); public void decode(IoSession session, IoBuffer in, ProtocolDecoderOutput out) throws Exception { IoBuffer buffer = (IoBuffer) session.getAttribute("buffer"); if (buffer == null) { buffer = IoBuffer.allocate(16 * 1024); buffer.setAutoExpand(true); session.setAttribute("buffer", buffer); } buffer.put(in); buffer.flip(); while (true) { if (buffer.remaining() < MRTMPPacket.COMMON_HEADER_LENGTH) { break; } int pos = buffer.position(); MRTMPPacket.Header header = decodeHeader(buffer); if (header == null) { buffer.position(pos); break; } if (buffer.remaining() < header.getBodyLength()) { buffer.position(pos); break; } MRTMPPacket.Body body = decodeBody(buffer, header); MRTMPPacket packet = new MRTMPPacket(); packet.setHeader(header); packet.setBody(body); if (log.isDebugEnabled()) { log.debug(packet.toString()); } out.write(packet); } buffer.compact(); } public void dispose(IoSession session) throws Exception { // nothing to dispose for decoding } public void finishDecode(IoSession session, ProtocolDecoderOutput out) throws Exception { IoBuffer buffer = (IoBuffer) session.getAttribute("buffer"); if (buffer != null) { buffer.free(); } } public MRTMPPacket.Header decodeHeader(IoBuffer buffer) { short type = buffer.getShort(); short bodyEncoding = buffer.getShort(); int preserved = buffer.getInt(); int clientId = buffer.getInt(); int headerLength = buffer.getInt(); int bodyLength = buffer.getInt(); if (buffer.remaining() < headerLength - MRTMPPacket.COMMON_HEADER_LENGTH) { return null; } MRTMPPacket.Header header = null; if (type == MRTMPPacket.RTMP && headerLength != MRTMPPacket.RTMP_HEADER_LENGTH) { // XXX errrh, something weird happens log.warn("Codec error: wrong RTMP header length " + headerLength); header = new MRTMPPacket.Header(); buffer.skip(headerLength - MRTMPPacket.COMMON_HEADER_LENGTH); } else if (type == MRTMPPacket.RTMP) { header = new MRTMPPacket.RTMPHeader(); MRTMPPacket.RTMPHeader rtmpHeader = (MRTMPPacket.RTMPHeader) header; rtmpHeader.setRtmpType(buffer.getInt()); } else { header = new MRTMPPacket.Header(); buffer.skip(headerLength - MRTMPPacket.COMMON_HEADER_LENGTH); } header.setType(type); header.setBodyEncoding(bodyEncoding); header.setDynamic((preserved & 0x8000000) != 0); header.setClientId(clientId); header.setHeaderLength(headerLength); header.setBodyLength(bodyLength); return header; } public MRTMPPacket.Body decodeBody(IoBuffer buffer, MRTMPPacket.Header header) { MRTMPPacket.Body body = null; switch (header.getType()) { case MRTMPPacket.CONNECT: case MRTMPPacket.CLOSE: if (header.getBodyLength() != 0) { // XXX something weird happens log.warn("Codec error: wrong connect/close body length " + header.getBodyLength()); } return new MRTMPPacket.Body(); case MRTMPPacket.RTMP: byte[] byteArray = new byte[header.getBodyLength()]; buffer.get(byteArray); ObjectInputStream ois = null; try { ois = new ObjectInputStream(new ByteArrayInputStream(byteArray)); Packet packet = (Packet) ois.readObject(); body = new MRTMPPacket.RTMPBody(); MRTMPPacket.RTMPBody rtmpBody = (MRTMPPacket.RTMPBody) body; rtmpBody.setRtmpPacket(packet); } catch (IOException e) { // XXX should not happen log.error("", e); } catch (ClassNotFoundException e) { // XXX should not happen log.error("", e); } break; default: byteArray = new byte[header.getBodyLength()]; buffer.get(byteArray); body = new MRTMPPacket.Body(); body.setRawBuf(IoBuffer.wrap(byteArray)); break; } return body; } } red5-1.0~svn4374.orig-plugins/cluster/src/org/red5/server/net/mrtmp/codec/MRTMPCodecFactory.java0000644000175000017500000000260211751254704032236 0ustar drazzibdrazzib/* * RED5 Open Source Flash Server - http://code.google.com/p/red5/ * * Copyright 2006-2012 by respective authors (see below). All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.red5.server.net.mrtmp.codec; import org.apache.mina.core.session.IoSession; import org.apache.mina.filter.codec.ProtocolCodecFactory; import org.apache.mina.filter.codec.ProtocolDecoder; import org.apache.mina.filter.codec.ProtocolEncoder; /** * @author Steven Gong (steven.gong@gmail.com) */ public class MRTMPCodecFactory implements ProtocolCodecFactory { private ProtocolDecoder decoder = new MRTMPProtocolDecoder(); private ProtocolEncoder encoder = new MRTMPProtocolEncoder(); public ProtocolDecoder getDecoder(IoSession session) throws Exception { return decoder; } public ProtocolEncoder getEncoder(IoSession session) throws Exception { return encoder; } } red5-1.0~svn4374.orig-plugins/cluster/src/org/red5/server/net/mrtmp/EdgeRTMPMinaConnection.java0000644000175000017500000000400611751254704032170 0ustar drazzibdrazzib/* * RED5 Open Source Flash Server - http://code.google.com/p/red5/ * * Copyright 2006-2012 by respective authors (see below). All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.red5.server.net.mrtmp; import org.red5.server.api.scheduling.ISchedulingService; import org.red5.server.net.rtmp.RTMPMinaConnection; import org.red5.server.net.rtmp.codec.RTMP; public class EdgeRTMPMinaConnection extends RTMPMinaConnection { private IMRTMPEdgeManager mrtmpManager; public void setMrtmpManager(IMRTMPEdgeManager mrtmpManager) { this.mrtmpManager = mrtmpManager; } @Override public void close() { boolean needNotifyOrigin = false; RTMP state = getState(); getWriteLock().lock(); try{ if (state.getState() == RTMP.STATE_CONNECTED) { needNotifyOrigin = true; // now we are disconnecting ourselves state.setState(RTMP.STATE_EDGE_DISCONNECTING); } } finally { getWriteLock().unlock(); } if (needNotifyOrigin) { IMRTMPConnection conn = mrtmpManager.lookupMRTMPConnection(this); if (conn != null) { conn.disconnect(getId()); } } getWriteLock().lock(); try { if (state.getState() == RTMP.STATE_DISCONNECTED) { return; } else { state.setState(RTMP.STATE_DISCONNECTED); } } finally { getWriteLock().unlock(); } super.close(); } @Override protected void startWaitForHandshake(ISchedulingService service) { // FIXME: do nothing to avoid disconnect. } } red5-1.0~svn4374.orig-plugins/cluster/src/org/red5/server/net/mrtmp/EdgeRTMPHandler.java0000644000175000017500000001523611751254704030650 0ustar drazzibdrazzib/* * RED5 Open Source Flash Server - http://code.google.com/p/red5/ * * Copyright 2006-2012 by respective authors (see below). All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.red5.server.net.mrtmp; import java.util.Map; import org.apache.mina.core.buffer.IoBuffer; import org.apache.mina.core.session.IoSession; import org.red5.server.api.IConnection.Encoding; import org.red5.server.api.service.IPendingServiceCall; import org.red5.server.api.service.IServiceCall; import org.red5.server.net.protocol.ProtocolState; import org.red5.server.net.rtmp.Channel; import org.red5.server.net.rtmp.RTMPConnection; import org.red5.server.net.rtmp.RTMPHandler; import org.red5.server.net.rtmp.codec.RTMP; import org.red5.server.net.rtmp.event.BytesRead; import org.red5.server.net.rtmp.event.IRTMPEvent; import org.red5.server.net.rtmp.event.Invoke; import org.red5.server.net.rtmp.event.Ping; import org.red5.server.net.rtmp.event.Unknown; import org.red5.server.net.rtmp.message.Header; import org.red5.server.net.rtmp.message.Packet; import org.red5.server.net.rtmp.message.StreamAction; import org.red5.server.service.Call; public class EdgeRTMPHandler extends RTMPHandler { private IMRTMPManager mrtmpManager; public void setMRTMPManager(IMRTMPManager mrtmpManager) { this.mrtmpManager = mrtmpManager; } @Override public void messageReceived(Object in, IoSession session) throws Exception { RTMPConnection conn = (RTMPConnection) session.getAttribute(RTMPConnection.RTMP_CONNECTION_KEY); RTMP state = (RTMP) session.getAttribute(ProtocolState.SESSION_KEY); IRTMPEvent message = null; final Packet packet = (Packet) in; message = packet.getMessage(); final Header header = packet.getHeader(); final Channel channel = conn.getChannel(header.getChannelId()); // Increase number of received messages conn.messageReceived(); if (header.getDataType() == TYPE_BYTES_READ) { // TODO need to sync the bytes read on edge and origin onStreamBytesRead(conn, channel, header, (BytesRead) message); } if (header.getDataType() == TYPE_INVOKE) { final IServiceCall call = ((Invoke) message).getCall(); final String action = call.getServiceMethodName(); if (call.getServiceName() == null && !conn.isConnected() && StreamAction.valueOf(action).equals(StreamAction.CONNECT)) { handleConnect(conn, channel, header, (Invoke) message, (RTMP) state); return; } } switch (header.getDataType()) { case TYPE_CHUNK_SIZE: case TYPE_INVOKE: case TYPE_FLEX_MESSAGE: case TYPE_NOTIFY: case TYPE_AUDIO_DATA: case TYPE_VIDEO_DATA: case TYPE_FLEX_SHARED_OBJECT: case TYPE_FLEX_STREAM_SEND: case TYPE_SHARED_OBJECT: case TYPE_BYTES_READ: forwardPacket(conn, packet); break; case TYPE_PING: onPing(conn, channel, header, (Ping) message); break; default: if (log.isDebugEnabled()) { log.debug("Unknown type: {}", header.getDataType()); } } if (message instanceof Unknown) { log.info(message.toString()); } if (message != null) { message.release(); } } public void messageSent(RTMPConnection conn, Object message) { log.debug("Message sent"); if (message instanceof IoBuffer) { return; } // Increase number of sent messages conn.messageSent((Packet) message); } /** * Pass through all Ping events to origin except ping/pong */ protected void onPing(RTMPConnection conn, Channel channel, Header source, Ping ping) { switch (ping.getEventType()) { case Ping.PONG_SERVER: // This is the response to an IConnection.ping request conn.pingReceived(ping); break; default: // forward other to origin Packet p = new Packet(source); p.setMessage(ping); forwardPacket(conn, p); } } protected void handleConnect(RTMPConnection conn, Channel channel, Header header, Invoke invoke, RTMP rtmp) { final IPendingServiceCall call = invoke.getCall(); // Get parameters passed from client to NetConnection#connection final Map params = invoke.getConnectionParams(); // Get hostname String host = getHostname((String) params.get("tcUrl")); // App name as path, but without query string if there is one String path = (String) params.get("app"); if (path.indexOf("?") != -1) { int idx = path.indexOf("?"); params.put("queryString", path.substring(idx)); path = path.substring(0, idx); } params.put("path", path); final String sessionId = null; conn.setup(host, path, sessionId, params); // check the security constraints // send back "ConnectionRejected" if fails. if (!checkPermission(conn)) { call.setStatus(Call.STATUS_ACCESS_DENIED); call.setResult(getStatus(NC_CONNECT_REJECTED)); Invoke reply = new Invoke(); reply.setCall(call); reply.setInvokeId(invoke.getInvokeId()); channel.write(reply); conn.close(); } else { synchronized (rtmp) { // connect the origin sendConnectMessage(conn); rtmp.setState(RTMP.STATE_EDGE_CONNECT_ORIGIN_SENT); Packet packet = new Packet(header); packet.setMessage(invoke); forwardPacket(conn, packet); rtmp.setState(RTMP.STATE_ORIGIN_CONNECT_FORWARDED); // Evaluate request for AMF3 encoding if (Integer.valueOf(3).equals(params.get("objectEncoding"))) { rtmp.setEncoding(Encoding.AMF3); } } } } protected boolean checkPermission(RTMPConnection conn) { // TODO check permission per some rules return true; } protected void sendConnectMessage(RTMPConnection conn) { IMRTMPConnection mrtmpConn = mrtmpManager.lookupMRTMPConnection(conn); if (mrtmpConn != null) { mrtmpConn.connect(conn.getId()); } } protected void forwardPacket(RTMPConnection conn, Packet packet) { IMRTMPConnection mrtmpConn = mrtmpManager.lookupMRTMPConnection(conn); if (mrtmpConn != null) { mrtmpManager.lookupMRTMPConnection(conn).write(conn.getId(), packet); } } @Override public void connectionClosed(RTMPConnection conn, RTMP state) { // the state change will be maintained inside connection object. conn.close(); } } red5-1.0~svn4374.orig-plugins/cluster/src/red5-edge.xml0000644000175000017500000000363011751254704022535 0ustar drazzibdrazzib classpath:/red5-common.xml classpath:/red5-edge-core.xml red5-1.0~svn4374.orig-plugins/cluster/src/red5-origin.xml0000644000175000017500000001534111751254704023122 0ustar drazzibdrazzib classpath:/red5-common.xml classpath:/red5-origin-core.xml ${http.port} ${https.port} false ${http.URIEncoding} red5-1.0~svn4374.orig-plugins/cluster/src/red5-edge-core.xml0000644000175000017500000001235611751254704023470 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/cluster/.settings/0000755000175000017500000000000011760512614021374 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/cluster/.settings/org.eclipse.jdt.core.prefs0000644000175000017500000005452611751254704026375 0ustar drazzibdrazzib#Tue Aug 10 20:18:27 PDT 2010 eclipse.preferences.version=1 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 org.eclipse.jdt.core.formatter.blank_lines_after_package=1 org.eclipse.jdt.core.formatter.blank_lines_before_field=1 org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 org.eclipse.jdt.core.formatter.blank_lines_before_method=1 org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 org.eclipse.jdt.core.formatter.blank_lines_before_package=0 org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false org.eclipse.jdt.core.formatter.comment.format_block_comments=false org.eclipse.jdt.core.formatter.comment.format_header=false org.eclipse.jdt.core.formatter.comment.format_html=true org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false org.eclipse.jdt.core.formatter.comment.format_line_comments=false org.eclipse.jdt.core.formatter.comment.format_source_code=true org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true org.eclipse.jdt.core.formatter.comment.indent_root_tags=true org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert org.eclipse.jdt.core.formatter.comment.line_length=80 org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true org.eclipse.jdt.core.formatter.compact_else_if=true org.eclipse.jdt.core.formatter.continuation_indentation=2 org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_empty_lines=false org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true org.eclipse.jdt.core.formatter.indentation.size=4 org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.join_lines_in_comments=true org.eclipse.jdt.core.formatter.join_wrapped_lines=true org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false org.eclipse.jdt.core.formatter.lineSplit=180 org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true org.eclipse.jdt.core.formatter.tabulation.char=mixed org.eclipse.jdt.core.formatter.tabulation.size=4 org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true red5-1.0~svn4374.orig-plugins/cluster/.settings/org.eclipse.jdt.ui.prefs0000644000175000017500000000016611751254704026051 0ustar drazzibdrazzib#Mon Nov 02 20:49:37 PST 2009 eclipse.preferences.version=1 formatter_profile=_Red5 formatter_settings_version=11 red5-1.0~svn4374.orig-plugins/tomcat/0000755000175000017500000000000011760512620017261 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/tomcat/build.xml0000644000175000017500000000717211745776716021136 0ustar drazzibdrazzib java.home is ${java.home} and the target version is ${java.target_version} red5.root is ${red5.root} javac version: ${java.version} Type ant -p for available targets" red5-1.0~svn4374.orig-plugins/tomcat/ivy.xml0000644000175000017500000000512211745776716020637 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/tomcat/lib/0000755000175000017500000000000011760512620020027 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/tomcat/ivysettings.xml0000644000175000017500000000323511745776716022423 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/tomcat/.classpath0000644000175000017500000000113611745776716021272 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/tomcat/.project0000644000175000017500000000071511745776716020760 0ustar drazzibdrazzib tomcatplugin Tomcat Red5 plugin org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature org.apache.ivyde.eclipse.ivynature red5-1.0~svn4374.orig-plugins/tomcat/build.bat0000644000175000017500000000000311431605517021044 0ustar drazzibdrazzibantred5-1.0~svn4374.orig-plugins/tomcat/build.properties0000644000175000017500000000027511754545067022520 0ustar drazzibdrazzib# Let the scripts know where your red5 is (ie. the location of the red5.jar) red5.root=E:/dev/red5/java/server/trunk/dist debug.state=true # Tomcat plugin version plugin.version=1.3 red5-1.0~svn4374.orig-plugins/tomcat/src/0000755000175000017500000000000011760512620020050 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/tomcat/src/jee-container.xml0000644000175000017500000002741611754545067023345 0ustar drazzibdrazzib ${https.port} ${http.port} false true port ${https.port} redirectPort ${http.port} SSLEnabled true sslProtocol TLS clientAuth false keystoreFile conf/keystore keystorePass ${rtmps.keystorepass} keystoreType JKS red5-1.0~svn4374.orig-plugins/tomcat/src/org/0000755000175000017500000000000011760512620020637 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/tomcat/src/org/red5/0000755000175000017500000000000011760512620021476 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/tomcat/src/org/red5/server/0000755000175000017500000000000011760512620023004 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/tomcat/src/org/red5/server/jmx/0000755000175000017500000000000011760512620023602 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/tomcat/src/org/red5/server/jmx/mxbeans/0000755000175000017500000000000011760512620025237 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/tomcat/src/org/red5/server/jmx/mxbeans/TomcatVHostLoaderMXBean.java0000644000175000017500000000445011745776716032527 0ustar drazzibdrazzibpackage org.red5.server.jmx.mxbeans; import javax.management.MXBean; import org.apache.catalina.Host; import org.apache.catalina.Valve; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** * Simple mbean interface for Tomcat container virtual host loaders. * * @author The Red5 Project (red5@osflash.org) * @author Paul Gregoire (mondain@gmail.com) */ @MXBean public interface TomcatVHostLoaderMXBean { public void init(); public void uninit(); public boolean startWebApplication(String applicationName); public boolean getAutoDeploy(); public void setAutoDeploy(boolean autoDeploy); public Host getHost(); public String getDomain(); public void setDomain(String domain); public void addAlias(String alias); public void removeAlias(String alias); public org.apache.catalina.Context addContext(String path, String docBase); public void removeContext(String path); public void addValve(Valve valve); public void removeValve(String valveInfo); public boolean getLiveDeploy(); public void setLiveDeploy(boolean liveDeploy); public String getName(); public void setName(String name); public boolean getStartChildren(); public void setStartChildren(boolean startChildren); public boolean getUnpackWARs(); public void setUnpackWARs(boolean unpackWARs); public String getWebappRoot(); public void setWebappRoot(String webappRoot); public void shutdown(); } red5-1.0~svn4374.orig-plugins/tomcat/src/org/red5/server/security/0000755000175000017500000000000011760512620024653 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/tomcat/src/org/red5/server/security/realm/0000755000175000017500000000000011760512620025753 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/tomcat/src/org/red5/server/security/realm/NoRealm.java0000644000175000017500000000616411616427014030164 0ustar drazzibdrazzibpackage org.red5.server.security.realm; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2011 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.security.Principal; import org.apache.catalina.LifecycleException; import org.apache.catalina.realm.RealmBase; /** * Simple implementation of a realm that does nothing but take up space. * * @author Paul Gregoire */ public class NoRealm extends RealmBase { /** * Descriptive information about this Realm implementation. */ protected final String info = "org.red5.server.security.realm.NoRealm/1.0"; /** * Descriptive information about this Realm implementation. */ protected static final String name = "NoRealm"; /** * Return descriptive information about this Realm implementation and * the corresponding version number, in the format * <description>/<version>. */ public String getInfo() { return info; } /** * Return the Principal associated with the specified username and * credentials, if there is one; otherwise return null. * * @param username Username of the Principal to look up * @param credentials Password or other credentials to use in * authenticating this username */ public Principal authenticate(String username, String credentials) { return null; } /** * Return a short name for this Realm implementation. */ protected String getName() { return NoRealm.name; } /** * Return the password associated with the given principal's user name. */ protected String getPassword(String username) { return null; } /** * Return the Principal associated with the given user name. */ protected Principal getPrincipal(String username) { return null; } /** * Prepare for active use of the public methods of this Component. * * @exception LifecycleException if this component detects a fatal error * that prevents it from being started */ public synchronized void start() throws LifecycleException { super.start(); } /** * Gracefully shut down active use of the public methods of this Component. * * @exception LifecycleException if this component detects a fatal error * that needs to be reported */ public synchronized void stop() throws LifecycleException { super.stop(); } } red5-1.0~svn4374.orig-plugins/tomcat/src/org/red5/server/security/jaas/0000755000175000017500000000000011760512620025571 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/tomcat/src/org/red5/server/security/jaas/jaas.config0000644000175000017500000000011511616427014027675 0ustar drazzibdrazzibred5Engine { org.red5.server.security.jaas.SimpleLoginModule required; }; red5-1.0~svn4374.orig-plugins/tomcat/src/org/red5/server/security/jaas/SimpleLoginModule.java0000644000175000017500000001336711616427014032040 0ustar drazzibdrazzibpackage org.red5.server.security.jaas; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2011 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.io.IOException; import java.util.HashMap; import java.util.Map; import javax.security.auth.Subject; import javax.security.auth.callback.Callback; import javax.security.auth.callback.CallbackHandler; import javax.security.auth.callback.NameCallback; import javax.security.auth.callback.PasswordCallback; import javax.security.auth.callback.UnsupportedCallbackException; import javax.security.auth.login.FailedLoginException; import javax.security.auth.login.LoginException; import javax.security.auth.spi.LoginModule; import org.red5.logging.Red5LoggerFactory; import org.slf4j.Logger; /** * This LoginModule authenticates a user with a password. * This module comes pre-loaded with one user / password pair and the ability for implementers * to add additional pairs. The pre-loaded user is "red5" and their password is "password". * * @author Paul Gregoire (mondain@gmail.com) */ public class SimpleLoginModule implements LoginModule { private static Logger log = Red5LoggerFactory.getLogger(SimpleLoginModule.class); // initial state private Subject subject; private CallbackHandler callbackHandler; private Map principals = new HashMap(); // the authentication status private boolean succeeded = false; private boolean commitSucceeded = false; private ThreadLocal userPrincipal = new ThreadLocal(); { // add our default user SimplePrincipal prince = new SimplePrincipal("red5", "password"); principals.put("red5", prince); } /** {@inheritDoc} */ public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options) { log.debug("initialize - subject: {}", subject); this.subject = subject; this.callbackHandler = callbackHandler; } /** {@inheritDoc} */ public boolean login() throws LoginException { // prompt for a user name and password if (callbackHandler == null) { throw new LoginException("Error: no CallbackHandler available, required to hold authentication information from the user"); } Callback[] callbacks = new Callback[2]; callbacks[0] = new NameCallback("User name: "); callbacks[1] = new PasswordCallback("Password: ", false); String userName; char[] passwd; try { callbackHandler.handle(callbacks); userName = ((NameCallback) callbacks[0]).getName(); char[] tmpPassword = ((PasswordCallback) callbacks[1]).getPassword(); if (tmpPassword == null) { // treat a NULL password as an empty password tmpPassword = new char[0]; } passwd = new char[tmpPassword.length]; System.arraycopy(tmpPassword, 0, passwd, 0, tmpPassword.length); ((PasswordCallback) callbacks[1]).clearPassword(); } catch (IOException ioe) { throw new LoginException(ioe.toString()); } catch (UnsupportedCallbackException uce) { throw new LoginException("Error: " + uce.getCallback().toString() + " not available to hold authentication information"); } String password = new String(passwd); log.debug("User name: {} password: {}", userName, password); // verify the username/password SimplePrincipal prince = new SimplePrincipal(userName, password); // look for a matching user SimplePrincipal tmp = principals.get(userName); // checks user name match if (tmp != null && tmp.equals(prince)) { // check passwords if (tmp.getPassword().equals(prince.getPassword())) { userPrincipal.set(prince); log.debug("Authentication succeeded"); succeeded = true; return true; } } succeeded = false; throw new FailedLoginException("Authentication failed"); } /** {@inheritDoc} */ public boolean commit() throws LoginException { if (!succeeded) { return false; } else { SimplePrincipal prince = userPrincipal.get(); if (!subject.getPrincipals().contains(prince)) { subject.getPrincipals().add(prince); } log.debug("Added principal to the subject"); commitSucceeded = true; return true; } } /** {@inheritDoc} */ public boolean abort() throws LoginException { if (!succeeded) { return false; } else if (succeeded && !commitSucceeded) { // login succeeded but overall authentication failed succeeded = false; userPrincipal.remove(); } else { // overall authentication succeeded and commit succeeded, // but someone else's commit failed logout(); } return true; } /** {@inheritDoc} */ public boolean logout() throws LoginException { SimplePrincipal prince = userPrincipal.get(); subject.getPrincipals().remove(prince); userPrincipal.remove(); succeeded = false; succeeded = commitSucceeded; return true; } /** * Adds a new Principal, given a user name and password. * * @param userName * @param password */ public void add(String userName, String password) { SimplePrincipal prince = new SimplePrincipal(userName, password); principals.put(userName, prince); } } red5-1.0~svn4374.orig-plugins/tomcat/src/org/red5/server/security/jaas/SimplePrincipal.java0000644000175000017500000000555111616427014031537 0ustar drazzibdrazzibpackage org.red5.server.security.jaas; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2011 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.io.Serializable; import java.security.Principal; /** * Represents a user. *
* Principals may be associated with a particular Subject * to augment it with an additional identity. Authorization decisions can be based upon * the Principals associated with a Subject. * * @see java.security.Principal * @see javax.security.auth.Subject */ public class SimplePrincipal implements Principal, Serializable { private static final long serialVersionUID = -5845179654012035528L; /** * @serial */ private String name; private String passwd; /** * Create a Principal with the given name. * * @param name the username for this user * @param password the password for this user * @exception NullPointerException if the name is null. */ public SimplePrincipal(String name, String password) { if (name == null) { throw new NullPointerException("Name cannot be null"); } this.name = name; this.passwd = password; } /** {@inheritDoc} */ public String getName() { return name; } /** * @return the passwd */ public String getPassword() { return passwd; } /* (non-Javadoc) * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((name == null) ? 0 : name.hashCode()); return result; } /* (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; SimplePrincipal other = (SimplePrincipal) obj; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) return false; return true; } /* (non-Javadoc) * @see java.lang.Object#toString() */ @Override public String toString() { return "SimplePrincipal [name=" + name + ", password=" + passwd + "]"; } } red5-1.0~svn4374.orig-plugins/tomcat/src/org/red5/server/tomcat/0000755000175000017500000000000011760512620024273 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/tomcat/src/org/red5/server/tomcat/TomcatLoader.java0000644000175000017500000010421011754545067027530 0ustar drazzibdrazzibpackage org.red5.server.tomcat; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2011 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.io.File; import java.io.FilenameFilter; import java.lang.management.ManagementFactory; import java.net.BindException; import java.net.InetAddress; import java.net.InetSocketAddress; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.management.JMX; import javax.management.MBeanServer; import javax.management.ObjectName; import javax.servlet.ServletContext; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.apache.catalina.Container; import org.apache.catalina.Context; import org.apache.catalina.Engine; import org.apache.catalina.Host; import org.apache.catalina.Loader; import org.apache.catalina.Realm; import org.apache.catalina.Valve; import org.apache.catalina.connector.Connector; import org.apache.catalina.core.AprLifecycleListener; import org.apache.catalina.core.ContainerBase; import org.apache.catalina.core.StandardContext; import org.apache.catalina.core.StandardHost; import org.apache.catalina.core.StandardWrapper; import org.apache.catalina.loader.WebappLoader; import org.apache.catalina.realm.JAASRealm; import org.apache.catalina.realm.RealmBase; import org.apache.catalina.startup.Embedded; import org.apache.coyote.ProtocolHandler; import org.apache.coyote.http11.Http11NioProtocol; import org.apache.coyote.http11.Http11Protocol; import org.red5.logging.Red5LoggerFactory; import org.red5.server.ContextLoader; import org.red5.server.LoaderBase; import org.red5.server.api.IApplicationContext; import org.red5.server.jmx.mxbeans.ContextLoaderMXBean; import org.red5.server.jmx.mxbeans.LoaderMXBean; import org.red5.server.security.realm.NoRealm; import org.red5.server.util.FileUtil; import org.slf4j.Logger; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.context.support.AbstractApplicationContext; import org.springframework.jmx.export.annotation.ManagedResource; import org.springframework.web.context.ConfigurableWebApplicationContext; import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.support.XmlWebApplicationContext; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** * Red5 loader for Tomcat. * * @author Paul Gregoire (mondain@gmail.com) */ @ManagedResource(objectName = "org.red5.server:type=TomcatLoader", description = "TomcatLoader") public class TomcatLoader extends LoaderBase implements ApplicationContextAware, LoaderMXBean { /* * http://blog.springsource.com/2007/06/11/using-a-shared-parent-application-context-in-a-multi-war-spring-application/ */ /** * Filters directory content */ protected final static class DirectoryFilter implements FilenameFilter { /** * Check whether file matches filter rules * * @param dir Directory * @param name File name * @return true If file does match filter rules, false otherwise */ public boolean accept(File dir, String name) { File f = new File(dir, name); log.trace("Filtering: {} name: {}", dir.getName(), name); log.trace("Constructed dir: {}", f.getAbsolutePath()); // filter out all non-directories that are hidden and/or not // readable boolean result = f.isDirectory() && f.canRead() && !f.isHidden(); // nullify f = null; return result; } } // Initialize Logging private static Logger log = Red5LoggerFactory.getLogger(TomcatLoader.class); public static final String defaultSpringConfigLocation = "/WEB-INF/red5-*.xml"; public static final String defaultParentContextKey = "default.context"; static { log.debug("Initializing tomcat"); } /** * Common name for the Service and Engine components. */ public String serviceEngineName = "red5Engine"; /** * Base container host. */ protected Host host; /** * Tomcat connector. */ protected Connector connector; /** * Embedded Tomcat service (like Catalina). */ protected static Embedded embedded; /** * Tomcat engine. */ protected static Engine engine; /** * Tomcat realm. */ protected Realm realm; /** * Hosts */ protected List hosts; /** * Connectors */ protected List connectors; /** * Valves */ protected List valves = new ArrayList(); /** * Additional connection properties to be set at init. */ protected Map connectionProperties = new HashMap(); /** * IP Address to bind to. */ protected InetAddress address; /** * Add context for path and docbase to current host. * * @param path Path * @param docBase Document base * @return Catalina context (that is, web application) */ public Context addContext(String path, String docBase) { return addContext(path, docBase, host); } /** * Add context for path and docbase to a host. * * @param path Path * @param docBase Document base * @param host Host to add context to * @return Catalina context (that is, web application) */ public Context addContext(String path, String docBase, Host host) { log.debug("Add context - path: {} docbase: {}", path, docBase); org.apache.catalina.Context c = embedded.createContext(path, docBase); if (c != null) { log.trace("Context name: {} docbase: {} encoded: {}", new Object[] { c.getName(), c.getDocBase(), c.getEncodedPath() }); ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); c.setParentClassLoader(classLoader); // Object ldr = c.getLoader(); log.trace("Context loader (null if the context has not been started): {}", ldr); if (ldr == null) { WebappLoader wldr = new WebappLoader(classLoader); //add the Loader to the context c.setLoader(wldr); } log.debug("Context loader (check): {} Context classloader: {}", c.getLoader(), c.getLoader().getClassLoader()); host.addChild(c); LoaderBase.setRed5ApplicationContext(getHostId() + path, new TomcatApplicationContext(c)); } else { log.trace("Context is null"); } return c; } /** * Remove context from the current host. * * @param path Path */ @Override public void removeContext(String path) { Container[] children = host.findChildren(); for (Container c : children) { if (c instanceof StandardContext && c.getName().equals(path)) { try { ((StandardContext) c).stop(); host.removeChild(c); break; } catch (Exception e) { log.error("Could not remove context: {}", c.getName(), e); } } } IApplicationContext ctx = LoaderBase.removeRed5ApplicationContext(path); if (ctx != null) { ctx.stop(); } else { log.warn("Context could not be stopped, it was null for path: {}", path); } } /** * Get base host. * * @return Base host */ public Host getBaseHost() { return host; } /** * Return connector. * * @return Connector */ public Connector getConnector() { return connector; } /** * Getter for embedded object. * * @return Embedded object */ public Embedded getEmbedded() { return embedded; } /** * Return Tomcat engine. * * @return Tomcat engine */ public Engine getEngine() { return engine; } /** * Getter for realm. * * @return Realm */ public Realm getRealm() { return realm; } /** * Initialization. */ public void init() { log.info("Loading tomcat context"); //get a reference to the current threads classloader final ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader(); // root location for servlet container String serverRoot = System.getProperty("red5.root"); log.info("Server root: {}", serverRoot); String confRoot = System.getProperty("red5.config_root"); log.info("Config root: {}", confRoot); // set catalina's home property System.setProperty("CATALINA_HOME", serverRoot); // create one embedded (server) and use it everywhere embedded = new Embedded(); embedded.createLoader(originalClassLoader); embedded.setCatalinaBase(serverRoot); embedded.setCatalinaHome(serverRoot); embedded.setName(serviceEngineName); log.trace("Classloader for embedded: {} TCL: {}", Embedded.class.getClassLoader(), originalClassLoader); engine = embedded.createEngine(); engine.setDefaultHost(host.getName()); engine.setName(serviceEngineName); if (webappFolder == null) { // Use default webapps directory webappFolder = FileUtil.formatPath(System.getProperty("red5.root"), "/webapps"); } System.setProperty("red5.webapp.root", webappFolder); log.info("Application root: {}", webappFolder); // scan for additional webapp contexts // Root applications directory File appDirBase = new File(webappFolder); // Subdirs of root apps dir File[] dirs = appDirBase.listFiles(new DirectoryFilter()); // Search for additional context files for (File dir : dirs) { String dirName = '/' + dir.getName(); // check to see if the directory is already mapped if (null == host.findChild(dirName)) { String webappContextDir = FileUtil.formatPath(appDirBase.getAbsolutePath(), dirName); log.debug("Webapp context directory (full path): {}", webappContextDir); Context ctx = null; if ("/root".equals(dirName) || "/root".equalsIgnoreCase(dirName)) { log.trace("Adding ROOT context"); ctx = addContext("/", webappContextDir); } else { log.trace("Adding context from directory scan: {}", dirName); ctx = addContext(dirName, webappContextDir); } log.trace("Context: {}", ctx); //see if the application requests php support String enablePhp = ctx.findParameter("enable-php"); //if its null try to read directly if (enablePhp == null) { File webxml = new File(webappContextDir + "/WEB-INF/", "web.xml"); if (webxml.exists() && webxml.canRead()) { try { DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); Document doc = docBuilder.parse(webxml); // normalize text representation doc.getDocumentElement().normalize(); log.trace("Root element of the doc is {}", doc.getDocumentElement().getNodeName()); NodeList listOfElements = doc.getElementsByTagName("context-param"); int totalElements = listOfElements.getLength(); log.trace("Total no of elements: {}", totalElements); for (int s = 0; s < totalElements; s++) { Node fstNode = listOfElements.item(s); if (fstNode.getNodeType() == Node.ELEMENT_NODE) { Element fstElmnt = (Element) fstNode; NodeList fstNmElmntLst = fstElmnt.getElementsByTagName("param-name"); Element fstNmElmnt = (Element) fstNmElmntLst.item(0); NodeList fstNm = fstNmElmnt.getChildNodes(); String pName = (fstNm.item(0)).getNodeValue(); log.trace("Param name: {}", pName); if ("enable-php".equals(pName)) { NodeList lstNmElmntLst = fstElmnt.getElementsByTagName("param-value"); Element lstNmElmnt = (Element) lstNmElmntLst.item(0); NodeList lstNm = lstNmElmnt.getChildNodes(); String pValue = (lstNm.item(0)).getNodeValue(); log.trace("Param value: {}", pValue); enablePhp = pValue; // break; } } } } catch (Exception e) { log.warn("Error reading web.xml", e); } } webxml = null; } log.debug("Enable php: {}", enablePhp); if ("true".equals(enablePhp)) { log.info("Adding PHP (Quercus) servlet for context: {}", ctx.getName()); // add servlet wrapper StandardWrapper wrapper = (StandardWrapper) ctx.createWrapper(); wrapper.setServletName("QuercusServlet"); wrapper.setServletClass("com.caucho.quercus.servlet.QuercusServlet"); log.debug("Wrapper: {}", wrapper); ctx.addChild(wrapper); // add servlet mappings ctx.addServletMapping("*.php", "QuercusServlet"); } webappContextDir = null; } } appDirBase = null; dirs = null; // Dump context list if (log.isDebugEnabled()) { for (Container cont : host.findChildren()) { log.debug("Context child name: {}", cont.getName()); } } // set a realm on the "server" if specified if (realm != null) { embedded.setRealm(realm); } else { /* realm = new MemoryRealm(); ((MemoryRealm) realm).setPathname(confRoot + "/tomcat-users.xml"); */ realm = new NoRealm(); embedded.setRealm(realm); } // use Tomcat jndi or not if (System.getProperty("catalina.useNaming") != null) { embedded.setUseNaming(Boolean.valueOf(System.getProperty("catalina.useNaming"))); } // add the valves to the host for (Valve valve : valves) { log.debug("Adding host valve: {}", valve); ((StandardHost) host).addValve(valve); } // baseHost = embedded.createHost(hostName, appRoot); engine.addChild(host); // add any additional hosts if (hosts != null && !hosts.isEmpty()) { // grab current contexts from base host Container[] currentContexts = host.findChildren(); log.info("Adding {} additional hosts", hosts.size()); for (Host h : hosts) { log.debug("Host - name: {} appBase: {} info: {}", new Object[] { h.getName(), h.getAppBase(), h.getInfo() }); //add the contexts to each host for (Container cont : currentContexts) { Context c = (Context) cont; addContext(c.getPath(), c.getDocBase(), h); } //add the host to the engine engine.addChild(h); } } // Add new Engine to set of Engine for embedded server embedded.addEngine(engine); // whether or not ssl is enabled boolean useSSL = false; // set connection properties for (String key : connectionProperties.keySet()) { log.debug("Setting connection property: {} = {}", key, connectionProperties.get(key)); if ("SSLEnabled".equals(key)) { useSSL = Boolean.valueOf(connectionProperties.get(key)); } if (connectors == null || connectors.isEmpty()) { connector.setProperty(key, connectionProperties.get(key)); } else { for (Connector ctr : connectors) { ctr.setProperty(key, connectionProperties.get(key)); } } } // determine if https support is requested if (useSSL) { // turn off native apr support AprLifecycleListener listener = new AprLifecycleListener(); listener.setSSLEngine("off"); connector.addLifecycleListener(listener); // set connection properties connector.setSecure(true); connector.setScheme("https"); } // set the bind address if (address == null) { //bind locally address = InetSocketAddress.createUnresolved("127.0.0.1", connector.getPort()).getAddress(); } // apply the bind address ProtocolHandler handler = connector.getProtocolHandler(); if (handler instanceof Http11Protocol) { ((Http11Protocol) handler).setAddress(address); } else if (handler instanceof Http11NioProtocol) { ((Http11NioProtocol) handler).setAddress(address); } else { log.warn("Unknown handler type: {}", handler.getClass().getName()); } // Start server try { // Add new Connector to set of Connectors for embedded server, // associated with Engine if (connectors == null || connectors.isEmpty()) { embedded.addConnector(connector); log.trace("Connector oName: {}", connector.getObjectName()); } else { for (Connector ctr : connectors) { embedded.addConnector(ctr); log.trace("Connector oName: {}", ctr.getObjectName()); } } log.info("Starting Tomcat servlet engine"); embedded.start(); // create references for later lookup LoaderBase.setApplicationLoader(new TomcatApplicationLoader(embedded, host, applicationContext)); for (final Container cont : host.findChildren()) { if (cont instanceof StandardContext) { if (log.isDebugEnabled()) { ContainerBase cb = (ContainerBase) cont; log.debug("Oname - domain: {} container suffix: {}", new Object[] { cb.getDomain(), cb.getContainerSuffix() }); } final StandardContext ctx = (StandardContext) cont; final ServletContext servletContext = ctx.getServletContext(); log.debug("Context initialized: {}", servletContext.getContextPath()); //set the hosts id servletContext.setAttribute("red5.host.id", getHostId()); final String prefix = servletContext.getRealPath("/"); log.debug("Path: {}", prefix); try { if (ctx.resourcesStart()) { log.debug("Resources started"); } log.debug("Context - available: {} privileged: {}, start time: {}, reloadable: {}", new Object[] { ctx.getAvailable(), ctx.getPrivileged(), ctx.getStartTime(), ctx.getReloadable() }); Loader cldr = ctx.getLoader(); log.debug("Loader delegate: {} type: {}", cldr.getDelegate(), cldr.getClass().getName()); if (log.isTraceEnabled()) { if (cldr instanceof WebappLoader) { log.trace("WebappLoader class path: {}", ((WebappLoader) cldr).getClasspath()); } } final ClassLoader webClassLoader = cldr.getClassLoader(); log.debug("Webapp classloader: {}", webClassLoader); // get the (spring) config file path final String contextConfigLocation = servletContext.getInitParameter(org.springframework.web.context.ContextLoader.CONFIG_LOCATION_PARAM) == null ? defaultSpringConfigLocation : servletContext.getInitParameter(org.springframework.web.context.ContextLoader.CONFIG_LOCATION_PARAM); log.debug("Spring context config location: {}", contextConfigLocation); // get the (spring) parent context key final String parentContextKey = servletContext.getInitParameter(org.springframework.web.context.ContextLoader.LOCATOR_FACTORY_KEY_PARAM) == null ? defaultParentContextKey : servletContext.getInitParameter(org.springframework.web.context.ContextLoader.LOCATOR_FACTORY_KEY_PARAM); log.debug("Spring parent context key: {}", parentContextKey); //set current threads classloader to the webapp classloader Thread.currentThread().setContextClassLoader(webClassLoader); //create a thread to speed-up application loading Thread thread = new Thread("Launcher:" + servletContext.getContextPath()) { public void run() { //set thread context classloader to web classloader Thread.currentThread().setContextClassLoader(webClassLoader); //get the web app's parent context ApplicationContext parentContext = null; if (applicationContext.containsBean(parentContextKey)) { parentContext = (ApplicationContext) applicationContext.getBean(parentContextKey); } else { log.warn("Parent context was not found: {}", parentContextKey); } // create a spring web application context final String contextClass = servletContext.getInitParameter(org.springframework.web.context.ContextLoader.CONTEXT_CLASS_PARAM) == null ? XmlWebApplicationContext.class .getName() : servletContext.getInitParameter(org.springframework.web.context.ContextLoader.CONTEXT_CLASS_PARAM); //web app context (spring) ConfigurableWebApplicationContext appctx = null; try { Class clazz = Class.forName(contextClass, true, webClassLoader); appctx = (ConfigurableWebApplicationContext) clazz.newInstance(); } catch (Throwable e) { throw new RuntimeException("Failed to load webapplication context class.", e); } appctx.setConfigLocations(new String[] { contextConfigLocation }); appctx.setServletContext(servletContext); //set parent context or use current app context if (parentContext != null) { appctx.setParent(parentContext); } else { appctx.setParent(applicationContext); } // set the root webapp ctx attr on the each servlet context so spring can find it later servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, appctx); //refresh the factory log.trace("Classloader prior to refresh: {}", appctx.getClassLoader()); appctx.refresh(); if (log.isDebugEnabled()) { log.debug("Red5 app is active: {} running: {}", appctx.isActive(), appctx.isRunning()); } // set a realm for the webapp if one is specified if (appctx.containsBean("realm")) { log.debug("Realm specified in context configuration"); Realm contextRealm = (Realm) appctx.getBean("realm"); if (contextRealm != null) { log.debug("Realm class: {}", contextRealm.getClass().getName()); contextRealm.setContainer(cont); ctx.setRealm(contextRealm); if (contextRealm instanceof JAASRealm) { log.debug("Realm is JAAS type"); System.setProperty("java.security.auth.login.config", prefix + "WEB-INF/jaas.config"); } log.debug("Realm info: {} path: {}", contextRealm.getInfo(), ((RealmBase) contextRealm).getRealmPath()); } } } }; thread.setDaemon(true); thread.start(); } catch (Throwable t) { log.error("Error setting up context: {} due to: {}", servletContext.getContextPath(), t.getMessage()); t.printStackTrace(); } finally { //reset the classloader Thread.currentThread().setContextClassLoader(originalClassLoader); } } } // if everything is ok at this point then call the rtmpt and rtmps // beans so they will init if (applicationContext.containsBean("rtmpt.server")) { log.debug("Initializing RTMPT"); applicationContext.getBean("rtmpt.server"); log.debug("Finished initializing RTMPT"); } else { log.info("Dedicated RTMPT server configuration was not specified"); } if (applicationContext.containsBean("rtmps.server")) { log.debug("Initializing RTMPS"); applicationContext.getBean("rtmps.server"); log.debug("Finished initializing RTMPS"); } else { log.debug("Dedicated RTMPS server configuration was not specified"); } } catch (Exception e) { if (e instanceof BindException || e.getMessage().indexOf("BindException") != -1) { log.error("Error loading tomcat, unable to bind connector. You may not have permission to use the selected port", e); } else { log.error("Error loading tomcat", e); } } finally { registerJMX(); } } /** * Starts a web application and its red5 (spring) component. This is * basically a stripped down version of init(). * * @return true on success */ public boolean startWebApplication(String applicationName) { log.info("Starting Tomcat - Web application"); boolean result = false; //get a reference to the current threads classloader final ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader(); log.debug("Webapp root: {}", webappFolder); // application directory String contextName = '/' + applicationName; Container ctx = null; if (webappFolder == null) { // Use default webapps directory webappFolder = System.getProperty("red5.root") + "/webapps"; } System.setProperty("red5.webapp.root", webappFolder); log.info("Application root: {}", webappFolder); // scan for additional webapp contexts // Root applications directory File appDirBase = new File(webappFolder); // check if the context already exists for the host if ((ctx = host.findChild(contextName)) == null) { log.debug("Context did not exist in host"); String webappContextDir = FileUtil.formatPath(appDirBase.getAbsolutePath(), applicationName); log.debug("Webapp context directory (full path): {}", webappContextDir); // set the newly created context as the current container ctx = addContext(contextName, webappContextDir); } else { log.debug("Context already exists in host"); } final ServletContext servletContext = ((Context) ctx).getServletContext(); log.debug("Context initialized: {}", servletContext.getContextPath()); String prefix = servletContext.getRealPath("/"); log.debug("Path: {}", prefix); try { Loader cldr = ctx.getLoader(); log.debug("Loader delegate: {} type: {}", cldr.getDelegate(), cldr.getClass().getName()); if (cldr instanceof WebappLoader) { log.debug("WebappLoader class path: {}", ((WebappLoader) cldr).getClasspath()); } final ClassLoader webClassLoader = cldr.getClassLoader(); log.debug("Webapp classloader: {}", webClassLoader); // get the (spring) config file path final String contextConfigLocation = servletContext.getInitParameter("contextConfigLocation") == null ? defaultSpringConfigLocation : servletContext .getInitParameter("contextConfigLocation"); log.debug("Spring context config location: {}", contextConfigLocation); // get the (spring) parent context key final String parentContextKey = servletContext.getInitParameter("parentContextKey") == null ? defaultParentContextKey : servletContext .getInitParameter("parentContextKey"); log.debug("Spring parent context key: {}", parentContextKey); //set current threads classloader to the webapp classloader Thread.currentThread().setContextClassLoader(webClassLoader); //create a thread to speed-up application loading Thread thread = new Thread("Launcher:" + servletContext.getContextPath()) { @SuppressWarnings("cast") public void run() { //set current threads classloader to the webapp classloader Thread.currentThread().setContextClassLoader(webClassLoader); // create a spring web application context XmlWebApplicationContext appctx = new XmlWebApplicationContext(); appctx.setClassLoader(webClassLoader); appctx.setConfigLocations(new String[] { contextConfigLocation }); // check for red5 context bean ApplicationContext parentAppCtx = null; if (applicationContext.containsBean(defaultParentContextKey)) { parentAppCtx = (ApplicationContext) applicationContext.getBean(defaultParentContextKey); appctx.setParent(parentAppCtx); } else { log.warn("{} bean was not found in context: {}", defaultParentContextKey, applicationContext.getDisplayName()); // lookup context loader and attempt to get what we need from it if (applicationContext.containsBean("context.loader")) { ContextLoader contextLoader = (ContextLoader) applicationContext.getBean("context.loader"); parentAppCtx = contextLoader.getContext(defaultParentContextKey); appctx.setParent(parentAppCtx); } else { log.debug("Context loader was not found, trying JMX"); MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); // get the ContextLoader from jmx ContextLoaderMXBean proxy = null; ObjectName oName = null; try { oName = new ObjectName("org.red5.server:name=contextLoader,type=ContextLoader"); if (mbs.isRegistered(oName)) { proxy = JMX.newMXBeanProxy(mbs, oName, ContextLoaderMXBean.class, true); log.debug("Context loader was found"); proxy.setParentContext(defaultParentContextKey, appctx.getId()); } else { log.warn("Context loader was not found"); } } catch (Exception e) { log.warn("Exception looking up ContextLoader", e); } } } if (log.isDebugEnabled()) { if (appctx.getParent() != null) { log.debug("Parent application context: {}", appctx.getParent().getDisplayName()); } } // add the servlet context appctx.setServletContext(servletContext); // set the root webapp ctx attr on the each // servlet context so spring can find it later servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, appctx); appctx.refresh(); } }; thread.setDaemon(true); thread.start(); result = true; } catch (Throwable t) { log.error("Error setting up context: {} due to: {}", servletContext.getContextPath(), t.getMessage()); t.printStackTrace(); } finally { //reset the classloader Thread.currentThread().setContextClassLoader(originalClassLoader); } return result; } /** * The address to which we will bind. * * @param address */ public void setAddress(InetSocketAddress address) { log.info("Address to bind: {}", address); this.address = address.getAddress(); } /** * Set base host. * * @param baseHost Base host */ public void setBaseHost(Host baseHost) { log.debug("setBaseHost"); this.host = baseHost; } /** * Set connector. * * @param connector Connector */ public void setConnector(Connector connector) { log.info("Setting connector: {}", connector.getClass().getName()); this.connector = connector; } /** * Set additional connectors. * * @param connectors Additional connectors */ public void setConnectors(List connectors) { log.debug("setConnectors: {}", connectors.size()); this.connectors = connectors; } /** * Set additional contexts. * * @param contexts Map of contexts */ public void setContexts(Map contexts) { log.debug("setContexts: {}", contexts.size()); for (Map.Entry entry : contexts.entrySet()) { host.addChild(embedded.createContext(entry.getKey(), webappFolder + entry.getValue())); } } /** * Setter for embedded object. * * @param embedded Embedded object */ public void setEmbedded(Embedded embedded) { log.info("Setting embedded: {}", embedded.getClass().getName()); TomcatLoader.embedded = embedded; } /** * Get the host. * * @return host */ public Host getHost() { return host; } /** * Set the host. * * @param host host */ public void setHost(Host host) { log.debug("setHost"); this.host = host; } /** * Set additional hosts. * * @param hosts List of hosts added to engine */ public void setHosts(List hosts) { log.debug("setHosts: {}", hosts.size()); this.hosts = hosts; } /** * Setter for realm. * * @param realm Realm */ public void setRealm(Realm realm) { log.info("Setting realm: {}", realm.getClass().getName()); this.realm = realm; } /** * Set additional valves. * * @param valves List of valves */ public void setValves(List valves) { log.debug("setValves: {}", valves.size()); this.valves.addAll(valves); } /** * Set connection properties for the connector * * @param props additional properties to set */ public void setConnectionProperties(Map props) { log.debug("Connection props: {}", props.size()); this.connectionProperties.putAll(props); } /** * Returns a semi-unique id for this host based on its host values * * @return host id */ protected String getHostId() { String hostId = host.getName(); log.debug("Host id: {}", hostId); return hostId; } protected void registerJMX() { // register with jmx MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); try { ObjectName oName = new ObjectName("org.red5.server:type=TomcatLoader"); // check for existing registration before registering if (!mbs.isRegistered(oName)) { mbs.registerMBean(this, oName); } else { log.debug("ContextLoader is already registered in JMX"); } } catch (Exception e) { log.warn("Error on jmx registration", e); } } protected void unregisterJMX() { MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); try { ObjectName oName = new ObjectName("org.red5.server:type=TomcatLoader"); mbs.unregisterMBean(oName); } catch (Exception e) { log.warn("Exception unregistering", e); } } /** * Shut server down. */ public void shutdown() { log.info("Shutting down Tomcat context"); //run through the applications and ensure that spring is told //to commence shutdown / disposal AbstractApplicationContext absCtx = (AbstractApplicationContext) LoaderBase.getApplicationContext(); if (absCtx != null) { log.debug("Using loader base application context for shutdown"); //get all the app (web) contexts and shut them down first Map contexts = LoaderBase.getRed5ApplicationContexts(); if (contexts.isEmpty()) { log.info("No contexts were found to shutdown"); } for (Map.Entry entry : contexts.entrySet()) { //stop the context log.debug("Calling stop on context: {}", entry.getKey()); entry.getValue().stop(); } if (absCtx.isActive()) { log.debug("Closing application context"); absCtx.close(); } } else { log.error("Error getting Spring bean factory for shutdown"); } try { //stop tomcat embedded.stop(); //kill the jvm System.exit(0); } catch (Exception e) { log.warn("Tomcat could not be stopped", e); throw new RuntimeException("Tomcat could not be stopped"); } } } red5-1.0~svn4374.orig-plugins/tomcat/src/org/red5/server/tomcat/rtmpt/0000755000175000017500000000000011760512620025441 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/tomcat/src/org/red5/server/tomcat/rtmpt/RTMPTLoader.java0000644000175000017500000001352411754545067030364 0ustar drazzibdrazzibpackage org.red5.server.tomcat.rtmpt; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.io.File; import java.net.InetSocketAddress; import java.util.HashMap; import java.util.Map; import org.apache.catalina.Context; import org.apache.catalina.Engine; import org.apache.catalina.Valve; import org.apache.catalina.core.StandardHost; import org.apache.catalina.core.StandardWrapper; import org.apache.catalina.loader.WebappLoader; import org.apache.coyote.ProtocolHandler; import org.apache.coyote.http11.Http11NioProtocol; import org.apache.coyote.http11.Http11Protocol; import org.red5.logging.Red5LoggerFactory; import org.red5.server.api.IServer; import org.red5.server.tomcat.TomcatLoader; import org.red5.server.util.FileUtil; import org.slf4j.Logger; /** * Loader for the RTMPT server which uses Tomcat. * * @author The Red5 Project (red5@osflash.org) * @author Paul Gregoire (mondain@gmail.com) */ public class RTMPTLoader extends TomcatLoader { // Initialize Logging private static Logger log = Red5LoggerFactory.getLogger(RTMPTLoader.class); /** * RTMPT Tomcat engine. */ protected Engine rtmptEngine; /** * Server instance */ protected IServer server; /** * Context, in terms of JEE context is web application in a servlet * container */ protected Context context; /** * Extra servlet mappings to add */ protected Map servletMappings = new HashMap(); /** * Setter for server * * @param server Value to set for property 'server'. */ public void setServer(IServer server) { log.debug("RTMPT setServer"); this.server = server; } /** {@inheritDoc} */ @Override public void init() { log.info("Loading RTMPT context"); rtmptEngine = embedded.createEngine(); rtmptEngine.setDefaultHost(host.getName()); rtmptEngine.setName("red5RTMPTEngine"); // add the valves to the host for (Valve valve : valves) { log.debug("Adding host valve: {}", valve); ((StandardHost) host).addValve(valve); } // create and add root context File appDirBase = new File(webappFolder); String webappContextDir = FileUtil.formatPath(appDirBase.getAbsolutePath(), "/root"); Context ctx = embedded.createContext("/", webappContextDir); //no reload for now ctx.setReloadable(false); log.debug("Context name: {}", ctx.getName()); Object ldr = ctx.getLoader(); log.trace("Context loader (null if the context has not been started): {}", ldr); if (ldr == null) { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); ctx.setParentClassLoader(classLoader); WebappLoader wldr = new WebappLoader(classLoader); //add the Loader to the context ctx.setLoader(wldr); } appDirBase = null; webappContextDir = null; host.addChild(ctx); // add servlet wrapper StandardWrapper wrapper = (StandardWrapper) ctx.createWrapper(); wrapper.setServletName("RTMPTServlet"); wrapper.setServletClass("org.red5.server.net.rtmpt.RTMPTServlet"); ctx.addChild(wrapper); // add servlet mappings ctx.addServletMapping("/open/*", "RTMPTServlet"); ctx.addServletMapping("/close/*", "RTMPTServlet"); ctx.addServletMapping("/send/*", "RTMPTServlet"); ctx.addServletMapping("/idle/*", "RTMPTServlet"); // add any additional mappings for (String key : servletMappings.keySet()) { context.addServletMapping(servletMappings.get(key), key); } rtmptEngine.addChild(host); // add new Engine to set of Engine for embedded server embedded.addEngine(rtmptEngine); // set the bind address if (address == null) { //bind locally address = InetSocketAddress.createUnresolved("127.0.0.1", connector.getPort()).getAddress(); } // apply the bind address ProtocolHandler handler = connector.getProtocolHandler(); if (handler instanceof Http11Protocol) { ((Http11Protocol) handler).setAddress(address); } else if (handler instanceof Http11NioProtocol) { ((Http11NioProtocol) handler).setAddress(address); } else { log.warn("Unknown handler type: {}", handler.getClass().getName()); } // set connection properties for (String key : connectionProperties.keySet()) { log.debug("Setting connection property: {} = {}", key, connectionProperties.get(key)); connector.setProperty(key, connectionProperties.get(key)); } // start server try { // add new Connector to set of Connectors for embedded server, // associated with Engine embedded.addConnector(connector); log.info("Starting RTMPT engine"); connector.start(); } catch (Exception e) { log.error("Error initializing RTMPT server instance", e); } finally { registerJMX(); } } /** * Set servlet mappings * * @param mappings mappings */ public void setMappings(Map mappings) { log.debug("Servlet mappings: {}", mappings.size()); servletMappings.putAll(mappings); } } red5-1.0~svn4374.orig-plugins/tomcat/src/org/red5/server/tomcat/TomcatApplicationContext.java0000644000175000017500000000631211430366363032125 0ustar drazzibdrazzibpackage org.red5.server.tomcat; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import javax.servlet.ServletContext; import org.apache.catalina.Context; import org.apache.catalina.core.StandardContext; import org.red5.logging.Red5LoggerFactory; import org.red5.server.api.IApplicationContext; import org.slf4j.Logger; import org.springframework.web.context.ConfigurableWebApplicationContext; import org.springframework.web.context.WebApplicationContext; /** * Class that wraps a Tomcat webapp context. * * @author The Red5 Project (red5@osflash.org) * @author Joachim Bauch (jojo@struktur.de) */ public class TomcatApplicationContext implements IApplicationContext { /** * Logger */ protected static Logger log = Red5LoggerFactory.getLogger(TomcatApplicationContext.class); /** Store a reference to the Tomcat webapp context. */ private Context context; /** * Wrap the passed Tomcat webapp context. * * @param context */ protected TomcatApplicationContext(Context context) { log.debug("new context: {}", context); this.context = context; } public void stop() { log.debug("stop"); try { ServletContext servlet = context.getServletContext(); Object o = servlet.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE); if (o != null) { log.debug("Spring context for {} was found", context.getName()); ConfigurableWebApplicationContext appCtx = (ConfigurableWebApplicationContext) o; //close the red5 app if (appCtx.isRunning()) { log.debug("Context was running, attempting to stop"); appCtx.stop(); } if (appCtx.isActive()) { log.debug("Context is active, attempting to close"); appCtx.close(); } } else { log.warn("Spring context for {} was not found", context.getName()); } } catch (Exception e) { log.error("Could not stop spring context", e); } context.getParent().removeChild(context); if (context instanceof StandardContext) { StandardContext ctx = (StandardContext) context; try { //stop the tomcat context ctx.stop(); } catch (Exception e) { log.error("Could not stop context", e); } finally { try { ctx.destroy(); } catch (Exception e) { log.error("Could not destroy context", e); } } } } } red5-1.0~svn4374.orig-plugins/tomcat/src/org/red5/server/tomcat/TomcatApplicationLoader.java0000644000175000017500000000637711430366363031722 0ustar drazzibdrazzibpackage org.red5.server.tomcat; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import org.apache.catalina.Context; import org.apache.catalina.Host; import org.apache.catalina.startup.Embedded; import org.red5.logging.Red5LoggerFactory; import org.red5.server.LoaderBase; import org.red5.server.api.IApplicationLoader; import org.slf4j.Logger; import org.springframework.context.ApplicationContext; /** * Class that can load new applications in Tomcat. * * @author The Red5 Project (red5@osflash.org) * @author Joachim Bauch (jojo@struktur.de) */ public class TomcatApplicationLoader implements IApplicationLoader { // Initialize Logging protected static Logger log = Red5LoggerFactory.getLogger(TomcatApplicationLoader.class); /** Store reference to embedded Tomcat engine. */ private Embedded embedded; /** Store reference to host Tomcat is running on. */ private Host host; /** Stores reference to the root ApplicationContext. */ private ApplicationContext rootCtx; /** * Wrap Tomcat engine and host. * * @param embedded * @param host */ protected TomcatApplicationLoader(Embedded embedded, Host host, ApplicationContext rootCtx) { this.embedded = embedded; this.host = host; this.rootCtx = rootCtx; } /** {@inheritDoc} */ public ApplicationContext getRootContext() { log.debug("getRootContext"); return rootCtx; } /** {@inheritDoc} */ public void loadApplication(String contextPath, String virtualHosts, String directory) throws Exception { log.debug("Load application - context path: {} directory: {} virtual hosts: {}", new Object[]{contextPath, directory, virtualHosts}); if (directory.startsWith("file:")) { directory = directory.substring(5); } if (host.findChild(contextPath) == null) { Context c = embedded.createContext(contextPath, directory); LoaderBase.setRed5ApplicationContext(contextPath, new TomcatApplicationContext(c)); host.addChild(c); //add virtual hosts / aliases String[] vhosts = virtualHosts.split(","); for (String s : vhosts) { if (!"*".equals(s)) { //if theres a port, strip it if (s.indexOf(':') == -1) { host.addAlias(s); } else { host.addAlias(s.split(":")[0]); } } else { log.warn("\"*\" based virtual hosts not supported"); } } } else { log.warn("Context path already exists with host"); } } } red5-1.0~svn4374.orig-plugins/tomcat/src/org/red5/server/tomcat/rtmps/0000755000175000017500000000000011760512620025440 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/tomcat/src/org/red5/server/tomcat/rtmps/RTMPSLoader.java0000644000175000017500000001331411754545067030357 0ustar drazzibdrazzibpackage org.red5.server.tomcat.rtmps; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.io.File; import java.net.InetSocketAddress; import org.apache.catalina.Context; import org.apache.catalina.Engine; import org.apache.catalina.Valve; import org.apache.catalina.core.AprLifecycleListener; import org.apache.catalina.core.StandardHost; import org.apache.catalina.core.StandardWrapper; import org.apache.catalina.loader.WebappLoader; import org.apache.coyote.ProtocolHandler; import org.apache.coyote.http11.Http11NioProtocol; import org.apache.coyote.http11.Http11Protocol; import org.red5.logging.Red5LoggerFactory; import org.red5.server.api.IServer; import org.red5.server.tomcat.rtmpt.RTMPTLoader; import org.red5.server.util.FileUtil; import org.slf4j.Logger; /** * Loader for the RTMPS server which uses Tomcat. * * @author The Red5 Project (red5@osflash.org) * @author Paul Gregoire (mondain@gmail.com) */ public class RTMPSLoader extends RTMPTLoader { // Initialize Logging private Logger log = Red5LoggerFactory.getLogger(RTMPSLoader.class); /** * RTMPS Tomcat engine. */ protected Engine rtmpsEngine; /** * Setter for server * * @param server Value to set for property 'server'. */ public void setServer(IServer server) { log.debug("RTMPS setServer"); this.server = server; } /** {@inheritDoc} */ @Override public void init() { log.info("Loading RTMPS context"); rtmpsEngine = embedded.createEngine(); rtmpsEngine.setDefaultHost(host.getName()); rtmpsEngine.setName("red5RTMPSEngine"); // add the valves to the host for (Valve valve : valves) { log.debug("Adding host valve: {}", valve); ((StandardHost) host).addValve(valve); } // create and add root context File appDirBase = new File(webappFolder); String webappContextDir = FileUtil.formatPath(appDirBase.getAbsolutePath(), "/root"); Context ctx = embedded.createContext("/", webappContextDir); //no reload for now ctx.setReloadable(false); log.debug("Context name: {}", ctx.getName()); Object ldr = ctx.getLoader(); log.trace("Context loader (null if the context has not been started): {}", ldr); if (ldr == null) { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); //log.debug("Classloaders - Parent {}\nTCL {}\n\n", new Object[] {classLoader.getParent(), classLoader}); ctx.setParentClassLoader(classLoader); WebappLoader wldr = new WebappLoader(classLoader); //add the Loader to the context ctx.setLoader(wldr); } appDirBase = null; webappContextDir = null; host.addChild(ctx); // add servlet wrapper StandardWrapper wrapper = new StandardWrapper(); wrapper.setServletName("RTMPTServlet"); wrapper.setServletClass("org.red5.server.net.rtmpt.RTMPTServlet"); ctx.addChild(wrapper); // add servlet mappings ctx.addServletMapping("/open/*", "RTMPTServlet"); ctx.addServletMapping("/close/*", "RTMPTServlet"); ctx.addServletMapping("/send/*", "RTMPTServlet"); ctx.addServletMapping("/idle/*", "RTMPTServlet"); // add the host rtmpsEngine.addChild(host); // add new Engine to set of Engine for embedded server embedded.addEngine(rtmpsEngine); //turn off native apr support AprLifecycleListener listener = new AprLifecycleListener(); listener.setSSLEngine("off"); connector.addLifecycleListener(listener); log.debug("Protocol handler: {}", connector.getProtocolHandlerClassName()); // set connection properties connector.setSecure(true); connector.setScheme("https"); // set the bind address if (address == null) { //bind locally address = InetSocketAddress.createUnresolved("127.0.0.1", connector.getPort()).getAddress(); } // apply the bind address ProtocolHandler handler = connector.getProtocolHandler(); if (handler instanceof Http11Protocol) { ((Http11Protocol) handler).setAddress(address); } else if (handler instanceof Http11NioProtocol) { ((Http11NioProtocol) handler).setAddress(address); } else { log.warn("Unknown handler type: {}", handler.getClass().getName()); } // set other connection / protocol handler properties for (String key : connectionProperties.keySet()) { log.debug("Setting connection property: {} = {}", key, connectionProperties.get(key)); connector.setProperty(key, connectionProperties.get(key)); } log.info("Connector info: {}", connector.getInfo()); // start server try { // add new Connector to set of Connectors for embedded server, // associated with Engine embedded.addConnector(connector); log.info("Starting RTMPS engine"); connector.start(); } catch (Exception e) { log.error("Error initializing RTMPS server instance", e); } finally { registerJMX(); } } } red5-1.0~svn4374.orig-plugins/tomcat/src/org/red5/server/tomcat/TomcatVHostLoader.java0000644000175000017500000004417311745776716030536 0ustar drazzibdrazzibpackage org.red5.server.tomcat; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.io.File; import java.lang.management.ManagementFactory; import java.util.Map; import javax.management.JMX; import javax.management.MBeanServer; import javax.management.ObjectName; import javax.servlet.ServletContext; import org.apache.catalina.Container; import org.apache.catalina.Context; import org.apache.catalina.Host; import org.apache.catalina.LifecycleException; import org.apache.catalina.Loader; import org.apache.catalina.Valve; import org.apache.catalina.core.StandardContext; import org.apache.catalina.core.StandardHost; import org.red5.server.ContextLoader; import org.red5.server.LoaderBase; import org.red5.server.jmx.mxbeans.ContextLoaderMXBean; import org.red5.server.jmx.mxbeans.TomcatVHostLoaderMXBean; import org.red5.server.util.FileUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.ApplicationContext; import org.springframework.jmx.export.annotation.ManagedResource; import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.support.XmlWebApplicationContext; /** * Red5 loader for Tomcat virtual hosts. * * @author Paul Gregoire (mondain@gmail.com) */ @ManagedResource(objectName = "org.red5.server:type=TomcatVHostLoader", description = "TomcatVHostLoader") public class TomcatVHostLoader extends TomcatLoader implements TomcatVHostLoaderMXBean { // Initialize Logging private static Logger log = LoggerFactory.getLogger(TomcatVHostLoader.class); /** * Base web applications directory */ protected String webappRoot; //the virtual hosts name protected String name; //the domain protected String domain; protected boolean autoDeploy; protected boolean liveDeploy; protected boolean startChildren = true; protected boolean unpackWARs; /** * MBean object name used for de/registration purposes. */ private ObjectName oName; private String defaultApplicationContextId = "default.context"; /** * Initialization. */ @SuppressWarnings("cast") public void init() { log.info("Loading tomcat virtual host"); if (webappFolder != null) { //check for match with base webapp root if (webappFolder.equals(webappRoot)) { log.error("Web application root cannot be the same as base"); return; } } ClassLoader classloader = Thread.currentThread().getContextClassLoader(); //ensure we have a host if (host == null) { host = createHost(); } host.setParentClassLoader(classloader); String propertyPrefix = name; if (domain != null) { propertyPrefix += '_' + domain.replace('.', '_'); } log.debug("Generating name (for props) {}", propertyPrefix); System.setProperty(propertyPrefix + ".webapp.root", webappRoot); log.info("Virtual host root: {}", webappRoot); log.info("Virtual host context id: {}", defaultApplicationContextId); // Root applications directory File appDirBase = new File(webappRoot); // Subdirs of root apps dir File[] dirs = appDirBase.listFiles(new TomcatLoader.DirectoryFilter()); // Search for additional context files for (File dir : dirs) { String dirName = '/' + dir.getName(); // check to see if the directory is already mapped if (null == host.findChild(dirName)) { String webappContextDir = FileUtil.formatPath(appDirBase.getAbsolutePath(), dirName); Context ctx = null; if ("/root".equals(dirName) || "/root".equalsIgnoreCase(dirName)) { log.debug("Adding ROOT context"); ctx = addContext("/", webappContextDir); } else { log.debug("Adding context from directory scan: {}", dirName); ctx = addContext(dirName, webappContextDir); } log.debug("Context: {}", ctx); webappContextDir = null; } } appDirBase = null; dirs = null; // Dump context list if (log.isDebugEnabled()) { for (Container cont : host.findChildren()) { log.debug("Context child name: {}", cont.getName()); } } engine.addChild(host); // Start server try { log.info("Starting Tomcat virtual host"); //may not have to do this step for every host LoaderBase.setApplicationLoader(new TomcatApplicationLoader(embedded, host, applicationContext)); for (Container cont : host.findChildren()) { if (cont instanceof StandardContext) { StandardContext ctx = (StandardContext) cont; ServletContext servletContext = ctx.getServletContext(); log.debug("Context initialized: {}", servletContext.getContextPath()); //set the hosts id servletContext.setAttribute("red5.host.id", getHostId()); String prefix = servletContext.getRealPath("/"); log.debug("Path: {}", prefix); try { Loader cldr = ctx.getLoader(); log.debug("Loader type: {}", cldr.getClass().getName()); ClassLoader webClassLoader = cldr.getClassLoader(); log.debug("Webapp classloader: {}", webClassLoader); //create a spring web application context XmlWebApplicationContext appctx = new XmlWebApplicationContext(); appctx.setClassLoader(webClassLoader); appctx.setConfigLocations(new String[]{"/WEB-INF/red5-*.xml"}); //check for red5 context bean if (applicationContext.containsBean(defaultApplicationContextId)) { appctx.setParent((ApplicationContext) applicationContext.getBean(defaultApplicationContextId)); } else { log.warn("{} bean was not found in context: {}", defaultApplicationContextId, applicationContext.getDisplayName()); //lookup context loader and attempt to get what we need from it if (applicationContext.containsBean("context.loader")) { ContextLoader contextLoader = (ContextLoader) applicationContext.getBean("context.loader"); appctx.setParent(contextLoader.getContext(defaultApplicationContextId)); } else { log.debug("Context loader was not found, trying JMX"); MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); // get the ContextLoader from jmx ContextLoaderMXBean proxy = null; ObjectName oName = null; try { oName = new ObjectName("org.red5.server:name=contextLoader,type=ContextLoader"); if (mbs.isRegistered(oName)) { proxy = JMX.newMXBeanProxy(mbs, oName, ContextLoaderMXBean.class, true); log.debug("Context loader was found"); proxy.setParentContext(defaultApplicationContextId, appctx.getId()); } else { log.warn("Context loader was not found"); } } catch (Exception e) { log.warn("Exception looking up ContextLoader", e); } } } if (log.isDebugEnabled()) { if (appctx.getParent() != null) { log.debug("Parent application context: {}", appctx.getParent().getDisplayName()); } } // appctx.setServletContext(servletContext); //set the root webapp ctx attr on the each servlet context so spring can find it later servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, appctx); appctx.refresh(); } catch (Throwable t) { log.error("Error setting up context: {}", servletContext.getContextPath(), t); if (log.isDebugEnabled()) { t.printStackTrace(); } } } } } catch (Exception e) { log.error("Error loading Tomcat virtual host", e); } } /** * Un-initialization. */ public void uninit() { log.debug("TomcatVHostLoader un-init"); Container[] children = host.findChildren(); for (Container c : children) { if (c instanceof StandardContext) { try { ((StandardContext) c).stop(); host.removeChild(c); } catch (Exception e) { log.error("Could not stop context: {}", c.getName(), e); } } } //remove system prop String propertyPrefix = name; if (domain != null) { propertyPrefix += '_' + domain.replace('.', '_'); } System.clearProperty(propertyPrefix + ".webapp.root"); //stop the host try { ((StandardHost) host).stop(); } catch (LifecycleException e) { log.error("Could not stop host: {}", host.getName(), e); } //remove host engine.removeChild(host); //unregister jmx unregisterJMX(); } /** * Starts a web application and its red5 (spring) component. This is basically a stripped down * version of init(). * * @return true on success */ @SuppressWarnings("cast") public boolean startWebApplication(String applicationName) { boolean result = false; log.info("Starting Tomcat virtual host - Web application"); log.info("Virtual host root: {}", webappRoot); log.info("Virtual host context id: {}", defaultApplicationContextId); // application directory String contextName = '/' + applicationName; Container cont = null; //check if the context already exists for the host if ((cont = host.findChild(contextName)) == null) { log.debug("Context did not exist in host"); String webappContextDir = FileUtil.formatPath(webappRoot, applicationName); //prepend slash Context ctx = addContext(contextName, webappContextDir); //set the newly created context as the current container cont = ctx; } else { log.debug("Context already exists in host"); } try { ServletContext servletContext = ((Context) cont).getServletContext(); log.debug("Context initialized: {}", servletContext.getContextPath()); String prefix = servletContext.getRealPath("/"); log.debug("Path: {}", prefix); Loader cldr = cont.getLoader(); log.debug("Loader type: {}", cldr.getClass().getName()); ClassLoader webClassLoader = cldr.getClassLoader(); log.debug("Webapp classloader: {}", webClassLoader); //create a spring web application context XmlWebApplicationContext appctx = new XmlWebApplicationContext(); appctx.setClassLoader(webClassLoader); appctx.setConfigLocations(new String[]{"/WEB-INF/red5-*.xml"}); //check for red5 context bean if (applicationContext.containsBean(defaultApplicationContextId)) { appctx.setParent((ApplicationContext) applicationContext.getBean(defaultApplicationContextId)); } else { log.warn("{} bean was not found in context: {}", defaultApplicationContextId, applicationContext.getDisplayName()); //lookup context loader and attempt to get what we need from it if (applicationContext.containsBean("context.loader")) { ContextLoader contextLoader = (ContextLoader) applicationContext.getBean("context.loader"); appctx.setParent(contextLoader.getContext(defaultApplicationContextId)); } else { log.debug("Context loader was not found, trying JMX"); MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); // get the ContextLoader from jmx ContextLoaderMXBean proxy = null; ObjectName oName = null; try { oName = new ObjectName("org.red5.server:name=contextLoader,type=ContextLoader"); if (mbs.isRegistered(oName)) { proxy = JMX.newMXBeanProxy(mbs, oName, ContextLoaderMXBean.class, true); log.debug("Context loader was found"); proxy.setParentContext(defaultApplicationContextId, appctx.getId()); } else { log.warn("Context loader was not found"); } } catch (Exception e) { log.warn("Exception looking up ContextLoader", e); } } } if (log.isDebugEnabled()) { if (appctx.getParent() != null) { log.debug("Parent application context: {}", appctx.getParent().getDisplayName()); } } // appctx.setServletContext(servletContext); //set the root webapp ctx attr on the each servlet context so spring can find it later servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, appctx); appctx.refresh(); result = true; } catch (Throwable t) { log.error("Error setting up context: {}", applicationName, t); if (log.isDebugEnabled()) { t.printStackTrace(); } } return result; } /** * Create a standard host. * * @return host */ public Host createHost() { log.debug("Creating host"); StandardHost stdHost = new StandardHost(); stdHost.setAppBase(webappRoot); stdHost.setAutoDeploy(autoDeploy); if (domain == null) { stdHost.setName(name); } else { stdHost.setDomain(domain); //seems to require that the domain be appended to the name stdHost.setName(name + '.' + domain); } stdHost.setLiveDeploy(liveDeploy); //stdHost.setParent(container); stdHost.setStartChildren(startChildren); stdHost.setUnpackWARs(unpackWARs); //stdHost.setWorkDir(workDir); stdHost.setXmlNamespaceAware(false); stdHost.setXmlValidation(false); return stdHost; } /** * Returns the current host. * * @return host */ public Host getHost() { return host; } /** * Adds an alias to the current host. * * @param alias alias */ public void addAlias(String alias) { log.debug("Adding alias: {}", alias); host.addAlias(alias); } /** * Removes an alias from the current host. * * @param alias Alias */ public void removeAlias(String alias) { log.debug("Removing alias: {}", alias); String[] aliases = host.findAliases(); for (String s : aliases) { if (alias.equals(s)) { host.removeAlias(alias); break; } } } /** * Adds a valve to the current host. * * @param valve Valve */ public void addValve(Valve valve) { log.debug("Adding valve: {}", valve); log.debug("Valve info: {}", valve.getInfo()); ((StandardHost) host).addValve(valve); } /** * Removes a valve from the current host. * * @param valveInfo Valve Information. */ public void removeValve(String valveInfo) { log.debug("Removing valve: {}", valveInfo); try { String[] valveNames = ((StandardHost) host).getValveNames(); for (String s : valveNames) { log.debug("Valve name: {}", s); } } catch (Exception e) { log.error("", e); } Valve[] valves = ((StandardHost) host).getValves(); for (Valve v : valves) { log.debug("Valve: {}", v); log.debug("Valve info: {}", v.getInfo()); } //TODO: fix removing valves //((StandardHost) host).removeValve(valve); } /** * Set additional contexts. * * @param contexts Map of contexts */ @Override public void setContexts(Map contexts) { log.debug("setContexts: {}", contexts.size()); for (Map.Entry entry : contexts.entrySet()) { host.addChild(embedded.createContext(entry.getKey(), webappRoot + entry.getValue())); } } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDomain() { return domain; } public void setDomain(String domain) { this.domain = domain; } public String getWebappRoot() { return webappRoot; } public void setWebappRoot(String webappRoot) { this.webappRoot = webappRoot; } public boolean getAutoDeploy() { return autoDeploy; } public void setAutoDeploy(boolean autoDeploy) { this.autoDeploy = autoDeploy; } public boolean getLiveDeploy() { return liveDeploy; } public void setLiveDeploy(boolean liveDeploy) { this.liveDeploy = liveDeploy; } public boolean getStartChildren() { return startChildren; } public void setStartChildren(boolean startChildren) { this.startChildren = startChildren; } public boolean getUnpackWARs() { return unpackWARs; } public void setUnpackWARs(boolean unpackWARs) { this.unpackWARs = unpackWARs; } public String getDefaultApplicationContextId() { return defaultApplicationContextId; } public void setDefaultApplicationContextId(String defaultApplicationContextId) { this.defaultApplicationContextId = defaultApplicationContextId; } protected void registerJMX() { // register with jmx MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); try { oName = new ObjectName(String.format("org.red5.server:type=TomcatVHostLoader,name=%s,domain=%s", name, domain)); // check for existing registration before registering if (!mbs.isRegistered(oName)) { mbs.registerMBean(this, oName); } else { log.debug("ContextLoader is already registered in JMX"); } } catch (Exception e) { log.warn("Error on jmx registration", e); } } protected void unregisterJMX() { MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); try { mbs.unregisterMBean(oName); } catch (Exception e) { log.warn("Exception unregistering", e); } } }red5-1.0~svn4374.orig-plugins/tomcat/.settings/0000755000175000017500000000000011760512620021177 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/tomcat/.settings/org.eclipse.jdt.core.prefs0000644000175000017500000005452611430427735026203 0ustar drazzibdrazzib#Tue Aug 10 20:18:27 PDT 2010 eclipse.preferences.version=1 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 org.eclipse.jdt.core.formatter.blank_lines_after_package=1 org.eclipse.jdt.core.formatter.blank_lines_before_field=1 org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 org.eclipse.jdt.core.formatter.blank_lines_before_method=1 org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 org.eclipse.jdt.core.formatter.blank_lines_before_package=0 org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false org.eclipse.jdt.core.formatter.comment.format_block_comments=false org.eclipse.jdt.core.formatter.comment.format_header=false org.eclipse.jdt.core.formatter.comment.format_html=true org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false org.eclipse.jdt.core.formatter.comment.format_line_comments=false org.eclipse.jdt.core.formatter.comment.format_source_code=true org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true org.eclipse.jdt.core.formatter.comment.indent_root_tags=true org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert org.eclipse.jdt.core.formatter.comment.line_length=80 org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true org.eclipse.jdt.core.formatter.compact_else_if=true org.eclipse.jdt.core.formatter.continuation_indentation=2 org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_empty_lines=false org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true org.eclipse.jdt.core.formatter.indentation.size=4 org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.join_lines_in_comments=true org.eclipse.jdt.core.formatter.join_wrapped_lines=true org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false org.eclipse.jdt.core.formatter.lineSplit=180 org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true org.eclipse.jdt.core.formatter.tabulation.char=mixed org.eclipse.jdt.core.formatter.tabulation.size=4 org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true red5-1.0~svn4374.orig-plugins/tomcat/.settings/org.eclipse.jdt.ui.prefs0000644000175000017500000000016611430366363025656 0ustar drazzibdrazzib#Mon Nov 02 20:49:37 PST 2009 eclipse.preferences.version=1 formatter_profile=_Red5 formatter_settings_version=11 red5-1.0~svn4374.orig-plugins/policyserver/0000755000175000017500000000000011760512616020525 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/policyserver/build.xml0000644000175000017500000000730511750051526022350 0ustar drazzibdrazzib java.home is ${java.home} and the target version is ${java.target_version} red5.root is ${red5.root} javac version: ${java.version} Type ant -p for available targets" red5-1.0~svn4374.orig-plugins/policyserver/ivy.xml0000644000175000017500000000276711750051526022067 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/policyserver/lib/0000755000175000017500000000000011760512616021273 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/policyserver/ivysettings.xml0000644000175000017500000000323311750051526023635 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/policyserver/.classpath0000644000175000017500000000113611750051526022506 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/policyserver/.project0000644000175000017500000000073411750051526022175 0ustar drazzibdrazzib policyplugin Flash policy server - Red5 plugin org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature org.apache.ivyde.eclipse.ivynature red5-1.0~svn4374.orig-plugins/policyserver/build.bat0000644000175000017500000000001211273713010022273 0ustar drazzibdrazzibant pausered5-1.0~svn4374.orig-plugins/policyserver/build.properties0000644000175000017500000000016111273707437023746 0ustar drazzibdrazzib# Let the scripts know where your red5 is (ie. the location of the red5.jar) red5.root=c:/red5 debug.state=truered5-1.0~svn4374.orig-plugins/policyserver/src/0000755000175000017500000000000011760512616021314 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/policyserver/src/flashpolicy.xml0000644000175000017500000000174311273707437024366 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/policyserver/src/org/0000755000175000017500000000000011760512616022103 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/policyserver/src/org/red5/0000755000175000017500000000000011760512616022742 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/policyserver/src/org/red5/server/0000755000175000017500000000000011760512616024250 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/policyserver/src/org/red5/server/net/0000755000175000017500000000000011760512616025036 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/policyserver/src/org/red5/server/net/policy/0000755000175000017500000000000011760512616026335 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/policyserver/src/org/red5/server/net/policy/SocketPolicyHandler.java0000644000175000017500000000776411750051526033121 0ustar drazzibdrazzibpackage org.red5.server.net.policy; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.io.InputStream; import java.net.InetSocketAddress; import java.net.SocketAddress; import java.util.HashSet; import java.util.Set; import org.apache.mina.core.buffer.IoBuffer; import org.apache.mina.core.service.IoAcceptor; import org.apache.mina.core.service.IoHandlerAdapter; import org.apache.mina.core.session.IoSession; import org.apache.mina.transport.socket.nio.NioSocketAcceptor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.DisposableBean; import org.springframework.beans.factory.InitializingBean; /** * Provides the socket policy file. * * @see "http://www.adobe.com/devnet/flashplayer/articles/socket_policy_files.html" * * @author Paul Gregoire (mondain@gmail.com) */ public class SocketPolicyHandler extends IoHandlerAdapter implements InitializingBean, DisposableBean { protected static Logger log = LoggerFactory.getLogger(SocketPolicyHandler.class); private String host = "0.0.0.0"; private int port = 843; private String policyFilePath = "flashpolicy.xml"; private static IoAcceptor acceptor; private static IoBuffer policyData; @Override public void afterPropertiesSet() throws Exception { log.debug("Starting socket policy file server"); try { // get the file InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(policyFilePath); if (is != null) { //read the policy file policyData = IoBuffer.allocate(1024); byte[] b = new byte[4]; while (is.read(b) != -1) { policyData.put(b); } policyData.flip(); is.close(); log.info("Policy file read successfully"); // create accept socket acceptor = new NioSocketAcceptor(); acceptor.setHandler(this); Set addresses = new HashSet(); addresses.add(new InetSocketAddress(host, port)); acceptor.bind(addresses); log.info("Socket policy file server listening on port {}", port); } else { log.error("Policy file was not found"); } } catch (Exception e) { log.error("Exception initializing socket policy server", e); } } @Override public void destroy() throws Exception { log.debug("Stopping socket policy file server"); if (acceptor != null) { acceptor.unbind(); } } @Override public void messageReceived(IoSession session, Object message) throws Exception { log.info("Incomming: {}", session.getRemoteAddress().toString()); session.write(policyData); session.close(true); } @Override public void exceptionCaught(IoSession session, Throwable ex) throws Exception { log.info("Exception: {}", session.getRemoteAddress().toString(), ex); } public String getHost() { return host; } public void setHost(String host) { this.host = host; } public int getPort() { return port; } public void setPort(int port) { this.port = port; } /** * @return the policyFilePath */ public String getPolicyFilePath() { return policyFilePath; } /** * @param policyFilePath the policyFilePath to set */ public void setPolicyFilePath(String policyFilePath) { this.policyFilePath = policyFilePath; } } red5-1.0~svn4374.orig-plugins/policyserver/src/org/red5/server/plugin/0000755000175000017500000000000011760512616025546 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/policyserver/src/org/red5/server/plugin/policy/0000755000175000017500000000000011760512616027045 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/policyserver/src/org/red5/server/plugin/policy/PolicyServerPlugin.java0000644000175000017500000000402011712071275033507 0ustar drazzibdrazzibpackage org.red5.server.plugin.policy; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import org.red5.logging.Red5LoggerFactory; import org.red5.server.plugin.Red5Plugin; import org.slf4j.Logger; import org.springframework.context.support.FileSystemXmlApplicationContext; /** * Provides a flash policy server implementation. * * @author Paul Gregoire (mondain@gmail.com) */ public class PolicyServerPlugin extends Red5Plugin { private static Logger log = Red5LoggerFactory.getLogger(PolicyServerPlugin.class); private static FileSystemXmlApplicationContext configContext; public void doStart() throws Exception { log.debug("Start"); // create app context try { configContext = new FileSystemXmlApplicationContext(new String[] { "${red5.root}/plugins/policycontext.xml" }, true); } catch (Exception e) { configContext = new FileSystemXmlApplicationContext(new String[] { "classpath:/policycontext.xml" }, true); } } public void doStop() throws Exception { log.debug("Stop"); if (configContext != null) { configContext.close(); } } @Override public String getName() { return "policyServerPlugin"; } } red5-1.0~svn4374.orig-plugins/policyserver/src/policycontext.xml0000644000175000017500000000256411750051526024746 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/policyserver/src/PolicyFileSocket.xsd0000644000175000017500000000521611273707437025256 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/policyserver/.settings/0000755000175000017500000000000011760512616022443 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/policyserver/.settings/org.eclipse.jdt.core.prefs0000644000175000017500000005660111712071275027433 0ustar drazzibdrazzib#Tue Jan 31 10:07:35 PST 2012 eclipse.preferences.version=1 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 org.eclipse.jdt.core.formatter.blank_lines_after_package=1 org.eclipse.jdt.core.formatter.blank_lines_before_field=1 org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 org.eclipse.jdt.core.formatter.blank_lines_before_method=1 org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 org.eclipse.jdt.core.formatter.blank_lines_before_package=0 org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false org.eclipse.jdt.core.formatter.comment.format_block_comments=false org.eclipse.jdt.core.formatter.comment.format_header=false org.eclipse.jdt.core.formatter.comment.format_html=true org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false org.eclipse.jdt.core.formatter.comment.format_line_comments=false org.eclipse.jdt.core.formatter.comment.format_source_code=true org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true org.eclipse.jdt.core.formatter.comment.indent_root_tags=true org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert org.eclipse.jdt.core.formatter.comment.line_length=80 org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false org.eclipse.jdt.core.formatter.compact_else_if=true org.eclipse.jdt.core.formatter.continuation_indentation=2 org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_empty_lines=false org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true org.eclipse.jdt.core.formatter.indentation.size=4 org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.join_lines_in_comments=true org.eclipse.jdt.core.formatter.join_wrapped_lines=true org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false org.eclipse.jdt.core.formatter.lineSplit=180 org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true org.eclipse.jdt.core.formatter.tabulation.char=mixed org.eclipse.jdt.core.formatter.tabulation.size=4 org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true red5-1.0~svn4374.orig-plugins/policyserver/.settings/org.eclipse.jdt.ui.prefs0000644000175000017500000000016611712071275027113 0ustar drazzibdrazzib#Tue Jan 31 10:07:35 PST 2012 eclipse.preferences.version=1 formatter_profile=_Red5 formatter_settings_version=12 red5-1.0~svn4374.orig-plugins/winstone/0000755000175000017500000000000011760512617017646 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/winstone/build.xml0000644000175000017500000000717611430437662021502 0ustar drazzibdrazzib java.home is ${java.home} and the target version is ${java.target_version} red5.root is ${red5.root} javac version: ${java.version} Type ant -p for available targets" red5-1.0~svn4374.orig-plugins/winstone/ivy.xml0000644000175000017500000000331211431605517021173 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/winstone/lib/0000755000175000017500000000000011760512617020414 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/winstone/ivysettings.xml0000644000175000017500000000126511431605517022761 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/winstone/.classpath0000644000175000017500000000106011430366363021625 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/winstone/.project0000644000175000017500000000063211430366363021315 0ustar drazzibdrazzib winstoneplugin Winstone Red5 plugin org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature red5-1.0~svn4374.orig-plugins/winstone/build.bat0000644000175000017500000000000311431605517021423 0ustar drazzibdrazzibantred5-1.0~svn4374.orig-plugins/winstone/build.properties0000644000175000017500000000024411430437662023063 0ustar drazzibdrazzib# Let the scripts know where your red5 is (ie. the location of the red5.jar) red5.root=c:/red5 debug.state=true # Winstone plugin version plugin.version=1.0 red5-1.0~svn4374.orig-plugins/winstone/src/0000755000175000017500000000000011760512617020435 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/winstone/src/jee-container.xml0000644000175000017500000000205311431605517023677 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/winstone/src/embedded.properties0000644000175000017500000000206611430366363024307 0ustar drazzibdrazzib # set the level of debug msgs (1-9). Default is 5 (INFO level) debug=9 # set the http listening port. -1 to disable, Default is 8080 httpPort=5080 # set the https listening port. -1 to disable, Default is disabled #httpsPort=8443 # set the no of worker threads to spawn at startup. Default is 5 handlerCountStartup=3 # set the max no of worker threads to allow. Default is 300 handlerCountMax=33 # set the max no of idle worker threads to allow. Default is 50 handlerCountMaxIdle=7 # enable directory lists (true/false). Default is true #directoryListings=false # enable jasper JSP handling (true/false). Default is false #useJasper=true # enable servlet reloading (true/false). Default is false #useServletReloading=true # enable the servlet invoker (true/false). Default is true useInvoker=false # set the invoker prefix. Default is /servlet/ #invokerPrefix=/servlet/ # logging accessLoggerClassName=winstone.accesslog.SimpleAccessLogger simpleAccessLogger.format=###date###\ ###uriLine### simpleAccessLogger.file=/log/access_log.txt red5-1.0~svn4374.orig-plugins/winstone/src/org/0000755000175000017500000000000011760512617021224 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/winstone/src/org/red5/0000755000175000017500000000000011760512617022063 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/winstone/src/org/red5/server/0000755000175000017500000000000011760512617023371 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/winstone/src/org/red5/server/winstone/0000755000175000017500000000000011760512617025237 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/winstone/src/org/red5/server/winstone/WinstoneApplicationLoader.java0000644000175000017500000000626311431605517033227 0ustar drazzibdrazzibpackage org.red5.server.winstone; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import org.red5.logging.Red5LoggerFactory; import org.red5.server.api.IApplicationLoader; import org.slf4j.Logger; import org.springframework.context.ApplicationContext; import winstone.HostConfiguration; /** * Class that can load new applications in Winstone. * * @author The Red5 Project (red5@osflash.org) * @author Paul Gregoire (mondain@gmail.com) */ public class WinstoneApplicationLoader implements IApplicationLoader { // Initialize Logging protected static Logger log = Red5LoggerFactory.getLogger(WinstoneApplicationLoader.class); private HostConfiguration host; /** Stores reference to the root ApplicationContext. */ private ApplicationContext rootCtx; /** * Wraps Winstone host configuration and spring application context. * * @param host * @param rootCtx */ protected WinstoneApplicationLoader(HostConfiguration host, ApplicationContext rootCtx) { this.host = host; this.rootCtx = rootCtx; } /** {@inheritDoc} */ public ApplicationContext getRootContext() { log.debug("getRootContext"); return rootCtx; } public HostConfiguration getHostConfiguration() { return host; } /** {@inheritDoc} */ public void loadApplication(String contextPath, String virtualHosts, String directory) throws Exception { log.debug("Load application - context path: {} directory: {} virtual hosts: {}", new Object[] { contextPath, directory, virtualHosts }); if (directory.startsWith("file:")) { directory = directory.substring(5); } if (host.getWebAppByURI(contextPath) == null) { log.warn("Not supported at this time"); // WebAppConfiguration c = createContext(contextPath, directory); // LoaderBase.setRed5ApplicationContext(contextPath, new WinstoneApplicationContext(c)); // host.addChild(c); // //add virtual hosts / aliases // String[] vhosts = virtualHosts.split(","); // for (String s : vhosts) { // if (!"*".equals(s)) { // //if theres a port, strip it // if (s.indexOf(':') == -1) { // host.addAlias(s); // } else { // host.addAlias(s.split(":")[0]); // } // } else { // log.warn("\"*\" based virtual hosts not supported"); // } // } } else { log.warn("Context path already exists with host"); } } } red5-1.0~svn4374.orig-plugins/winstone/src/org/red5/server/winstone/WinstoneApplicationContext.java0000644000175000017500000000523211430427735033443 0ustar drazzibdrazzibpackage org.red5.server.winstone; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import org.red5.logging.Red5LoggerFactory; import org.red5.server.api.IApplicationContext; import org.slf4j.Logger; import org.springframework.web.context.ConfigurableWebApplicationContext; import org.springframework.web.context.WebApplicationContext; import winstone.WebAppConfiguration; /** * Class that wraps a Winstone webapp context. * * @author The Red5 Project (red5@osflash.org) * @author Paul Gregoire (mondain@gmail.com) */ public class WinstoneApplicationContext implements IApplicationContext { protected static Logger log = Red5LoggerFactory.getLogger(WinstoneApplicationContext.class); /** Store a reference to the Winstone webapp */ private WebAppConfiguration context; /** * Wrap the passed Winstone webapp context. * * @param context */ protected WinstoneApplicationContext(WebAppConfiguration context) { log.debug("new context: {}", context); this.context = context; } public void stop() { log.debug("stop"); try { Object o = context.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE); if (o != null) { log.debug("Spring context for {} was found", context.getContextName()); ConfigurableWebApplicationContext appCtx = (ConfigurableWebApplicationContext) o; //close the red5 app if (appCtx.isRunning()) { log.debug("Context was running, attempting to stop"); appCtx.stop(); } if (appCtx.isActive()) { log.debug("Context is active, attempting to close"); appCtx.close(); } } else { log.warn("Spring context for {} was not found", context.getContextName()); } } catch (Exception e) { log.error("Could not stop spring context", e); } context.destroy(); } } red5-1.0~svn4374.orig-plugins/winstone/src/org/red5/server/winstone/WinstoneLoader.java0000644000175000017500000005230711431605517031043 0ustar drazzibdrazzibpackage org.red5.server.winstone; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.io.File; import java.io.FilenameFilter; import java.io.IOException; import java.io.InputStream; import java.lang.reflect.Constructor; import java.net.BindException; import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.URL; import java.net.URLClassLoader; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Properties; import javax.servlet.ServletContext; import org.red5.logging.Red5LoggerFactory; import org.red5.server.LoaderBase; import org.red5.server.api.IApplicationContext; import org.red5.server.jmx.JMXAgent; import org.red5.server.jmx.mxbeans.LoaderMXBean; import org.red5.server.util.FileUtil; import org.slf4j.Logger; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.context.support.AbstractApplicationContext; import org.springframework.web.context.ConfigurableWebApplicationContext; import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.support.XmlWebApplicationContext; import winstone.HostConfiguration; import winstone.Launcher; import winstone.WebAppConfiguration; /** * Red5 loader for the Winstone servlet container. * * @author Paul Gregoire (mondain@gmail.com) */ public class WinstoneLoader extends LoaderBase implements ApplicationContextAware, LoaderMXBean { // Initialize Logging private static Logger log = Red5LoggerFactory.getLogger(WinstoneLoader.class); public static final String defaultSpringConfigLocation = "/WEB-INF/red5-*.xml"; public static final String defaultParentContextKey = "default.context"; private static List contextNames = new ArrayList(); static { log.debug("Initializing Winstone"); } /** * Common name for the Service and Engine components. */ public String serviceEngineName = "red5Engine"; /** * Embedded Winstone service (like Catalina). */ protected static StoneLauncher embedded; /** * Additional connection properties to be set at init. */ protected Map connectionProperties = new HashMap(); /** * IP Address to bind to. */ protected InetAddress address; /** * Add context for path and docbase to current host. * * @param path Path * @param docBase Document base * @return context (that is, web application) */ public WebAppConfiguration addContext(String path, String docBase) { log.debug("Add context - path: {} docbase: {}", path, docBase); return null; } /** * Remove context from the current host. * * @param path Path */ @Override public void removeContext(String path) { WinstoneApplicationLoader appLoader = (WinstoneApplicationLoader) LoaderBase.getApplicationLoader(); WebAppConfiguration c = appLoader.getHostConfiguration().getWebAppByURI(path); c.destroy(); IApplicationContext ctx = LoaderBase.removeRed5ApplicationContext(path); if (ctx != null) { ctx.stop(); } else { log.warn("Context could not be stopped, it was null for path: {}", path); } } /** * Initialization. */ @SuppressWarnings({ "unchecked", "rawtypes" }) public void init() { log.info("Loading Winstone context"); //get a reference to the current threads classloader final ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader(); // root location for servlet container String serverRoot = System.getProperty("red5.root"); log.info("Server root: {}", serverRoot); String confRoot = System.getProperty("red5.config_root"); log.info("Config root: {}", confRoot); // configure the webapps folder, make sure we have one if (webappFolder == null) { // Use default webapps directory webappFolder = FileUtil.formatPath(System.getProperty("red5.root"), "/webapps"); } System.setProperty("red5.webapp.root", webappFolder); log.info("Application root: {}", webappFolder); // create one embedded (server) and use it everywhere Map args = new HashMap(); //args.put("webroot", webappFolder + "/root"); args.put("webappsDir", webappFolder); // Start server try { log.info("Starting Winstone servlet engine"); Launcher.initLogger(args); // spawns threads, so your application doesn't block embedded = new StoneLauncher(args); log.trace("Classloader for embedded: {} TCL: {}", Launcher.class.getClassLoader(), originalClassLoader); // get the default host HostConfiguration host = embedded.getHostGroup().getHostByName(null); // set the primary application loader LoaderBase.setApplicationLoader(new WinstoneApplicationLoader(host, applicationContext)); // get root first, we may want to start a spring config internally but for now skip it WebAppConfiguration root = host.getWebAppByURI("/"); log.trace("Root: {}", root); // scan the sub directories to determine our context names buildContextNameList(webappFolder); // loop the other contexts for (String contextName : contextNames) { WebAppConfiguration ctx = host.getWebAppByURI(contextName); // get access to the servlet context final ServletContext servletContext = ctx.getContext(contextName); log.debug("Context initialized: {}", servletContext.getContextPath()); //set the hosts id servletContext.setAttribute("red5.host.id", host.getHostname()); // get the path String prefix = servletContext.getRealPath("/"); log.debug("Path: {}", prefix); try { final ClassLoader cldr = ctx.getLoader(); log.debug("Loader type: {}", cldr.getClass().getName()); // get the (spring) config file path final String contextConfigLocation = servletContext.getInitParameter(org.springframework.web.context.ContextLoader.CONFIG_LOCATION_PARAM) == null ? defaultSpringConfigLocation : servletContext.getInitParameter(org.springframework.web.context.ContextLoader.CONFIG_LOCATION_PARAM); log.debug("Spring context config location: {}", contextConfigLocation); // get the (spring) parent context key final String parentContextKey = servletContext.getInitParameter(org.springframework.web.context.ContextLoader.LOCATOR_FACTORY_KEY_PARAM) == null ? defaultParentContextKey : servletContext.getInitParameter(org.springframework.web.context.ContextLoader.LOCATOR_FACTORY_KEY_PARAM); log.debug("Spring parent context key: {}", parentContextKey); //set current threads classloader to the webapp classloader Thread.currentThread().setContextClassLoader(cldr); //create a thread to speed-up application loading Thread thread = new Thread("Launcher:" + servletContext.getContextPath()) { public void run() { //set thread context classloader to web classloader Thread.currentThread().setContextClassLoader(cldr); //get the web app's parent context ApplicationContext parentContext = null; if (applicationContext.containsBean(parentContextKey)) { parentContext = (ApplicationContext) applicationContext.getBean(parentContextKey); } else { log.warn("Parent context was not found: {}", parentContextKey); } // create a spring web application context final String contextClass = servletContext.getInitParameter(org.springframework.web.context.ContextLoader.CONTEXT_CLASS_PARAM) == null ? XmlWebApplicationContext.class .getName() : servletContext.getInitParameter(org.springframework.web.context.ContextLoader.CONTEXT_CLASS_PARAM); //web app context (spring) ConfigurableWebApplicationContext appctx = null; try { Class clazz = Class.forName(contextClass, true, cldr); appctx = (ConfigurableWebApplicationContext) clazz.newInstance(); } catch (Throwable e) { throw new RuntimeException("Failed to load webapplication context class.", e); } appctx.setConfigLocations(new String[] { contextConfigLocation }); appctx.setServletContext(servletContext); //set parent context or use current app context if (parentContext != null) { appctx.setParent(parentContext); } else { appctx.setParent(applicationContext); } // set the root webapp ctx attr on the each servlet context so spring can find it later servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, appctx); //refresh the factory log.trace("Classloader prior to refresh: {}", appctx.getClassLoader()); appctx.refresh(); if (log.isDebugEnabled()) { log.debug("Red5 app is active: {} running: {}", appctx.isActive(), appctx.isRunning()); } } }; thread.setDaemon(true); thread.start(); } catch (Throwable t) { log.error("Error setting up context: {} due to: {}", servletContext.getContextPath(), t.getMessage()); t.printStackTrace(); } finally { //reset the classloader Thread.currentThread().setContextClassLoader(originalClassLoader); } } } catch (Exception e) { if (e instanceof BindException || e.getMessage().indexOf("BindException") != -1) { log.error("Error loading Winstone, unable to bind connector. You may not have permission to use the selected port", e); } else { log.error("Error loading Winstone", e); } } finally { registerJMX(); } } /** * Starts a web application and its red5 (spring) component. This is * basically a stripped down version of init(). * * @return true on success */ public boolean startWebApplication(String applicationName) { return false; } /** * Figure out the context names. * * @param webappFolder */ private void buildContextNameList(String webappFolder) { // Root applications directory File appDirBase = new File(webappFolder); // Subdirs of root apps dir File[] dirs = appDirBase.listFiles(new DirectoryFilter()); // Search for additional context files for (File dir : dirs) { String dirName = '/' + dir.getName(); if (dirName.equalsIgnoreCase("/ROOT")) { //skip root continue; } String webappContextDir = FileUtil.formatPath(appDirBase.getAbsolutePath(), dirName); File webXml = new File(webappContextDir, "WEB-INF/web.xml"); if (webXml.exists()) { log.debug("Webapp context directory (full path): {}", webappContextDir); contextNames.add(dirName); } webappContextDir = null; webXml = null; } appDirBase = null; dirs = null; } /** * The address to which we will bind. * * @param address */ public void setAddress(InetSocketAddress address) { log.info("Address to bind: {}", address); this.address = address.getAddress(); } /** * Set connection properties for the connector * * @param props additional properties to set */ public void setConnectionProperties(Map props) { log.debug("Connection props: {}", props.size()); this.connectionProperties.putAll(props); } public void registerJMX() { JMXAgent.registerMBean(this, this.getClass().getName(), LoaderMXBean.class); } /** * Shut server down. */ public void shutdown() { log.info("Shutting down Winstone context"); //run through the applications and ensure that spring is told //to commence shutdown / disposal AbstractApplicationContext absCtx = (AbstractApplicationContext) LoaderBase.getApplicationContext(); if (absCtx != null) { log.debug("Using loader base application context for shutdown"); //get all the app (web) contexts and shut them down first Map contexts = LoaderBase.getRed5ApplicationContexts(); if (contexts.isEmpty()) { log.info("No contexts were found to shutdown"); } for (Map.Entry entry : contexts.entrySet()) { //stop the context log.debug("Calling stop on context: {}", entry.getKey()); entry.getValue().stop(); } if (absCtx.isActive()) { log.debug("Closing application context"); absCtx.close(); } } else { log.error("Error getting Spring bean factory for shutdown"); } //shutdown jmx JMXAgent.shutdown(); try { //stop Winstone embedded.shutdown(); //kill the jvm System.exit(0); } catch (Exception e) { log.warn("Winstone could not be stopped", e); throw new RuntimeException("Winstone could not be stopped"); } } /** * Our implementation of the Winstone Launcher class. */ final class StoneLauncher { static final String HTTP_LISTENER_CLASS = "winstone.HttpListener"; static final String HTTPS_LISTENER_CLASS = "winstone.ssl.HttpsListener"; static final String DEFAULT_JNDI_MGR_CLASS = "winstone.jndi.ContainerJNDIManager"; private winstone.HostGroup hostGroup; private winstone.ObjectPool objectPool; private List listeners = new ArrayList(); @SuppressWarnings("rawtypes") private Map args; private winstone.JNDIManager globalJndiManager; @SuppressWarnings({ "unchecked", "rawtypes", "deprecation" }) public StoneLauncher(Map args) throws IOException { // load properties file InputStream embeddedPropsStream = WinstoneLoader.class.getResourceAsStream("embedded.properties"); if (embeddedPropsStream != null) { Properties props = new Properties(); props.load(embeddedPropsStream); for (Iterator i = props.keySet().iterator(); i.hasNext(); ) { String key = (String) i.next(); if (!args.containsKey(key.trim())) { args.put(key.trim(), props.getProperty(key).trim()); } } props.clear(); embeddedPropsStream.close(); } // use jndi? boolean useJNDI = WebAppConfiguration.booleanArg(args, "useJNDI", false); // Set jndi resource handler if not set (workaround for JamVM bug) if (useJNDI) try { Class ctxFactoryClass = Class.forName("winstone.jndi.java.javaURLContextFactory"); if (System.getProperty("java.naming.factory.initial") == null) { System.setProperty("java.naming.factory.initial", ctxFactoryClass.getName()); } if (System.getProperty("java.naming.factory.url.pkgs") == null) { System.setProperty("java.naming.factory.url.pkgs", "winstone.jndi"); } } catch (ClassNotFoundException err) { } log.debug("Launcher.StartupArgs {}", args); this.args = args; // Check for java home List jars = new ArrayList(); List commonLibCLPaths = new ArrayList(); String defaultJavaHome = System.getProperty("java.home"); String javaHome = WebAppConfiguration.stringArg(args, "javaHome", defaultJavaHome); log.debug("Launcher.UsingJavaHome {}", javaHome); String toolsJarLocation = WebAppConfiguration.stringArg(args, "toolsJar", null); File toolsJar = null; if (toolsJarLocation == null) { toolsJar = new File(javaHome, "lib/tools.jar"); // first try - if it doesn't exist, try up one dir since we might have // the JRE home by mistake if (!toolsJar.exists()) { File javaHome2 = new File(javaHome).getParentFile(); File toolsJar2 = new File(javaHome2, "lib/tools.jar"); if (toolsJar2.exists()) { javaHome = javaHome2.getCanonicalPath(); toolsJar = toolsJar2; } } } else { toolsJar = new File(toolsJarLocation); } // Add tools jar to classloader path if (toolsJar.exists()) { jars.add(toolsJar.toURL()); commonLibCLPaths.add(toolsJar); log.debug("Launcher.AddedCommonLibJar {}", toolsJar.getName()); } else if (WebAppConfiguration.booleanArg(args, "useJasper", false)) { log.warn("Launcher.ToolsJarNotFound"); } // Set up common lib class loader String commonLibCLFolder = WebAppConfiguration.stringArg(args, "commonLibFolder", "lib"); File libFolder = new File(commonLibCLFolder); if (libFolder.exists() && libFolder.isDirectory()) { log.debug("Launcher.UsingCommonLib {}", libFolder.getCanonicalPath()); File children[] = libFolder.listFiles(); for (int n = 0; n < children.length; n++) if (children[n].getName().endsWith(".jar") || children[n].getName().endsWith(".zip")) { jars.add(children[n].toURL()); commonLibCLPaths.add(children[n]); log.debug("Launcher.AddedCommonLibJar {}", children[n].getName()); } } else { log.debug("Launcher.NoCommonLib"); } ClassLoader commonLibCL = new URLClassLoader((URL[]) jars.toArray(new URL[jars.size()]), getClass().getClassLoader()); log.trace("Launcher.CLClassLoader {}", commonLibCL.toString()); log.trace("Launcher.CLClassLoader {}", commonLibCLPaths.toString()); // If jndi is enabled, run the container wide jndi populator if (useJNDI) { String jndiMgrClassName = WebAppConfiguration.stringArg(args, "containerJndiClassName", DEFAULT_JNDI_MGR_CLASS).trim(); try { // Build the realm Class jndiMgrClass = Class.forName(jndiMgrClassName, true, commonLibCL); Constructor jndiMgrConstr = jndiMgrClass.getConstructor(new Class[] { Map.class, List.class, ClassLoader.class }); this.globalJndiManager = (winstone.JNDIManager) jndiMgrConstr.newInstance(new Object[] { args, null, commonLibCL }); this.globalJndiManager.setup(); } catch (ClassNotFoundException err) { log.debug("Launcher.JNDIDisabled"); } catch (Throwable err) { log.error("Launcher.JNDIError {}", jndiMgrClassName, err); } } // create an object pool objectPool = new winstone.ObjectPool(args); // Open the web apps hostGroup = new winstone.HostGroup(null, objectPool, commonLibCL, (File[]) commonLibCLPaths.toArray(new File[0]), args); // Create connectors (http, https) spawnListener(HTTP_LISTENER_CLASS); try { Class.forName("javax.net.ServerSocketFactory"); spawnListener(HTTPS_LISTENER_CLASS); } catch (ClassNotFoundException err) { log.debug("Launcher.NeedsJDK14 {}", HTTPS_LISTENER_CLASS); } } /** * Instantiates listeners. Note that an exception thrown in the * constructor is interpreted as the listener being disabled, so * don't do anything too adventurous in the constructor, or if you do, * catch and log any errors locally before rethrowing. */ @SuppressWarnings({ "rawtypes", "unchecked" }) protected void spawnListener(String listenerClassName) { try { Class listenerClass = Class.forName(listenerClassName); Constructor listenerConstructor = listenerClass.getConstructor(new Class[] { Map.class, winstone.ObjectPool.class, winstone.HostGroup.class }); winstone.Listener listener = (winstone.Listener) listenerConstructor.newInstance(new Object[] { args, objectPool, hostGroup }); if (listener.start()) { listeners.add(listener); } } catch (ClassNotFoundException err) { log.info("Launcher.ListenerNotFound {}", listenerClassName); } catch (Throwable err) { log.error("Launcher.ListenerStartupError {}", listenerClassName, err); } } public void shutdown() { // Release all listeners/pools/webapps for (winstone.Listener listener : listeners) { listener.destroy(); } objectPool.destroy(); hostGroup.destroy(); if (globalJndiManager != null) { globalJndiManager.tearDown(); } } winstone.HostGroup getHostGroup() { return hostGroup; } List getListeners() { return listeners; } } /** * Filters directory content */ protected final static class DirectoryFilter implements FilenameFilter { /** * Check whether file matches filter rules * * @param dir Directory * @param name File name * @return true If file does match filter rules, false otherwise */ public boolean accept(File dir, String name) { File f = new File(dir, name); log.trace("Filtering: {} name: {}", dir.getName(), name); log.trace("Constructed dir: {}", f.getAbsolutePath()); // filter out all non-directories that are hidden and/or not // readable boolean result = f.isDirectory() && f.canRead() && !f.isHidden(); // nullify f = null; return result; } } } red5-1.0~svn4374.orig-plugins/winstone/.settings/0000755000175000017500000000000011760512617021564 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/winstone/.settings/org.eclipse.jdt.core.prefs0000644000175000017500000005452611430427735026562 0ustar drazzibdrazzib#Tue Aug 10 20:18:26 PDT 2010 eclipse.preferences.version=1 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 org.eclipse.jdt.core.formatter.blank_lines_after_package=1 org.eclipse.jdt.core.formatter.blank_lines_before_field=1 org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 org.eclipse.jdt.core.formatter.blank_lines_before_method=1 org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 org.eclipse.jdt.core.formatter.blank_lines_before_package=0 org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false org.eclipse.jdt.core.formatter.comment.format_block_comments=false org.eclipse.jdt.core.formatter.comment.format_header=false org.eclipse.jdt.core.formatter.comment.format_html=true org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false org.eclipse.jdt.core.formatter.comment.format_line_comments=false org.eclipse.jdt.core.formatter.comment.format_source_code=true org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true org.eclipse.jdt.core.formatter.comment.indent_root_tags=true org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert org.eclipse.jdt.core.formatter.comment.line_length=80 org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true org.eclipse.jdt.core.formatter.compact_else_if=true org.eclipse.jdt.core.formatter.continuation_indentation=2 org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_empty_lines=false org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true org.eclipse.jdt.core.formatter.indentation.size=4 org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.join_lines_in_comments=true org.eclipse.jdt.core.formatter.join_wrapped_lines=true org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false org.eclipse.jdt.core.formatter.lineSplit=180 org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true org.eclipse.jdt.core.formatter.tabulation.char=mixed org.eclipse.jdt.core.formatter.tabulation.size=4 org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true red5-1.0~svn4374.orig-plugins/winstone/.settings/org.eclipse.jdt.ui.prefs0000644000175000017500000000016611430366363026235 0ustar drazzibdrazzib#Mon Nov 02 20:49:37 PST 2009 eclipse.preferences.version=1 formatter_profile=_Red5 formatter_settings_version=11 red5-1.0~svn4374.orig-plugins/securityplugin/0000755000175000017500000000000011760512615021064 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/securityplugin/allowedSharedObjectNames.txt0000644000175000017500000000002211250365606026510 0ustar drazzibdrazzibserverSharedObjectred5-1.0~svn4374.orig-plugins/securityplugin/build.xml0000644000175000017500000000603311267331542022707 0ustar drazzibdrazzib java.home is ${java.home} and the target version is ${java.target_version} red5.root is ${red5.root} javac version: ${java.version} Type ant -p for available targets" red5-1.0~svn4374.orig-plugins/securityplugin/ivy.xml0000644000175000017500000000342211755020232022407 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/securityplugin/lib/0000755000175000017500000000000011760512615021632 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/securityplugin/ivysettings.xml0000644000175000017500000000320311755020232024165 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/securityplugin/.classpath0000644000175000017500000000114211755020232023036 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/securityplugin/.project0000644000175000017500000000067511755020232022534 0ustar drazzibdrazzib securityplugin org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature org.apache.ivyde.eclipse.ivynature red5-1.0~svn4374.orig-plugins/securityplugin/build.bat0000644000175000017500000000000311250365606022644 0ustar drazzibdrazzibantred5-1.0~svn4374.orig-plugins/securityplugin/build.properties0000644000175000017500000000024611755020232024274 0ustar drazzibdrazzib# Let the scripts know where your red5 is (ie. the location of the red5.jar) red5.root=../server/trunk/dist main-class=org.red5.server.plugin.security.SecurityPlugin red5-1.0~svn4374.orig-plugins/securityplugin/allowedSWFdomains.txt0000644000175000017500000000005211250365606025204 0ustar drazzibdrazziblocalhost electroteque.org electrocode.netred5-1.0~svn4374.orig-plugins/securityplugin/allowedPublishNames.txt0000644000175000017500000000000711250365606025564 0ustar drazzibdrazzibdanielrred5-1.0~svn4374.orig-plugins/securityplugin/src/0000755000175000017500000000000011760512615021653 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/securityplugin/src/org/0000755000175000017500000000000011760512615022442 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/securityplugin/src/org/red5/0000755000175000017500000000000011760512615023301 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/securityplugin/src/org/red5/server/0000755000175000017500000000000011760512615024607 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/securityplugin/src/org/red5/server/plugin/0000755000175000017500000000000011760512615026105 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/securityplugin/src/org/red5/server/plugin/security/0000755000175000017500000000000011760512615027754 5ustar drazzibdrazzib././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootred5-1.0~svn4374.orig-plugins/securityplugin/src/org/red5/server/plugin/security/PlaybackSecurityHandler.javared5-1.0~svn4374.orig-plugins/securityplugin/src/org/red5/server/plugin/security/PlaybackSecurityHan0000644000175000017500000001361111755020232033577 0ustar drazzibdrazzibpackage org.red5.server.plugin.security; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.io.BufferedReader; import java.io.DataInputStream; import java.io.InputStreamReader; import org.apache.commons.lang3.ArrayUtils; import org.red5.logging.Red5LoggerFactory; import org.red5.server.api.IConnection; import org.red5.server.api.Red5; import org.red5.server.api.scope.IScope; import org.red5.server.api.stream.IStreamPlaybackSecurity; import org.slf4j.Logger; public class PlaybackSecurityHandler extends SecurityBase implements IStreamPlaybackSecurity { private Boolean HTMLDomainsAuth = true; private Boolean SWFDomainsAuth = true; private String[] allowedHTMLDomains; private String[] allowedSWFDomains; private String htmlDomains = "allowedHTMLdomains.txt"; private String swfDomains = "allowedSWFdomains.txt"; private static Logger log = Red5LoggerFactory.getLogger(PlaybackSecurityHandler.class, "securityTest"); @Override public void init() { if (properties.containsKey("htmlDomains")) { htmlDomains = properties.get("htmlDomains").toString(); } if (properties.containsKey("swfDomains")) { swfDomains = properties.get("swfDomains").toString(); } allowedHTMLDomains = readValidDomains(htmlDomains, "HTMLDomains"); // Populating the list of domains which are allowed to host a SWF file // which may connect to this application allowedSWFDomains = readValidDomains(swfDomains, "SWFDomains"); // Logging if (HTMLDomainsAuth) { log.debug("Authentication of HTML page URL domains is enabled"); } if (SWFDomainsAuth) { log.debug("Authentication of SWF URL domains is enabled"); } log.debug("...loading completed."); //now register with the application application.registerStreamPlaybackSecurity(this); } public boolean isPlaybackAllowed(IScope scope, String name, int start, int length, boolean flushPlaylist) { IConnection conn = Red5.getConnectionLocal(); try { String pageUrl = conn.getConnectParams().get("pageUrl").toString(); String swfUrl = conn.getConnectParams().get("swfUrl").toString(); String ip = conn.getRemoteAddress(); if ((ip != "127.0.0.1") && HTMLDomainsAuth && !this.validate(pageUrl, this.allowedHTMLDomains)) { log.debug("Authentication failed for pageurl: " + pageUrl + ", rejecting connection from " + ip); return false; } // Authenticating the SWF file's domain for the request : // Don't call validate() when the request is from localhost // or SWF Domains Authentication is off. if ((ip != "127.0.0.1") && SWFDomainsAuth && !this.validate(swfUrl, this.allowedSWFDomains)) { log.debug("Authentication failed for referrer: " + swfUrl + ", rejecting connection from " + ip); return false; } } catch (Exception e) { if (HTMLDomainsAuth || SWFDomainsAuth) return false; return true; } return true; } private Boolean validate(String url, String[] patterns) { // Convert to lower case url = url.toLowerCase(); int domainStartPos = 0; // domain start position in the URL int domainEndPos = 0; // domain end position in the URL switch (url.indexOf("://")) { case 4: if (url.indexOf("http://") == 0) domainStartPos = 7; break; case 5: if (url.indexOf("https://") == 0) domainStartPos = 8; break; } if (domainStartPos == 0) { // URL must be HTTP or HTTPS protocol based return false; } domainEndPos = url.indexOf("/", domainStartPos); if (domainEndPos > 0) { int colonPos = url.indexOf(":", domainStartPos); if ((colonPos > 0) && (domainEndPos > colonPos)) { // probably URL contains a port number domainEndPos = colonPos; // truncate the port number in the URL } } url = url.substring(domainStartPos, domainEndPos); if (ArrayUtils.indexOf(patterns, url) > 0) return true; return false; } private String[] readValidDomains(String fileName, String domainsType) { String[] domainsArray = new String[100]; try { DataInputStream in = new DataInputStream(application.getResource(fileName).getInputStream()); BufferedReader br = new BufferedReader(new InputStreamReader(in)); int index = 0; String strLine = ""; while ((strLine = br.readLine()) != null) { if (strLine.equals("") || strLine.indexOf("#") == 0) { continue; } if (strLine.indexOf(" ") < 0) { index++; domainsArray[index] = strLine.toLowerCase(); log.debug(domainsArray[index]); if (strLine.trim().equals("*")) { if (domainsType.equals("HTMLDomains")) { log.debug("Found wildcard (*) entry: disabling authentication of HTML file domains "); HTMLDomainsAuth = false; } else if (domainsType.equals("SWFDomains")) { log.debug("Found wildcard (*) entry: disabling authentication of SWF file domains "); SWFDomainsAuth = false; } } } } in.close(); } catch (Exception e) { log.error("{}", e.getMessage()); e.printStackTrace(); if (domainsType.equals("HTMLDomains")) { HTMLDomainsAuth = false; } else if (domainsType.equals("HTMLDomains")) { SWFDomainsAuth = false; } } return domainsArray; } } red5-1.0~svn4374.orig-plugins/securityplugin/src/org/red5/server/plugin/security/SecurityPlugin.java0000644000175000017500000001115411267331542033607 0ustar drazzibdrazzibpackage org.red5.server.plugin.security; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import org.apache.mina.core.buffer.IoBuffer; import org.red5.io.amf.AMF; import org.red5.io.amf.Output; import org.red5.io.object.Serializer; import org.red5.logging.Red5LoggerFactory; import org.red5.server.adapter.MultiThreadedApplicationAdapter; import org.red5.server.api.IConnection; import org.red5.server.net.rtmp.BaseRTMPHandler; import org.red5.server.net.rtmp.RTMPConnection; import org.red5.server.net.rtmp.event.IRTMPEvent; import org.red5.server.net.rtmp.event.Notify; import org.red5.server.net.rtmp.message.Header; import org.red5.server.net.rtmp.message.Packet; import org.red5.server.net.rtmp.status.StatusObject; import org.red5.server.plugin.Red5Plugin; import org.slf4j.Logger; /** * Provides security token features. * * @author Paul Gregoire * @author Dan Rossi */ public class SecurityPlugin extends Red5Plugin { private static Logger log = Red5LoggerFactory.getLogger(SecurityPlugin.class, "plugins"); private static Serializer serializer = new Serializer(); private MultiThreadedApplicationAdapter application; public void doStart() throws Exception { log.debug("Start"); } public void doStop() throws Exception { log.debug("Stop"); } public String getName() { return "securityPlugin"; } public void setApplication(MultiThreadedApplicationAdapter app) { log.trace("Setting application adapter: {}", app); this.application = app; } //methods specific to this plug-in public PlaybackSecurityHandler getPlaybackSecurityHandler() { PlaybackSecurityHandler ph = null; try { ph = (PlaybackSecurityHandler) Class.forName("org.red5.server.plugin.security.PlaybackSecurityHandler").newInstance(); ph.setApplication(application); } catch (Exception e) { log.error("PlaybackSecurityHandler could not be loaded", e); } return ph; } public PublishSecurityHandler getPublishSecurityHandler() { PublishSecurityHandler ps = null; try { ps = (PublishSecurityHandler) Class.forName("org.red5.server.plugin.security.PublishSecurityHandler").newInstance(); ps.setApplication(application); } catch (Exception e) { log.error("PublishSecurityHandler could not be loaded", e); } return ps; } public SharedObjectSecurityHandler getSharedObjectSecurityHandler() { SharedObjectSecurityHandler sh = null; try { sh = (SharedObjectSecurityHandler) Class.forName("org.red5.server.plugin.security.SharedObjectSecurityHandler").newInstance(); sh.setApplication(application); } catch (Exception e) { log.error("SharedObjectSecurityHandler could not be loaded", e); } return sh; } //common methods /** * Invokes the "onStatus" event on the client, passing our derived status. * * @param conn * @param status */ public static void writeStatus(IConnection conn, StatusObject status) { //make a buffer to put our data in IoBuffer buf = IoBuffer.allocate(128); buf.setAutoExpand(true); //create amf output Output out = new Output(buf); //mark it as an amf object buf.put(AMF.TYPE_OBJECT); //serialize our status status.serialize(out, serializer); //write trailer buf.put((byte) 0x00); buf.put((byte) 0x00); buf.put(AMF.TYPE_END_OF_OBJECT); //make the buffer read to be read buf.flip(); //create an RTMP event of Notify type IRTMPEvent event = new Notify(buf); //construct a packet Header header = new Header(); Packet packet = new Packet(header, event); //get our stream id int streamId = BaseRTMPHandler.getStreamId(); //set channel to "data" which im pretty sure is 3 header.setChannelId(3); header.setTimer(event.getTimestamp()); //0 header.setStreamId(streamId); header.setDataType(event.getDataType()); //write to the client ((RTMPConnection) conn).write(packet); } }red5-1.0~svn4374.orig-plugins/securityplugin/src/org/red5/server/plugin/security/SecurityBase.java0000644000175000017500000000315011267331542033220 0ustar drazzibdrazzibpackage org.red5.server.plugin.security; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.util.Map; import org.red5.server.adapter.MultiThreadedApplicationAdapter; import org.red5.server.adapter.ApplicationLifecycle; import org.red5.server.api.plugin.IRed5PluginHandler; /** * Base class for security handlers. * * @author Paul Gregoire * @author Dan Rossi */ public abstract class SecurityBase extends ApplicationLifecycle implements IRed5PluginHandler { protected MultiThreadedApplicationAdapter application; protected Map properties; public abstract void init(); public void setApplication(MultiThreadedApplicationAdapter app) { application = app; } public void setProperties(Map props) { properties = props; } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootred5-1.0~svn4374.orig-plugins/securityplugin/src/org/red5/server/plugin/security/SharedObjectSecurityHandler.javared5-1.0~svn4374.orig-plugins/securityplugin/src/org/red5/server/plugin/security/SharedObjectSecurit0000644000175000017500000001160511755020232033567 0ustar drazzibdrazzibpackage org.red5.server.plugin.security; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.io.BufferedReader; import java.io.DataInputStream; import java.io.InputStreamReader; import java.util.List; import org.apache.commons.lang3.ArrayUtils; import org.red5.logging.Red5LoggerFactory; import org.red5.server.api.scope.IScope; import org.red5.server.api.so.ISharedObject; import org.red5.server.api.so.ISharedObjectSecurity; import org.slf4j.Logger; public class SharedObjectSecurityHandler extends SecurityBase implements ISharedObjectSecurity { private Boolean creationAllowed; private Boolean connectionAllowed; private Boolean deleteAllowed; private Boolean sendAllowed; private Boolean writeAllowed; private Boolean enableSharedObjects; private String sharedObjectNames; private Boolean NamesAuth = false; private String[] allowedSharedObjectNames; private static Logger log = Red5LoggerFactory.getLogger(SharedObjectSecurityHandler.class, "plugins"); @Override public void init() { if (properties.containsKey("connectionAllowed")) { connectionAllowed = Boolean.valueOf(properties.get("connectionAllowed").toString()); } if (properties.containsKey("creationAllowed")) { creationAllowed = Boolean.valueOf(properties.get("creationAllowed").toString()); } if (properties.containsKey("deleteAllowed")) { deleteAllowed = Boolean.valueOf(properties.get("deleteAllowed").toString()); } if (properties.containsKey("sendAllowed")) { sendAllowed = Boolean.valueOf(properties.get("sendAllowed").toString()); } if (properties.containsKey("writeAllowed")) { writeAllowed = Boolean.valueOf(properties.get("writeAllowed").toString()); } if (properties.containsKey("enableSharedObjects")) { enableSharedObjects = Boolean.valueOf(properties.get("enableSharedObjects").toString()); } if (properties.containsKey("sharedObjectNames")) { sharedObjectNames = properties.get("sharedObjectNames").toString(); } allowedSharedObjectNames = readValidNames(sharedObjectNames); if (NamesAuth) { log.debug("Authentication of Shared Object Names is enabled"); } //now register with the application application.registerSharedObjectSecurity(this); } private Boolean validate(String name, String[] patterns) { if (ArrayUtils.indexOf(patterns, name) > 0) return true; return false; } private String[] readValidNames(String fileName) { String[] namesArray = {}; try { NamesAuth = true; //FileInputStream fstream = new FileInputStream(fileName); DataInputStream in = new DataInputStream(application.getResource(fileName).getInputStream()); BufferedReader br = new BufferedReader(new InputStreamReader(in)); int index = 0; String strLine = ""; while ((strLine = br.readLine()) != null) { if (strLine.equals("") || strLine.indexOf("#") == 0) { continue; } if (strLine.indexOf(" ") < 0) { namesArray[index] = strLine.toLowerCase(); index++; if (strLine == "*") { log.debug("Found wildcard (*) entry: disabling authentication of HTML file domains "); NamesAuth = false; } } } in.close(); } catch (Exception e) { log.error("Problem: {}", e.getStackTrace()); NamesAuth = false; } return namesArray; } public boolean isConnectionAllowed(ISharedObject so) { // Note: we don't check for the name here as only one SO can be // created with this handler. return (enableSharedObjects && connectionAllowed); } public boolean isCreationAllowed(IScope scope, String name, boolean persistent) { if (enableSharedObjects && creationAllowed) { if (NamesAuth && !validate(name, allowedSharedObjectNames)) { log.debug("Authentication failed for shared object name: " + name); return false; } return true; } return false; } public boolean isDeleteAllowed(ISharedObject so, String key) { return deleteAllowed; } public boolean isSendAllowed(ISharedObject so, String message, List arguments) { return sendAllowed; } public boolean isWriteAllowed(ISharedObject so, String key, Object value) { return writeAllowed; } }././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootred5-1.0~svn4374.orig-plugins/securityplugin/src/org/red5/server/plugin/security/PublishSecurityHandler.javared5-1.0~svn4374.orig-plugins/securityplugin/src/org/red5/server/plugin/security/PublishSecurityHand0000644000175000017500000000730711755020232033630 0ustar drazzibdrazzibpackage org.red5.server.plugin.security; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.io.BufferedReader; import java.io.DataInputStream; import java.io.InputStreamReader; import java.util.HashMap; import org.apache.commons.lang3.ArrayUtils; import org.red5.logging.Red5LoggerFactory; import org.red5.server.api.scope.IScope; import org.red5.server.api.stream.IStreamPublishSecurity; import org.slf4j.Logger; public class PublishSecurityHandler extends SecurityBase implements IStreamPublishSecurity { private Boolean enablePublish = true; private String publishNames; private Boolean NamesAuth = false; private HashMap allowedPublishNames; private static Logger log = Red5LoggerFactory.getLogger(PublishSecurityHandler.class, "securityTest"); @Override public void init() { if (properties.containsKey("publishNames")) { publishNames = properties.get("publishNames").toString(); } if (properties.containsKey("enablePublish")) { enablePublish = Boolean.valueOf(properties.get("enablePublish").toString()); } allowedPublishNames = readValidNames(publishNames); if (NamesAuth) { log.debug("Authentication of Publish Names is enabled"); } //now register with the application application.registerStreamPublishSecurity(this); } public boolean isPublishAllowed(IScope scope, String name, String mode) { if (enablePublish) { if (NamesAuth && !validate(name, mode, allowedPublishNames)) { log.debug("Authentication failed for publish name: " + name); return false; } return true; } return false; } private Boolean validate(String name, String mode, HashMap patterns) { if (!patterns.get(name).equals(null)) { String[] modes = patterns.get(name); if (ArrayUtils.indexOf(modes, mode) > 0) return true; } return false; } private HashMap readValidNames(String fileName) { HashMap map = new HashMap(); try { NamesAuth = true; //FileInputStream fstream = new FileInputStream(fileName); DataInputStream in = new DataInputStream(application.getResource(fileName).getInputStream()); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String strLine = ""; while ((strLine = br.readLine()) != null) { if (strLine.equals("") || strLine.indexOf("#") == 0) { continue; } if (strLine.indexOf(" ") < 0) { String line = strLine.toLowerCase(); String[] nameMode = line.split(";"); String name = nameMode[0]; String[] modes = nameMode[1].split(","); map.put(name, modes); if (strLine == "*") { log.debug("Found wildcard (*) entry: disabling authentication of publish names "); NamesAuth = false; } } } in.close(); } catch (Exception e) { log.error("Problem: {}", e.getStackTrace()); NamesAuth = false; } return map; } }red5-1.0~svn4374.orig-plugins/securityplugin/allowedHTMLdomains.txt0000644000175000017500000000005211250365606025311 0ustar drazzibdrazziblocalhost electroteque.org electrocode.netred5-1.0~svn4374.orig-plugins/securityplugin/.settings/0000755000175000017500000000000011760512615023002 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/securityplugin/.settings/org.eclipse.jdt.core.prefs0000644000175000017500000005305311250365606027772 0ustar drazzibdrazzib#Sat Aug 29 19:43:09 PDT 2009 eclipse.preferences.version=1 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 org.eclipse.jdt.core.formatter.blank_lines_after_package=1 org.eclipse.jdt.core.formatter.blank_lines_before_field=1 org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 org.eclipse.jdt.core.formatter.blank_lines_before_method=1 org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 org.eclipse.jdt.core.formatter.blank_lines_before_package=0 org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false org.eclipse.jdt.core.formatter.comment.format_block_comments=false org.eclipse.jdt.core.formatter.comment.format_header=false org.eclipse.jdt.core.formatter.comment.format_html=true org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false org.eclipse.jdt.core.formatter.comment.format_line_comments=false org.eclipse.jdt.core.formatter.comment.format_source_code=true org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true org.eclipse.jdt.core.formatter.comment.indent_root_tags=true org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert org.eclipse.jdt.core.formatter.comment.line_length=80 org.eclipse.jdt.core.formatter.compact_else_if=true org.eclipse.jdt.core.formatter.continuation_indentation=2 org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_empty_lines=false org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true org.eclipse.jdt.core.formatter.indentation.size=4 org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false org.eclipse.jdt.core.formatter.lineSplit=120 org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true org.eclipse.jdt.core.formatter.tabulation.char=mixed org.eclipse.jdt.core.formatter.tabulation.size=4 org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true red5-1.0~svn4374.orig-plugins/securityplugin/.settings/org.eclipse.jdt.ui.prefs0000644000175000017500000000016611250365606027454 0ustar drazzibdrazzib#Sat Aug 29 19:43:09 PDT 2009 eclipse.preferences.version=1 formatter_profile=_Red5 formatter_settings_version=11 red5-1.0~svn4374.orig-plugins/oflademoplugin/0000755000175000017500000000000011760512615021003 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/oflademoplugin/build.xml0000644000175000017500000000657711436757214022651 0ustar drazzibdrazzib java.home is ${java.home} and the target version is ${java.target_version} red5.root is ${red5.root} javac version: ${java.version} Type ant -p for available targets" red5-1.0~svn4374.orig-plugins/oflademoplugin/ivy.xml0000644000175000017500000000267711436757214022356 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/oflademoplugin/lib/0000755000175000017500000000000011760512615021551 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/oflademoplugin/ivysettings.xml0000644000175000017500000000126711436757214024131 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/oflademoplugin/.classpath0000644000175000017500000000106011436757214022771 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/oflademoplugin/.project0000644000175000017500000000056511436757214022466 0ustar drazzibdrazzib oflademoplugin org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature red5-1.0~svn4374.orig-plugins/oflademoplugin/build.bat0000644000175000017500000000000311436757214022571 0ustar drazzibdrazzibantred5-1.0~svn4374.orig-plugins/oflademoplugin/build.properties0000644000175000017500000000022611436757214024226 0ustar drazzibdrazzib# Let the scripts know where your red5 is (ie. the location of the red5.jar) red5.root=c:/red5 build.verbose=true build.fork=true debug.state=truered5-1.0~svn4374.orig-plugins/oflademoplugin/src/0000755000175000017500000000000011760512615021572 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/oflademoplugin/src/oflaDemo.xml0000644000175000017500000000113111436757214024044 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/oflademoplugin/src/org/0000755000175000017500000000000011760512615022361 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/oflademoplugin/src/org/red5/0000755000175000017500000000000011760512615023220 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/oflademoplugin/src/org/red5/server/0000755000175000017500000000000011760512615024526 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/oflademoplugin/src/org/red5/server/plugin/0000755000175000017500000000000011760512615026024 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/oflademoplugin/src/org/red5/server/plugin/oflaDemo/0000755000175000017500000000000011760512615027552 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/oflademoplugin/src/org/red5/server/plugin/oflaDemo/DemoService.java0000644000175000017500000000470211436757214032633 0ustar drazzibdrazzibpackage org.red5.server.plugin.oflaDemo; import java.io.File; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import java.util.Locale; import java.util.Map; import org.red5.logging.Red5LoggerFactory; import org.red5.server.api.IScope; import org.red5.server.api.Red5; import org.slf4j.Logger; import org.springframework.core.io.Resource; public class DemoService { private static Logger log = Red5LoggerFactory.getLogger(DemoService.class); { log.info("oflaDemo DemoService created"); } private String formatDate(Date date) { SimpleDateFormat formatter; String pattern = "dd/MM/yy H:mm:ss"; Locale locale = new Locale("en", "US"); formatter = new SimpleDateFormat(pattern, locale); return formatter.format(date); } /** * Getter for property 'listOfAvailableFLVs'. * * @return Value for property 'listOfAvailableFLVs'. */ public Map> getListOfAvailableFLVs() { log.debug("Getting the FLV files"); IScope scope = Red5.getConnectionLocal().getScope(); log.info("Path: {} Resource: {}", scope.getContextPath(), scope.getResource("/")); Map> filesMap = new HashMap>(); try { addToMap(filesMap, scope.getResources("streams/*.flv")); addToMap(filesMap, scope.getResources("streams/*.f4v")); addToMap(filesMap, scope.getResources("streams/*.mp3")); addToMap(filesMap, scope.getResources("streams/*.mp4")); } catch (IOException e) { log.error("", e); } return filesMap; } private void addToMap(Map> filesMap, Resource[] files) throws IOException { if (files != null) { for (Resource flv : files) { File file = flv.getFile(); Date lastModifiedDate = new Date(file.lastModified()); String lastModified = formatDate(lastModifiedDate); String flvName = flv.getFile().getName(); String flvBytes = Long.toString(file.length()); if (log.isDebugEnabled()) { log.debug("flvName: {}", flvName); log.debug("lastModified date: {}", lastModified); log.debug("flvBytes: {}", flvBytes); log.debug("-------"); } Map fileInfo = new HashMap(); fileInfo.put("name", flvName); fileInfo.put("lastModified", lastModified); fileInfo.put("size", flvBytes); filesMap.put(flvName, fileInfo); } } } } red5-1.0~svn4374.orig-plugins/oflademoplugin/src/org/red5/server/plugin/oflaDemo/OflaDemoPlugin.java0000644000175000017500000001025511436757214033273 0ustar drazzibdrazzibpackage org.red5.server.plugin.oflaDemo; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import org.red5.logging.Red5LoggerFactory; import org.red5.server.ClientRegistry; import org.red5.server.Context; import org.red5.server.GlobalScope; import org.red5.server.MappingStrategy; import org.red5.server.Scope; import org.red5.server.ScopeResolver; import org.red5.server.api.IScope; import org.red5.server.plugin.Red5Plugin; import org.red5.server.service.ServiceInvoker; import org.slf4j.Logger; import org.springframework.context.ApplicationContext; import org.springframework.context.support.FileSystemXmlApplicationContext; /** * OflaDemo for Red5 * * @author Paul Gregoire */ public class OflaDemoPlugin extends Red5Plugin { private static Logger log = Red5LoggerFactory.getLogger(OflaDemoPlugin.class); private OflaDemoHandler handler = null; private ApplicationContext oflaDemoContext; private String hostName = "localhost"; @Override public void doStart() throws Exception { super.doStart(); //create a handler handler = new OflaDemoHandler(); ApplicationContext commonCtx = (ApplicationContext) context.getBean("red5.common"); if (context.containsBean("playlistSubscriberStream")) { //create app context oflaDemoContext = new FileSystemXmlApplicationContext(new String[]{"classpath:/oflaDemo.xml"}, true, context); } else if (commonCtx.containsBean("playlistSubscriberStream")) { //create app context oflaDemoContext = new FileSystemXmlApplicationContext(new String[]{"classpath:/oflaDemo.xml"}, true, commonCtx); } else { log.error("Playlist subscriber stream bean could not be located"); } //set the context handler.setContext(oflaDemoContext); //get a ref to the "default" global scope GlobalScope global = (GlobalScope) server.getGlobal("default"); //create a scope resolver ScopeResolver scopeResolver = new ScopeResolver(); scopeResolver.setGlobalScope(global); //create a context - this takes the place of the previous web context Context ctx = new Context(oflaDemoContext, "oflaDemo"); ctx.setClientRegistry(new ClientRegistry()); ctx.setMappingStrategy(new MappingStrategy()); ctx.setPersistanceStore(global.getStore()); ctx.setScopeResolver(scopeResolver); ctx.setServiceInvoker(new ServiceInvoker()); //create a scope for the admin Scope scope = new Scope.Builder((IScope) global, "scope", "oflaDemo", false).build(); scope.setContext(ctx); scope.setHandler(handler); //set the scope on the handler handler.setScope(scope); server.addMapping(hostName, "oflaDemo", "default"); if (global.addChildScope(scope)) { log.info("oflaDemo scope was added to global (default) scope"); } else { log.warn("oflaDemo scope was not added to global (default) scope"); } } @Override public void doStop() throws Exception { super.doStop(); //clean up / unregister everything server.removeMapping(hostName, "oflaDemo"); handler.stop(null); } @Override public String getName() { return "oflaDemoPlugin"; } @Override public void init() { log.debug("Initializing"); super.init(); } public String getHostName() { return hostName; } public void setHostName(String hostName) { this.hostName = hostName; } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootred5-1.0~svn4374.orig-plugins/oflademoplugin/src/org/red5/server/plugin/oflaDemo/DemoServiceImpl.javared5-1.0~svn4374.orig-plugins/oflademoplugin/src/org/red5/server/plugin/oflaDemo/DemoServiceImpl.jav0000644000175000017500000000150111436757214033306 0ustar drazzibdrazzibpackage org.red5.server.plugin.oflaDemo; import java.util.HashMap; import java.util.Map; import org.red5.logging.Red5LoggerFactory; import org.slf4j.Logger; public class DemoServiceImpl implements IDemoService { private static Logger log = Red5LoggerFactory.getLogger(DemoServiceImpl.class); /** * Getter for property 'listOfAvailableFLVs'. * * @return Value for property 'listOfAvailableFLVs'. */ public Map> getListOfAvailableFLVs() { log.debug("getListOfAvailableFLVs empty"); return new HashMap>(1); } public Map> getListOfAvailableFLVs(String string) { log.debug("getListOfAvailableFLVs, Got a string: {}", string); return getListOfAvailableFLVs(); } } red5-1.0~svn4374.orig-plugins/oflademoplugin/src/org/red5/server/plugin/oflaDemo/IDemoService.java0000644000175000017500000000061611436757214032744 0ustar drazzibdrazzibpackage org.red5.server.plugin.oflaDemo; import java.util.Map; public interface IDemoService { /** * Getter for property 'listOfAvailableFLVs'. * * @return Value for property 'listOfAvailableFLVs'. */ public Map> getListOfAvailableFLVs(); public Map> getListOfAvailableFLVs(String string); } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootred5-1.0~svn4374.orig-plugins/oflademoplugin/src/org/red5/server/plugin/oflaDemo/OflaDemoHandler.javared5-1.0~svn4374.orig-plugins/oflademoplugin/src/org/red5/server/plugin/oflaDemo/OflaDemoHandler.jav0000644000175000017500000000662611436757214033260 0ustar drazzibdrazzibpackage org.red5.server.plugin.oflaDemo; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import org.red5.logging.Red5LoggerFactory; import org.red5.server.Scope; import org.red5.server.api.IBasicScope; import org.red5.server.api.IClient; import org.red5.server.api.IConnection; import org.red5.server.api.IScope; import org.red5.server.api.IScopeHandler; import org.red5.server.api.event.IEvent; import org.red5.server.api.service.IServiceCall; import org.slf4j.Logger; import org.springframework.context.ApplicationContext; /** * Primary "oflaDemo" class, it handles all the features and functions of a standard red5 application. This code is based on original code in the * oflaDemo application. * * @author Paul Gregoire */ public class OflaDemoHandler implements IScopeHandler { private static Logger log = Red5LoggerFactory.getLogger(OflaDemoHandler.class); private IScope scope; @SuppressWarnings("unused") private ApplicationContext context; public boolean start(IScope scope) { log.info("start: {}", scope); return true; } public void stop(IScope scope) { log.info("stop: {}", scope); if (scope != null) { //un-initializing admin scope and children ((Scope) this.scope).uninit(); } } public boolean handleEvent(IEvent event) { log.debug("Scope event: {}", event); return false; } public boolean connect(IConnection conn, IScope scope, Object[] params) { log.info("connect - conn: {} params: {} scope: {}", new Object[]{conn, params, scope}); return true; } public void disconnect(IConnection conn, IScope scope) { log.info("disconnect"); // Get the previously stored username String rid = conn.getClient().getId(); // Unregister user log.info("Client with id {} disconnected.", rid); } public boolean join(IClient client, IScope scope) { log.info("join - client: {} scope: {}", new Object[]{client, scope}); return true; } public void leave(IClient client, IScope scope) { log.info("leave"); } public boolean addChildScope(IBasicScope scope) { log.info("addChildScope: {}", scope); return false; } public void removeChildScope(IBasicScope scope) { log.info("removeChildScope: {}", scope); } public boolean serviceCall(IConnection conn, IServiceCall call) { log.info("serviceCall {}", call); return true; } public void setContext(ApplicationContext ctx) { this.context = ctx; } /** * @param scope the scope to set */ public void setScope(IScope scope) { this.scope = scope; } } red5-1.0~svn4374.orig-plugins/oflademoplugin/.settings/0000755000175000017500000000000011760512615022721 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/oflademoplugin/.settings/org.eclipse.jdt.core.prefs0000644000175000017500000005305311436757214027717 0ustar drazzibdrazzib#Fri Sep 04 21:08:42 PDT 2009 eclipse.preferences.version=1 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 org.eclipse.jdt.core.formatter.blank_lines_after_package=1 org.eclipse.jdt.core.formatter.blank_lines_before_field=1 org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 org.eclipse.jdt.core.formatter.blank_lines_before_method=1 org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 org.eclipse.jdt.core.formatter.blank_lines_before_package=0 org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false org.eclipse.jdt.core.formatter.comment.format_block_comments=false org.eclipse.jdt.core.formatter.comment.format_header=false org.eclipse.jdt.core.formatter.comment.format_html=true org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false org.eclipse.jdt.core.formatter.comment.format_line_comments=false org.eclipse.jdt.core.formatter.comment.format_source_code=true org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true org.eclipse.jdt.core.formatter.comment.indent_root_tags=true org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert org.eclipse.jdt.core.formatter.comment.line_length=80 org.eclipse.jdt.core.formatter.compact_else_if=true org.eclipse.jdt.core.formatter.continuation_indentation=2 org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_empty_lines=false org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true org.eclipse.jdt.core.formatter.indentation.size=4 org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false org.eclipse.jdt.core.formatter.lineSplit=120 org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true org.eclipse.jdt.core.formatter.tabulation.char=mixed org.eclipse.jdt.core.formatter.tabulation.size=4 org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true red5-1.0~svn4374.orig-plugins/oflademoplugin/.settings/org.eclipse.jdt.ui.prefs0000644000175000017500000000016611436757214027401 0ustar drazzibdrazzib#Fri Sep 04 21:08:42 PDT 2009 eclipse.preferences.version=1 formatter_profile=_Red5 formatter_settings_version=11 red5-1.0~svn4374.orig-plugins/definst/0000755000175000017500000000000011760512623017431 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/definst/build.xml0000644000175000017500000000656611712071275021267 0ustar drazzibdrazzib java.home is ${java.home} and the target version is ${java.target_version} red5.root is ${red5.root} javac version: ${java.version} Type ant -p for available targets" red5-1.0~svn4374.orig-plugins/definst/ivy.xml0000644000175000017500000000311211712071275020757 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/definst/lib/0000755000175000017500000000000011760512623020177 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/definst/ivysettings.xml0000644000175000017500000000126711712071275022551 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/definst/.classpath0000644000175000017500000000106011712071275021411 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/definst/.project0000644000175000017500000000063111712071275021100 0ustar drazzibdrazzib definstplugin Plugin to handle the default instance org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature red5-1.0~svn4374.orig-plugins/definst/build.bat0000644000175000017500000000000311712071275021211 0ustar drazzibdrazzibantred5-1.0~svn4374.orig-plugins/definst/build.properties0000644000175000017500000000022611712071275022646 0ustar drazzibdrazzib# Let the scripts know where your red5 is (ie. the location of the red5.jar) red5.root=c:/red5 build.verbose=true build.fork=true debug.state=truered5-1.0~svn4374.orig-plugins/definst/src/0000755000175000017500000000000011760512623020220 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/definst/src/definst.xml0000644000175000017500000000077711712071275022411 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/definst/src/org/0000755000175000017500000000000011760512623021007 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/definst/src/org/red5/0000755000175000017500000000000011760512623021646 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/definst/src/org/red5/server/0000755000175000017500000000000011760512623023154 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/definst/src/org/red5/server/plugin/0000755000175000017500000000000011760512623024452 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/definst/src/org/red5/server/plugin/definst/0000755000175000017500000000000011760512623026106 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/definst/src/org/red5/server/plugin/definst/DefinstPlugin.java0000644000175000017500000001017511712071275031530 0ustar drazzibdrazzib/* * RED5 Open Source Flash Server - http://code.google.com/p/red5/ * * Copyright 2006-2012 by respective authors (see below). All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.red5.server.plugin.definst; import org.red5.logging.Red5LoggerFactory; import org.red5.server.ClientRegistry; import org.red5.server.Context; import org.red5.server.GlobalScope; import org.red5.server.MappingStrategy; import org.red5.server.Scope; import org.red5.server.ScopeResolver; import org.red5.server.api.IScope; import org.red5.server.plugin.Red5Plugin; import org.red5.server.service.ServiceInvoker; import org.slf4j.Logger; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.ApplicationContext; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.support.FileSystemXmlApplicationContext; /** * Default instance for Red5 * * @author Paul Gregoire */ public class DefinstPlugin extends Red5Plugin { private static Logger log = Red5LoggerFactory.getLogger(DefinstPlugin.class); private DefinstHandler handler = null; private ApplicationContext parentContext; private ApplicationContext appContext; private String appName = "definst"; private String hostName = "localhost"; @Override public void doStart() throws Exception { super.doStart(); // add the context to the parent, this will be red5.xml ConfigurableBeanFactory factory = ((ConfigurableApplicationContext) context).getBeanFactory(); // if parent context was not set then lookup red5.common log.debug("Lookup common - bean:{} local:{} singleton:{}", new Object[] { factory.containsBean("red5.common"), factory.containsLocalBean("red5.common"), factory.containsSingleton("red5.common"), }); parentContext = (ApplicationContext) factory.getBean("red5.common"); //create app context appContext = new FileSystemXmlApplicationContext(new String[]{"classpath:/definst.xml"}, true, parentContext); //get a ref to the "default" global scope GlobalScope global = (GlobalScope) server.getGlobal("default"); //create a scope resolver ScopeResolver scopeResolver = new ScopeResolver(); scopeResolver.setGlobalScope(global); //create a context - this takes the place of the previous web context Context ctx = new Context(appContext, appName); ctx.setClientRegistry(new ClientRegistry()); ctx.setMappingStrategy(new MappingStrategy()); ctx.setPersistanceStore(global.getStore()); ctx.setScopeResolver(scopeResolver); ctx.setServiceInvoker(new ServiceInvoker()); //create a handler handler = new DefinstHandler(); //create a scope for the admin Scope scope = new Scope.Builder((IScope) global, "scope", appName, false).build(); scope.setContext(ctx); scope.setHandler(handler); server.addMapping(hostName, appName, "default"); if (global.addChildScope(scope)) { log.info("Scope was added to global (default) scope"); } else { log.warn("Scope was not added to global (default) scope"); } //start the scope scope.start(); } @Override public void doStop() throws Exception { super.doStop(); //clean up / unregister everything server.removeMapping(hostName, appName); handler.stop(null); } @Override public String getName() { return appName; } @Override public void init() { log.debug("Initializing"); super.init(); } public String getHostName() { return hostName; } public void setHostName(String hostName) { this.hostName = hostName; } } red5-1.0~svn4374.orig-plugins/definst/src/org/red5/server/plugin/definst/DefinstHandler.java0000644000175000017500000000645011712071275031650 0ustar drazzibdrazzib/* * RED5 Open Source Flash Server - http://code.google.com/p/red5/ * * Copyright 2006-2012 by respective authors (see below). All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.red5.server.plugin.definst; import org.red5.logging.Red5LoggerFactory; import org.red5.server.Scope; import org.red5.server.api.IBasicScope; import org.red5.server.api.IClient; import org.red5.server.api.IConnection; import org.red5.server.api.IScope; import org.red5.server.api.IScopeAware; import org.red5.server.api.IScopeHandler; import org.red5.server.api.event.IEvent; import org.red5.server.api.service.IServiceCall; import org.slf4j.Logger; /** * Primary definst class, it handles all the features and functions of a * standard red5 application. * * @author Paul Gregoire */ public class DefinstHandler implements IScopeHandler, IScopeAware { private static Logger log = Red5LoggerFactory.getLogger(DefinstHandler.class); private IScope scope; public boolean start(IScope scope) { log.info("start: {}", scope); //return ((Scope) this.scope).start(); return true; } public void stop(IScope scope) { log.info("stop: {}", scope); if (scope != null) { //un-initializing admin scope and children ((Scope) this.scope).uninit(); } } public boolean handleEvent(IEvent event) { log.debug("Scope event: {}", event); return false; } public boolean connect(IConnection conn, IScope scope, Object[] params) { log.info("connect - conn: {} params: {} scope: {}", new Object[]{conn, params, scope}); //return ((Scope) scope).connect(conn, params); return true; } public void disconnect(IConnection conn, IScope scope) { log.info("disconnect"); // Get the previously stored username String rid = conn.getClient().getId(); // Unregister user log.info("Client with id {} disconnected.", rid); //((Scope) scope).disconnect(conn); } public boolean join(IClient client, IScope scope) { log.info("join - client: {} scope: {}", new Object[]{client, scope}); return true; } public void leave(IClient client, IScope scope) { log.info("leave"); } public boolean addChildScope(IBasicScope scope) { log.info("addChildScope: {}", scope); //return ((Scope) this.scope).addChildScope(scope); return true; } public void removeChildScope(IBasicScope scope) { log.info("removeChildScope: {}", scope); //((Scope) this.scope).removeChildScope(scope); } public boolean serviceCall(IConnection conn, IServiceCall call) { log.info("serviceCall {}", call); return true; } /** * Get the root scope * * @return IScope */ public IScope getScope() { return scope; } public void setScope(IScope scope) { this.scope = scope; } } red5-1.0~svn4374.orig-plugins/definst/.settings/0000755000175000017500000000000011760512623021347 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/definst/.settings/org.eclipse.jdt.core.prefs0000644000175000017500000005305311712071275026337 0ustar drazzibdrazzib#Fri Sep 04 21:08:42 PDT 2009 eclipse.preferences.version=1 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 org.eclipse.jdt.core.formatter.blank_lines_after_package=1 org.eclipse.jdt.core.formatter.blank_lines_before_field=1 org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 org.eclipse.jdt.core.formatter.blank_lines_before_method=1 org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 org.eclipse.jdt.core.formatter.blank_lines_before_package=0 org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false org.eclipse.jdt.core.formatter.comment.format_block_comments=false org.eclipse.jdt.core.formatter.comment.format_header=false org.eclipse.jdt.core.formatter.comment.format_html=true org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false org.eclipse.jdt.core.formatter.comment.format_line_comments=false org.eclipse.jdt.core.formatter.comment.format_source_code=true org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true org.eclipse.jdt.core.formatter.comment.indent_root_tags=true org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert org.eclipse.jdt.core.formatter.comment.line_length=80 org.eclipse.jdt.core.formatter.compact_else_if=true org.eclipse.jdt.core.formatter.continuation_indentation=2 org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_empty_lines=false org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true org.eclipse.jdt.core.formatter.indentation.size=4 org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false org.eclipse.jdt.core.formatter.lineSplit=120 org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true org.eclipse.jdt.core.formatter.tabulation.char=mixed org.eclipse.jdt.core.formatter.tabulation.size=4 org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true red5-1.0~svn4374.orig-plugins/definst/.settings/org.eclipse.jdt.ui.prefs0000644000175000017500000000016611712071275026021 0ustar drazzibdrazzib#Fri Sep 04 21:08:42 PDT 2009 eclipse.preferences.version=1 formatter_profile=_Red5 formatter_settings_version=11 red5-1.0~svn4374.orig-plugins/rtspplugin/0000755000175000017500000000000011760512620020201 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/rtspplugin/build.xml0000644000175000017500000000710611275371545022040 0ustar drazzibdrazzib java.home is ${java.home} and the target version is ${java.target_version} red5.root is ${red5.root} javac version: ${java.version} Type ant -p for available targets" red5-1.0~svn4374.orig-plugins/rtspplugin/ivy.xml0000644000175000017500000000240011275371545021540 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/rtspplugin/lib/0000755000175000017500000000000011760512617020755 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/rtspplugin/ivysettings.xml0000644000175000017500000000250711275371545023331 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/rtspplugin/.classpath0000644000175000017500000000106011275371545022173 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/rtspplugin/.project0000644000175000017500000000063411275371545021665 0ustar drazzibdrazzib rtspplugin RTSP / RTP plugin for Red5 org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature red5-1.0~svn4374.orig-plugins/rtspplugin/build.bat0000644000175000017500000000001211275371545021773 0ustar drazzibdrazzibant pausered5-1.0~svn4374.orig-plugins/rtspplugin/build.properties0000644000175000017500000000016111275371545023426 0ustar drazzibdrazzib# Let the scripts know where your red5 is (ie. the location of the red5.jar) red5.root=c:/red5 debug.state=truered5-1.0~svn4374.orig-plugins/rtspplugin/src/0000755000175000017500000000000011760512617020776 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/rtspplugin/src/org/0000755000175000017500000000000011760512617021565 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/rtspplugin/src/org/red5/0000755000175000017500000000000011760512617022424 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/rtspplugin/src/org/red5/server/0000755000175000017500000000000011760512617023732 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/rtspplugin/src/org/red5/server/net/0000755000175000017500000000000011760512617024520 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/rtspplugin/src/org/red5/server/net/rtsp/0000755000175000017500000000000011760512620025502 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/rtspplugin/src/org/red5/server/net/rtsp/RTSPSession.java0000644000175000017500000001137311272347163030514 0ustar drazzibdrazzibpackage org.red5.server.net.rtsp; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * Copyright (C) 2005 - Matteo Merli - matteo.merli@gmail.com * * * ***************************************************************************/ import java.util.Map; import java.util.Random; import java.util.concurrent.ConcurrentHashMap; import org.red5.io.object.UnsignedLong; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * RTSP is primarily a connection-less protocol, that means that RTSP request can * be made over multiples TCP connections. To identify such a "session", a * 64-bit identifier is used. * * @author Matteo Merli (matteo.merli@gmail.com) */ public class RTSPSession { private static Logger log = LoggerFactory.getLogger(RTSPSession.class); private static Map sessions = new ConcurrentHashMap(); // Members /** Session ID */ private String sessionId; /** Session associated tracks */ private Map tracks = new ConcurrentHashMap(); /** * Creates a new empty RTSPSession and stores it. * * @param sessionId * Session identifier * @return The newly created session */ static public RTSPSession create(String sessionId) { if (sessions.get(sessionId) != null) { log.error("Session key conflit!!"); return null; } RTSPSession session = new RTSPSession(sessionId); sessions.put(sessionId, session); log.debug("New session created - id=" + sessionId); return session; } /** * @return a new RTSPSession with a new random ID */ static public RTSPSession create() { return create(newSessionID()); } /** * Access an opened session. * * @param id * Session identifier * @return The RTSPSession identified by id or null if not present */ static public RTSPSession get(String id) { if (id == null) return null; long key = Long.valueOf(id); return sessions.get(key); } /** * Close a session and remove resources. * * @param id * Session identifier */ static public void close(String id) { long key = Long.valueOf(id); close(key); } /** * Close the session and removes it. * * @param id * the session ID */ static public void close(long id) { sessions.remove(id); } protected RTSPSession(String sessionId) { this.sessionId = sessionId; } /** * @return the session ID */ public String getId() { return sessionId; } /** * @param control * the key to access the track * @return the track */ public Track getTrack(String control) { return tracks.get(control); } /** * @return the number of track contained in this sessions */ public int getTracksCount() { return tracks.size(); } /** * Adds a new track to the session * * @param track * a Track object */ public void addTrack(Track track) { String control = track.getControl(); tracks.put(control, track); } // / Session ID generation private static Random random = new Random(); /** * Creates a unique session ID * * @return the session ID */ private static String newSessionID() { String id; synchronized (random) { while (true) { id = new UnsignedLong(random).toString(); if (sessions.get(id) == null) { // Ok, the id is unique return id; } } // try with another id } } } red5-1.0~svn4374.orig-plugins/rtspplugin/src/org/red5/server/net/rtsp/RTSPResponse.java0000644000175000017500000000734611272347163030674 0ustar drazzibdrazzibpackage org.red5.server.net.rtsp; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * Copyright (C) 2005 - Matteo Merli - matteo.merli@gmail.com * * * ***************************************************************************/ import org.apache.mina.core.buffer.IoBuffer; import org.red5.server.net.rtsp.messages.RTSPMessage; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Wraps up a RTSP response message. * * @author Matteo Merli (matteo.merli@gmail.com) */ public class RTSPResponse extends RTSPMessage { private static Logger log = LoggerFactory.getLogger(RTSPResponse.class); RTSPCode code; RTSPRequest.Verb requestVerb = RTSPRequest.Verb.None; public RTSPResponse() { super(); code = RTSPCode.OK; } public Type getType() { return Type.TypeResponse; } public RTSPCode getCode() { return code; } public void setCode(RTSPCode code) { this.code = code; } public void setRequestVerb(RTSPRequest.Verb requestVerb) { this.requestVerb = requestVerb; } public RTSPRequest.Verb getRequestVerb() { return requestVerb; } /** * Serialize the RTSP response to a string. * *
	 *    "RTSP/1.0" SP [code] SP [reason] CRLF
	 *    [headers] CRLF
	 *    CRLF
	 *    [buf] 
	 * 
*/ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("RTSP/1.0 ").append(code.value()).append(" "); sb.append(code.description()).append(CRLF); sb.append(getHeadersString()); // Insert a blank line sb.append(CRLF); if (getBufferSize() > 0) { sb.append(getBuffer()); log.debug("Buffer Size: " + getBufferSize()); } return sb.toString(); } /** * serialize the RTSP response message into a byte buffer. */ public IoBuffer toByteBuffer() throws Exception { try { String msg = this.toString(); IoBuffer buffer = IoBuffer.wrap(msg.getBytes("UTF-8")); return buffer; } catch (Exception e) { log.error("failed to serialize message to byte buffer", e); throw e; } } /** * Construct a new RTSPResponse error message. * * @param errorCode * the RTSP error code to be sent * @return a RTSP response message */ public static RTSPResponse errorResponse(RTSPCode errorCode) { RTSPResponse response = new RTSPResponse(); response.setCode(errorCode); return response; } } red5-1.0~svn4374.orig-plugins/rtspplugin/src/org/red5/server/net/rtsp/RTSPTransport.java0000644000175000017500000003043011272347163031060 0ustar drazzibdrazzibpackage org.red5.server.net.rtsp; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * Copyright (C) 2005 - Matteo Merli - matteo.merli@gmail.com * * * ***************************************************************************/ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Parse the RTSP Transport header field. Reference Grammar: * *
 *         Transport           =    "Transport" ":"
 *                                  1\#transport-spec
 *         transport-spec      =    transport-protocol/profile[/lower-transport]
 *                                  *parameter
 *         transport-protocol  =    "RTP"
 *         profile             =    "AVP"
 *         lower-transport     =    "TCP" | "UDP"
 *         parameter           =    ( "unicast" | "multicast" )
 *                             |    ";" "destination" [ "=" address ]
 *                             |    ";" "interleaved" "=" channel [ "-" channel ]
 *                             |    ";" "append"
 *                             |    ";" "ttl" "=" ttl
 *                             |    ";" "layers" "=" 1*DIGIT
 *                             |    ";" "port" "=" port [ "-" port ]
 *                             |    ";" "client_port" "=" port [ "-" port ]
 *                             |    ";" "server_port" "=" port [ "-" port ]
 *                             |    ";" "ssrc" "=" ssrc
 *                             |    ";" "mode" = <"> 1\#mode <">
 *         ttl                 =    1*3(DIGIT)
 *         port                =    1*5(DIGIT)
 *         ssrc                =    8*8(HEX)
 *         channel             =    1*3(DIGIT)
 *         address             =    host
 *         mode                =    <"> *Method <"> | Method
 *      
 *      
 *         Example:
 *           Transport: RTP/AVP;multicast;ttl=127;mode="PLAY",
 *                      RTP/AVP;unicast;client_port=3456-3457;mode="PLAY"
 * 
* * @author Matteo Merli (matteo.merli@gmail.com) */ public class RTSPTransport { private static Logger log = LoggerFactory.getLogger(RTSPTransport.class); public enum TransportProtocol { None, RTP, RDT, RAW } public enum Profile { None, AVP } public enum LowerTransport { None, TCP, UDP } public enum DeliveryType { None, unicast, multicast } TransportProtocol transportProtocol; Profile profile; LowerTransport lowerTransport; DeliveryType deliveryType; String destination; String interleaved; int layers; boolean append; int ttl; int[] port = new int[2]; int[] client_port = new int[2]; int[] server_port = new int[2]; String ssrc; String mode; String source; /** * Constructor. Creates a RTSPTransport object from a transport header * string. */ public RTSPTransport(String transport) { transportProtocol = TransportProtocol.None; profile = Profile.None; lowerTransport = LowerTransport.None; deliveryType = DeliveryType.None; destination = null; interleaved = null; layers = 0; append = false; ttl = 0; port[0] = 0; port[1] = 0; client_port[0] = 0; client_port[1] = 0; server_port[0] = 0; server_port[1] = 0; ssrc = null; mode = null; source = null; parseTransport(transport); if (transport.compareToIgnoreCase(this.toString()) != 0) { log.warn("Transport header incorrectly parsed."); } } private void parseTransport(String transport) { for (String tok : transport.split(";")) { // First check for the transport protocol if (tok.startsWith("RTP") || tok.startsWith("RDT")) { String[] tpl = tok.split("/"); transportProtocol = TransportProtocol.valueOf(tpl[0]); if (tpl.length > 1) profile = Profile.valueOf(tpl[1]); if (tpl.length > 2) lowerTransport = LowerTransport.valueOf(tpl[2]); continue; } if (tok.compareToIgnoreCase("unicast") == 0) deliveryType = DeliveryType.unicast; else if (tok.compareToIgnoreCase("multicast") == 0) deliveryType = DeliveryType.multicast; else if (tok.startsWith("destination")) setDestination(_getStrValue(tok)); else if (tok.startsWith("interleaved")) setInterleaved(_getStrValue(tok)); else if (tok.startsWith("append")) setAppend(true); else if (tok.startsWith("layers")) setLayers(Integer.valueOf(_getStrValue(tok))); else if (tok.startsWith("ttl")) setTTL(Integer.valueOf(_getStrValue(tok))); else if (tok.startsWith("port")) setPort(_getPairValue(tok)); else if (tok.startsWith("client_port")) setClientPort(_getPairValue(tok)); else if (tok.startsWith("server_port")) setServerPort(_getPairValue(tok)); else if (tok.startsWith("ssrc")) setSSRC(_getStrValue(tok)); else if (tok.startsWith("mode")) setMode(_getStrValue(tok)); else if (tok.startsWith("source")) setSource(_getStrValue(tok)); } } public String toString() { StringBuilder sb = new StringBuilder(); sb.append(transportProtocol); if (profile != Profile.None) { sb.append("/").append(profile); if (lowerTransport != LowerTransport.None) sb.append("/").append(lowerTransport); } if (deliveryType != DeliveryType.None) sb.append(";").append(deliveryType); if (destination != null) sb.append(";destination=").append(destination); if (interleaved != null) sb.append(";interleaved=").append(interleaved); if (append) sb.append(";append"); if (layers > 0) sb.append(";layers=").append(layers); if (ttl > 0) sb.append(";ttl=").append(ttl); if (port[0] > 0) sb.append(";port=").append(port[0]).append("-").append(port[1]); if (client_port[0] > 0) sb.append(";client_port=").append(client_port[0]).append("-") .append(client_port[1]); if (server_port[0] > 0) sb.append(";server_port=").append(server_port[0]).append("-") .append(server_port[1]); if (ssrc != null) sb.append(";ssrc=").append(ssrc); if (source != null) sb.append(";source=").append(source); if (mode != null) sb.append(";mode=").append(mode); return sb.toString(); } /** * @return Returns the append. */ public boolean isAppend() { return append; } /** * @param append * The append to set. */ public void setAppend(boolean append) { this.append = append; } /** * @return Returns the client_port. */ public int[] getClientPort() { return client_port; } /** * @param client_port * The client_port to set. */ public void setClientPort(int[] client_port) { this.client_port = client_port; } /** * @return Returns the deliveryType. */ public DeliveryType getDeliveryType() { return deliveryType; } /** * @param deliveryType * The deliveryType to set. */ public void setDeliveryType(DeliveryType deliveryType) { this.deliveryType = deliveryType; } /** * @return Returns the destination. */ public String getDestination() { return destination; } /** * @param destination * The destination to set. */ public void setDestination(String destination) { this.destination = destination; } /** * @return Returns the interleaved. */ public String getInterleaved() { return interleaved; } /** * @param interleaved * The interleaved to set. */ public void setInterleaved(String interleaved) { this.interleaved = interleaved; } /** * @return Returns the layers. */ public int getLayers() { return layers; } /** * @param layers * The layers to set. */ public void setLayers(int layers) { this.layers = layers; } /** * @return Returns the lowerTransport. */ public LowerTransport getLowerTransport() { return lowerTransport; } /** * @param lowerTransport * The lowerTransport to set. */ public void setLowerTransport(LowerTransport lowerTransport) { this.lowerTransport = lowerTransport; } /** * @return Returns the mode. */ public String getMode() { return mode; } /** * @param mode * The mode to set. */ public void setMode(String mode) { this.mode = mode; } /** * @return Returns the port. */ public int[] getPort() { return port; } /** * @param port * The port to set. */ public void setPort(int[] port) { this.port = port; } /** * @return Returns the profile. */ public Profile getProfile() { return profile; } /** * @param profile * The profile to set. */ public void setProfile(Profile profile) { this.profile = profile; } /** * @return Returns the server_port. */ public int[] getServerPort() { return server_port; } /** * @param server_port * The server_port to set. */ public void setServerPort(int[] server_port) { this.server_port = server_port; } /** * @return Returns the ssrc. */ public String getSSRC() { return ssrc; } /** * @param ssrc * The ssrc to set. */ public void setSSRC(String ssrc) { this.ssrc = ssrc; } /** * @param ssrc * The ssrc to set. */ public void setSSRC(long ssrc) { this.ssrc = Long.toHexString(ssrc & 0xFFFFFFFFL).toUpperCase(); } /** * @return Returns the transportProtocol. */ public TransportProtocol getTransportProtocol() { return transportProtocol; } /** * @param transportProtocol * The transportProtocol to set. */ public void setTransportProtocol(TransportProtocol transportProtocol) { this.transportProtocol = transportProtocol; } /** * @return Returns the ttl. */ public int getTTL() { return ttl; } /** * @param ttl * The ttl to set. */ public void setTTL(int ttl) { this.ttl = ttl; } public void setSource(String source) { this.source = source; } public String getSource() { return source; } /** * Get the value part in a string like: * *
	 * key = value
	 * 
* * @param str * the content string * @return a String containing only the value */ private static String _getStrValue(String str) { String[] list = str.split("="); if (list.length != 2) return null; return list[1]; } /** * Get the value part in a string like: * *
	 * key = 6344 - 6345
	 * 
* * @param str * the content string * @return a int[2] containing only the value */ private static int[] _getPairValue(String str) { int[] pair = { 0, 0 }; String[] list = str.split("="); if (list.length != 2) return pair; try { pair[0] = Integer.parseInt(list[1].split("-")[0]); pair[1] = Integer.parseInt(list[1].split("-")[1]); // log.debug("Client ports: " + 1); // Integers.parse(); } catch (Exception e) { return pair; } return pair; } } red5-1.0~svn4374.orig-plugins/rtspplugin/src/org/red5/server/net/rtsp/messages/0000755000175000017500000000000011760512620027311 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/rtspplugin/src/org/red5/server/net/rtsp/messages/RTSPMessage.java0000644000175000017500000001346111272347163032264 0ustar drazzibdrazzibpackage org.red5.server.net.rtsp.messages; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * Copyright (C) 2005 - Matteo Merli - matteo.merli@gmail.com * * * ***************************************************************************/ import java.nio.CharBuffer; import java.util.Properties; import org.red5.server.api.Red5; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Base abstract class for RTSP messages. * * @author Matteo Merli (matteo.merli@gmail.com) */ public abstract class RTSPMessage { /** * RTSP Message Type */ public enum Type { /** Generic message (internal use) */ TypeNone, /** Request message */ TypeRequest, /** Response message */ TypeResponse }; private static Logger log = LoggerFactory.getLogger(RTSPMessage.class); // CRLF public static final String CRLF = "\r\n"; private int sequenceNumber; private Properties headers; private StringBuffer buffer; private final static String serverSignature; static { serverSignature = Red5.getVersion().split("[$]")[0] + " (" + System.getProperty("os.name") + " / " + System.getProperty("os.version") + " / " + System.getProperty("os.arch") + ")"; log.debug("RTSP signature set to: {}", serverSignature); } /** * Constructor. */ public RTSPMessage() { sequenceNumber = 0; headers = new Properties(); buffer = new StringBuffer(); } /** * @return the RTSP type of the message */ public Type getType() { return Type.TypeNone; } /** * Adds a new header to the RTSP message. * * @param key * The name of the header * @param value * Its value */ public void setHeader(String key, String value) { // Handle some bad formatted headers if (key.compareToIgnoreCase("content-length") == 0) { headers.setProperty("Content-Length", value); } else { headers.setProperty(key, value); } } /** * @param key * Header name * @return the value of the header */ public String getHeader(String key) { return headers.getProperty(key); } /** * * @param key * Header name * @param defaultValue * the default value * @return the value of the header of defaultValue if header is not * found */ public String getHeader(String key, String defaultValue) { String value = getHeader(key); if (value == null) return defaultValue; else return value; } /** * Remove an header from the message headers collection * * @param key * the name of the header */ public void removeHeader(String key) { headers.remove(key); } /** * Formats all the headers into a string ready to be sent in a RTSP message. * *
	 * Header1: Value1
	 * Header2: value 2
	 * ... 
	 * 
* * @return a string containing the serialized headers */ public String getHeadersString() { StringBuilder buf = new StringBuilder(); for (Object key : headers.keySet()) { String value = headers.getProperty((String) key); buf.append(key + ": " + value + CRLF); } return buf.toString(); } /** * * @return the number of headers owned by the message */ public int getHeadersCount() { return headers.size(); } /** * Sets common headers like Server and Via. */ public void setCommonHeaders() { if (getHeader("Server") != null) { setHeader("Via", serverSignature); } else { setHeader("Server", serverSignature); } } /** * * @param buffer * StringBuffer containing the contents */ public void setBuffer(StringBuffer buffer) { this.buffer = buffer; } /** * @param other * buffer with content to be appended */ public void appendToBuffer(StringBuffer other) { this.buffer.append(other); } /** * @param other * buffer with content to be appended */ public void appendToBuffer(CharBuffer other) { this.buffer.append(other); } /** * @return the content buffer */ public StringBuffer getBuffer() { return buffer; } /** * @return the size of the content buffer */ public int getBufferSize() { return buffer.length(); } /** * @return Returns the sequenceNumber. */ public int getSequenceNumber() { return sequenceNumber; } /** * @param sequenceNumber * The sequenceNumber to set. */ public void setSequenceNumber(int sequenceNumber) { this.sequenceNumber = sequenceNumber; } } red5-1.0~svn4374.orig-plugins/rtspplugin/src/org/red5/server/net/rtsp/RTSPRequest.java0000644000175000017500000000645611272347163030527 0ustar drazzibdrazzibpackage org.red5.server.net.rtsp; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * Copyright (C) 2005 - Matteo Merli - matteo.merli@gmail.com * * * ***************************************************************************/ import java.net.URL; import org.red5.server.net.rtsp.messages.RTSPMessage; /** * @author Matteo Merli (matteo.merli@gmail.com) */ public class RTSPRequest extends RTSPMessage { public enum Verb { None, ANNOUNCE, DESCRIBE, GET_PARAMETER, OPTIONS, PAUSE, PLAY, RECORD, REDIRECT, SETUP, SET_PARAMETER, TEARDOWN }; private Verb verb; private URL url; /** * */ public RTSPRequest() { super(); verb = Verb.None; } public Type getType() { return Type.TypeRequest; } public String getVerbString() { return verb.toString(); } public void setVerb(Verb verb) { this.verb = verb; } public Verb getVerb() { return verb; } /** * Sets the verb of the request from a string. * * @param strVerb * String containing the the verb */ public void setVerb(String strVerb) { try { this.verb = Verb.valueOf(strVerb); } catch (Exception e) { this.verb = Verb.None; // System.out.println( "Invalid verb: " + strVerb ); } } public void setUrl(URL url) { this.url = url; } public URL getUrl() { return url; } /** * Return a serialized version of the RTSP request message that will be sent * over the network. The message is in the form: * *
	 * [verb] SP [url] SP "RTSP/1.0" CRLF
	 * [headers] CRLF
	 * CRLF 
	 * [buffer]
	 * 
*/ public String toString() { StringBuilder sb = new StringBuilder(); sb.append(getVerbString() + " "); sb.append(url != null ? url : "*"); sb.append(" RTSP/1.0\r\n"); sb.append(getHeadersString()); // Insert a blank line sb.append(CRLF); if (getBufferSize() > 0) { sb.append(getBuffer()); } return sb.toString(); } } red5-1.0~svn4374.orig-plugins/rtspplugin/src/org/red5/server/net/rtsp/Track.java0000644000175000017500000000271511272347163027424 0ustar drazzibdrazzibpackage org.red5.server.net.rtsp; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** * * @author Matteo Merli (matteo.merli@gmail.com) */ public class Track { private String control; // private DataTunnel dataTunnel; /** * @return Returns the control. */ public String getControl() { return control; } /** * @param control * The control to set. */ public void setControl(String control) { this.control = control; } /* * public void setDataTunnel( DataTunnel dataTunnel ) { this.dataTunnel = * dataTunnel; } * * public DataTunnel getDataTunnel() { return dataTunnel; } */ } red5-1.0~svn4374.orig-plugins/rtspplugin/src/org/red5/server/net/rtsp/RTSPTransportList.java0000644000175000017500000000522711272347163031722 0ustar drazzibdrazzibpackage org.red5.server.net.rtsp; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * Copyright (C) 2005 - Matteo Merli - matteo.merli@gmail.com * * * ***************************************************************************/ import java.util.ArrayList; import java.util.List; /** * Represent a list of transport headers. * * @author Matteo Merli (matteo.merli@gmail.com) */ public class RTSPTransportList { private List transportList; /** * Constructor. Creates a list of transport type. */ public RTSPTransportList(String transportHeader) { transportList = new ArrayList(); for (String transport : transportHeader.split(",")) { transportList.add(new RTSPTransport(transport)); } } public List getList() { return transportList; } public RTSPTransport get(int index) { return transportList.get(index); } /** * @return The number of transports defined. */ public int count() { return transportList.size(); } public String toString() { StringBuilder buf = new StringBuilder(); int i = 0; for (RTSPTransport t : transportList) { if (i++ != 0) buf.append(","); buf.append(t.toString()); } return buf.toString(); } } red5-1.0~svn4374.orig-plugins/rtspplugin/src/org/red5/server/net/rtsp/filter/0000755000175000017500000000000011760512620026767 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/rtspplugin/src/org/red5/server/net/rtsp/filter/RTSPFilters.java0000644000175000017500000001104711272347163031764 0ustar drazzibdrazzibpackage org.red5.server.net.rtsp.filter; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * Copyright (C) 2005 - Matteo Merli - matteo.merli@gmail.com * * * ***************************************************************************/ import org.apache.mina.core.filterchain.IoFilter; import org.apache.mina.core.filterchain.IoFilterChain; import org.apache.mina.core.filterchain.IoFilterChainBuilder; import org.apache.mina.core.session.IoSession; import org.apache.mina.filter.codec.ProtocolCodecFactory; import org.apache.mina.filter.codec.ProtocolCodecFilter; import org.apache.mina.filter.codec.ProtocolDecoder; import org.apache.mina.filter.codec.ProtocolEncoder; import org.red5.server.net.rtsp.codec.RTSPDecoder; import org.red5.server.net.rtsp.codec.RTSPEncoder; import org.red5.server.net.rtsp.filter.ipaddress.IpAddressFilter; import org.red5.server.net.rtsp.filter.rewrite.RequestUrlRewritingImpl; /** * Base class for filter chains based on configuration settings. * * @author Matteo Merli (matteo.merli@gmail.com) */ public abstract class RTSPFilters implements IoFilterChainBuilder { private static ProtocolCodecFactory codecFactory = new ProtocolCodecFactory() { // Decoders can be shared private ProtocolEncoder rtspEncoder = new RTSPEncoder(); private ProtocolDecoder rtspDecoder = new RTSPDecoder(); public ProtocolEncoder getEncoder(IoSession session) { return rtspEncoder; } public ProtocolDecoder getDecoder(IoSession session) { return rtspDecoder; } }; private static IoFilter codecFilter = new ProtocolCodecFilter(codecFactory); // These filters are instanciated only one time, when requested private static IpAddressFilter ipAddressFilter = null; private boolean enableIpAddressFilter = false; private String rewritingFilterClassName = null; /** * IP Address filter. *

* This needs to be the first filter in the chain to block blacklisted host * in the early stage of the connection, preventing network and computation * load from unwanted hosts. */ protected void addIpAddressFilter(IoFilterChain chain) { if (enableIpAddressFilter) { if (ipAddressFilter == null) { ipAddressFilter = new IpAddressFilter(); } chain.addLast("ipAddressFilter", ipAddressFilter); } } /** * The RTSP codec filter is always present. Translates the incoming streams * into RTSP messages. */ protected void addRTSPCodecFilter(IoFilterChain chain) { chain.addLast("codec", codecFilter); } protected void addRewriteFilter(IoFilterChain chain) { try { if (rewritingFilterClassName != null) { chain.addLast("requestUrlRewriting", new RequestUrlRewritingImpl(rewritingFilterClassName)); } } catch (Exception e) { } } public boolean isEnableIpAddressFilter() { return enableIpAddressFilter; } public void setEnableIpAddressFilter(boolean enableIpAddressFilter) { this.enableIpAddressFilter = enableIpAddressFilter; } public String getRewritingFilterClassName() { return rewritingFilterClassName; } public void setRewritingFilterClassName(String rewritingFilterClassName) { this.rewritingFilterClassName = rewritingFilterClassName; } } red5-1.0~svn4374.orig-plugins/rtspplugin/src/org/red5/server/net/rtsp/filter/RTSPServerFilters.java0000644000175000017500000000411711272347163033153 0ustar drazzibdrazzibpackage org.red5.server.net.rtsp.filter; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * Copyright (C) 2005 - Matteo Merli - matteo.merli@gmail.com * * * ***************************************************************************/ import org.apache.mina.core.filterchain.IoFilterChain; /** * Builds the filter chain used when connecting to a RTSP server. * * @author Matteo Merli (matteo.merli@gmail.com) */ public class RTSPServerFilters extends RTSPFilters { public void buildFilterChain(IoFilterChain chain) throws Exception { // When connecting to the server we don't need to use AAA filters addRTSPCodecFilter(chain); } } red5-1.0~svn4374.orig-plugins/rtspplugin/src/org/red5/server/net/rtsp/filter/rewrite/0000755000175000017500000000000011760512620030450 5ustar drazzibdrazzib././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootred5-1.0~svn4374.orig-plugins/rtspplugin/src/org/red5/server/net/rtsp/filter/rewrite/RequestUrlRewritingImpl.javared5-1.0~svn4374.orig-plugins/rtspplugin/src/org/red5/server/net/rtsp/filter/rewrite/RequestUrlRewri0000644000175000017500000001135511272347163033532 0ustar drazzibdrazzibpackage org.red5.server.net.rtsp.filter.rewrite; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * Copyright (C) 2005 - Matteo Merli - matteo.merli@gmail.com * * * ***************************************************************************/ import java.net.MalformedURLException; import java.net.URL; import org.apache.mina.core.filterchain.IoFilterAdapter; import org.apache.mina.core.session.IoSession; import org.red5.server.net.rtsp.RTSPRequest; import org.red5.server.net.rtsp.RTSPResponse; import org.red5.server.net.rtsp.messages.RTSPMessage; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * @author bieniekr */ public class RequestUrlRewritingImpl extends IoFilterAdapter { /** * Logger for this class */ private static final Logger logger = LoggerFactory.getLogger(RequestUrlRewritingImpl.class); // the filter instance private RequestUrlRewritingFilter filter; /** * construct the IoFilter around the filter class denoted by the clazz name * parameter. * * TODO: This may become obsolete if moving to OSGi bundles TODO: Make * filter parametrizeable. Could be done by moving from properties to XML * config file. */ public RequestUrlRewritingImpl(String clazzName) throws Exception { try { Class filterClazz = Class.forName(clazzName); this.filter = (RequestUrlRewritingFilter) filterClazz.newInstance(); logger.info("using request URL rewriter " + clazzName); } catch (Exception e) { logger.error("", e); throw e; } } /* * (non-Javadoc) * * @see org.apache.mina.common.IoFilterAdapter#messageReceived(org.apache.mina.common.IoFilter.NextFilter, * org.apache.mina.common.IoSession, java.lang.Object) */ @Override public void messageReceived(NextFilter nextFilter, IoSession session, Object message) throws Exception { RTSPMessage rtspMessage = (RTSPMessage) message; logger.debug("Received (pre-rewriting) message:\n" + message); if (rtspMessage.getType() == RTSPMessage.Type.TypeRequest) { RTSPRequest request = (RTSPRequest) rtspMessage; URL rewritten = this.filter.rewriteRequestUrl(request.getUrl()); if (rewritten != null) { logger.debug("changed request URL from '" + request.getUrl() + "' to '" + rewritten + "'"); request.setUrl(rewritten); } } else if (rtspMessage.getType() == RTSPMessage.Type.TypeResponse) { RTSPResponse resp = (RTSPResponse) rtspMessage; switch (resp.getRequestVerb()) { case DESCRIBE: rewriteUrlHeader("Content-base", resp); break; case PLAY: // rewriteUrlHeader("RTP-Info", resp); break; } } logger.debug("Sent (post-rewriting) message:\n" + message); nextFilter.messageReceived(session, message); } /** * rewrite a header */ private void rewriteUrlHeader(String headerName, RTSPResponse resp) { String oldHeader = resp.getHeader(headerName); if (oldHeader != null) { logger.debug("old content " + headerName + " header value: " + oldHeader); try { URL header = this.filter.rewriteResponseHeaderUrl(new URL( oldHeader)); if (header != null) { logger.debug("changed header " + headerName + " to " + header); resp.setHeader(headerName, header.toString()); } } catch (MalformedURLException mue) { logger.error("failed to parse " + headerName + " header", mue); } } } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootred5-1.0~svn4374.orig-plugins/rtspplugin/src/org/red5/server/net/rtsp/filter/rewrite/RequestUrlRewritingFilter.javared5-1.0~svn4374.orig-plugins/rtspplugin/src/org/red5/server/net/rtsp/filter/rewrite/RequestUrlRewri0000644000175000017500000000432311272347163033527 0ustar drazzibdrazzibpackage org.red5.server.net.rtsp.filter.rewrite; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * Copyright (C) 2005 - Matteo Merli - matteo.merli@gmail.com * * * ***************************************************************************/ import java.net.URL; /** * This filter is used to rewrite the requested URL before passing it * to the upstream server. * * @author Rainer Bieniek */ public interface RequestUrlRewritingFilter { /** * rewrite the request URL. * @return a replacement URL or null if the URL is not to be modified. */ public URL rewriteRequestUrl(URL request); /** * rewrite an URL in a response header. * @return a replacement URL or null if the URL is not to be modified. */ public URL rewriteResponseHeaderUrl(URL request); } red5-1.0~svn4374.orig-plugins/rtspplugin/src/org/red5/server/net/rtsp/filter/RTSPClientFilters.java0000644000175000017500000000404711272347163033125 0ustar drazzibdrazzibpackage org.red5.server.net.rtsp.filter; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * Copyright (C) 2005 - Matteo Merli - matteo.merli@gmail.com * * * ***************************************************************************/ import org.apache.mina.core.filterchain.IoFilterChain; /** * Builds the filter chain used for connection from RTSP client. * * @author Matteo Merli (matteo.merli@gmail.com) */ public class RTSPClientFilters extends RTSPFilters { public void buildFilterChain(IoFilterChain chain) throws Exception { addIpAddressFilter(chain); addRTSPCodecFilter(chain); } } red5-1.0~svn4374.orig-plugins/rtspplugin/src/org/red5/server/net/rtsp/filter/ipaddress/0000755000175000017500000000000011760512620030745 5ustar drazzibdrazzib././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootred5-1.0~svn4374.orig-plugins/rtspplugin/src/org/red5/server/net/rtsp/filter/ipaddress/PlainTextIpAddressProvider.javared5-1.0~svn4374.orig-plugins/rtspplugin/src/org/red5/server/net/rtsp/filter/ipaddress/PlainTextIpAd0000644000175000017500000001233611272347163033351 0ustar drazzibdrazzibpackage org.red5.server.net.rtsp.filter.ipaddress; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * Copyright (C) 2005 - Matteo Merli - matteo.merli@gmail.com * * * ***************************************************************************/ import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.io.Reader; import java.net.InetAddress; import java.util.LinkedList; import java.util.List; import java.util.regex.Pattern; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Implementation of the IpAddressFilter that is based on plain * text file containing instruction on "allowed" and "denied" * addresses and hosts. * * @author Matteo Merli (matteo.merli@gmail.com) */ public class PlainTextIpAddressProvider implements IpAddressProvider { private static Logger log = LoggerFactory.getLogger(PlainTextIpAddressProvider.class); private enum RuleType { Allow, Deny }; private static class Rule { public RuleType type; public Pattern pattern; } private String configFile = "conf/ipfilter.txt"; private static List rules = new LinkedList(); /* (non-Javadoc) * @see rtspproxy.auth.IpAddressProvider#init() */ public void init() throws Exception { // Load rules from file loadRules(new FileReader(new File(configFile))); } /* (non-Javadoc) * @see rtspproxy.auth.IpAddressProvider#shutdown() */ public void shutdown() throws Exception { rules.clear(); } /* (non-Javadoc) * @see rtspproxy.auth.IpAddressProvider#isBlocked(java.net.InetAddress) */ public boolean isBlocked(InetAddress address) { boolean blocked = true; // by default the address is blocked String[] hostip = address.toString().split("/"); String host = hostip[0]; String ip = hostip[1]; for (Rule rule : rules) { if (blocked && rule.type == RuleType.Deny) // Don't need to check, up to now this IP is already // blocked continue; if (rule.pattern.matcher(ip).matches() || rule.pattern.matcher(host).matches()) // the address matches the pattern // check if it's allow or deny blocked = (rule.type == RuleType.Allow) ? false : true; } return blocked; } /** * Reads the rules from a file * @param reader Reader of a file containing the access rules * @throws IOException */ protected void loadRules(Reader reader) throws IOException { BufferedReader in = new BufferedReader(reader); String line; int lineNumber = 0; try { while ((line = in.readLine()) != null) { line = line.replaceAll("\t", " "); // replace tabs line = line.trim(); ++lineNumber; if (line.length() == 0) continue; // Ignore empty lines if (line.startsWith("#")) continue; // Ignore comments RuleType ruleType = null; if (line.startsWith("Allow")) ruleType = RuleType.Allow; else if (line.startsWith("Deny")) ruleType = RuleType.Deny; else throw new IOException("Invalid filter pattern (line " + lineNumber + ")"); // read the pattern String[] patternSplit = line.split(" ", 2); if (patternSplit.length != 2) throw new IOException("Invalid filter pattern (line " + lineNumber + ")"); String pattern = patternSplit[1]; log.debug("Rule: {} {}", ruleType, pattern); // Transform the patterns escaping "." and "*" characters pattern = pattern.replaceAll("\\.", "\\\\."); pattern = pattern.replaceAll("\\*", ".*"); Rule rule = new Rule(); rule.type = ruleType; rule.pattern = Pattern.compile(pattern); rules.add(rule); } } catch (IOException e) { log.error("Error reading IpAddressFilter rules: ", e); throw e; } } public String getConfigFile() { return configFile; } public void setConfigFile(String configFile) { this.configFile = configFile; } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootred5-1.0~svn4374.orig-plugins/rtspplugin/src/org/red5/server/net/rtsp/filter/ipaddress/IpAddressFilter.javared5-1.0~svn4374.orig-plugins/rtspplugin/src/org/red5/server/net/rtsp/filter/ipaddress/IpAddressFilt0000644000175000017500000001000311272347163033365 0ustar drazzibdrazzibpackage org.red5.server.net.rtsp.filter.ipaddress; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * Copyright (C) 2005 - Matteo Merli - matteo.merli@gmail.com * * * ***************************************************************************/ import java.net.InetSocketAddress; import org.apache.mina.core.filterchain.IoFilterAdapter; import org.apache.mina.core.session.IoSession; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * @author Matteo Merli (matteo.merli@gmail.com) */ public class IpAddressFilter extends IoFilterAdapter { private static Logger log = LoggerFactory.getLogger(IpAddressFilter.class); private IpAddressProvider provider; private String filterClassName = "org.red5.server.net.rtsp.filter.ipaddress.PlainTextIpAddressProvider"; public void init() { Class providerClass; try { providerClass = Class.forName(filterClassName); } catch (ClassNotFoundException e) { log.error("Invalid IpAddressProvider class: {}", filterClassName); return; } // Check if the class implements the IpAddressProvider interfaces boolean found = false; for (Class interFace : providerClass.getInterfaces()) { if (IpAddressProvider.class.equals(interFace)) { found = true; break; } } if (!found) { log.error("Class ({}) does not implement the IpAddressProvider interface.", provider); return; } try { provider = (IpAddressProvider) providerClass.newInstance(); provider.init(); } catch (Exception e) { log.error("Error starting IpAddressProvider", e); return; } log.info("Using IpAddressFilter ({})", filterClassName); } @Override public void messageReceived(NextFilter nextFilter, IoSession session, Object message) throws Exception { if (!provider .isBlocked(((InetSocketAddress) session.getRemoteAddress()) .getAddress())) { // forward if not blocked nextFilter.messageReceived(session, message); } else { blockSession(session); } } @Override public void sessionCreated(NextFilter nextFilter, IoSession session) throws Exception { if (!provider .isBlocked(((InetSocketAddress) session.getRemoteAddress()) .getAddress())) { // forward if not blocked nextFilter.sessionCreated(session); } else { blockSession(session); } } protected void blockSession(IoSession session) { log.info("Blocked connection from : " + session.getRemoteAddress()); session.close(true); } public String getFilterClassName() { return filterClassName; } public void setFilterClassName(String filterClassName) { this.filterClassName = filterClassName; } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootred5-1.0~svn4374.orig-plugins/rtspplugin/src/org/red5/server/net/rtsp/filter/ipaddress/IpAddressProvider.javared5-1.0~svn4374.orig-plugins/rtspplugin/src/org/red5/server/net/rtsp/filter/ipaddress/IpAddressProv0000644000175000017500000000370111272347163033424 0ustar drazzibdrazzibpackage org.red5.server.net.rtsp.filter.ipaddress; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * Copyright (C) 2005 - Matteo Merli - matteo.merli@gmail.com * * * ***************************************************************************/ import java.net.InetAddress; /** * @author Matteo Merli (matteo.merli@gmail.com) */ public interface IpAddressProvider { public void init() throws Exception; public void shutdown() throws Exception; public boolean isBlocked(InetAddress address); } red5-1.0~svn4374.orig-plugins/rtspplugin/src/org/red5/server/net/rtsp/codec/0000755000175000017500000000000011760512620026557 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/rtspplugin/src/org/red5/server/net/rtsp/codec/RTSPEncoder.java0000644000175000017500000000611711272347163031525 0ustar drazzibdrazzibpackage org.red5.server.net.rtsp.codec; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * Copyright (C) 2005 - Matteo Merli - matteo.merli@gmail.com * * * ***************************************************************************/ import org.apache.mina.core.buffer.IoBuffer; import org.apache.mina.core.session.IoSession; import org.apache.mina.filter.codec.ProtocolEncoder; import org.apache.mina.filter.codec.ProtocolEncoderException; import org.apache.mina.filter.codec.ProtocolEncoderOutput; import org.red5.server.net.rtsp.messages.RTSPMessage; /** * Encode a RTSP message into a buffer for sending. * * @author Matteo Merli (matteo.merli@gmail.com) */ public class RTSPEncoder implements ProtocolEncoder { /* * (non-Javadoc) * * @see org.apache.mina.protocol.ProtocolEncoder#encode(org.apache.mina.protocol.ProtocolSession, * java.lang.Object, org.apache.mina.protocol.ProtocolEncoderOutput) */ public void encode(IoSession session, Object message, ProtocolEncoderOutput out) throws ProtocolEncoderException { // Serialization to string is already provided in RTSP messages. String val = ((RTSPMessage) message).toString(); /* IoBuffer buf = IoBuffer.allocate( val.length() ); for ( int i = 0; i < val.length(); i++ ) { buf.put( (byte) val.charAt( i ) ); } buf.flip(); */ // TODO: Alternative implementation, should be better. IoBuffer buf = IoBuffer.wrap(val.getBytes()); out.write(buf); } /* (non-Javadoc) * @see org.apache.mina.filter.codec.ProtocolEncoder#dispose(org.apache.mina.common.IoSession) */ public void dispose(IoSession arg0) throws Exception { // Don't need to do nothing } } red5-1.0~svn4374.orig-plugins/rtspplugin/src/org/red5/server/net/rtsp/codec/RTSPDecoder.java0000644000175000017500000002055711272347163031517 0ustar drazzibdrazzibpackage org.red5.server.net.rtsp.codec; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * Copyright (C) 2005 - Matteo Merli - matteo.merli@gmail.com * * * ***************************************************************************/ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; import java.net.URL; import java.nio.CharBuffer; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.mina.core.buffer.IoBuffer; import org.apache.mina.core.session.IoSession; import org.apache.mina.filter.codec.ProtocolDecoder; import org.apache.mina.filter.codec.ProtocolDecoderException; import org.apache.mina.filter.codec.ProtocolDecoderOutput; import org.red5.server.net.rtsp.RTSPCode; import org.red5.server.net.rtsp.RTSPRequest; import org.red5.server.net.rtsp.RTSPResponse; import org.red5.server.net.rtsp.messages.RTSPMessage; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * @author Matteo Merli (matteo.merli@gmail.com) */ public class RTSPDecoder implements ProtocolDecoder { /** * State enumerator that indicates the reached state in the RTSP message * decoding process. */ public enum ReadState { /** Unrecoverable error occurred */ Failed, /** Trying to resync */ Sync, /** Waiting for a command */ Ready, /** Reading interleaved packet */ Packet, /** Reading command (request or command line) */ Command, /** Reading headers */ Header, /** Reading body (entity) */ Body, /** Fully formed message */ Dispatch } private static Logger log = LoggerFactory.getLogger(RTSPDecoder.class); private static final Pattern rtspRequestPattern = Pattern .compile("([A-Z_]+) ([^ ]+) RTSP/1.0"); private static final Pattern rtspResponsePattern = Pattern .compile("RTSP/1.0 ([0-9]+) .+"); private static final Pattern rtspHeaderPattern = Pattern .compile("([a-zA-Z\\-]+[0-9]?):\\s?(.*)"); /** * Do the parsing on the incoming stream. If the stream does not contain the * entire RTSP message wait for other data to arrive, before dispatching the * message. * */ public void decode(IoSession session, IoBuffer buffer, ProtocolDecoderOutput out) throws ProtocolDecoderException { BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(buffer .asInputStream(), "US-ASCII")); } catch (UnsupportedEncodingException e1) { } // Retrieve status from session ReadState state = (ReadState) session.getAttribute("state"); if (state == null) state = ReadState.Command; RTSPMessage rtspMessage = (RTSPMessage) session .getAttribute("rtspMessage"); try { while (true) { if (state != ReadState.Command && state != ReadState.Header) // the "while" loop is only used to read commands and // headers break; String line = reader.readLine(); if (line == null) // there's no more data in the buffer break; if (line.length() == 0) { // This is the empty line that marks the end // of the headers section state = ReadState.Body; break; } switch (state) { case Command: // log.debug( "Command line: " + line ); if (line.startsWith("RTSP")) { // this is a RTSP response Matcher m = rtspResponsePattern.matcher(line); if (!m.matches()) throw new ProtocolDecoderException( "Malformed response line: " + line); RTSPCode code = RTSPCode.fromString(m.group(1)); rtspMessage = new RTSPResponse(); ((RTSPResponse) (rtspMessage)).setCode(code); RTSPRequest.Verb verb = (RTSPRequest.Verb) session .getAttribute("lastRequestVerb"); ((RTSPResponse) (rtspMessage)).setRequestVerb(verb); } else { // this is a RTSP request Matcher m = rtspRequestPattern.matcher(line); if (!m.matches()) throw new ProtocolDecoderException( "Malformed request line: " + line); String verb = m.group(1); String strUrl = m.group(2); URL url = null; if (!strUrl.equalsIgnoreCase("*")) { try { url = new URL(strUrl); } catch (MalformedURLException e) { log.error("", e); url = null; session.setAttribute("state", ReadState.Failed); throw new ProtocolDecoderException( "Invalid URL"); } } rtspMessage = new RTSPRequest(); ((RTSPRequest) rtspMessage).setVerb(verb); if (((RTSPRequest) rtspMessage).getVerb() == RTSPRequest.Verb.None) { session.setAttribute("state", ReadState.Failed); throw new ProtocolDecoderException( "Invalid method: " + verb); } ((RTSPRequest) rtspMessage).setUrl(url); } state = ReadState.Header; break; case Header: // this is an header Matcher m = rtspHeaderPattern.matcher(line); if (!m.matches()) throw new ProtocolDecoderException( "RTSP header not valid"); rtspMessage.setHeader(m.group(1), m.group(2)); break; } } if (state == ReadState.Body) { // Read the message body int bufferLen = Integer.parseInt(rtspMessage.getHeader( "Content-Length", "0")); if (bufferLen == 0) { // there's no buffer to be read state = ReadState.Dispatch; } else { // we have a content buffer to read int bytesToRead = bufferLen - rtspMessage.getBufferSize(); // if ( bytesToRead < reader. decodeBuf.length() ) { // log.warn( "We are reading more bytes than // Content-Length." ); // } // read the content buffer CharBuffer bufferContent = CharBuffer.allocate(bytesToRead); reader.read(bufferContent); bufferContent.flip(); rtspMessage.appendToBuffer(bufferContent); if (rtspMessage.getBufferSize() >= bufferLen) { // The RTSP message parsing is completed state = ReadState.Dispatch; } } } } catch (IOException e) { /* * error on input stream should not happen since the input stream is * coming from a bytebuffer. */ log.error("", e); return; } finally { try { reader.close(); } catch (Exception e) { } } if (state == ReadState.Dispatch) { // The message is already formed // send it session.removeAttribute("state"); session.removeAttribute("rtspMessage"); out.write(rtspMessage); return; } // log.debug( "INCOMPLETE MESSAGE \n" + rtspMessage ); // Save attributes in session session.setAttribute("state", state); session.setAttribute("rtspMessage", rtspMessage); } /* * (non-Javadoc) * * @see org.apache.mina.filter.codec.ProtocolDecoder#dispose(org.apache.mina.common.IoSession) */ public void dispose(IoSession session) throws Exception { // Do nothing } /** {@inheritDoc} */ public void finishDecode(IoSession session, ProtocolDecoderOutput out) throws Exception { // TODO Auto-generated method stub } } red5-1.0~svn4374.orig-plugins/rtspplugin/src/org/red5/server/net/rtsp/Handler.java0000644000175000017500000000424211272347163027732 0ustar drazzibdrazzibpackage org.red5.server.net.rtsp; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * Copyright (C) 2005 - Matteo Merli - matteo.merli@gmail.com * * * ***************************************************************************/ import java.io.IOException; import java.net.URL; import java.net.URLConnection; import java.net.URLStreamHandler; /** * Register the "rtsp://" scheme as a valid protocol. */ public class Handler extends URLStreamHandler { public static final int DEFAULT_RTSP_PORT = 554; @Override protected URLConnection openConnection(URL url) throws IOException { return null; } /** * @return the default RTSP port */ @Override protected int getDefaultPort() { return DEFAULT_RTSP_PORT; } } red5-1.0~svn4374.orig-plugins/rtspplugin/src/org/red5/server/net/rtsp/RTSPCode.java0000644000175000017500000000762311272347163027746 0ustar drazzibdrazzibpackage org.red5.server.net.rtsp; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** * RTSP Status codes. * * @author Matteo Merli (matteo.merli@gmail.com) */ public enum RTSPCode { Continue(100), OK(200), Created(201), LowOnStorageSpace(250, "Low on Storage Space"), MultipleChoices(300, "Multiple Choices"), MovedPermanently(301, "Multiple Choices"), MovedTemporarily(302, "Moved Temporarily"), SeeOther( 303, "See Other"), NotModified(304, "Not Modified"), UseProxy(305, "Not Modified"), BadRequest(400, "Bad Request"), Unauthorized(401), PaymentRequired(402, "Payment Required"), Forbidden(403), NotFound(404, "Not Found"), MethodNotAllowed( 405, "Method Not Allowed"), NotAcceptable(406, "Not Acceptable"), ProxyAuthenticationRequired( 407, "Proxy Authentication Required"), RequestTimeOut(408, "Request Time-out"), Gone(410), LengthRequired(411, "Length Required"), PreconditionFailed(412, "Precondition Failed"), RequestEntityTooLarge( 413, "Request Entity Too Large"), RequestUriTooLarge(414, "Request-URI Too Large"), UnsupportedMediaType(415, "Unsupported Media Type"), ParameterNotUnderstood(451, "Parameter Not Understood"), ConferenceNotFound(452, "Conference Not Found"), NotEnoughBandwidth(453, "Not Enough Bandwidth"), SessionNotFound(454, "Session Not Found"), MethodNotValidInThisState( 455, "Method Not Valid in This State"), HeaderFieldNotValidForResource( 456, "Header Field Not Valid for Resource"), InvalidRange(457, "Invalid Range"), ParameterIsReadOnly(458, "Parameter Is Read-Only"), AggregateOperationNotAllowed( 459, "Aggregate operation not allowed"), OnlyAggregateOperationAllowed( 460, "Only aggregate operation allowed"), UnsupportedTransport(461, "Unsupported transport"), DestinationUnreachable(464, "Destination unreachable"), InternalServerError(500, "Internal Server Error"), NotImplemented(501, "Not Implemented"), BadGateway(502, "Bad Gateway"), ServiceUnavailable( 503, "Service Unavailable"), GatewayTimeOut(504, "Gateway Time-out"), RTSPVersionNotSupported( 505, "RTSP Version not supported"), OptionNotSupported(551, "Option not supported"); private final int value; private final String description; private RTSPCode(int value, String description) { this.value = value; this.description = description; } private RTSPCode(int value) { this.value = value; this.description = null; } /** * @return the numeric value of the RTSP code */ public int value() { return this.value; } /** * @return the human-readable description of the RTSP code */ public String description() { if (description != null) return description; else return name(); } /** * Try to translare a numeric RTSP status code to the corresponding enum * value. * * @param strCode * numeric code (as a string) * @return enum values */ public static RTSPCode fromString(String strCode) { int intCode = Integer.valueOf(strCode); for (RTSPCode code : RTSPCode.values()) { if (code.value() == intCode) return code; } return RTSPCode.BadRequest; } } red5-1.0~svn4374.orig-plugins/rtspplugin/src/org/red5/server/net/rtp/0000755000175000017500000000000011760512617025325 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/rtspplugin/src/org/red5/server/net/rtp/rtcp/0000755000175000017500000000000011760512617026275 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/rtspplugin/src/org/red5/server/net/rtp/rtcp/SDESInfo.java0000644000175000017500000000576111272347163030523 0ustar drazzibdrazzibpackage org.red5.server.net.rtp.rtcp; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * Copyright (C) 2005 - Matteo Merli - matteo.merli@gmail.com * * * ***************************************************************************/ import java.nio.ByteBuffer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * @author Matteo Merli (matteo.merli@gmail.com) */ public class SDESInfo implements RTCPInfo { static Logger log = LoggerFactory.getLogger(SDESInfo.class); public enum Type { END(0), CNAME(1), NAME(2), EMAIL(3), PHONE(4), LOC(5), TOOL(6), NOTE(7), PRIV( 8); public final byte value; public static Type fromByte(byte value) { for (Type t : Type.values()) if (t.value == value) return t; return END; } private Type(int value) { this.value = (byte) value; } } private class Chunk { @SuppressWarnings("unused") public int ssrc; public Type type; @SuppressWarnings("unused") public byte[] value; } private Chunk[] chunkList; public SDESInfo(RTCPPacket packet, ByteBuffer buffer) { // int totalBytesToRead = packet.length * 4; byte sourceCount = packet.count; chunkList = new Chunk[sourceCount]; for (byte i = 0; i < sourceCount; i++) { chunkList[i] = new Chunk(); Chunk c = chunkList[i]; c.ssrc = buffer.getInt(); c.type = Type.fromByte(buffer.get()); switch (c.type) { case PRIV: log.debug("Chunk private..."); } } } /* * (non-Javadoc) * * @see rtspproxy.rtp.rtcp.RTCPInfo#toBuffer() */ public ByteBuffer toBuffer() { return null; } } red5-1.0~svn4374.orig-plugins/rtspplugin/src/org/red5/server/net/rtp/rtcp/RTCPInfo.java0000644000175000017500000000350411272347163030526 0ustar drazzibdrazzibpackage org.red5.server.net.rtp.rtcp; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * Copyright (C) 2005 - Matteo Merli - matteo.merli@gmail.com * * * ***************************************************************************/ import java.nio.ByteBuffer; /** * Interface for all the RTCP types of packets. */ public interface RTCPInfo { public ByteBuffer toBuffer(); } red5-1.0~svn4374.orig-plugins/rtspplugin/src/org/red5/server/net/rtp/rtcp/RTCPPacket.java0000644000175000017500000001234711272347163031047 0ustar drazzibdrazzibpackage org.red5.server.net.rtp.rtcp; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * Copyright (C) 2005 - Matteo Merli - matteo.merli@gmail.com * * * ***************************************************************************/ import org.apache.mina.core.buffer.IoBuffer; import org.red5.io.object.UnsignedByte; import org.red5.io.object.UnsignedInt; import org.red5.server.net.rtp.Packet; /** * @author Matteo Merli (matteo.merli@gmail.com) */ public class RTCPPacket implements Packet { // private static Logger log = LoggerFactory.getLogger( RTCPPacket.class ); public enum Type { /** Sender Report */ SR(200), /** Receiver Report */ RR(201), /** Source description */ SDES(202), /** End of participation */ BYE(203), /** Application specific */ APP(204), NONE(0); private final UnsignedByte value; public static Type valueOf(UnsignedByte value) { for (Type t : Type.values()) if (t.value.equals(value)) return t; return NONE; } private Type(int value) { this.value = new UnsignedByte(value); } public UnsignedByte getValue() { return value; } } /** protocol version */ protected byte version; /** padding flag */ protected boolean padding; /** varies by packet type */ protected byte count; /** RTCP packet type */ protected UnsignedByte packetType; /** pkt len in words, w/o this word */ protected short length; protected UnsignedInt ssrc; // private RTCPInfo rtcpInfo; protected byte[] packetBuffer; /** * TODO: At this moment, the RTCP packet is not completely parsed, only some * informations are extracted such as the SSRC identificator. The rest of * the packet is saved but not processed nor validated (for now). */ public RTCPPacket(IoBuffer buffer) { byte c = buffer.get(); // |V=2|P=1| SC=5 | version = (byte) ((c & 0xC0) >> 6); padding = ((c & 0x20) >> 5) == 1; count = (byte) (c & 0x1F); packetType = new UnsignedByte(buffer.get()); length = buffer.getShort(); ssrc = new UnsignedInt(buffer.getInt()); // we have already read 2 * 4 = 8 bytes // out of ( length + 1 ) * 4 totals int size = Math.min(((length + 1) * 4 - 8), buffer.remaining()); packetBuffer = new byte[size]; buffer.get(packetBuffer); /* * System.err.println( "version: " + version ); System.err.println( * "Padding: " + padding ); System.err.println( "count: " + count ); * System.err.println( "packetType: " + Type.fromByte( packetType ) ); * System.err.println( "length: " + length ); System.err.println( * "ssrc: " + Long.toHexString( (long) ssrc & 0xFFFFFFFFL ) ); * System.err.println( "buffer: " + Arrays.toString( packetBuffer ) ); */ /** *

		 * switch (Type.fromByte(packetType)) {
		 * 	case SR:
		 * 	case RR:
		 * 	case SDES:
		 * 		rtcpInfo = new SDESInfo(this, buffer);
		 * 		break;
		 * 	case BYE:
		 * 	case APP:
		 * 	case NONE:
		 * 		log.debug("Invalid RTCP	 packet.");
		 * }
		 * 
*/ } protected RTCPPacket() { } /** * @return Returns the ssrc. */ public UnsignedInt getSsrc() { return ssrc; } /** * @param ssrc * The ssrc to set. */ public void setSsrc(UnsignedInt ssrc) { this.ssrc = ssrc; } public Type getType() { return Type.valueOf(packetType); } /* * (non-Javadoc) * * @see rtspproxy.rtp.Packet#toIoBuffer() */ public IoBuffer toByteBuffer() { int packetSize = (packetBuffer.length + 2) * 4; // content IoBuffer buffer = IoBuffer.allocate(packetSize); buffer.limit(packetSize); // |V=2|P=1| SC=5 | byte c; c = (byte) ((version << 6) & 0xC0); c |= (byte) (((padding ? 1 : 0) << 5) & 0x20); c |= (byte) (count & 0x1F); buffer.put(c); buffer.put(packetType.getBytes()); buffer.putShort(length); buffer.put(ssrc.getBytes()); buffer.put(packetBuffer); buffer.rewind(); return buffer; } } red5-1.0~svn4374.orig-plugins/rtspplugin/src/org/red5/server/net/rtp/PacketType.java0000644000175000017500000000213111272347163030236 0ustar drazzibdrazzibpackage org.red5.server.net.rtp; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** * @author Matteo Merli (matteo.merli@gmail.com) */ public enum PacketType { /** A data packet (RTP) */ DataPacket, /** A control packet (RTCP) */ ControlPacket } red5-1.0~svn4374.orig-plugins/rtspplugin/src/org/red5/server/net/rtp/Packet.java0000644000175000017500000000360111272347163027377 0ustar drazzibdrazzibpackage org.red5.server.net.rtp; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * Copyright (C) 2005 - Matteo Merli - matteo.merli@gmail.com * * * ***************************************************************************/ import org.apache.mina.core.buffer.IoBuffer; /** * Base interface for RTP and RTCP packets * * @author Matteo Merli (matteo.merli@gmail.com) */ public interface Packet { public IoBuffer toByteBuffer(); } red5-1.0~svn4374.orig-plugins/rtspplugin/src/org/red5/server/net/rtp/RTPPacket.java0000644000175000017500000002743111272347163027774 0ustar drazzibdrazzibpackage org.red5.server.net.rtp; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * Copyright (C) 2005 - Matteo Merli - matteo.merli@gmail.com * * * ***************************************************************************/ import org.apache.mina.core.buffer.IoBuffer; import org.red5.io.object.UnsignedByte; import org.red5.io.object.UnsignedInt; import org.red5.io.object.UnsignedShort; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * This class wraps a RTP packet providing method to convert from and to a * {@link IoBuffer}. *

* A RTP packet is composed of an header and the subsequent payload. *

* The RTP header has the following format: * *

 *        0                   1                   2                   3
 *        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
 *        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *        |V=2|P|X|  CC   |M|     PT      |       sequence number         |
 *        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *        |                           timestamp                           |
 *        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *        |           synchronization source (SSRC) identifier            |
 *        +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
 *        |            contributing source (CSRC) identifiers             |
 *        |                             ....                              |
 *        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 * 
* * The first twelve octets are present in every RTP packet, while the list of * CSRC identifiers is present only when inserted by a mixer. * * @author Matteo Merli */ public class RTPPacket implements Packet { private static Logger log = LoggerFactory.getLogger(RTPPacket.class); /** * This field identifies the version of RTP. The version defined by this * specification is two (2). (The value 1 is used by the first draft version * of RTP and the value 0 is used by the protocol initially implemented in * the "vat" audio tool.) */ private byte version; /** * Padding flag. If the padding bit is set, the packet contains one or more * additional padding octets at the end which are not part of the payload. * The last octet of the padding contains a count of how many padding octets * should be ignored, including itself. Padding may be needed by some * encryption algorithms with fixed block sizes or for carrying several RTP * packets in a lower-layer protocol data unit. */ private boolean padding; /** * Extension Flag. If the extension bit is set, the fixed header MUST be * followed by exactly one header extension, with a format defined in * Section 5.3.1 of the RFC. */ private boolean extension; /** * The CSRC count contains the number of CSRC identifiers that follow the * fixed header. */ private byte csrcCount; /** * The interpretation of the marker is defined by a profile. It is intended * to allow significant events such as frame boundaries to be marked in the * packet stream. A profile MAY define additional marker bits or specify * that there is no marker bit by changing the number of bits in the payload * type field (see Section 5.3). */ private boolean marker; /** * This field identifies the format of the RTP payload and determines its * interpretation by the application. A profile MAY specify a default static * mapping of payload type codes to payload formats. Additional payload type * codes MAY be defined dynamically through non-RTP means (see Section 3). *

* A set of default mappings for audio and video is specified in the * companion RFC 3551 [1]. An RTP source MAY change the payload type during * a session, but this field SHOULD NOT be used for multiplexing separate * media streams (see Section 5.2). */ private UnsignedByte payloadType; /** * The sequence number increments by one for each RTP data packet sent, and * may be used by the receiver to detect packet loss and to restore packet * sequence. The initial value of the sequence number SHOULD be random * (unpredictable) to make known-plaintext attacks on encryption more * difficult, even if the source itself does not encrypt according to the * method in Section 9.1, because the packets may flow through a translator * that does. */ private UnsignedShort sequence; /** * The timestamp reflects the sampling instant of the first octet in the RTP * data packet. The sampling instant MUST be derived from a clock that * increments monotonically and linearly in time to allow synchronization * and jitter calculations (see Section 6.4.1). */ private UnsignedInt timestamp; /** * The SSRC field identifies the synchronization source. This identifier * SHOULD be chosen randomly, with the intent that no two synchronization * sources within the same RTP session will have the same SSRC identifier. */ private UnsignedInt ssrc; /** * The CSRC list identifies the contributing sources for the payload * contained in this packet. The number of identifiers is given by the CC * field. If there are more than 15 contributing sources, only 15 can be * identified. */ private UnsignedInt[] csrc = {}; private short profileExtension; private byte[] headerExtension = {}; /** * Content of the packet. */ private byte[] payload = {}; /** * Construct a new RTPPacket reading the fields from a IoBuffer * * @param buffer * the buffer containing the packet */ public RTPPacket(IoBuffer buffer) { // Read the packet header byte c = buffer.get(); // |V=2|P=1|X=1| CC=4 | this.version = (byte) ((c & 0xC0) >> 6); this.padding = ((c & 0x20) >> 5) == 1; this.extension = ((c & 0x10) >> 4) == 1; this.csrcCount = (byte) (c & 0x0F); c = buffer.get(); // |M=1| PT=7 | this.marker = ((c & 0x80) >> 7) == 1; this.payloadType = new UnsignedByte(c & 0x7F); this.sequence = new UnsignedShort(buffer.getShort()); this.timestamp = new UnsignedInt(buffer.getInt()); this.ssrc = new UnsignedInt(buffer.getInt()); // CSRC list csrc = new UnsignedInt[csrcCount]; for (int i = 0; i < csrcCount; i++) { csrc[i] = new UnsignedInt(buffer.getInt()); } // Read the extension header if present if (extension) { this.profileExtension = buffer.getShort(); int length = buffer.getShort(); this.headerExtension = new byte[length]; buffer.get(this.headerExtension); } // Read the payload int payloadSize = buffer.remaining(); this.payload = new byte[payloadSize]; buffer.get(payload); if (version != 2) { log.debug("Packet Version is not 2."); } } protected RTPPacket() { // Creates an empty packet } /** * Convert the packet instance into a {@link IoBuffer} ready to be sent. * * @return a new IoBuffer */ public IoBuffer toByteBuffer() { int packetSize = 12 + csrc.length * 4 + payload.length; if (extension) packetSize += headerExtension.length; IoBuffer buffer = IoBuffer.allocate(packetSize); buffer.limit(packetSize); byte c = 0x00; int bPadding = padding ? 1 : 0; int bExtension = extension ? 1 : 0; c = (byte) ((version << 6) | (bPadding << 5) | (bExtension << 4) | csrcCount); buffer.put(c); int bMarker = marker ? 1 : 0; c = (byte) ((bMarker << 7) | payloadType.intValue()); buffer.put(c); buffer.put(sequence.getBytes()); buffer.put(timestamp.getBytes()); buffer.put(ssrc.getBytes()); for (byte i = 0; i < Math.min(csrcCount, csrc.length); i++) { buffer.put(csrc[i].getBytes()); } // Write the extension header if present if (extension) { buffer.putShort(profileExtension); buffer.putShort((short) headerExtension.length); buffer.put(headerExtension); } buffer.put(payload); buffer.rewind(); return buffer; } /** * @return Returns the csrc. */ public UnsignedInt[] getCsrc() { return csrc; } /** * @param csrc * The csrc to set. */ public void setCsrc(UnsignedInt[] csrc) { this.csrc = csrc; } /** * @return Returns the csrcCount. */ public byte getCsrcCount() { return csrcCount; } /** * @param csrcCount * The csrcCount to set. */ public void setCsrcCount(byte csrcCount) { this.csrcCount = csrcCount; } /** * @return Returns the extension. */ public boolean isExtension() { return extension; } /** * @param extension * The extension to set. */ public void setExtension(boolean extension) { this.extension = extension; } /** * @return Returns the marker. */ public boolean isMarker() { return marker; } /** * @param marker * The marker to set. */ public void setMarker(boolean marker) { this.marker = marker; } /** * @return Returns the padding. */ public boolean isPadding() { return padding; } /** * @param padding * The padding to set. */ public void setPadding(boolean padding) { this.padding = padding; } /** * @return Returns the payload. */ public byte[] getPayload() { return payload; } /** * @param payload * The payload to set. */ public void setPayload(byte[] payload) { this.payload = payload; } /** * @return Returns the payloadType. */ public UnsignedByte getPayloadType() { return payloadType; } /** * @param payloadType * The payloadType to set. */ public void setPayloadType(UnsignedByte payloadType) { this.payloadType = payloadType; } /** * @return Returns the sequence. */ public UnsignedShort getSequence() { return sequence; } /** * @param sequence * The sequence to set. */ public void setSequence(UnsignedShort sequence) { this.sequence = sequence; } /** * @return Returns the ssrc. */ public UnsignedInt getSsrc() { return ssrc; } /** * @param ssrc * The ssrc to set. */ public void setSsrc(UnsignedInt ssrc) { this.ssrc = ssrc; } /** * @return Returns the timestamp. */ public UnsignedInt getTimestamp() { return timestamp; } /** * @param timestamp * The timestamp to set. */ public void setTimestamp(UnsignedInt timestamp) { this.timestamp = timestamp; } /** * @return Returns the version. */ public byte getVersion() { return version; } /** * @param version * The version to set. */ public void setVersion(byte version) { this.version = version; } } red5-1.0~svn4374.orig-plugins/rtspplugin/.settings/0000755000175000017500000000000011760512620022117 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/rtspplugin/.settings/org.eclipse.jdt.core.prefs0000644000175000017500000005323611275371545027124 0ustar drazzibdrazzib#Mon Nov 02 20:49:37 PST 2009 eclipse.preferences.version=1 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 org.eclipse.jdt.core.formatter.blank_lines_after_package=1 org.eclipse.jdt.core.formatter.blank_lines_before_field=1 org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 org.eclipse.jdt.core.formatter.blank_lines_before_method=1 org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 org.eclipse.jdt.core.formatter.blank_lines_before_package=0 org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false org.eclipse.jdt.core.formatter.comment.format_block_comments=false org.eclipse.jdt.core.formatter.comment.format_header=false org.eclipse.jdt.core.formatter.comment.format_html=true org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false org.eclipse.jdt.core.formatter.comment.format_line_comments=false org.eclipse.jdt.core.formatter.comment.format_source_code=true org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true org.eclipse.jdt.core.formatter.comment.indent_root_tags=true org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert org.eclipse.jdt.core.formatter.comment.line_length=80 org.eclipse.jdt.core.formatter.compact_else_if=true org.eclipse.jdt.core.formatter.continuation_indentation=2 org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_empty_lines=false org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true org.eclipse.jdt.core.formatter.indentation.size=4 org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.join_lines_in_comments=true org.eclipse.jdt.core.formatter.join_wrapped_lines=true org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false org.eclipse.jdt.core.formatter.lineSplit=80 org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true org.eclipse.jdt.core.formatter.tabulation.char=mixed org.eclipse.jdt.core.formatter.tabulation.size=4 org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true red5-1.0~svn4374.orig-plugins/rtspplugin/.settings/org.eclipse.jdt.ui.prefs0000644000175000017500000000016611275371545026603 0ustar drazzibdrazzib#Mon Nov 02 20:49:37 PST 2009 eclipse.preferences.version=1 formatter_profile=_Red5 formatter_settings_version=11 red5-1.0~svn4374.orig-plugins/icyplugin/0000755000175000017500000000000011760512615020001 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/icyplugin/readme.txt0000644000175000017500000000130111260150712021761 0ustar drazzibdrazzib ICY protocol streaming plug-in 09/2009 Paul Gregoire This plugin allows media origination from SHOUTcast, NSVCap, Winamp DSP, or other ICY compatible broadcasting applications. Definitions: ICY = I Can Yell NSV = Nullsoft Streaming Video Links: SHOUTcast: http://www.shoutcast.com/ ICY whitepaper: http://forums.radiotoolbox.com/viewtopic.php?t=74 NSV Project: http://www.nullsoft.com/nsv/ NSV Format specification and documentation: http://ultravox.aol.com/NSVFormat.rtf Special thanks for making this happen go to: Wittawas Nakkasem Andy Shaules More info: http://en.wikipedia.org/wiki/SHOUTcast http://en.wikipedia.org/wiki/Nullsoft_Streaming_Video red5-1.0~svn4374.orig-plugins/icyplugin/build.xml0000644000175000017500000000712711260150712021620 0ustar drazzibdrazzib java.home is ${java.home} and the target version is ${java.target_version} red5.root is ${red5.root} javac version: ${java.version} Type ant -p for available targets" red5-1.0~svn4374.orig-plugins/icyplugin/ivy.xml0000644000175000017500000000203211271132714021322 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/icyplugin/lib/0000755000175000017500000000000011760512615020547 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/icyplugin/ivysettings.xml0000644000175000017500000000125111260150712023101 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/icyplugin/.classpath0000644000175000017500000000136311273707437021776 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/icyplugin/.project0000644000175000017500000000065211260150712021442 0ustar drazzibdrazzib icyplugin Red5 plugin implementing the ICY protocol org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature red5-1.0~svn4374.orig-plugins/icyplugin/build.bat0000644000175000017500000000000311260150712021550 0ustar drazzibdrazzibantred5-1.0~svn4374.orig-plugins/icyplugin/build.properties0000644000175000017500000000015711260150712023210 0ustar drazzibdrazzib# Let the scripts know where your red5 is (ie. the location of the red5.jar) red5.root=c:/red5 debug.state=truered5-1.0~svn4374.orig-plugins/icyplugin/src/0000755000175000017500000000000011760512615020570 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/icyplugin/src/org/0000755000175000017500000000000011760512615021357 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/icyplugin/src/org/red5/0000755000175000017500000000000011760512615022216 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/icyplugin/src/org/red5/server/0000755000175000017500000000000011760512615023524 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/icyplugin/src/org/red5/server/plugin/0000755000175000017500000000000011760512615025022 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/icyplugin/src/org/red5/server/plugin/icy/0000755000175000017500000000000011760512615025606 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/icyplugin/src/org/red5/server/plugin/icy/marshal/0000755000175000017500000000000011760512615027235 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/icyplugin/src/org/red5/server/plugin/icy/marshal/transpose/0000755000175000017500000000000011760512615031253 5ustar drazzibdrazzib././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootred5-1.0~svn4374.orig-plugins/icyplugin/src/org/red5/server/plugin/icy/marshal/transpose/VideoFramer.javared5-1.0~svn4374.orig-plugins/icyplugin/src/org/red5/server/plugin/icy/marshal/transpose/VideoFramer0000644000175000017500000000456511260152251033402 0ustar drazzibdrazzibpackage org.red5.server.plugin.icy.marshal.transpose; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import org.apache.mina.core.buffer.IoBuffer; import org.red5.server.icy.IICYEventSink; import org.red5.server.net.rtmp.event.IRTMPEvent; import org.red5.server.net.rtmp.event.VideoData; import org.red5.server.net.rtmp.message.Header; /** * Provides video in pre-defined containers. * * @author Wittawas Nakkasem (vittee@hotmail.com) * @author Andy Shaules (bowljoman@hotmail.com) */ public class VideoFramer { private IICYEventSink output; public VideoFramer(IICYEventSink outputSink) { output = outputSink; } /** * Take raw vp6 and format it for flv. May need adjustments. * * @param frame * @param timecode */ public void pushVP6Frame(byte[] frame, int timecode) { IoBuffer buffV = IoBuffer.allocate(frame.length); buffV.setAutoExpand(true); byte flags; byte crops = 0x00; boolean key = ((frame[0] & 0x80) == 0); if (!key) { flags = (0x03) << 4 | (0x04); } else { flags = (0x01) << 4 | (0x04); } buffV.put(flags); buffV.put(crops); buffV.put(frame); buffV.flip(); buffV.position(0); IRTMPEvent video = new VideoData(buffV); video.setHeader(new Header()); video.getHeader().setTimer((int) timecode & 0xffffff); //video.getHeader().setTimerRelative(false); video.setTimestamp((int) timecode & 0xffffff); output.dispatchEvent(video); } /** * Take raw h264 and format it for flv * @param frame * @param timecode */ public void pushAVCFrame(byte[] frame, int timecode) { } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootred5-1.0~svn4374.orig-plugins/icyplugin/src/org/red5/server/plugin/icy/marshal/transpose/AudioFramer.javared5-1.0~svn4374.orig-plugins/icyplugin/src/org/red5/server/plugin/icy/marshal/transpose/AudioFramer0000644000175000017500000001453111260152251033367 0ustar drazzibdrazzibpackage org.red5.server.plugin.icy.marshal.transpose; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.util.Arrays; import org.apache.mina.core.buffer.IoBuffer; import org.red5.server.icy.IICYEventSink; import org.red5.server.net.rtmp.event.AudioData; import org.red5.server.net.rtmp.event.IRTMPEvent; import org.red5.server.net.rtmp.message.Header; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Provides audio in pre-defined containers. * * @author Wittawas Nakkasem (vittee@hotmail.com) * @author Andy Shaules (bowljoman@hotmail.com) */ public class AudioFramer { private static Logger log = LoggerFactory.getLogger(AudioFramer.class); public static final int[] AAC_SAMPLERATES = { 96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350 }; private int saveAACfrequency = -1; private int saveAACsamplesPerFrame = -1; private int aacTimecodeOffset = 0; private int lastSample = 0; private boolean isFirst; private int lastTimecode = 0; private byte[] tail = null; private boolean frameSynched; private int profile = 0; private int sampleRateIndex = 0; private int channels = 0; private int currentFrameLeft = 0; private int raw_data_block = 0; private IoBuffer buffer = null; public IICYEventSink output; public AudioFramer(IICYEventSink outputSink) { output = outputSink; } public void reset() { tail = null; buffer = null; currentFrameLeft = 0; frameSynched = false; isFirst = true; saveAACfrequency = -1; saveAACsamplesPerFrame = -1; aacTimecodeOffset = 0; lastTimecode = 0; lastSample = 0; } public void onAACData(byte[] feed) { byte[] data; // merge previous tail if (tail != null) { IoBuffer bb = IoBuffer.allocate(tail.length + feed.length); bb.put(tail); for (int i = 0; i < feed.length; i++) { bb.put(feed[i]); } data = bb.array(); tail = null; } else { IoBuffer bb = IoBuffer.allocate(feed.length); for (int i = 0; i < feed.length; i++) { bb.put(feed[i]); } data = bb.array(); } // parse int offset = 0; int adtsSkipped = 0; while ((data.length - offset) > 7) { if (!frameSynched) { if ((data[offset++] & 0xff) == 0xff) { if ((data[offset++] & 0xf6) == 0xf0) { profile = (data[offset] & 0xC0) >> 6; sampleRateIndex = (data[offset] & 0x3C) >> 2; channels = ((data[offset] & 0x01) << 2) | ((data[offset + 1] & 0xC0) >> 6); log.trace("Profile: {} sample rate index: {} channels: {}", new Object[]{profile, sampleRateIndex, channels}); // frame length, ADTS excluded currentFrameLeft = (((data[offset + 1] & 0x03) << 8) | ((data[offset + 2] & 0xff) << 3) | ((data[offset + 3] & 0xff) >>> 5)) - 7; raw_data_block = data[(offset + 4)] & 0x3; log.trace("Current frame left: {} raw: {}", currentFrameLeft, raw_data_block); offset += 5; // skip ADTS adtsSkipped += 7; frameSynched = true; } } } else { int remain = (data.length - offset); int bytesToRead = currentFrameLeft; if (bytesToRead > remain) bytesToRead = remain; if (buffer == null) { buffer = IoBuffer.allocate(2); buffer.setAutoExpand(true); buffer.put(new byte[] { (byte) 0xAF, (byte) 0x01 }); } buffer.put(data, offset, bytesToRead); offset += bytesToRead; currentFrameLeft -= bytesToRead; log.trace("Current frame left: {}", currentFrameLeft); if (currentFrameLeft == 0) { try { IoBuffer newBuffer = IoBuffer.allocate(buffer.limit()); buffer.flip(); newBuffer.put(buffer); if (AAC_SAMPLERATES.length <= sampleRateIndex) { isFirst = false; buffer = null; frameSynched = false; return; } deliverAACFrame(newBuffer, AAC_SAMPLERATES[sampleRateIndex], (raw_data_block + 1) * 1024); } finally { isFirst = false; buffer = null; frameSynched = false; } } } } // keep tail int remain = data.length - offset; if (remain > 0) { try { tail = Arrays.copyOfRange(data, offset, data.length); } catch (Exception e) { } } } public void onMP3Data(byte[] data) { //TODO } private void deliverAACFrame(IoBuffer buffer, int sampleRate, int sampleCount) { if (saveAACfrequency == -1) { saveAACfrequency = sampleRate; saveAACsamplesPerFrame = sampleCount; } if ((saveAACfrequency != sampleRate) || (saveAACsamplesPerFrame != sampleCount)) { saveAACfrequency = sampleRate; saveAACsamplesPerFrame = sampleCount; aacTimecodeOffset = lastTimecode; lastSample = 0; } long timeSpan = 0; if (isFirst) { timeSpan = 0; lastSample = 0; lastTimecode = 0; } else { lastSample += sampleCount; timeSpan = aacTimecodeOffset + sample2TimeCode(lastSample, sampleRate) - lastTimecode; lastTimecode += timeSpan; } IRTMPEvent audio = new AudioData(buffer); audio.setTimestamp((int) timeSpan); audio.setHeader(new Header()); audio.getHeader().setTimer((int) timeSpan & 0xffffff); //audio.getHeader().setTimerRelative(true); output.dispatchEvent(audio); } @SuppressWarnings("unused") private IRTMPEvent deliverMP3Frame(IoBuffer buffer, int sampleRate, int sampleCount) { //TODO return null; } public byte[] getAACSpecificConfig() { return new byte[] { (byte) (/*0x10 |*/((profile > 2) ? 2 : profile << 3) | ((sampleRateIndex >> 1) & 0x03)), (byte) (((sampleRateIndex & 0x01) << 7) | ((channels & 0x0F) << 3)) }; } private long sample2TimeCode(long time, int sampleRate) { return (time * 1000L / sampleRate); } } red5-1.0~svn4374.orig-plugins/icyplugin/src/org/red5/server/plugin/icy/marshal/ICYMarshal.java0000644000175000017500000001676411260161677032055 0ustar drazzibdrazzibpackage org.red5.server.plugin.icy.marshal; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.util.HashMap; import java.util.Map; import org.apache.mina.core.buffer.IoBuffer; import org.red5.io.amf.Output; import org.red5.io.object.Serializer; import org.red5.logging.Red5LoggerFactory; import org.red5.server.api.IContext; import org.red5.server.api.IScope; import org.red5.server.icy.IICYMarshal; import org.red5.server.icy.message.Frame; import org.red5.server.icy.nsv.NSVFrameQueue; import org.red5.server.net.rtmp.event.IRTMPEvent; import org.red5.server.net.rtmp.event.Notify; import org.red5.server.plugin.icy.StreamManager; import org.red5.server.plugin.icy.marshal.transpose.AudioFramer; import org.red5.server.plugin.icy.marshal.transpose.VideoFramer; import org.red5.server.plugin.icy.stream.ICYStream; import org.red5.server.stream.BroadcastScope; import org.red5.server.stream.IBroadcastScope; import org.red5.server.stream.IProviderService; import org.red5.server.stream.codec.AACAudio; import org.slf4j.Logger; /** * This class registers the stream name in the provided scope and packages the buffers into rtmp events. * * @author Wittawas Nakkasem (vittee@hotmail.com) * @author Andy Shaules (bowljoman@hotmail.com) * @author Paul Gregoire (mondain@gmail.com) */ public class ICYMarshal implements IICYMarshal { private static Logger log = Red5LoggerFactory.getLogger(ICYMarshal.class, "plugins"); private AudioFramer audioFramer; private VideoFramer videoFramer; private IScope scope; private String name; private ICYStream stream; @SuppressWarnings("unused") private String content; private String type; private String fourCCAudio; private String fourCCVideo; private Map metaData; private NSVFrameQueue queue; private NSVSenderThread sender; public ICYMarshal(IScope outputScope, String outputName) { log.debug("ICYMarshal created - name: {} scope: {}", outputName, outputScope.getName()); scope = outputScope; name = outputName; stream = new ICYStream(name, true, true); stream.setScope(outputScope); IContext context = outputScope.getContext(); IProviderService providerService = (IProviderService) context.getBean(IProviderService.BEAN_NAME); if (providerService.registerBroadcastStream(outputScope, stream.getPublishedName(), stream)) { IBroadcastScope bsScope = (BroadcastScope) providerService.getLiveProviderInput(outputScope, stream.getPublishedName(), true); bsScope.setAttribute(IBroadcastScope.STREAM_ATTRIBUTE, stream); } audioFramer = new AudioFramer(stream); } public AudioFramer getAudioFramer() { return audioFramer; } public VideoFramer getVideoFramer() { return videoFramer; } public IScope getScope() { return scope; } public ICYStream getStream() { return stream; } public String getContentType() { return type; } public String getAudioType() { return fourCCAudio; } public String getVideoType() { return fourCCVideo; } public void reset(String content, String type) { log.debug("Reset - content: {} type: {}", content, type); this.content = content; this.type = type; stream.reset(); audioFramer.reset(); if (content.equals("audio")) { if (type.startsWith("aac")) { AACAudio audioCodec = new AACAudio(); stream.setAudioReader(audioCodec); stream.audioFramer = audioFramer; } else if (type.equals("mpeg")) { //MP3Audio } else { log.debug("Unsupported content type at reset: {}", type); } } else if (content.equals("video")) { videoFramer = new VideoFramer(stream); } } public void onAuxData(String fourCC, IoBuffer buffer) { log.debug("onAuxData - fourCC: {} buffer: {}", fourCC, buffer.getHexDump(32)); buffer.free(); } public void onConnected(String videoType, String audioType) { log.debug("onConnected - video type: {} audio type: {}", videoType, audioType); fourCCAudio = audioType; if (fourCCAudio.startsWith("AAC")) { AACAudio audioCodec = new AACAudio(); stream.setAudioReader(audioCodec); stream.audioFramer = audioFramer; } else if (fourCCAudio.equals("MP3")) { //TODO MP3Audio } else { log.debug("Unsupported audio type: {}", audioType); } fourCCVideo = videoType; if (fourCCVideo.startsWith("VP6") || fourCCVideo.startsWith("H264")) { // } else { log.debug("Unsupported video type: {}", videoType); } } public void onAudioData(byte[] data) { log.debug("onAudioData - length: {}", data.length); String codecName = stream.getCodecReader().getName(); if ("AAC".equals(codecName)) { audioFramer.onAACData(data); } else if ("MP3".equals(codecName)) { audioFramer.onMP3Data(data); } else if ("PCM".equals(codecName)) { log.info("PCM is not yet supported"); //audioFramer.onPCMData(data); } else if ("SPX".equals(codecName)) { log.info("Speex is not yet supported"); //audioFramer.onSpeexData(data); } } public void onVideoData(byte[] data) { log.debug("onVideoData - length: {}", data.length); if (fourCCVideo.startsWith("VP6")) { videoFramer.pushVP6Frame(data, 0); } else if (fourCCVideo.startsWith("H264")) { videoFramer.pushAVCFrame(data, 0); } } public void onMetaData(Map metaData) { log.debug("onMetaData: {}", metaData); this.metaData = metaData; IRTMPEvent event = getMetaDataEvent(); if (event != null) { stream.setMetaDataEvent(event); } stream.dispatchEvent(event); } public void onFrameData(Frame frame) { if (queue == null) { queue = new NSVFrameQueue(); sender = new NSVSenderThread(); } queue.addFrame(frame); if (sender != null && !sender.isRunning()) { //now that the sender has a config, submit it for execution StreamManager.submit(sender); } } public void onDisconnected() { } private IRTMPEvent getMetaDataEvent() { if (metaData == null) { return null; } IoBuffer buf = IoBuffer.allocate(1024); buf.setAutoExpand(true); Output out = new Output(buf); out.writeString("onMetaData"); Map props = new HashMap(); props.putAll(metaData); props.put("canSeekToEnd", false); out.writeMap(props, new Serializer()); buf.flip(); return new Notify(buf); } public int queueSize() { if (queue == null) { return 0; } else { return queue.count(); } } final class NSVSenderThread implements Runnable { private boolean running; @Override public void run() { running = true; while (queue.hasFrames()) { Frame frame = queue.getFrame(); onAudioData(frame.audioData); if (fourCCVideo == null) { continue; } onVideoData(frame.videoData); } log.debug("Sender thread exiting"); running = false; } public boolean isRunning() { return running; } } } red5-1.0~svn4374.orig-plugins/icyplugin/src/org/red5/server/plugin/icy/stream/0000755000175000017500000000000011760512615027101 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/icyplugin/src/org/red5/server/plugin/icy/stream/ICYStream.java0000644000175000017500000002217411260161677031555 0ustar drazzibdrazzibpackage org.red5.server.plugin.icy.stream; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Set; import java.util.concurrent.CopyOnWriteArraySet; import org.apache.mina.core.buffer.IoBuffer; import org.red5.server.api.IScope; import org.red5.server.api.event.IEvent; import org.red5.server.api.statistics.IClientBroadcastStreamStatistics; import org.red5.server.api.statistics.support.StatisticsCounter; import org.red5.server.api.stream.IAudioStreamCodec; import org.red5.server.api.stream.IBroadcastStream; import org.red5.server.api.stream.IStreamCodecInfo; import org.red5.server.api.stream.IStreamListener; import org.red5.server.api.stream.IStreamPacket; import org.red5.server.api.stream.IVideoStreamCodec; import org.red5.server.api.stream.ResourceExistException; import org.red5.server.api.stream.ResourceNotFoundException; import org.red5.server.icy.IICYEventSink; import org.red5.server.messaging.IConsumer; import org.red5.server.messaging.IMessageComponent; import org.red5.server.messaging.IPipe; import org.red5.server.messaging.IPipeConnectionListener; import org.red5.server.messaging.IProvider; import org.red5.server.messaging.OOBControlMessage; import org.red5.server.messaging.PipeConnectionEvent; import org.red5.server.net.rtmp.event.AudioData; import org.red5.server.net.rtmp.event.IRTMPEvent; import org.red5.server.net.rtmp.message.Header; import org.red5.server.plugin.icy.marshal.transpose.AudioFramer; import org.red5.server.plugin.icy.marshal.transpose.VideoFramer; import org.red5.server.stream.IStreamData; import org.red5.server.stream.PlayEngine; import org.red5.server.stream.codec.AACAudio; import org.red5.server.stream.codec.StreamCodecInfo; import org.red5.server.stream.message.RTMPMessage; /** * Output stream used to pipe the icy/nsv content. * * @author Wittawas Nakkasem (vittee@hotmail.com) * @author Andy Shaules (bowljoman@hotmail.com) */ public class ICYStream implements IBroadcastStream, IProvider, IPipeConnectionListener, IICYEventSink, IClientBroadcastStreamStatistics { private Set mListeners = new CopyOnWriteArraySet(); private String mPublishedName; private IPipe mLivePipe; private IScope mScope; private StreamCodecInfo mCodecInfo; private List newComsumers = new ArrayList(); private StatisticsCounter subscriberStats = new StatisticsCounter(); private int audioTime; private long bytesReceived = 0; private long creationTime; private IAudioStreamCodec audioReader; private IVideoStreamCodec videoReader; public AudioFramer audioFramer; public VideoFramer videoFramer; private IRTMPEvent _metaDataEvent; public ICYStream(String name, boolean video, boolean audio) { mPublishedName = name; mLivePipe = null; mCodecInfo = new StreamCodecInfo(); mCodecInfo.setHasAudio(audio); mCodecInfo.setHasVideo(video); } @Override public void addStreamListener(IStreamListener listener) { //log.debug("addStreamListener(listener: {})", listener); mListeners.add(listener); } @Override public IProvider getProvider() { //log.debug("getProvider()"); return this; } @Override public String getPublishedName() { return mPublishedName; } @Override public String getSaveFilename() { throw new Error("unimplemented method"); } @Override public Collection getStreamListeners() { return mListeners; } @Override public void removeStreamListener(IStreamListener listener) { mListeners.remove(listener); } @Override public void saveAs(String arg0, boolean arg1) throws IOException, ResourceNotFoundException, ResourceExistException { throw new Error("unimplemented method"); } @Override public void setPublishedName(String name) { //log.debug("setPublishedName(name:{})", name); mPublishedName = name; } @Override public void close() { // log.debug("close()"); } @Override public IStreamCodecInfo getCodecInfo() { return mCodecInfo; } @Override public String getName() { return mPublishedName; } @Override public IScope getScope() { return mScope; } public void setScope(IScope scope) { mScope = scope; } @Override public void start() { bytesReceived = 0; audioTime = 0; creationTime = System.currentTimeMillis(); } @Override public void stop() { } @Override public void onOOBControlMessage(IMessageComponent arg0, IPipe arg1, OOBControlMessage arg2) { } public void setAudioReader(IAudioStreamCodec codecReader) { this.audioReader = codecReader; } public IAudioStreamCodec getCodecReader() { return audioReader; } public void setVideoReader(IVideoStreamCodec codecReader) { this.videoReader = codecReader; } public IVideoStreamCodec getVideoReader() { return videoReader; } @SuppressWarnings("unused") @Override public void onPipeConnectionEvent(PipeConnectionEvent event) { switch (event.getType()) { case PipeConnectionEvent.PROVIDER_CONNECT_PUSH: if ((event.getProvider() == this) && (event.getParamMap() == null)) { mLivePipe = (IPipe) event.getSource(); //log.info("mLivePipe {}", mLivePipe); for (IConsumer consumer : mLivePipe.getConsumers()) { subscriberStats.increment(); } } break; case PipeConnectionEvent.PROVIDER_DISCONNECT: if (mLivePipe == event.getSource()) { mLivePipe = null; } break; case PipeConnectionEvent.CONSUMER_CONNECT_PUSH: if (mLivePipe != null) { List consumers = mLivePipe.getConsumers(); int count = consumers.size(); if (count > 0) { newComsumers.add(consumers.get(count - 1)); } subscriberStats.increment(); } break; case PipeConnectionEvent.CONSUMER_DISCONNECT: subscriberStats.decrement(); break; default: break; } } private void sendConfig() { while (newComsumers.size() > 0) { IConsumer consumer = newComsumers.remove(0); if (consumer instanceof PlayEngine) { if (audioReader instanceof AACAudio) { // Audio pay-load IoBuffer buffer = IoBuffer.allocate(10); buffer.setAutoExpand(true); buffer.put((byte) 0xaf); buffer.put((byte) 0x00); buffer.put(audioFramer.getAACSpecificConfig()); //buffer.put((byte) 0x06); buffer.flip(); RTMPMessage msg = new RTMPMessage(); AudioData data = new AudioData(buffer); data.setHeader(new Header()); msg.setBody(data); try { ((PlayEngine) consumer).pushMessage(null, msg); } catch (IOException e) { } } if (_metaDataEvent != null) { dispatchEvent(_metaDataEvent); } } } } public void dispatchEvent(IEvent event) { if (event instanceof IRTMPEvent) { IRTMPEvent rtmpEvent = (IRTMPEvent) event; int eventTime = 0; IoBuffer buf = null; if (rtmpEvent instanceof IStreamData && (buf = ((IStreamData) rtmpEvent).getData()) != null) { bytesReceived += buf.limit(); } if (rtmpEvent instanceof AudioData) { audioTime += rtmpEvent.getTimestamp(); eventTime = audioTime; sendConfig(); } else { eventTime = audioTime; } if (mLivePipe != null) { RTMPMessage msg = new RTMPMessage(); msg.setBody(rtmpEvent); msg.getBody().setTimestamp(eventTime); try { mLivePipe.pushMessage(msg); } catch (Exception e) { //log.info("dispatchEvent {}, error: {}", event, e); } } // Notify listeners about received packet if (rtmpEvent instanceof IStreamPacket) { for (IStreamListener listener : getStreamListeners()) { try { listener.packetReceived(this, (IStreamPacket) rtmpEvent); } catch (Exception e) { //log.info("Error while notifying listener {}", listener, e); } } } } } @Override public int getActiveSubscribers() { return subscriberStats.getCurrent(); } @Override public long getBytesReceived() { return bytesReceived; } @Override public int getMaxSubscribers() { return subscriberStats.getMax(); } @Override public int getTotalSubscribers() { return subscriberStats.getTotal(); } @Override public int getCurrentTimestamp() { return audioTime; } @Override public long getCreationTime() { return creationTime; } @Override public void reset() { newComsumers.addAll(mLivePipe.getConsumers()); } public void setMetaDataEvent(IRTMPEvent event) { _metaDataEvent = event; } } red5-1.0~svn4374.orig-plugins/icyplugin/src/org/red5/server/plugin/icy/stream/NSVConsumer.java0000644000175000017500000000540511260152251032121 0ustar drazzibdrazzibpackage org.red5.server.plugin.icy.stream; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import org.red5.server.icy.ICYHandler; import org.red5.server.icy.IICYMarshal; /** * The NSVConsumer will consume or subscribe to data from a winamp shoutcast dsp, * nsv encoder, or a shoutcast server. * * @author Wittawas Nakkasem (vittee@hotmail.com) * @author Andy Shaules (bowljoman@hotmail.com) * @author Paul Gregoire (mondain@gmail.com) */ public class NSVConsumer { public static int SERVER_MODE = 0; public static int CLIENT_MODE = 1; private IICYMarshal handler; private int port; private String password = "changeme"; private ICYHandler socketHandler; private int mode = 1; private String host; public NSVConsumer(int serverType, IICYMarshal handler, String host) { mode = serverType; this.handler = handler; this.host = host; } public NSVConsumer(int serverType, IICYMarshal handler) { mode = serverType; this.handler = handler; this.host = ""; } public void init() { //create a handler socketHandler = new ICYHandler(); //socketHandler.setDataTimeout(10000); socketHandler.setHandler(handler); socketHandler.setHost(host); socketHandler.setMode(mode); socketHandler.setPassword(password); socketHandler.setPort(port); //socketHandler.setWaitTime(50); socketHandler.setNotifyFlipped(true); socketHandler.start(); } public void stop() { if (socketHandler != null) { socketHandler.stop(); } } public boolean isConnected() { if (socketHandler != null) { return socketHandler.isConnected(); } else { return false; } } public IICYMarshal getMarshal() { return handler; } public void setHost(String val) { host = val; } public int getMode() { if (socketHandler != null) { return socketHandler.getMode(); } else { return mode; } } public void setPort(int val) { port = val; } public void setPassword(String val) { password = val; } } red5-1.0~svn4374.orig-plugins/icyplugin/src/org/red5/server/plugin/icy/StreamManager.java0000644000175000017500000000501711260161677031205 0ustar drazzibdrazzibpackage org.red5.server.plugin.icy; import java.util.HashSet; import java.util.Set; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import org.red5.logging.Red5LoggerFactory; import org.red5.server.plugin.icy.stream.NSVConsumer; import org.slf4j.Logger; import org.springframework.beans.factory.DisposableBean; import org.springframework.beans.factory.InitializingBean; /** * Provides a means to manage streams and threads. * * @author Paul Gregoire (mondain@gmail.com) */ public class StreamManager implements InitializingBean, DisposableBean { private static Logger log = Red5LoggerFactory.getLogger(StreamManager.class, "plugins"); //executor thread pool size private int poolSize = 1; private static ExecutorService executor; private static final Set consumers = new HashSet(); @Override public void afterPropertiesSet() throws Exception { executor = Executors.newFixedThreadPool(poolSize); } @Override public void destroy() throws Exception { //clear the set consumers.clear(); //disable new tasks from being submitted executor.shutdown(); try { //wait a while for existing tasks to terminate if (!executor.awaitTermination(3, TimeUnit.SECONDS)) { executor.shutdownNow(); // cancel currently executing tasks //wait a while for tasks to respond to being canceled if (!executor.awaitTermination(3, TimeUnit.SECONDS)) { System.err.println("Notifier pool did not terminate"); } } } catch (InterruptedException ie) { // re-cancel if current thread also interrupted executor.shutdownNow(); // preserve interrupt status Thread.currentThread().interrupt(); } } public void addConsumer(final NSVConsumer consumer) { log.debug("Add consumer: {}", consumer); //add consumer to collection if (consumers.add(consumer)) { Runnable initer = new Runnable() { public void run() { //start the consumer consumer.init(); } }; StreamManager.submit(initer); } } public void removeConsumer(NSVConsumer consumer) { log.debug("Remove consumer: {}", consumer); //remove it if (consumers.remove(consumer)) { consumer.stop(); } } /** * Adds a runnable to the executor service. * * @param runnable */ public static void submit(Runnable runnable) { log.debug("Submit runnable"); executor.execute(runnable); } public int getPoolSize() { return poolSize; } public void setPoolSize(int poolSize) { this.poolSize = poolSize; } } red5-1.0~svn4374.orig-plugins/icyplugin/src/org/red5/server/plugin/icy/ICYPlugin.java0000644000175000017500000001020611273731357030260 0ustar drazzibdrazzibpackage org.red5.server.plugin.icy; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import org.red5.logging.Red5LoggerFactory; import org.red5.server.api.IScope; import org.red5.server.plugin.Red5Plugin; import org.red5.server.plugin.icy.marshal.ICYMarshal; import org.red5.server.plugin.icy.stream.NSVConsumer; import org.slf4j.Logger; import org.springframework.context.support.FileSystemXmlApplicationContext; /** * Provides a means to stream media via NSV and Shoutcast. * * @author Paul Gregoire (mondain@gmail.com) * @author Wittawas Nakkasem (vittee@hotmail.com) * @author Andy Shaules (bowljoman@hotmail.com) */ public class ICYPlugin extends Red5Plugin { private static Logger log = Red5LoggerFactory.getLogger(ICYPlugin.class, "plugins"); private static FileSystemXmlApplicationContext nsvContext; /** * Create a thread to listen for a connection from nsv or winamp shoutcast dsp encoders. * @param outputScope the stream is registered in. * @param outputName stream name in output scope. * @param port Port to open. * @param password Pass word to accept. * @return The running thread wrapper. */ public static NSVConsumer openServerPort(IScope outputScope, String outputName, int port, String password) { log.debug("Open server port: {} scope: {} name: {} password: {}", new Object[]{port, outputScope, outputName, password}); ICYMarshal marsh = new ICYMarshal(outputScope, outputName); NSVConsumer nsv = new NSVConsumer(NSVConsumer.SERVER_MODE, marsh); nsv.setPort(port); nsv.setPassword(password); //lookup the stream manager if (nsvContext.containsBean("streamManager")) { StreamManager mgr = (StreamManager) nsvContext.getBean("streamManager"); //add the consumer for execution mgr.addConsumer(nsv); } else { log.warn("Stream manager not found"); } return nsv; } /** * Create a thread to subscribe to a shoutcast server. Host format "http://host:port/;stream.nsv". * Note. The ';' is not a typo. * * Test link (vp6/aac): http://stream.dreamcatch-radio.net:10000/stream.nsv * * @param outputScope The stream is registered to. * @param outputName The output stream name. * @param host The url to subscribe to. * @return The running thread wrapper. */ public static NSVConsumer openExternalURI(IScope outputScope, String outputName, String host) { log.debug("Open external host: {} scope: {} name: {}", new Object[]{host, outputScope, outputName}); ICYMarshal marsh = new ICYMarshal(outputScope, outputName); NSVConsumer nsv = new NSVConsumer(NSVConsumer.CLIENT_MODE, marsh, host); //lookup the stream manager if (nsvContext.containsBean("streamManager")) { StreamManager mgr = (StreamManager) nsvContext.getBean("streamManager"); //add the consumer for execution mgr.addConsumer(nsv); } else { log.warn("Stream manager not found"); } return nsv; } public void doStart() throws Exception { log.debug("Start"); //create app context try { nsvContext = new FileSystemXmlApplicationContext(new String[]{"${red5.root}/plugins/icy.xml"}, true); } catch (Exception e) { nsvContext = new FileSystemXmlApplicationContext(new String[]{"classpath:/icy.xml"}, true); } } public void doStop() throws Exception { log.debug("Stop"); nsvContext.close(); } @Override public String getName() { return "icyPlugin"; } } red5-1.0~svn4374.orig-plugins/icyplugin/src/org/red5/server/icy/0000755000175000017500000000000011760512615024310 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/icyplugin/src/org/red5/server/icy/IICYMarshal.java0000644000175000017500000000306511260152251027213 0ustar drazzibdrazzibpackage org.red5.server.icy; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import org.red5.server.api.IScope; import org.red5.server.plugin.icy.marshal.transpose.AudioFramer; import org.red5.server.plugin.icy.marshal.transpose.VideoFramer; import org.red5.server.plugin.icy.stream.ICYStream; /** * Provides access to running data. * * @author Wittawas Nakkasem (vittee@hotmail.com) * @author Andy Shaules (bowljoman@hotmail.com) */ public interface IICYMarshal extends IICYHandler { public AudioFramer getAudioFramer(); public VideoFramer getVideoFramer(); public IScope getScope(); public ICYStream getStream(); public String getContentType(); public String getAudioType(); public String getVideoType(); } red5-1.0~svn4374.orig-plugins/icyplugin/src/org/red5/server/icy/IICYHandler.java0000644000175000017500000000310711260161677027212 0ustar drazzibdrazzibpackage org.red5.server.icy; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.util.Map; import org.apache.mina.core.buffer.IoBuffer; import org.red5.server.icy.message.Frame; /** * Lifecycle. * * @author Wittawas Nakkasem (vittee@hotmail.com) * @author Andy Shaules (bowljoman@hotmail.com) */ public interface IICYHandler { public void onConnected(String videoType, String audioType); public void onDisconnected(); public void onAuxData(String fourCC, IoBuffer buffer); public void onAudioData(byte[] data); public void onVideoData(byte[] data); public void onMetaData(Map metaData); public void onFrameData(Frame frame); public void reset(String content, String type); public int queueSize(); } red5-1.0~svn4374.orig-plugins/icyplugin/src/org/red5/server/icy/ICYStreamUtil.java0000644000175000017500000000602011261447124027605 0ustar drazzibdrazzibpackage org.red5.server.icy; import java.util.concurrent.atomic.AtomicInteger; import org.red5.server.icy.nsv.NSVStreamConfig; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** * NSV constants and utility functions * * @author Paul Gregoire (mondain@gmail.com) * @author Andy Shaules (bowljoman@hotmail.com) */ public class ICYStreamUtil { public static final int NSV_MAX_AUDIO_LEN = 0x8000; // 32kb public static final long NSV_MAX_VIDEO_LEN = 0x80000;// 512kb public static final int NSV_MAX_AUX_LEN = 0x8000; // 32kb for each aux stream public static final long NSV_MAX_AUXSTREAMS = 15; // 15 aux streams maximum public static final long NSV_SYNC_HEADERLEN_BITS = 192; public static final long NSV_NONSYNC_HEADERLEN_BITS = 56; public static final int NSV_NONSYNC_WORD = 0xbeef; public static final int NSV_SYNC_DWORD = makeType('N', 'S', 'V', 's'); public static final int NSV_HDR_DWORD = makeType('N', 'S', 'V', 'f'); private static AtomicInteger streamId = new AtomicInteger(0); public static double framerateToDouble(int fr) { double ret = 0; if ((fr & 0x80) == 0) { return fr; } double sc = 0; int d = fr & 0x7f >> 2; if (d < 16) { sc = 1.0 / (d + 1); } else { sc = d - 15; } int r = fr & 3; switch (r) { case 0: ret = 30.0 * sc; break; case 1: ret = 30.0 * 1000.0 / 1001.0 * sc; break; case 2: ret = 25.0 * sc; break; case 3: ret = 24.0 * 1000.0 / 1001.0 * sc; break; } return ret; } public static int makeType(char a, char b, char c, char d) { return (a | (b << 8) | (c << 16) | (d << 24)); } /** * Creates a stream config based on given properties. * * @param vidtype * @param audtype * @param width * @param height * @param frameRate * @return */ public static NSVStreamConfig createStreamConfig(String videoType, String audioType, int width, int height, double frameRate) { NSVStreamConfig newConfig = new NSVStreamConfig(); newConfig.streamId = streamId.incrementAndGet(); newConfig.videoFormat = videoType; newConfig.audioFormat = audioType; newConfig.videoWidth = width; newConfig.videoHeight = height; newConfig.frameRate = frameRate; return newConfig; } } red5-1.0~svn4374.orig-plugins/icyplugin/src/org/red5/server/icy/message/0000755000175000017500000000000011760512615025734 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/icyplugin/src/org/red5/server/icy/message/NSVFrame.java0000644000175000017500000000665011260161677030232 0ustar drazzibdrazzibpackage org.red5.server.icy.message; import org.red5.server.icy.BitStream; import org.red5.server.icy.ICYStreamUtil; import org.red5.server.icy.nsv.NSVStreamConfig; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** * Represents a single frame of NSV data. * * @author Andy Shaules (bowljoman@hotmail.com) */ public class NSVFrame extends Frame { public long frameType = 0x8080;//empty public int parser_info = 0; public int frameRateEncoded = 0x0; public int offsetCurrent = 0; public int numberAux = 0; public NSVFrame(NSVStreamConfig id, long type) { frameType = type; audioType = id.audioFormat; videoType = id.videoFormat; width = id.videoWidth; height = id.videoHeight; frameRate = id.frameRate; frameRateEncoded = id.frameRateEncoded; } /** * For output back to shoutcast server. */ public int[] toBitStream() { int[] ret = new int[1]; ret[0] = 0; int length = 0; BitStream bs = new BitStream(); switch ((frameType == ICYStreamUtil.NSV_SYNC_DWORD) ? 1 : 2) { case 1: length = 24 + (videoLength + audioLength); ret = new int[length]; ret[0] = 'N'; ret[1] = 'S'; ret[2] = 'V'; ret[3] = 's'; ret[4] = (byte) videoType.charAt(0); ret[5] = (byte) videoType.charAt(1); ret[6] = (byte) videoType.charAt(2); ret[7] = (byte) videoType.charAt(3); ret[8] = (byte) audioType.charAt(0); ret[9] = (byte) audioType.charAt(1); ret[10] = (byte) audioType.charAt(2); ret[11] = (byte) audioType.charAt(3); ret[12] = ((width << 8) >> 8); ret[13] = ((width) >> 8); ret[14] = ((height << 8) >> 8); ret[15] = ((height) >> 8); ret[16] = frameRateEncoded;//frame rate ret[17] = ((offsetCurrent << 8) >> 8); ret[18] = ((offsetCurrent) >> 8); bs.putBits(4, numberAux); bs.putBits(20, videoLength); bs.putBits(16, audioLength); for (int i = 0; i < 5; i++) { ret[19 + i] = bs.getbits(8); } for (int i = 0; i < videoLength; i++) { ret[24 + i] = videoData[i]; } for (int i = 0; i < audioLength; i++) { ret[(24 + videoLength + i)] = audioData[i]; } break; case 2: length = 7 + (videoLength + audioLength); ret = new int[length]; ret[0] = 0xef; ret[1] = 0xbe; bs.putBits(4, numberAux); bs.putBits(20, videoLength); bs.putBits(16, audioLength); for (int i = 0; i < 5; i++) { ret[2 + i] = bs.getbits(8); } for (int i = 0; i < videoLength; i++) { ret[7 + i] = videoData[i]; } for (int i = 0; i < audioLength; i++) { ret[(7 + videoLength + i)] = audioData[i]; } break; } return ret; } } red5-1.0~svn4374.orig-plugins/icyplugin/src/org/red5/server/icy/message/MP3Frame.java0000644000175000017500000000232311260152251030140 0ustar drazzibdrazzibpackage org.red5.server.icy.message; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** * Represents a single frame of MP3 data. * * @author Paul Gregoire (mondain@gmail.com) */ public class MP3Frame extends Frame { private final byte[] payload; public MP3Frame(byte[] payload) { this.payload = payload; } public byte[] getPayload() { return payload; } } red5-1.0~svn4374.orig-plugins/icyplugin/src/org/red5/server/icy/message/AACFrame.java0000644000175000017500000000232211260152251030124 0ustar drazzibdrazzibpackage org.red5.server.icy.message; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** * Represents a single frame of AAC data. * * @author Paul Gregoire (mondain@gmail.com) */ public class AACFrame extends Frame { private final byte[] payload; public AACFrame(byte[] payload) { this.payload = payload; } public byte[] getPayload() { return payload; } } red5-1.0~svn4374.orig-plugins/icyplugin/src/org/red5/server/icy/message/Frame.java0000644000175000017500000000307111260152251027621 0ustar drazzibdrazzibpackage org.red5.server.icy.message; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** * Simple abstract stream data frame. * * @author Paul Gregoire (mondain@gmail.com) */ public abstract class Frame { public long frameNumber = 0; public long timeStamp = 0; public String videoType; public String audioType; public int width = 0; public int height = 0; public double frameRate = 0; public int frameRateEncoded = 0x0; public int offsetCurrent = 0; public byte[] videoData; public byte[] audioData; public int videoLength = 0; public int audioLength = 0; public long getFrameNumber() { return frameNumber; } public void setFrameNumber(long frameNumber) { this.frameNumber = frameNumber; } } red5-1.0~svn4374.orig-plugins/icyplugin/src/org/red5/server/icy/nsv/0000755000175000017500000000000011760512615025116 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/icyplugin/src/org/red5/server/icy/nsv/NSVStreamConfig.java0000644000175000017500000000266411260161677030744 0ustar drazzibdrazzibpackage org.red5.server.icy.nsv; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** * Individual stream configuration generated from the parser when the shoutcast header is received. * * TODO: make this OO * * @author Paul Gregoire (mondain@gmail.com) * @author Andy Shaules (bowljoman@hotmail.com) */ public class NSVStreamConfig { public int streamId = -1; public String videoFormat = null; public String audioFormat = null; public int videoWidth = 0; public int videoHeight = 0; public double frameRate = 0; public int frameRateEncoded = 0x0; public long startTime = 0; } red5-1.0~svn4374.orig-plugins/icyplugin/src/org/red5/server/icy/nsv/NSVFrameQueue.java0000644000175000017500000000502611260161677030415 0ustar drazzibdrazzibpackage org.red5.server.icy.nsv; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.util.ArrayList; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock; import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock; import org.red5.server.icy.message.Frame; /** * Simple concurrent queue for storing NSV frames. * * TODO: ensure frames are in the correct order, check comparable * TODO: look at using a fifo queue instead of list * * @author Paul Gregoire (mondain@gmail.com) * @author Andy Shaules (bowljoman@hotmail.com) */ public class NSVFrameQueue { public AtomicLong totalFrames = new AtomicLong(0); public volatile ArrayList frames = new ArrayList(); private ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); private ReadLock readLock = lock.readLock(); private WriteLock writeLock = lock.writeLock(); public void addFrame(Frame frame) { long frameNumber = totalFrames.incrementAndGet(); frame.setFrameNumber(frameNumber); try { writeLock.lock(); frames.add(frame); } finally { writeLock.unlock(); } } public Frame getFrame() { try { writeLock.lock(); return frames.remove(0); } finally { writeLock.unlock(); } } public boolean hasFrames() { try { readLock.lock(); return (frames.isEmpty()) ? false : true; } finally { readLock.unlock(); } } public int count() { try { readLock.lock(); return frames.size(); } finally { readLock.unlock(); } } public void flush() { try { writeLock.lock(); frames.clear(); } finally { writeLock.unlock(); } } } red5-1.0~svn4374.orig-plugins/icyplugin/src/org/red5/server/icy/ServerTypes.java0000644000175000017500000000325011260152251027435 0ustar drazzibdrazzibpackage org.red5.server.icy; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /** * While the nsv consumer is running you can retrieve its current mode which will * indicate content type. When creating an nsv consumer, you only need to specify * client or server mode. It will determine the proper content type from the actual * shoutcast headers. * * @author Andy Shaules (bowljoman@hotmail.com) */ public class ServerTypes { /** * Acting like a shoutcast server for nsv tv encoder. */ public static int MODE_NSV_SERVER = 0; /** * Acting like a shoutcast client for nsv tv. */ public static int MODE_NSV_CLIENT = 1; /** * Acting like a shoutcast client. */ public static int MODE_SHOUT_CAST_CLIENT = 2; /** * Acting like a shoutcast server for the encoder. */ public static int MODE_SHOUT_CAST_SERVER = 3; } red5-1.0~svn4374.orig-plugins/icyplugin/src/org/red5/server/icy/ICYHandler.java0000644000175000017500000002770211260161677027110 0ustar drazzibdrazzibpackage org.red5.server.icy; import java.io.IOException; import java.net.InetSocketAddress; import java.net.SocketAddress; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import org.apache.commons.httpclient.HostConfiguration; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.HttpException; import org.apache.commons.httpclient.HttpMethod; import org.apache.commons.httpclient.methods.GetMethod; import org.apache.commons.httpclient.params.HttpClientParams; import org.apache.commons.httpclient.params.HttpMethodParams; import org.apache.mina.core.buffer.IoBuffer; import org.apache.mina.core.filterchain.IoFilter; import org.apache.mina.core.service.IoHandlerAdapter; import org.apache.mina.core.session.IdleStatus; import org.apache.mina.core.session.IoSession; import org.apache.mina.filter.codec.ProtocolCodecFactory; import org.apache.mina.filter.codec.ProtocolCodecFilter; import org.apache.mina.filter.codec.ProtocolDecoder; import org.apache.mina.filter.codec.ProtocolEncoder; import org.apache.mina.filter.logging.LoggingFilter; import org.apache.mina.transport.socket.SocketAcceptor; import org.apache.mina.transport.socket.nio.NioSocketAcceptor; import org.red5.server.icy.codec.ICYDecoder; import org.red5.server.icy.codec.ICYEncoder; import org.red5.server.icy.codec.ICYDecoder.ReadState; import org.red5.server.icy.message.AACFrame; import org.red5.server.icy.message.MP3Frame; import org.red5.server.icy.message.NSVFrame; import org.red5.server.icy.nsv.NSVStreamConfig; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * SHOUTcast / ICY protocol handler. * * @author Paul Gregoire (mondain@gmail.com) */ public class ICYHandler extends IoHandlerAdapter { private static Logger log = LoggerFactory.getLogger(ICYHandler.class); private static final String userAgent = "Mozilla/4.0 (compatible; Red5 Server/NSV plugin)"; private static ProtocolCodecFactory codecFactory = new ProtocolCodecFactory() { //coders can be shared private ProtocolEncoder icyEncoder = new ICYEncoder(); private ProtocolDecoder icyDecoder = new ICYDecoder(); public ProtocolEncoder getEncoder(IoSession session) { return icyEncoder; } public ProtocolDecoder getDecoder(IoSession session) { return icyDecoder; } }; private static IoFilter codecFilter = new ProtocolCodecFilter(codecFactory); private String host = "0.0.0.0"; private int port = 8001; private int mode = 0; private SocketAcceptor acceptor; private IoBuffer outBuffer; private IICYHandler handler; public NSVStreamConfig config; private boolean connected; //private long lastDataTs; private String password; //thread sleep period private int waitTime = 50; //data timeout in milliseconds private long dataTimeout = 10000; //password has been accepted private boolean validated; //determines how to notify players that the video is upside down private boolean notifyFlipped; private String audioType; public void start() { log.debug("Starting icy socket handler"); switch (mode) { case 1: // client mode // create a singular HttpClient object HttpClient client = new HttpClient(); // use proxy if specified if (System.getProperty("http.proxyHost") != null && System.getProperty("http.proxyPort") != null) { HostConfiguration config = client.getHostConfiguration(); config.setProxy(System.getProperty("http.proxyHost").toString(), Integer.parseInt( System.getProperty("http.proxyPort"))); } // establish a connection within 5 seconds client.getHttpConnectionManager().getParams().setConnectionTimeout(5000); //get the params for the client HttpClientParams params = client.getParams(); params.setParameter(HttpMethodParams.USER_AGENT, userAgent); //get registry file HttpMethod method = new GetMethod(host); //follow any 302's although there should not be any method.setFollowRedirects(true); // execute the method try { int code = client.executeMethod(method); log.debug("HTTP response code: {}", code); String resp = method.getResponseBodyAsString(); log.trace("Response: {}", resp); //TODO pipe input stream into mina //input = method.getResponseBodyAsStream(); } catch (HttpException he) { log.error("Http error connecting to {}", host, he); } catch (IOException ioe) { log.error("Unable to connect to {}", host, ioe); } finally { //client mode is automatically validated validated = true; if (method != null) { method.releaseConnection(); } } break; case 0: // server mode try { acceptor = new NioSocketAcceptor(); acceptor.setReuseAddress(true); acceptor.setHandler(this); if (log.isDebugEnabled()) { acceptor.getFilterChain().addLast("logger", new LoggingFilter()); } acceptor.getFilterChain().addLast("codec", codecFilter); acceptor.getSessionConfig().setReadBufferSize(1024); acceptor.getSessionConfig().setIdleTime(IdleStatus.BOTH_IDLE, 10); if ("".equals(host)) { acceptor.setDefaultLocalAddress(new InetSocketAddress(port)); acceptor.bind(); } else { Set addresses = new HashSet(); addresses.add(new InetSocketAddress(host, port)); acceptor.bind(addresses); } log.info("icy listening on port {}", port); connected = true; } catch (IOException ioe) { log.debug("Unable to setup connector on host: {} port: {}", host, port); log.error("Unable to setup connector", ioe); } break; default: log.debug("Unhandled mode: {}", mode); } outBuffer = IoBuffer.allocate(16); outBuffer.setAutoExpand(true); } public void reset() { log.debug("Resetting icy socket"); connected = false; validated = false; //lastDataTs = 0L; } public void stop() { log.debug("Stopping icy socket"); reset(); acceptor.unbind(); } @Override public void sessionOpened(IoSession session) throws Exception { super.sessionOpened(session); //add the password so it can be retrieved in the decoder log.debug("Adding password to session"); session.setAttribute("password", password); } @Override public void sessionClosed(IoSession session) throws Exception { //reset local props reset(); super.sessionClosed(session); } @SuppressWarnings("unchecked") @Override public void messageReceived(IoSession session, Object message) throws Exception { log.info("Incomming: {}", session.getRemoteAddress().toString()); log.trace("Message: {}", message.getClass().getName()); /* if (lastDataTs > 0) { long delta = System.currentTimeMillis() - lastDataTs; if (delta > dataTimeout) { log.debug("Data too late exit time: {} > timeout: {}", delta, dataTimeout); //disconnect if late? stop(); } } lastDataTs = System.currentTimeMillis(); log.debug("Data ts: {}", lastDataTs); */ //check state ReadState state = (ReadState) session.getAttribute("state"); log.debug("Current state: {}", state); //stream config NSVStreamConfig config = null; switch (state) { case Header: if (validated) { break; } validated = true; case Failed: outBuffer.put((byte[]) message); //flip it! outBuffer.flip(); //respond to the client session.write(outBuffer); break; case Ready: //handle meta log.debug("Pulling metadata"); Map metaData = (Map) session.getAttribute("meta"); if (metaData != null) { handler.onMetaData(metaData); } else { log.debug("Metadata was null for the session"); } //reset mode based on type log.debug("Checking type, resetting mode. Current mode: {}", mode); String[] type = ((String) metaData.get("type")).split("/"); if (mode == 3 || mode == 2) { if (type[0].equals("video")) { mode = (mode == 3) ? 0 : 1; } else { audioType = type[1]; } } else { if (type[0].equals("audio")) { if (mode == 0) { mode = 3; } else { mode = 2; } audioType = type[1]; } } //notify handler of mode change handler.reset(type[0], type[1]); //audio only if (mode == 2 || mode == 3) { //handler.onAudioData(bits); } //lookup stream config config = (NSVStreamConfig) session.getAttribute("nsvconfig"); if (config != null) { log.debug("NSV stream config found in session. Previous audio type: {}", audioType); log.debug("NSV types - audio: {} video: {}", config.audioFormat, config.videoFormat); handler.onConnected(config.videoFormat, config.audioFormat); //use standard codec meta tags. if (metaData == null) { metaData = new HashMap(); } //upside down format. Send negative values? if (notifyFlipped) { metaData.put("width", config.videoWidth); metaData.put("height", config.videoHeight); metaData.put("flipped", "true"); } else { metaData.put("width", config.videoWidth * -1); metaData.put("height", config.videoHeight * -1); } metaData.put("frameRate", config.frameRate); metaData.put("videoCodec", config.videoFormat); metaData.put("audioCodec", config.audioFormat); //send updated meta data handler.onMetaData(metaData); //get any aux data Map aux = (Map) session.removeAttribute("aux"); if (aux != null) { for (Map.Entry entry : aux.entrySet()) { handler.onAuxData(entry.getKey(), entry.getValue()); } } } //set to packet state session.setAttribute("state", ReadState.Packet); //allow fall through to packet case Packet: //lookup stream config config = (NSVStreamConfig) session.getAttribute("nsvconfig"); //check for a frame if (message instanceof NSVFrame) { //got a frame, writing to config handler.onFrameData((NSVFrame) message); } else if (message instanceof AACFrame) { //got a frame handler.onAudioData(((AACFrame) message).getPayload()); } else if (message instanceof MP3Frame) { //got a frame handler.onAudioData(((MP3Frame) message).getPayload()); } break; default: log.debug("Unhandled state"); } log.trace("Buffered frames: {}", handler.queueSize()); } @Override public void exceptionCaught(IoSession session, Throwable ex) throws Exception { log.debug("Exception occurred {}", session.getRemoteAddress().toString()); if (log.isDebugEnabled()) { //we want the stacktrace only if debugging log.warn("Exception: {}", ex); } session.close(true); //if we "stop" here then the port will need to be re-established reset(); } public String getHost() { return host; } public void setHost(String host) { this.host = host; } public int getPort() { return port; } public void setPort(int port) { this.port = port; } public int getMode() { return mode; } public void setMode(int mode) { this.mode = mode; } public IICYHandler getHandler() { return handler; } public void setHandler(IICYHandler handler) { this.handler = handler; } public void setPassword(String password) { this.password = password; } public int getWaitTime() { return waitTime; } public void setWaitTime(int waitTime) { this.waitTime = waitTime; } public long getDataTimeout() { return dataTimeout; } public void setDataTimeout(long dataTimeout) { this.dataTimeout = dataTimeout; } public boolean isNotifyFlipped() { return notifyFlipped; } public void setNotifyFlipped(boolean notifyFlipped) { this.notifyFlipped = notifyFlipped; } public boolean isConnected() { return connected; } } red5-1.0~svn4374.orig-plugins/icyplugin/src/org/red5/server/icy/BitStream.java0000644000175000017500000000632711260152251027044 0ustar drazzibdrazzibpackage org.red5.server.icy; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.io.*; /** * Provides a means to stream media via NSV and shoutcast. * For use with NSVCap, Winamp shoutcast dsp, and shoutcast dnas. * * @author Paul Gregoire (mondain@gmail.com) * @author Andy Shaules (bowljoman@hotmail.com) */ public class BitStream { private int allocated = 1; private long[] bits = new long[allocated]; public InputStream inputSource; private int used = 0; private int bitpos = 0; private int eof = 0; public BitStream() { } public BitStream(InputStream stream) { inputSource = stream; } /** * only tested 32 bits max per request. * * @param nbits * @param p_value */ public void putBits(int nbits, long value) { eof = 0; while (nbits-- > 0) { bits[used / 8] |= (value & 1) << (used & 7); if (((++used) & 7) == 0) { resize(1); } value >>= 1; } } /** * only tested 32 bit Maximum per request. * * @param nbits * @return */ public int getbits(int nbits) { if (used - bitpos < nbits) { if (!inputSource.equals(null)) { try { this.putBits(8, inputSource.read()); this.putBits(8, inputSource.read()); this.putBits(8, inputSource.read()); this.putBits(8, inputSource.read()); } catch (IOException ex) { eof = 1; return -1; } } else { eof = 1; return -1; } } int ret = 0; int sh = 0; int t = bitpos / 8; for (sh = 0; sh < nbits; sh++) { ret |= ((bits[t] >> (bitpos & 7)) & 1) << sh; if (((++bitpos) & 7) == 0) { t++; } } return ret; } public int eof() { eof = (used - bitpos == 0) ? 1 : 0; return eof; } public int rewind() { bitpos = 0; return used; } public int available() { return used - bitpos; } /** * Number of Bytes to add. * * @param size */ private void resize(int size) { long[] newBits = new long[allocated + size]; for (int i = 0; i < allocated; i++) { newBits[i] = bits[i]; } allocated += size; bits = newBits; } public void seek(int val) { bitpos += val; bitpos = bitpos < 0 ? 0 : bitpos; bitpos = bitpos > used ? used : bitpos; } public void compact() { System.out.println("Compacting"); int av = used - bitpos; long[] newBits = new long[av / 8 + 1]; for (int i = (bitpos / 8); i < av / 8 + 1; i++) { newBits[i] = bits[i]; } allocated = av / 8 + 1; bits = newBits; } } red5-1.0~svn4374.orig-plugins/icyplugin/src/org/red5/server/icy/codec/0000755000175000017500000000000011760512615025365 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/icyplugin/src/org/red5/server/icy/codec/ICYDecoder.java0000644000175000017500000006566611260161677030170 0ustar drazzibdrazzibpackage org.red5.server.icy.codec; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.nio.ByteBuffer; import java.util.HashMap; import java.util.Map; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; import org.apache.mina.core.buffer.IoBuffer; import org.apache.mina.core.session.IoSession; import org.apache.mina.filter.codec.CumulativeProtocolDecoder; import org.apache.mina.filter.codec.ProtocolDecoderOutput; import org.red5.server.icy.BitStream; import org.red5.server.icy.ICYStreamUtil; import org.red5.server.icy.message.AACFrame; import org.red5.server.icy.message.Frame; import org.red5.server.icy.message.MP3Frame; import org.red5.server.icy.message.NSVFrame; import org.red5.server.icy.nsv.NSVStreamConfig; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Decoder for data coming from a source. * * @author Paul Gregoire (mondain@gmail.com) * @author Andy Shaules (bowljoman@hotmail.com) */ public class ICYDecoder extends CumulativeProtocolDecoder { /** * State enumerator that indicates the reached state in the message * decoding process. */ public enum ReadState { /** Unrecoverable error occurred */ Failed, /** Trying to resync */ Sync, /** Waiting for a command */ Ready, /** Reading interleaved packet */ Packet, /** Not validated (password not yet checked) */ Notvalidated, /** Reading headers */ Header } private static Logger log = LoggerFactory.getLogger(ICYDecoder.class); private static final byte[] OK_MESSAGE = "OK2\r\nicy-caps:11\r\n\r\n".getBytes(); private static final byte[] BAD_PASSWD_MESSAGE = "invalid password\r\n".getBytes(); private static final Pattern PATTERN_CRLF = Pattern.compile("[\\r|\\n|\u0085|\u2028]{1,2}"); private static final Pattern PATTERN_HEADER = Pattern.compile("(icy-|content-).{1,}[:]{1}.{1,}", Pattern.DOTALL); private ThreadLocal frameLocal = new ThreadLocal(); @Override protected boolean doDecode(IoSession session, IoBuffer in, ProtocolDecoderOutput out) throws Exception { String hex = in.getHexDump(); log.debug("doDecode dump: {}", hex); boolean result = false; //check state ReadState state = (ReadState) session.getAttribute("state"); if (state == null) { state = ReadState.Notvalidated; } //collect the current incoming bytes IoBuffer curBuffer = IoBuffer.wrap(in.buf()); //index of the line-feed in the byte stream int lfIndex = -1; //get any previously read / unused bytes and put them in the front byte[] prevBuffer = (byte[]) session.removeAttribute("prev"); if (prevBuffer != null) { //wrap previous bytes IoBuffer tmp = IoBuffer.wrap(prevBuffer); tmp.setAutoExpand(true); //jump to the end tmp.position(tmp.limit()); //add current buffer to the end tmp.put(curBuffer); //flip tmp.flip(); //free the current buffer we are replacing curBuffer.free(); //replace with our new buffer curBuffer = tmp; log.debug("Current buffer dump (prep): {}", curBuffer.getHexDump()); } //most common action should live at the top of the switch! switch (state) { case Packet: //do normal media packet handling here log.trace("Hex (pkt): {}", curBuffer.getHexDump()); //we need at least 7 bytes to build a frame if (curBuffer.remaining() >= 7) { byte[] prefix = new byte[2]; curBuffer.get(prefix); //log.trace("Prefix: {}", new String(prefix)); //looking for 0xef, 0xbe bytes if (prefix[0] == (byte) 0xef && prefix[1] == (byte) 0xbe) { int position = curBuffer.position(); //read data for the stream if (chnkFrame(session, curBuffer)) { Frame frame = frameLocal.get(); if (frame != null) { //write frame as decoder output out.write(frame); //clear thread local frameLocal.remove(); } } else { //rewind back to original position + prefix length log.trace("Frame creation failed"); curBuffer.position(position - 2); } } else if (prefix[0] == (byte) 0xff && prefix[1] == (byte) 0xfb) { //look for MP3 sync FF FB log.debug("MP3 sync frame found"); int position = curBuffer.position(); //read all the configuration info for the stream if (syncFrameMP3(session, curBuffer)) { Frame frame = frameLocal.get(); if (frame != null) { //write frame as decoder output out.write(frame); //clear thread local frameLocal.remove(); } else { //let the handler know it should handle the "ready" stuff out.write(Boolean.TRUE); } } else { //rewind back to original position + sync dword length log.trace("MP3 Sync frame creation failed"); curBuffer.position(position - 2); } } else if (prefix[0] == (byte) 0xff && prefix[1] == (byte) 0xf9) { //look for AAC sync FF F9 5C 80 or FF F9 50 40 log.debug("AAC sync frame found"); int position = curBuffer.position(); //read all the configuration info for the stream if (syncFrameAAC(session, curBuffer)) { Frame frame = frameLocal.get(); if (frame != null) { //write frame as decoder output out.write(frame); //clear thread local frameLocal.remove(); } else { //let the handler know it should handle the "ready" stuff out.write(Boolean.TRUE); } } else { //rewind back to original position + sync dword length log.trace("AAC Sync frame creation failed"); curBuffer.position(position - 2); } } else { //rewind it back 2 log.trace("Data frame prefix not found - 0: {} 1: {}", prefix[0], prefix[1]); curBuffer.position(curBuffer.position() - 2); //look for sync frame byte[] sync = new byte[4]; curBuffer.get(sync); log.trace("Sync: {}", new String(sync)); int nsvSync = (sync[0] | (sync[1] << 8) | (sync[2] << 16) | (sync[3] << 24)); //we need at least 20 bytes if (curBuffer.remaining() >= 20 && nsvSync == ICYStreamUtil.NSV_SYNC_DWORD) { int position = curBuffer.position(); //read all the configuration info for the stream if (syncFrame(session, curBuffer)) { Frame frame = frameLocal.get(); if (frame != null) { //write frame as decoder output out.write(frame); //clear thread local frameLocal.remove(); } else { //let the handler know it should handle the "ready" stuff out.write(Boolean.TRUE); } } else { //rewind back to original position + sync dword length log.trace("Sync frame creation failed"); curBuffer.position(position - 4); } } else { //rewind it back 4 log.trace("Not enough data available for sync frame or wrong frame type"); curBuffer.position(curBuffer.position() - 4); } } } else { log.trace("Not enough data available for framing"); } break; case Ready: //look for NSV prefix log.trace("Hex (rdy): {}", curBuffer.getHexDump()); //do nsv handling, magic bytes = 4E 53 56 73 //consume bytes byte[] sync = new byte[4]; curBuffer.get(sync); log.trace("Sync: {}", new String(sync)); int nsvSync = (sync[0] | (sync[1] << 8) | (sync[2] << 16) | (sync[3] << 24)); log.trace("Sync: {} Dword: {}", nsvSync, ICYStreamUtil.NSV_SYNC_DWORD); //we need at least 20 bytes if (curBuffer.remaining() >= 20 && nsvSync == ICYStreamUtil.NSV_SYNC_DWORD) { int position = curBuffer.position(); //read all the configuration info for the stream if (syncFrame(session, curBuffer)) { Frame frame = frameLocal.get(); if (frame != null) { //write frame as decoder output out.write(frame); //clear thread local frameLocal.remove(); } else { //let the handler know it should handle the "ready" stuff out.write(Boolean.TRUE); } } else { //rewind back to original position + sync dword length log.trace("Sync frame creation failed"); curBuffer.position(position - 4); } } else if (sync[0] == (byte) 0xef && sync[1] == (byte) 0xbe) { //if we get a "data" frame here fail log.debug("Data frame found while awaiting initial sync frame, failing out"); state = ReadState.Failed; } else if (sync[0] == (byte) 0xff && sync[1] == (byte) 0xfb) { //look for MP3 sync FF FB log.debug("MP3 sync frame found"); int position = curBuffer.position(); //read all the configuration info for the stream if (syncFrameMP3(session, curBuffer)) { Frame frame = frameLocal.get(); if (frame != null) { //write frame as decoder output out.write(frame); //clear thread local frameLocal.remove(); } else { //let the handler know it should handle the "ready" stuff out.write(Boolean.TRUE); } } else { //rewind back to original position + sync dword length log.trace("MP3 Sync frame creation failed"); curBuffer.position(position - 4); } } else if (sync[0] == (byte) 0xff && sync[1] == (byte) 0xf9) { //look for AAC sync FF F9 5C 80 or FF F9 50 40 log.debug("AAC sync frame found"); int position = curBuffer.position(); //read all the configuration info for the stream if (syncFrameAAC(session, curBuffer)) { Frame frame = frameLocal.get(); if (frame != null) { //write frame as decoder output out.write(frame); //clear thread local frameLocal.remove(); } else { //let the handler know it should handle the "ready" stuff out.write(Boolean.TRUE); } } else { //rewind back to original position + sync dword length log.trace("AAC Sync frame creation failed"); curBuffer.position(position - 4); } } else { //rewind it back 4 log.trace("Not enough data available for sync frame or wrong frame type"); curBuffer.position(curBuffer.position() - 4); } //drop any remaining current buffer data into the session if (curBuffer.hasRemaining()) { log.debug("Had left over bytes after sync, adding to session"); //get the buffer info int pos = curBuffer.position(); int len = curBuffer.limit(); log.trace("Current pos: {} len: {} size: {}", new Object[]{pos, len, (len - pos)}); //consume bytes byte[] bf = new byte[(len - pos)]; curBuffer.get(bf); //put bytes into the session session.setAttribute("prev", bf); } break; case Notvalidated: //need to check password lfIndex = curBuffer.indexOf((byte) 0x0a); if (lfIndex > 0) { //get data as a string byte[] buf = new byte[lfIndex + 1]; curBuffer.get(buf); String msg = new String(buf, "US-ASCII"); log.debug("Not validated, check password {}", msg); //pull password from session String password = (String) session.getAttribute("password"); log.debug("Password from session: {}", password); String[] arr = null; try { arr = PATTERN_CRLF.split(msg); log.debug("Password data count: {}", arr.length); } catch (PatternSyntaxException ex) { log.warn("", ex); } if (password.equals(arr[0])) { log.debug("Passwords match!"); state = ReadState.Header; out.write(OK_MESSAGE); //check for remaining data if (curBuffer.hasRemaining()) { log.debug("Had left over bytes, adding to session"); //get the buffer info int pos = curBuffer.position(); int len = curBuffer.limit(); log.trace("Current pos: {} len: {} size: {}", new Object[]{pos, len, (len - pos)}); //consume bytes byte[] bf = new byte[(len - pos)]; curBuffer.get(bf); //put bytes into the session session.setAttribute("prev", bf); } } else { log.info("Invalid password {}, reset and close", arr[0]); state = ReadState.Failed; out.write(BAD_PASSWD_MESSAGE); } // result = true; } break; case Header: //max bytes to read when looking for LF int maxSearchBytes = 128; //search count int searched = 0; //buffer for storing bytes which may be headers IoBuffer headerBuf = IoBuffer.allocate(maxSearchBytes); //nio bytebuffer seems to work better for locating LF ByteBuffer byteBuffer = curBuffer.buf(); while (true) { //read a byte byte b = byteBuffer.get(); searched++; log.trace("Byte: {} searched: {}", b, searched); //make sure we dont search too far if (searched > maxSearchBytes) { log.debug("Searched past maximum range"); //add to prev bytes (outside this loop) break; } //store our byte for header checking headerBuf.put(b); //LF found if (b == 0x0a) { //flip so we can do some reading headerBuf.flip(); //get the buffer info log.trace("Current pos: {} len: {}", curBuffer.position(), curBuffer.limit()); log.trace("ByteBuffer pos: {} len: {}", byteBuffer.position(), byteBuffer.limit()); log.trace("Hex: {}", curBuffer.getHexDump()); //get data as a string byte[] buf = null; //look for the end of the header marker hex = headerBuf.getHexDump(); log.trace("Buffer head1: {}", hex); state = detectEndOfHeader(hex, state); if (state != ReadState.Ready) { //size our array buf = new byte[headerBuf.limit()]; //consume bytes headerBuf.get(buf); log.trace("Buffer head2: {}", headerBuf.getHexDump()); String header = new String(buf, "US-ASCII"); log.debug("Message {}", header); //pull out the headers and put into meta data parseHeader(session, header); //set result to true result = true; //check if theres remaining data to parse in current buffer if (curBuffer.hasRemaining()) { //clear already read data headerBuf.clear(); } else { //no more to read for now break; } } else if (state == ReadState.Ready) { log.debug("End of header found during header parse"); //consume the EOH bytes buf = hex.startsWith("0D 0A") ? new byte[2] : new byte[1]; headerBuf.get(buf); //set result to true just in-case no headers were read result = true; //drop any remaining current buffer data into the session if (curBuffer.hasRemaining()) { log.debug("Had left over bytes after EOH, adding to session"); //get the buffer info int pos = curBuffer.position(); int len = curBuffer.limit(); log.trace("Current pos: {} len: {} size: {}", new Object[]{pos, len, (len - pos)}); //consume bytes byte[] bf = new byte[(len - pos)]; curBuffer.get(bf); //put bytes into the session session.setAttribute("prev", bf); } //exit header read loop break; } //reset searched counter searched = 0; } } if (headerBuf.hasRemaining()) { log.debug("Had left over bytes, adding to session"); //get the buffer info int pos = headerBuf.position(); int len = headerBuf.limit(); log.trace("Header buffer pos: {} len: {} size: {}", new Object[]{pos, len, (len - pos)}); //consume bytes byte[] bf = new byte[(len - pos)]; headerBuf.get(bf); //put bytes into the session session.setAttribute("prev", bf); } break; case Failed: log.info("Stream error, closing"); session.close(true); break; default: log.warn("Unhandled state: {}", state); } // save attributes in session session.setAttribute("state", state); return result; } /** * Look for the end of the header block. This is different depending on the * client. *
* Winamp dsp sends (0A 0A) *
* NSVCAP sends (0D 0D 0A 0D 0D 0A 0D 0A) *
* * @param hex * @param state * @return */ private ReadState detectEndOfHeader(String hex, ReadState state) { if (hex.indexOf("0A") == 0 || hex.indexOf("0D 0A") == 0) { log.debug("End of header detected"); //set to ready state state = ReadState.Ready; } else if (hex.indexOf("4E 53 56") == 0) { //check also for NSV log.debug("End of header detected, found NSV"); //set to ready state state = ReadState.Ready; } return state; } @SuppressWarnings("unchecked") private void parseHeader(IoSession session, String header) { //lookup the metadata in the session Map metaData = (Map) session.getAttribute("meta"); if (metaData == null) { metaData = new HashMap(); session.setAttribute("meta", metaData); } //log.trace("Header length: {}", header.length()); if (header.length() > 0 && PATTERN_HEADER.matcher(header).matches()) { String key = header.substring(header.indexOf('-') + 1, header.indexOf(':')); String value = header.substring(header.indexOf(':') + 1); log.debug("Meta: {}={}", key, value); metaData.put(key, value.trim()); } else { //ignore 0 length headers if (header.length() > 0) { log.trace("Unrecognized header: {}", header); } } } @SuppressWarnings({ "unchecked", "unused" }) private void parseHeaders(IoSession session, String[] headers) { //lookup the metadata in the session Map metaData = (Map) session.getAttribute("meta"); if (metaData == null) { metaData = new HashMap(); session.setAttribute("meta", metaData); } for (String header : headers) { parseHeader(session, header); } } /** * Called when sync frame header is found. This may occur more than once during streaming. * The first 136 bits / 17 bytes should not change but the remaining 16 bits / 2 bytes may * change. * * @param session * @param ioBuffer contains nsv bitstream * @return true if frame create is successful, false otherwise */ private boolean syncFrame(IoSession session, IoBuffer ioBuffer) { boolean result = false; //get the buffer info int pos = ioBuffer.position(); int len = ioBuffer.limit(); int remain = ioBuffer.remaining(); log.trace("Buffer pos: {} len: {} size: {} remaining: {}", new Object[]{pos, len, (len - pos), remain}); //byte holders byte[] twoBytes = new byte[2]; byte[] fourBytes = new byte[4]; //stream configuration data NSVStreamConfig config = (NSVStreamConfig) session.getAttribute("nsvconfig"); if (config == null) { //first frame with full data ioBuffer.get(fourBytes); String videoType = new String(fourBytes); ioBuffer.get(fourBytes); String audioType = new String(fourBytes); log.debug("Types - video: {} audio: {}", videoType, audioType); //get dimensions ioBuffer.get(twoBytes); int width = (twoBytes[0] & 0xff) | ((twoBytes[1] & 0xff) << 8); ioBuffer.get(twoBytes); int height = (twoBytes[0] & 0xff) | ((twoBytes[1] & 0xff) << 8); int frameRateEncoded = ioBuffer.get(); //convert the fps double frameRate = ICYStreamUtil.framerateToDouble(frameRateEncoded); log.debug("Width: {} Height: {} Framerate: {}", new Object[]{width, height, frameRate}); //create a stream config config = ICYStreamUtil.createStreamConfig(videoType, audioType, width, height, frameRate); config.frameRateEncoded = frameRateEncoded; //add stream config to the session session.setAttribute("nsvconfig", config); } else { //read the first 13 bytes / 'N','S','V','s' already consumed ioBuffer.get(new byte[13]); } //create a sync frame NSVFrame frame = new NSVFrame(config, ICYStreamUtil.NSV_SYNC_DWORD); ioBuffer.get(twoBytes); //the a/v sync offset (number of milliseconds ahead of the video the audio is at this frame) //(treat as signed) frame.offsetCurrent = (twoBytes[0] & 0xff) | ((twoBytes[1] & 0xff) << 8); log.trace("a/v sync offset: {}", frame.offsetCurrent); //build the frames payload result = framePayload(session, ioBuffer, frame); return result; } /** * Called when chunk frame header is found. * * @param session * @param ioBuffer contains nsv bitstream * @return true if frame create is successful, false otherwise */ private boolean chnkFrame(IoSession session, IoBuffer ioBuffer) { boolean result = false; //get the buffer info int pos = ioBuffer.position(); int len = ioBuffer.limit(); int remain = ioBuffer.remaining(); log.trace("Buffer pos: {} len: {} size: {} remaining: {}", new Object[]{pos, len, (len - pos), remain}); //add stream config to the session NSVStreamConfig config = (NSVStreamConfig) session.getAttribute("nsvconfig"); NSVFrame frame = new NSVFrame(config, ICYStreamUtil.NSV_NONSYNC_WORD); //build the frames payload result = framePayload(session, ioBuffer, frame); return result; } /** * Constructs the frames payload. * * @param session * @param ioBuffer * @param frame * @return */ private boolean framePayload(IoSession session, IoBuffer ioBuffer, NSVFrame frame) { boolean result = false; BitStream bs0 = new BitStream(); bs0.putBits(8, ioBuffer.get()); bs0.putBits(8, ioBuffer.get()); bs0.putBits(8, ioBuffer.get()); //number of auxiliary data chunks int numAux = bs0.getbits(4); //aux length + video length. maximum 524288 + numAux * (32768 + 6) int videoAndAuxLen = bs0.getbits(20); bs0.putBits(8, ioBuffer.get()); bs0.putBits(8, ioBuffer.get()); //audio length. maximum allowed 32768 int audioLen = bs0.getbits(16); int bytesNeeded = videoAndAuxLen + audioLen; log.trace("Lengths - audio: {} video+aux: {} needed: {}", new Object[]{audioLen, videoAndAuxLen, bytesNeeded}); if (ioBuffer.remaining() >= bytesNeeded) { if (videoAndAuxLen > ICYStreamUtil.NSV_MAX_VIDEO_LEN / 8 || audioLen > ICYStreamUtil.NSV_MAX_AUDIO_LEN / 8) { log.debug("Video or audio length exceeds max allowed"); } else { //all is well, proceed int totalAuxUsed = 0; Map aux = null; if (numAux > 0) { log.debug("Number of aux: {}", numAux); byte[] twoBytes = new byte[2]; byte[] fourBytes = new byte[4]; aux = new HashMap(numAux); for (int a = 0; a < numAux; a++) { ioBuffer.get(twoBytes); //aux length. maximum allowed 32768 int auxLen = (twoBytes[0] & 0xff) | ((twoBytes[1] & 0xff) << 8); totalAuxUsed += auxLen + 6; ioBuffer.get(fourBytes); String auxType = new String(fourBytes); log.debug("Aux type: {}", auxType); IoBuffer buffer = IoBuffer.allocate(auxLen); byte[] auxBytes = new byte[auxLen]; ioBuffer.get(auxBytes); buffer.put(auxBytes); buffer.flip(); buffer.position(0); //add to the map aux.put(auxType, buffer); } session.setAttribute("aux", aux); } frame.videoLength = videoAndAuxLen; frame.videoData = new byte[videoAndAuxLen - totalAuxUsed]; ioBuffer.get(frame.videoData); frame.audioLength = audioLen; frame.audioData = new byte[audioLen]; ioBuffer.get(frame.audioData); frameLocal.set(frame); result = true; } } return result; } /** * Called when an AAC sync frame is found. * * @param session * @param ioBuffer contains aac data * @return true if frame create is successful, false otherwise */ private boolean syncFrameAAC(IoSession session, IoBuffer ioBuffer) { boolean result = false; //get the buffer info int pos = ioBuffer.position(); int len = ioBuffer.limit(); int remain = ioBuffer.remaining(); log.trace("Buffer pos: {} len: {} size: {} remaining: {}", new Object[]{pos, len, (len - pos), remain}); //rewind ioBuffer.position(0); //grab all the bytes available byte[] all = new byte[ioBuffer.remaining()]; ioBuffer.get(all); //create a sync frame AACFrame frame = new AACFrame(all); frameLocal.set(frame); //we may return false for some reason in the future result = true; return result; } /** * Called when an MP3 sync frame is found. * * @param session * @param ioBuffer contains mp3 data * @return true if frame create is successful, false otherwise */ private boolean syncFrameMP3(IoSession session, IoBuffer ioBuffer) { boolean result = false; //get the buffer info int pos = ioBuffer.position(); int len = ioBuffer.limit(); int remain = ioBuffer.remaining(); log.trace("Buffer pos: {} len: {} size: {} remaining: {}", new Object[]{pos, len, (len - pos), remain}); /* * 0xffe => synchronization bits * 0x1b => 11010b (11b == MPEG1 | 01b == Layer III | 0b == no CRC) * 0x9 => 128kbps * 0x00 => 00b == 44100 Hz | 0b == no padding | 0b == private bit * 0x44 => 0010b 0010b (00b == stereo | 10b == (unused) mode extension) * (0b == no copyright bit | 0b == original bit) * (00b == no emphasis) * Such a frame (MPEG1 Layer III) contains 1152 samples, its size is thus: * (1152*(128000/8))/44100 = 417.96 rounded to the next smaller integer, i.e. * 417. * * There are also 32 bytes (ie 8 32 bits values) to skip after the header for such frames */ //rewind ioBuffer.position(0); //grab all the bytes available byte[] all = new byte[ioBuffer.remaining()]; ioBuffer.get(all); //create a sync frame MP3Frame frame = new MP3Frame(all); frameLocal.set(frame); //we may return false for some reason in the future result = true; return result; } }red5-1.0~svn4374.orig-plugins/icyplugin/src/org/red5/server/icy/codec/ICYEncoder.java0000644000175000017500000000316411260152251030147 0ustar drazzibdrazzibpackage org.red5.server.icy.codec; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import org.apache.mina.core.buffer.IoBuffer; import org.apache.mina.core.session.IoSession; import org.apache.mina.filter.codec.ProtocolEncoderAdapter; import org.apache.mina.filter.codec.ProtocolEncoderException; import org.apache.mina.filter.codec.ProtocolEncoderOutput; /** * Encoder for data going out to a source. * * @author Paul Gregoire */ public class ICYEncoder extends ProtocolEncoderAdapter { public void encode(IoSession session, Object message, ProtocolEncoderOutput out) throws ProtocolEncoderException { IoBuffer buffer = null; if (message instanceof IoBuffer) { buffer = (IoBuffer) message; } else { buffer = IoBuffer.wrap((byte[]) message); } out.write(buffer); } } red5-1.0~svn4374.orig-plugins/icyplugin/src/org/red5/server/icy/IICYEventSink.java0000644000175000017500000000226511260152251027533 0ustar drazzibdrazzibpackage org.red5.server.icy; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import org.red5.server.api.event.IEvent; /** * Event sink. * * @author Wittawas Nakkasem (vittee@hotmail.com) * @author Andy Shaules (bowljoman@hotmail.com) */ public interface IICYEventSink { public void dispatchEvent(IEvent event); public void reset(); } red5-1.0~svn4374.orig-plugins/icyplugin/src/icy.xml0000644000175000017500000000332711260150712022072 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/icyplugin/.settings/0000755000175000017500000000000011760512615021717 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/icyplugin/.settings/org.eclipse.jdt.core.prefs0000644000175000017500000005305311260150712026676 0ustar drazzibdrazzib#Tue Sep 22 23:17:19 PDT 2009 eclipse.preferences.version=1 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 org.eclipse.jdt.core.formatter.blank_lines_after_package=1 org.eclipse.jdt.core.formatter.blank_lines_before_field=1 org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 org.eclipse.jdt.core.formatter.blank_lines_before_method=1 org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 org.eclipse.jdt.core.formatter.blank_lines_before_package=0 org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false org.eclipse.jdt.core.formatter.comment.format_block_comments=false org.eclipse.jdt.core.formatter.comment.format_header=false org.eclipse.jdt.core.formatter.comment.format_html=true org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false org.eclipse.jdt.core.formatter.comment.format_line_comments=false org.eclipse.jdt.core.formatter.comment.format_source_code=true org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true org.eclipse.jdt.core.formatter.comment.indent_root_tags=true org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert org.eclipse.jdt.core.formatter.comment.line_length=80 org.eclipse.jdt.core.formatter.compact_else_if=true org.eclipse.jdt.core.formatter.continuation_indentation=2 org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_empty_lines=false org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true org.eclipse.jdt.core.formatter.indentation.size=4 org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false org.eclipse.jdt.core.formatter.lineSplit=120 org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true org.eclipse.jdt.core.formatter.tabulation.char=mixed org.eclipse.jdt.core.formatter.tabulation.size=4 org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true red5-1.0~svn4374.orig-plugins/icyplugin/.settings/org.eclipse.jdt.ui.prefs0000644000175000017500000000016611260150712026360 0ustar drazzibdrazzib#Tue Sep 22 23:17:19 PDT 2009 eclipse.preferences.version=1 formatter_profile=_Red5 formatter_settings_version=11 red5-1.0~svn4374.orig-plugins/adminplugin/0000755000175000017500000000000011760512620020301 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/adminplugin/build.xml0000644000175000017500000000656611712071275022142 0ustar drazzibdrazzib java.home is ${java.home} and the target version is ${java.target_version} red5.root is ${red5.root} javac version: ${java.version} Type ant -p for available targets" red5-1.0~svn4374.orig-plugins/adminplugin/ivy.xml0000644000175000017500000000455511276701315021646 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/adminplugin/lib/0000755000175000017500000000000011760512620021047 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/adminplugin/ivysettings.xml0000644000175000017500000000125111250517101023403 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/adminplugin/.classpath0000644000175000017500000000106011273707437022274 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/adminplugin/.project0000644000175000017500000000056211250324757021761 0ustar drazzibdrazzib adminplugin org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature red5-1.0~svn4374.orig-plugins/adminplugin/build.bat0000644000175000017500000000000311250324757022067 0ustar drazzibdrazzibantred5-1.0~svn4374.orig-plugins/adminplugin/build.properties0000644000175000017500000000022211274175775023532 0ustar drazzibdrazzib# Let the scripts know where your red5 is (ie. the location of the red5.jar) red5.root=c:/red5 build.verbose=true build.fork=true debug.state=truered5-1.0~svn4374.orig-plugins/adminplugin/src/0000755000175000017500000000000011760512620021070 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/adminplugin/src/message_de.properties0000644000175000017500000000055611256232045025310 0ustar drazzibdrazzibtitle=Admin heading=Red5 Administration greeting=Willkommen, ist es jetzt error.missing-username=Benutzername nicht angegeben! error.missing-password=Kennwort nicht angegeben! error.too-low=Sie haben ein Passwort Länge von mehr als {0} angeben! required=Eingabe erforderlich typeMismatch=Ungültige Daten typeMismatch.percentage=Das ist keine Zahl! echo=Hallo Welt! red5-1.0~svn4374.orig-plugins/adminplugin/src/dispatcher-servlet.xml0000644000175000017500000000611711250324757025435 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/adminplugin/src/org/0000755000175000017500000000000011760512620021657 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/adminplugin/src/org/red5/0000755000175000017500000000000011760512620022516 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/adminplugin/src/org/red5/server/0000755000175000017500000000000011760512620024024 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/adminplugin/src/org/red5/server/plugin/0000755000175000017500000000000011760512620025322 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/adminplugin/src/org/red5/server/plugin/admin/0000755000175000017500000000000011760512620026412 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/adminplugin/src/org/red5/server/plugin/admin/dao/0000755000175000017500000000000011760512620027155 5ustar drazzibdrazzib././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootred5-1.0~svn4374.orig-plugins/adminplugin/src/org/red5/server/plugin/admin/dao/UserDetailsValidator.javared5-1.0~svn4374.orig-plugins/adminplugin/src/org/red5/server/plugin/admin/dao/UserDetailsValidator.0000644000175000017500000000460011250517101033241 0ustar drazzibdrazzibpackage org.red5.server.plugin.admin.dao; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import org.apache.commons.lang.StringUtils; import org.red5.logging.Red5LoggerFactory; import org.red5.server.plugin.admin.domain.UserDetails; import org.slf4j.Logger; import org.springframework.validation.Errors; import org.springframework.validation.Validator; public class UserDetailsValidator implements Validator { private static Logger log = Red5LoggerFactory.getLogger(UserDetailsValidator.class, "admin"); private int minLength = 4; @SuppressWarnings("unchecked") public boolean supports(Class clazz) { return UserDetails.class.equals(clazz); } public void validate(Object obj, Errors errors) { log.debug("validate"); UserDetails ud = (UserDetails) obj; if (ud == null) { log.debug("User details were null"); errors.rejectValue("username", "error.not-specified", null, "Value required."); } else { log.debug("User details were null"); if (StringUtils.isEmpty(ud.getUsername())) { errors.rejectValue("username", "error.missing-username", new Object[] {}, "Username Required."); } if (StringUtils.isEmpty(ud.getPassword())) { errors.rejectValue("password", "error.missing-password", new Object[] {}, "Password Required."); } else if (ud.getPassword().length() < minLength) { errors.rejectValue("password", "error.too-low", new Object[] { new Integer(minLength) }, "Password Length Is Too Small."); } } } public void setMinLength(int i) { minLength = i; } public int getMinLength() { return minLength; } }red5-1.0~svn4374.orig-plugins/adminplugin/src/org/red5/server/plugin/admin/dao/UserDAO.java0000644000175000017500000001046111250517101031255 0ustar drazzibdrazzibpackage org.red5.server.plugin.admin.dao; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import javax.sql.DataSource; import org.red5.logging.Red5LoggerFactory; import org.red5.server.plugin.admin.domain.UserDetails; import org.slf4j.Logger; import org.springframework.security.GrantedAuthority; import org.springframework.security.GrantedAuthorityImpl; /** * Simple DAO for manipulation of the user database. * * @author Paul Gregoire (mondain@gmail.com) */ public class UserDAO { private static Logger log = Red5LoggerFactory.getLogger(UserDAO.class, "admin"); public static boolean addUser(String username, String hashedPassword) { boolean result = false; Connection conn = null; PreparedStatement stmt = null; try { // JDBC stuff DataSource ds = UserDatabase.getDataSource(); conn = ds.getConnection(); //make a statement stmt = conn.prepareStatement("INSERT INTO APPUSER (username, password, enabled) VALUES (?, ?, 'enabled')"); stmt.setString(1, username); stmt.setString(2, hashedPassword); log.debug("Add user: {}", stmt.execute()); //add role stmt = conn.prepareStatement("INSERT INTO APPROLE (username, authority) VALUES (?, 'ROLE_SUPERVISOR')"); stmt.setString(1, username); log.debug("Add role: {}", stmt.execute()); // result = true; } catch (Exception e) { log.error("Error connecting to db", e); } finally { if (stmt != null) { try { stmt.close(); } catch (SQLException e) { } } if (conn != null) { try { conn.close(); } catch (SQLException e) { } } } return result; } public static UserDetails getUser(String username) { UserDetails details = null; Connection conn = null; PreparedStatement stmt = null; try { // JDBC stuff DataSource ds = UserDatabase.getDataSource(); conn = ds.getConnection(); //make a statement stmt = conn.prepareStatement("SELECT * FROM APPUSER WHERE username = ?"); stmt.setString(1, username); ResultSet rs = stmt.executeQuery(); if (rs.next()) { log.debug("User found"); details = new UserDetails(); details.setEnabled("enabled".equals(rs.getString("enabled"))); details.setPassword(rs.getString("password")); details.setUserid(rs.getInt("userid")); details.setUsername(rs.getString("username")); // rs.close(); //get role stmt = conn.prepareStatement("SELECT authority FROM APPROLE WHERE username = ?"); stmt.setString(1, username); rs = stmt.executeQuery(); if (rs.next()) { GrantedAuthority[] authorities = new GrantedAuthority[1]; authorities[0] = new GrantedAuthorityImpl(rs.getString("authority")); details.setAuthorities(authorities); // //if (daoAuthenticationProvider != null) { //User usr = new User(username, details.getPassword(), true, true, true, true, authorities); //daoAuthenticationProvider.getUserCache().putUserInCache(usr); //} } } rs.close(); } catch (Exception e) { log.error("Error connecting to db", e); } finally { if (stmt != null) { try { stmt.close(); } catch (SQLException e) { } } if (conn != null) { try { conn.close(); } catch (SQLException e) { } } } return details; } } red5-1.0~svn4374.orig-plugins/adminplugin/src/org/red5/server/plugin/admin/dao/UserDatabase.java0000644000175000017500000001266611274175775032416 0ustar drazzibdrazzibpackage org.red5.server.plugin.admin.dao; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import javax.sql.DataSource; import org.apache.derby.jdbc.EmbeddedDataSource; import org.red5.logging.Red5LoggerFactory; import org.slf4j.Logger; /** * Database setup for admin. * * http://db.apache.org/derby/docs/10.5/ref/ * jdbc:derby:;databaseName=newDB;create=true * * @author The Red5 Project (red5@osflash.org) * @author Paul Gregoire (mondain@gmail.com) */ public class UserDatabase { private static Logger log = Red5LoggerFactory.getLogger(UserDatabase.class, "admin"); private boolean debug; private static String database; private static String userName; private static String password; private static DataSource ds; public void init() { if (debug) { System.setProperty("derby.debug.true", ""); } //override derby log System.setProperty("derby.stream.error.method", "org.red5.logging.DerbyLogInterceptor.handleDerbyLogFile"); String prop = System.getenv("DERBY_HOME"); if (prop == null) { prop = System.getProperty("user.home"); } System.setProperty("derby.system.home", prop); log.debug("Setting derby home to: {}", prop); Connection conn = null; Statement stmt = null; try { // JDBC stuff try { if (ds == null) { log.debug("Creating new db - name: {} user: {} password: {}", new Object[]{database, userName, password}); EmbeddedDataSource eds = new EmbeddedDataSource(); eds.setCreateDatabase("create"); eds.setDataSourceName(database); eds.setDatabaseName(database); eds.setPassword(password); eds.setUser(userName); ds = eds; } } catch (Exception e) { log.error("Context check for datasource", e); } if (ds == null) { log.error("No usable datasource is set"); return; } //create the db and get a connection conn = ds.getConnection(); //make a statement stmt = conn.createStatement(); //check for table ResultSet rs = stmt.executeQuery("SELECT t.tablename FROM sys.systables t WHERE t.tabletype = 'T' AND t.tablename = 'APPUSER'"); if (rs.next()) { String tableName = rs.getString("tablename"); if (tableName != null) { log.debug("Tablename: {}", tableName); rs.close(); //check for entries rs = stmt.executeQuery("SELECT COUNT(userid) FROM APPUSER"); if (rs.next()) { log.debug("Records: {}", rs.getInt(1)); } } } else { log.debug("APPUSER table was not found"); //create the table if (stmt.execute("CREATE TABLE APPUSER(userid INT GENERATED BY DEFAULT AS IDENTITY, username VARCHAR(16), password VARCHAR(36), enabled VARCHAR(7) NOT NULL)")) { log.debug("Create user table executed"); } } rs.close(); //check for table rs = stmt.executeQuery("SELECT t.tablename FROM sys.systables t WHERE t.tabletype = 'T' AND t.tablename = 'APPROLE'"); if (rs.next()) { String tableName = rs.getString("tablename"); if (tableName != null) { log.debug("Tablename: {}", tableName); } } else { log.debug("APPROLE table was not found"); //create the table if (stmt.execute("CREATE TABLE APPROLE(username VARCHAR(16) NOT NULL PRIMARY KEY, authority VARCHAR(16) NOT NULL)")) { log.debug("Create role table executed"); } } rs.close(); } catch (Exception e) { log.error("Error in db setup", e); } finally { if (stmt != null) { try { stmt.close(); } catch (SQLException e) { } } if (conn != null) { try { conn.close(); } catch (SQLException e) { } } } } public void shutdown() { log.debug("Shutdown {} db", UserDatabase.database); try { //DriverManager.getConnection("jdbc:derby:" + UserDatabase.database + ";shutdown=true"); ((EmbeddedDataSource) ds).setShutdownDatabase("shutdown"); } catch (Exception e) { log.debug("Error in db shutdown", e); } } public boolean isDebug() { return debug; } public void setDebug(boolean debug) { this.debug = debug; } public static String getDatabase() { return database; } public void setDatabase(String database) { UserDatabase.database = database; } public static String getUserName() { return userName; } public void setUserName(String userName) { UserDatabase.userName = userName; } public static String getPassword() { return password; } public void setPassword(String password) { UserDatabase.password = password; } public static DataSource getDataSource() { return ds; } }red5-1.0~svn4374.orig-plugins/adminplugin/src/org/red5/server/plugin/admin/stats/0000755000175000017500000000000011760512620027550 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/adminplugin/src/org/red5/server/plugin/admin/stats/UserStatistics.java0000644000175000017500000000635111250517101033402 0ustar drazzibdrazzibpackage org.red5.server.plugin.admin.stats; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.Set; import org.red5.server.api.IClient; import org.red5.server.api.IConnection; import org.red5.server.api.IScope; import org.red5.server.api.ScopeUtils; import org.red5.server.plugin.admin.utils.Utils; /** * * @author The Red5 Project (red5@osflash.org) * @author Martijn van Beek (martijn.vanbeek@gmail.com) */ public class UserStatistics { private HashMap> apps; private int id; public HashMap> getStats(String userid, IScope scope) { apps = new HashMap>(); id = 0; IScope root = ScopeUtils.findRoot(scope); Set clients = root.getClients(); Iterator client = clients.iterator(); extractConnectionData(root); addData("User attributes", "--"); while (client.hasNext()) { IClient c = client.next(); if (c.getId().equals(userid)) { Set names = c.getAttributeNames(); Iterator itnames = names.iterator(); while (itnames.hasNext()) { String key = itnames.next(); addData(key, c.getAttribute(key)); } addData("Created", Utils.formatDate(c.getCreationTime())); } } return apps; } protected void addData(String name, Object value) { HashMap app = new HashMap(); app.put("name", name); app.put("value", value.toString()); apps.put(id, app); id++; } protected void extractConnectionData(IScope root) { Collection> conns = root.getConnections(); for (Set set : conns) { for (IConnection connection : set) { addData("Scope statistics", "--"); addData("Send bytes", Utils.formatBytes(connection .getWrittenBytes())); addData("Received bytes", Utils.formatBytes(connection .getReadBytes())); addData("Send messages", connection.getWrittenMessages()); addData("Received messages", connection.getReadMessages()); addData("Dropped messages", connection.getDroppedMessages()); addData("Pending messages", connection.getPendingMessages()); addData("Remote address", connection.getRemoteAddress() + ":" + connection.getRemotePort() + " (" + connection.getHost() + ")"); addData("Path", connection.getPath()); } } } }././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootred5-1.0~svn4374.orig-plugins/adminplugin/src/org/red5/server/plugin/admin/stats/ScopeStatistics.javared5-1.0~svn4374.orig-plugins/adminplugin/src/org/red5/server/plugin/admin/stats/ScopeStatistics.jav0000644000175000017500000000726611250517101033402 0ustar drazzibdrazzibpackage org.red5.server.plugin.admin.stats; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.Set; import org.red5.server.api.IConnection; import org.red5.server.api.IScope; import org.red5.server.api.persistence.IPersistable; import org.red5.server.api.persistence.IPersistenceStore; import org.red5.server.api.statistics.IScopeStatistics; import org.red5.server.plugin.admin.utils.Utils; /** * * @author The Red5 Project (red5@osflash.org) * @author Martijn van Beek (martijn.vanbeek@gmail.com) */ public class ScopeStatistics { private HashMap> apps; private int id; public HashMap> getStats(IScope root) { apps = new HashMap>(); id = 0; IScopeStatistics stats = root.getStatistics(); extractConnectionData(root); addData("Persistence Data", "--"); IPersistenceStore data = root.getStore(); Collection objects = data.getObjects(); Iterator iter = objects.iterator(); while (iter.hasNext()) { IPersistable name = iter.next(); addData("Name", name.getName()); addData("Type", name.getType()); addData("Path", name.getPath()); addData("Last modified", Utils.formatDate(name.getLastModified())); } addData("Scope Data", "--"); addData("Active sub scopes", stats.getActiveSubscopes()); addData("Total sub scopes", stats.getTotalSubscopes()); addData("Active clients", stats.getActiveClients()); addData("Total clients", stats.getTotalClients()); addData("Active connections", stats.getActiveConnections()); addData("Total connections", stats.getTotalConnections()); addData("Created", Utils.formatDate(stats.getCreationTime())); return apps; } protected void addData(String name, Object value) { HashMap app = new HashMap(); app.put("name", name); app.put("value", value.toString()); apps.put(id, app); id++; } protected void extractConnectionData(IScope root) { Collection> conns = root.getConnections(); for (Set set : conns) { for (IConnection connection : set) { addData("Scope statistics", "--"); addData("Send bytes", Utils.formatBytes(connection .getWrittenBytes())); addData("Received bytes", Utils.formatBytes(connection .getReadBytes())); addData("Send messages", connection.getWrittenMessages()); addData("Dropped messages", connection.getDroppedMessages()); addData("Pending messages", connection.getPendingMessages()); addData("Received messages", connection.getReadMessages()); addData("Remote address", connection.getRemoteAddress() + ":" + connection.getRemotePort() + " (" + connection.getHost() + ")"); addData("Path", connection.getPath()); } } } }red5-1.0~svn4374.orig-plugins/adminplugin/src/org/red5/server/plugin/admin/domain/0000755000175000017500000000000011760512620027661 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/adminplugin/src/org/red5/server/plugin/admin/domain/UserDetails.java0000644000175000017500000000613211250376203032751 0ustar drazzibdrazzibpackage org.red5.server.plugin.admin.domain; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import org.springframework.security.GrantedAuthority; public class UserDetails implements org.springframework.security.userdetails.UserDetails { private final static long serialVersionUID = 2801983490L; private GrantedAuthority[] authorities = new GrantedAuthority[1]; private int userid; private String username; private String password; private Boolean enabled; public UserDetails() { } public UserDetails(int userid) { this.userid = userid; } public int getUserid() { return userid; } public void setUserid(int userid) { this.userid = userid; } public void setUsername(String value) { username = value; } public String getUsername() { return username; } public void setPassword(String value) { password = value; } public String getPassword() { return password; } public Boolean getEnabled() { return enabled; } public void setEnabled(Boolean enabled) { this.enabled = enabled; } public void setEnabled(Integer enabledInt) { this.enabled = (enabledInt == 1); } public void setEnabled(String enabledStr) { this.enabled = "enabled".equals(enabledStr); } public void setAuthorities(GrantedAuthority[] authorities) { this.authorities = authorities; } public GrantedAuthority[] getAuthorities() { return authorities; } public boolean isAccountNonExpired() { return true; } public boolean isAccountNonLocked() { return true; } public boolean isCredentialsNonExpired() { return true; } public boolean isEnabled() { return enabled; } /** * Returns a hash code value for the object. This implementation computes * a hash code value based on the id fields in this object. * @return a hash code value for this object. */ @Override public int hashCode() { return userid; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof UserDetails)) { return false; } UserDetails other = (UserDetails) object; if (this.userid != other.userid) { return false; } return true; } }red5-1.0~svn4374.orig-plugins/adminplugin/src/org/red5/server/plugin/admin/client/0000755000175000017500000000000011760512620027670 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/adminplugin/src/org/red5/server/plugin/admin/client/AuthClient.java0000644000175000017500000000244111436757214032606 0ustar drazzibdrazzibpackage org.red5.server.plugin.admin.client; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import org.red5.server.Client; import org.red5.server.ClientRegistry; /** * * @author The Red5 Project (red5@osflash.org) * @author Martijn van Beek (martijn.vanbeek@gmail.com) */ public class AuthClient extends Client { public AuthClient() { super(null, null); } public AuthClient(String id, ClientRegistry registry) { super(id, registry); } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootred5-1.0~svn4374.orig-plugins/adminplugin/src/org/red5/server/plugin/admin/client/AuthClientRegistry.javared5-1.0~svn4374.orig-plugins/adminplugin/src/org/red5/server/plugin/admin/client/AuthClientRegistry0000644000175000017500000000662711256230767033430 0ustar drazzibdrazzibpackage org.red5.server.plugin.admin.client; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.util.ArrayList; import java.util.HashMap; import org.red5.server.ClientRegistry; import org.red5.server.api.IClient; import org.red5.server.api.IScope; import org.red5.server.api.Red5; import org.red5.server.exception.ClientNotFoundException; import org.red5.server.exception.ClientRejectedException; import org.springframework.security.BadCredentialsException; import org.springframework.security.providers.ProviderManager; import org.springframework.security.providers.UsernamePasswordAuthenticationToken; import org.red5.logging.Red5LoggerFactory; import org.slf4j.Logger; /** * * @author The Red5 Project (red5@osflash.org) * @author Martijn van Beek (martijn.vanbeek@gmail.com) */ public class AuthClientRegistry extends ClientRegistry { private static Logger log = Red5LoggerFactory.getLogger(AuthClientRegistry.class, "admin"); protected IScope masterScope; protected IClient client; public AuthClientRegistry() { super(); } @SuppressWarnings("unchecked") @Override public IClient newClient(Object[] params) throws ClientNotFoundException, ClientRejectedException { log.debug("New client - params: {}, {}, {}", params); if (params == null || params.length == 0) { log.warn("Client didn't pass a username."); throw new ClientRejectedException(); } String username, passwd; if (params[0] instanceof HashMap) { // Win FP sends HashMap HashMap userWin = (HashMap) params[0]; username = (String) userWin.get(0); passwd = (String) userWin.get(1); } else if (params[0] instanceof ArrayList) { // Mac FP sends ArrayList ArrayList userMac = (ArrayList) params[0]; username = (String) userMac.get(0); passwd = (String) userMac.get(1); } else { throw new ClientRejectedException(); } UsernamePasswordAuthenticationToken t = new UsernamePasswordAuthenticationToken(username, passwd); masterScope = Red5.getConnectionLocal().getScope(); ProviderManager mgr = (ProviderManager) masterScope.getContext().getBean("authenticationManager"); try { log.debug("Checking password: {}", passwd); t = (UsernamePasswordAuthenticationToken) mgr.authenticate(t); } catch (BadCredentialsException ex) { log.debug("{}", ex); throw new ClientRejectedException(); } if (t.isAuthenticated()) { client = new AuthClient(nextId(), this); addClient(client); client.setAttribute("authInformation", t); log.debug("Authenticated client - username: {}, id: {}", new Object[] { username, client.getId() }); } return client; } }red5-1.0~svn4374.orig-plugins/adminplugin/src/org/red5/server/plugin/admin/client/ClientManager.java0000644000175000017500000000626711252062106033252 0ustar drazzibdrazzibpackage org.red5.server.plugin.admin.client; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import org.red5.server.api.IScope; import org.red5.server.api.ScopeUtils; import org.red5.server.api.so.ISharedObject; import org.red5.server.api.so.ISharedObjectService; /** * Class that keeps a list of client names in a SharedObject. * * @author The Red5 Project (red5@osflash.org) * @author Joachim Bauch (jojo@struktur.de) */ public class ClientManager { /** Stores the name of the SharedObject to use. */ private String name; /** Should the SharedObject be persistent? */ private boolean persistent; /** * Create a new instance of the client manager. * * @param name * name of the shared object to use * @param persistent * should the shared object be persistent */ public ClientManager(String name, boolean persistent) { this.name = name; this.persistent = persistent; } /** * Return the shared object to use for the given scope. * * @param scope * the scope to return the shared object for * @return the shared object to use */ private ISharedObject getSharedObject(IScope scope) { ISharedObjectService service = (ISharedObjectService) ScopeUtils.getScopeService(scope, ISharedObjectService.class, false); return service.getSharedObject(scope, name, persistent); } /** * A new client connected. This adds the username to * the shared object of the passed scope. * * @param scope * scope the client connected to * @param username * name of the user that connected * @param uid * the unique id of the user that connected */ public void addClient(IScope scope, String username, String uid) { ISharedObject so = getSharedObject(scope); so.setAttribute(uid, username); } /** * A client disconnected. This removes the username from * the shared object of the passed scope. * * @param scope * scope the client disconnected from * @param uid * unique id of the user that disconnected * @return the username of the disconnected user */ public String removeClient(IScope scope, String uid) { ISharedObject so = getSharedObject(scope); if (!so.hasAttribute(uid)) { // SharedObject is empty. This happens when the last client // disconnects. return null; } String username = so.getStringAttribute(uid); so.removeAttribute(uid); return username; } } red5-1.0~svn4374.orig-plugins/adminplugin/src/org/red5/server/plugin/admin/utils/0000755000175000017500000000000011760512620027552 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/adminplugin/src/org/red5/server/plugin/admin/utils/Utils.java0000644000175000017500000000317311250376203031520 0ustar drazzibdrazzibpackage org.red5.server.plugin.admin.utils; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.text.SimpleDateFormat; import java.util.Calendar; /** * * @author The Red5 Project (red5@osflash.org) * @author Martijn van Beek (martijn.vanbeek@gmail.com) * @author Daniel Rossi */ public class Utils { public static String formatDate(long d) { Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(d); SimpleDateFormat date = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z"); return date.format(calendar.getTime()); } public static String formatBytes(long d) { String out = d + ""; if (d < 1024) { out = d + " Bytes"; } else if (d > 1024) { out = (d / 1024) + " KB"; } else if (d > 104858) { out = (d / 1000000) + " MB"; } return out; } }././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootred5-1.0~svn4374.orig-plugins/adminplugin/src/org/red5/server/plugin/admin/utils/PasswordGenerator.javared5-1.0~svn4374.orig-plugins/adminplugin/src/org/red5/server/plugin/admin/utils/PasswordGenerator.j0000644000175000017500000000326511250376203033403 0ustar drazzibdrazzibpackage org.red5.server.plugin.admin.utils; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import org.springframework.security.providers.encoding.Md5PasswordEncoder; /** * * @author The Red5 Project (red5@osflash.org) * @author Daniel Rossi */ public class PasswordGenerator { private String password; private String salt = "secret"; private Md5PasswordEncoder md5 = new Md5PasswordEncoder(); public static void main(String args[]) { PasswordGenerator generate = new PasswordGenerator(args[0], args[1]); generate.run(); } public PasswordGenerator(String password, String salt) { this.salt = salt; this.password = password; } public String getPassword() { return md5.encodePassword(this.password, this.salt).toString(); } public void run() { System.out.println(md5.encodePassword(this.password, this.salt).toString()); } } red5-1.0~svn4374.orig-plugins/adminplugin/src/org/red5/server/plugin/admin/AdminHandler.java0000644000175000017500000002300211274175775031620 0ustar drazzibdrazzibpackage org.red5.server.plugin.admin; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.util.HashMap; import java.util.Iterator; import java.util.Locale; import java.util.Set; import org.red5.logging.Red5LoggerFactory; import org.red5.server.Scope; import org.red5.server.api.IBasicScope; import org.red5.server.api.IClient; import org.red5.server.api.IConnection; import org.red5.server.api.IScope; import org.red5.server.api.IScopeHandler; import org.red5.server.api.Red5; import org.red5.server.api.ScopeUtils; import org.red5.server.api.event.IEvent; import org.red5.server.api.service.IServiceCall; import org.red5.server.api.service.ServiceUtils; import org.red5.server.plugin.admin.stats.ScopeStatistics; import org.red5.server.plugin.admin.stats.UserStatistics; import org.slf4j.Logger; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ResourceBundleMessageSource; /** * Primary "admin" class, it handles all the features and functions of a * standard red5 application. This code is based on original code in the * admin application. * * @author Paul Gregoire */ public class AdminHandler implements IScopeHandler { private static Logger log = Red5LoggerFactory.getLogger(AdminHandler.class, "admin"); private static ResourceBundleMessageSource messageSource; private IScope scope; private HashMap scopes; private int scopeId = 0; private ApplicationContext context; public boolean start(IScope scope) { log.info("start: {}", scope); return true; } public void stop(IScope scope) { log.info("stop: {}", scope); if (scope != null) { //un-initializing admin scope and children ((Scope) this.scope).uninit(); } } public boolean handleEvent(IEvent event) { log.debug("Scope event: {}", event); return false; } public boolean connect(IConnection conn, IScope scope, Object[] params) { log.info("connect - conn: {} params: {} scope: {}", new Object[]{conn, params, scope}); return true; } public void disconnect(IConnection conn, IScope scope) { log.info("disconnect"); // Get the previously stored username String rid = conn.getClient().getId(); // Unregister user log.info("Client with id {} disconnected.", rid); } public boolean join(IClient client, IScope scope) { log.info("join - client: {} scope: {}", new Object[]{client, scope}); return true; } public void leave(IClient client, IScope scope) { log.info("leave"); } public boolean addChildScope(IBasicScope scope) { log.info("addChildScope: {}", scope); return false; } public void removeChildScope(IBasicScope scope) { log.info("removeChildScope: {}", scope); } public boolean serviceCall(IConnection conn, IServiceCall call) { log.info("serviceCall {}", call); return true; } /** * Get all running applications * * @return HashMap containing all applications */ public HashMap getApplications() { IScope root = ScopeUtils.findRoot(scope); Iterator iter = root.getScopeNames(); HashMap apps = new HashMap(); int id = 0; while (iter.hasNext()) { String name = iter.next(); String name2 = name.substring(1, name.length()); int size = getConnections(name2).size(); HashMap app = new HashMap(); app.put("name", name2); app.put("clients", size + ""); apps.put(id, app); id++; } return apps; } /** * Get Application statistics. * * @param scopeName * @return HashMap with the statistics */ public HashMap> getStatistics(String scopeName) { ScopeStatistics scopestats = new ScopeStatistics(); return scopestats.getStats(getScope(scopeName)); } /** * Get Client statistics * * @param userid * @return HashMap with the statistics */ public HashMap> getUserStatistics(String userid) { UserStatistics userstats = new UserStatistics(); return userstats.getStats(userid, scope); } /** * Get all the scopes * * @param scopeName * @return HashMap containing all the scopes */ public HashMap getScopes(String scopeName) { IScope root = ScopeUtils.findRoot(scope); IScope scopeObj = root.getScope(scopeName); scopes = new HashMap(); try { getRooms(scopeObj, 0); } catch (NullPointerException npe) { log.debug(npe.toString()); } return scopes; } /** * Get all the scopes * * @param root * the scope to from * @param depth * scope depth */ public void getRooms(IScope root, int depth) { Iterator iter = root.getScopeNames(); String indent = ""; for (int i = 0; i < depth; i++) { indent += " "; } while (iter.hasNext()) { String name = iter.next(); String name2 = name.substring(1, name.length()); try { IScope parent = root.getScope(name2); // parent getRooms(parent, depth + 1); scopes.put(scopeId, indent + name2); scopeId++; // log.info("Found scope: "+name2); } catch (NullPointerException npe) { log.debug(npe.toString()); } } } /** * Get all the connections (clients) * * @param scopeName * @return HashMap with all clients in the given scope */ public HashMap getConnections(String scopeName) { HashMap connections = new HashMap(); IScope root = getScope(scopeName); if (root != null) { Set clients = root.getClients(); Iterator client = clients.iterator(); int id = 0; while (client.hasNext()) { IClient c = client.next(); String user = c.getId(); connections.put(id, user); id++; } } return connections; } /** * Kill a client * * @param userid */ public void killUser(String userid) { IScope root = ScopeUtils.findRoot(scope); Set clients = root.getClients(); Iterator client = clients.iterator(); while (client.hasNext()) { IClient c = client.next(); if (c.getId().equals(userid)) { c.disconnect(); } } } /** * Get an scope by name * * @param scopeName * @return IScope the requested scope */ private IScope getScope(String scopeName) { IScope root = ScopeUtils.findRoot(scope); return getScopes(root, scopeName); } /** * Search through all the scopes in the given scope to a scope with the * given name * * @param root * @param scopeName * @return IScope the requested scope */ private IScope getScopes(IScope root, String scopeName) { // log.info("Found scope "+root.getName()); if (root.getName().equals(scopeName)) { return root; } else { Iterator iter = root.getScopeNames(); while (iter.hasNext()) { String name = iter.next(); String name2 = name.substring(1, name.length()); try { IScope parent = root.getScope(name2); IScope scope = getScopes(parent, scopeName); if (scope != null) { return scope; } } catch (NullPointerException npe) { log.debug(npe.toString()); } } } return null; } /** * Get the root scope * * @return IScope */ public IScope getScope() { return scope; } public void setScope(IScope scope) { this.scope = scope; } public void setContext(ApplicationContext ctx) { this.context = ctx; messageSource = (ResourceBundleMessageSource) context.getBean("adminMessageSource"); } /** * Method for setting locale property on the connection. * * @param localeId */ public void setLocale(String localeId) { IConnection conn = Red5.getConnectionLocal(); if (conn != null) { conn.setAttribute("locale", localeId); } } /** * onError callback invoker. * * @param code * @param args */ public static boolean sendError(String code, Object[] args) { boolean sent = false; IConnection conn = Red5.getConnectionLocal(); if (conn != null) { Locale locale = Locale.ENGLISH; if (conn.hasAttribute("locale")) { // http://java.sun.com/j2se/1.5.0/docs/api/java/util/Locale.html String[] parts = conn.getStringAttribute("locale").split("[-_]"); if (parts.length == 1) { locale = new Locale(parts[0]); } else { locale = new Locale(parts[0], parts[1]); } } String errorMessage = messageSource.getMessage(code, args, locale); log.debug("Sending error to client: {}", errorMessage); if (ServiceUtils.invokeOnConnection(conn, "onError", new Object[]{errorMessage})) { //call succeeded sent = true; } else { log.warn("Send error failed - client id: {} method: {}", conn.getClient().getId()); } } else { log.warn("Connection was not found for sending error"); } return sent; } /** * Locale echo test. */ public void echo() { sendError("echo", null); } } red5-1.0~svn4374.orig-plugins/adminplugin/src/org/red5/server/plugin/admin/AdminPlugin.java0000644000175000017500000000731511256230767031503 0ustar drazzibdrazzibpackage org.red5.server.plugin.admin; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import org.red5.logging.Red5LoggerFactory; import org.red5.server.Context; import org.red5.server.GlobalScope; import org.red5.server.MappingStrategy; import org.red5.server.Scope; import org.red5.server.ScopeResolver; import org.red5.server.api.IScope; import org.red5.server.plugin.Red5Plugin; import org.red5.server.plugin.admin.client.AuthClientRegistry; import org.red5.server.service.ServiceInvoker; import org.slf4j.Logger; import org.springframework.context.ApplicationContext; import org.springframework.context.support.FileSystemXmlApplicationContext; /** * Admin for Red5 * * @author Paul Gregoire * @author Dan Rossi */ public class AdminPlugin extends Red5Plugin { private static Logger log = Red5LoggerFactory.getLogger(AdminPlugin.class, "admin"); private AdminHandler handler = null; private ApplicationContext adminContext; private String hostName = "localhost"; @Override public void doStart() throws Exception { super.doStart(); //create a handler handler = new AdminHandler(); //create app context adminContext = new FileSystemXmlApplicationContext(new String[]{"classpath:/admin-security.xml"}, true, context); //set the context handler.setContext(adminContext); //get a ref to the "default" global scope GlobalScope global = (GlobalScope) server.getGlobal("default"); //create a scope resolver ScopeResolver scopeResolver = new ScopeResolver(); scopeResolver.setGlobalScope(global); AuthClientRegistry registry = (AuthClientRegistry) adminContext.getBean("authClientRegistry"); //create a context - this takes the place of the previous web context Context ctx = new Context(adminContext, "admin"); ctx.setClientRegistry(registry); ctx.setMappingStrategy(new MappingStrategy()); ctx.setPersistanceStore(global.getStore()); ctx.setScopeResolver(scopeResolver); ctx.setServiceInvoker(new ServiceInvoker()); //create a scope for the admin Scope scope = new Scope.Builder((IScope) global, "scope", "admin", false).build(); scope.setContext(ctx); scope.setHandler(handler); //set the scope on the handler handler.setScope(scope); server.addMapping(hostName, "admin", "default"); if (global.addChildScope(scope)) { log.info("Admin scope was added to global (default) scope"); } else { log.warn("Admin scope was not added to global (default) scope"); } } @Override public void doStop() throws Exception { super.doStop(); //clean up / unregister everything server.removeMapping(hostName, "admin"); handler.stop(null); } @Override public String getName() { return "adminPlugin"; } @Override public void init() { log.debug("Initializing"); super.init(); } public String getHostName() { return hostName; } public void setHostName(String hostName) { this.hostName = hostName; } } red5-1.0~svn4374.orig-plugins/adminplugin/src/derby.properties0000644000175000017500000000452011250324757024322 0ustar drazzibdrazzib###################################################################### # Example DEBUG derby.properties file ## Create the derby.properties file in the derby.system.home folder. ## By default the derby.log file is written to derby.system.home. If you are unsure ## where to place the properties use the folder containing the derby.log file. ## Uncomment properties preceeded by the string '#.. ' to make them active. ################################################### ## The next three properties can be set for all test situations. They have a ## very slight performance impact but insure we get all messages ## and that the log is not automatically removed. # -- Append to the log file rather than overwriting it - manually remove # -- the derby.log when it becomes large derby.infolog.append=true # -- Log all errors/messages of any severity (will list deadlocks) derby.stream.error.logSeverityLevel=0 # -- Log all Network Server connections (if any) derby.drda.logConnections=true ################################################## ## When you need to trace what requests (SQL) the application(s) is/are ## making of Cloudscape set the following property (Uncomment the line). ## !! CAUTION !! : You will need to manage the size of the derby.log file ## !! - it can grow to 100's of MBs or larger !! # -- Log all SQL received #.. derby.language.logStatementText=true ################################################### ## Performance problems: # -- write query plan to log #.. derby.language.logQueryPlan=true ################################################### ## If you are encountering locking / concurrency problems set (uncomment) the ## following two properties # -- Log all deadlocks #.. derby.locks.monitor=true # -- Writes a stack trace of all threads involved in lock problems # -- (not just the victims) to the log #.. derby.locks.deadlockTrace=true #################################################### ## These properties adjust the time a process will wait for a lock and ## how often Cloudscape checks for deadlocks. # -- Hold locks for five minutes before timeout #.. derby.locks.waitTimeout=300 # -- If deadlocks are occurring lengthen wait # -- (waitTimeout must be < deadlockTimeout) #.. derby.locks.deadlockTimeout=310 # END of Example properties file red5-1.0~svn4374.orig-plugins/adminplugin/src/logback-admin.xml0000644000175000017500000000131011250324757024303 0ustar drazzibdrazzib admin log/admin.log false UTF-8 false true %date [%thread] %-5level %logger{35} - %msg%n red5-1.0~svn4374.orig-plugins/adminplugin/src/message_fr.properties0000644000175000017500000000061711256232045025325 0ustar drazzibdrazzibtitle=Admin heading=Red5 Administration greeting=Bienvenue, il est maintenant de error.missing-username=Nom d'utilisateur non spécifiée! error.missing-password=Mot de passe non spécifié! error.too-low=Vous devez spécifier une longueur supérieure à {0} Mot de passe! required=D'entrée requis typeMismatch=Données invalides typeMismatch.percentage=Ce n'est pas un numéro! echo=Bonjour tout le monde! red5-1.0~svn4374.orig-plugins/adminplugin/src/message.properties0000644000175000017500000000054311256230767024645 0ustar drazzibdrazzibtitle=Administration heading=Red5 Administration greeting=Welcome, it is now error.missing-username=Username not specified! error.missing-password=Password not specified! error.too-low=You have to specify a password length higher than {0}! required=Entry required typeMismatch=Invalid data typeMismatch.percentage=That is not a number! echo=Hello world! red5-1.0~svn4374.orig-plugins/adminplugin/src/message_es.properties0000644000175000017500000000061311256232045025321 0ustar drazzibdrazzibtitle=Admin heading=Red5 Administration greeting=Bienvenido, es ahora de error.missing-username=Nombre de usuario no especificado! error.missing-password=Contraseña no especificado! error.too-low=Usted tiene que especificar una contraseña de longitud superior a {0}! required=Entrada obligatoria typeMismatch=Los datos no válidos typeMismatch.percentage=Eso no es un número! echo=¡Hola, mundo! red5-1.0~svn4374.orig-plugins/adminplugin/src/admin-security.xml0000644000175000017500000001111311254774153024555 0ustar drazzibdrazzib seKret message red5-1.0~svn4374.orig-plugins/adminplugin/.settings/0000755000175000017500000000000011760512620022217 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/adminplugin/.settings/org.eclipse.jdt.core.prefs0000644000175000017500000005305311250376203027206 0ustar drazzibdrazzib#Fri Sep 04 21:08:42 PDT 2009 eclipse.preferences.version=1 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 org.eclipse.jdt.core.formatter.blank_lines_after_package=1 org.eclipse.jdt.core.formatter.blank_lines_before_field=1 org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 org.eclipse.jdt.core.formatter.blank_lines_before_method=1 org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 org.eclipse.jdt.core.formatter.blank_lines_before_package=0 org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false org.eclipse.jdt.core.formatter.comment.format_block_comments=false org.eclipse.jdt.core.formatter.comment.format_header=false org.eclipse.jdt.core.formatter.comment.format_html=true org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false org.eclipse.jdt.core.formatter.comment.format_line_comments=false org.eclipse.jdt.core.formatter.comment.format_source_code=true org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true org.eclipse.jdt.core.formatter.comment.indent_root_tags=true org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert org.eclipse.jdt.core.formatter.comment.line_length=80 org.eclipse.jdt.core.formatter.compact_else_if=true org.eclipse.jdt.core.formatter.continuation_indentation=2 org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_empty_lines=false org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true org.eclipse.jdt.core.formatter.indentation.size=4 org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false org.eclipse.jdt.core.formatter.lineSplit=120 org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true org.eclipse.jdt.core.formatter.tabulation.char=mixed org.eclipse.jdt.core.formatter.tabulation.size=4 org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true red5-1.0~svn4374.orig-plugins/adminplugin/.settings/org.eclipse.jdt.ui.prefs0000644000175000017500000000016611250376203026670 0ustar drazzibdrazzib#Fri Sep 04 21:08:42 PDT 2009 eclipse.preferences.version=1 formatter_profile=_Red5 formatter_settings_version=11 red5-1.0~svn4374.orig-plugins/example/0000755000175000017500000000000011760512621017426 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/example/readme.txt0000644000175000017500000000012011250105103021400 0ustar drazzibdrazzibThis plugin is intended to be used as an example for building your own plugins. red5-1.0~svn4374.orig-plugins/example/build.xml0000644000175000017500000000670311251314230021244 0ustar drazzibdrazzib java.home is ${java.home} and the target version is ${java.target_version} red5.root is ${red5.root} javac version: ${java.version} Type ant -p for available targets" red5-1.0~svn4374.orig-plugins/example/ivy.xml0000644000175000017500000000116011251313614020751 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/example/lib/0000755000175000017500000000000011760512621020174 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/example/ivysettings.xml0000644000175000017500000000125111251313614022533 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/example/.classpath0000644000175000017500000000106411273712507021416 0ustar drazzibdrazzib red5-1.0~svn4374.orig-plugins/example/.project0000644000175000017500000000063711250104722021074 0ustar drazzibdrazzib exampleplugin An example plugin for Red5 org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature red5-1.0~svn4374.orig-plugins/example/build.properties0000644000175000017500000000013711251314230022633 0ustar drazzibdrazzib# Let the scripts know where your red5 is (ie. the location of the red5.jar) red5.root=c:/red5 red5-1.0~svn4374.orig-plugins/example/src/0000755000175000017500000000000011760512621020215 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/example/src/org/0000755000175000017500000000000011760512621021004 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/example/src/org/red5/0000755000175000017500000000000011760512621021643 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/example/src/org/red5/server/0000755000175000017500000000000011760512621023151 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/example/src/org/red5/server/plugin/0000755000175000017500000000000011760512621024447 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/example/src/org/red5/server/plugin/example/0000755000175000017500000000000011760512621026102 5ustar drazzibdrazzibred5-1.0~svn4374.orig-plugins/example/src/org/red5/server/plugin/example/ExamplePlugin.java0000644000175000017500000000350711250370074031522 0ustar drazzibdrazzibpackage org.red5.server.plugin.example; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * This library is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * 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. * * You should have received a copy of the GNU Lesser General Public License along * with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import org.red5.logging.Red5LoggerFactory; import org.red5.server.Server; import org.red5.server.plugin.Red5Plugin; import org.slf4j.Logger; import org.springframework.context.ApplicationContext; /** * Simple plug-in to test functionality. * * @author Paul Gregoire */ public class ExamplePlugin extends Red5Plugin { private static Logger log = Red5LoggerFactory.getLogger(ExamplePlugin.class, "plugins"); public void doStart() throws Exception { log.debug("Start"); super.doStart(); } public void doStop() throws Exception { log.debug("Stop"); super.doStop(); } public void setApplicationContext(ApplicationContext context) { log.debug("Set application context: {}", context); super.setApplicationContext(context); } public void setServer(Server server) { log.debug("Set server: {}", server); super.setServer(server); } public String getName() { return "examplePlugin"; } }