<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:lang="http://www.springframework.org/schema/lang"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd                            
	http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.5.xsd">
	<!-- This context holds all the networking: mina -->

	<bean id="customEditorConfigurer"
		class="org.springframework.beans.factory.config.CustomEditorConfigurer">
		<property name="customEditors">
			<map>
				<entry key="java.net.SocketAddress">
					<bean
						class="org.apache.mina.integration.spring.InetSocketAddressEditor" />
				</entry>
			</map>
		</property>
	</bean>
	
	<bean id="placeholderConfig"
		class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
		<property name="location" value="classpath:/red5.properties" />
	</bean>

	<!-- RTMP Handler -->
	<bean id="rtmpHandler"
		class="org.red5.server.net.rtmp.EdgeRTMPHandler">
		<property name="server" ref="red5.server" />
		<property name="statusObjectService" ref="statusObjectService" />
		<property name="MRTMPManager" ref="mrtmpEdgeManager" />
	</bean>
	
	<bean id="rtmpMinaConnManager"
		class="org.red5.server.net.rtmp.RTMPConnManager">
	</bean>
	
	<!-- RTMP Mina IO Handler -->
	<bean id="rtmpMinaIoHandler"
		class="org.red5.server.net.rtmp.EdgeRTMPMinaIoHandler">
		<property name="handler" ref="rtmpHandler" />
		<property name="codecFactory" ref="rtmpCodecFactory" />
		<property name="rtmpConnManager" ref="rtmpMinaConnManager" />
	</bean>
	
	<!-- RTMP Mina Transport -->
	<bean id="rtmpTransport" class="org.red5.server.net.rtmp.RTMPMinaTransport" init-method="start" destroy-method="stop">
		<property name="ioHandler" ref="rtmpMinaIoHandler" />
		<property name="address" value="${rtmp.host}" />
		<property name="port" value="${rtmp.port}" />
		<property name="receiveBufferSize" value="${rtmp.receive_buffer_size}" />
		<property name="sendBufferSize" value="${rtmp.send_buffer_size}" />
		<property name="eventThreadsCore" value="${rtmp.event_threads_core}" />
		<property name="eventThreadsMax" value="${rtmp.event_threads_max}" />
		<property name="eventThreadsQueue" value="${rtmp.event_threads_queue}" />
		<property name="eventThreadsKeepalive" value="${rtmp.event_threads_keepalive}" />
		<!-- This is the interval at which the sessions are polled for stats. If mina monitoring is not
				enabled, polling will not occur. -->
		<property name="jmxPollInterval" value="1000" />
		<property name="tcpNoDelay" value="${rtmp.tcp_nodelay}" />
	</bean>
	
	<!-- RTMP Mina Connection -->
	<bean id="rtmpEdgeMinaConnection" scope="prototype"
		class="org.red5.server.net.rtmp.EdgeRTMPMinaConnection">
		<!-- Ping clients every X ms. Set to 0 to disable ghost detection code. -->
		<property name="pingInterval" value="${rtmp.ping_interval}" />
		<!-- Disconnect client after X ms of not responding. -->
		<property name="maxInactivity" value="${rtmp.max_inactivity}" />
		<!-- Max. time in milliseconds to wait for a valid handshake. -->
		<property name="maxHandshakeTimeout" value="5000" />
		<property name="mrtmpManager" ref="mrtmpEdgeManager" />
	</bean>
	
	<bean id="mrtmpCodecFactory"
		class="org.red5.server.net.mrtmp.codec.MRTMPCodecFactory" />
	
	<bean id="mrtmpHandler" class="org.red5.server.net.mrtmp.EdgeMRTMPHandler">
		<property name="mrtmpManager" ref="mrtmpEdgeManager"/>
		<property name="codecFactory" ref="mrtmpCodecFactory" />
		<property name="rtmpConnManager" ref="rtmpMinaConnManager" />
	</bean>
	
	<bean id="mrtmpClient"
		class="org.red5.server.net.mrtmp.MRTMPClient" init-method="start" >
		<property name="ioHandler" ref="mrtmpHandler" />
		<property name="server" value="${mrtmp.server}" />
		<property name="port" value="${mrtmp.port}" />
	</bean>
	
	<bean id="mrtmpEdgeManager"
		class="org.red5.server.net.mrtmp.SimpleMRTMPEdgeManager">
		<property name="rtmpConnManager" ref="rtmpMinaConnManager" />
	</bean>
	
	<!-- Enable when you need it.
	<bean id="rtmpProxyTransport" class="org.red5.server.net.rtmp.RTMPMinaTransport" init-method="start" destroy-method="stop">
		<property name="ioHandler" ref="debugProxyIoHandler" />
		<property name="address" value="${proxy.source_host}" />
		<property name="port" value="${proxy.source_port}" />
		<property name="receiveBufferSize" value="${rtmp.receive_buffer_size}" />
		<property name="sendBufferSize" value="${rtmp.send_buffer_size}" />
		<property name="eventThreadsCore" value="${rtmp.event_threads_core}" />
		<property name="eventThreadsMax" value="${rtmp.event_threads_max}" />
		<property name="eventThreadsQueue" value="${rtmp.event_threads_queue}" />
		<property name="eventThreadsKeepalive" value="${rtmp.event_threads_keepalive}" />
	</bean>
    
	<bean id="debugProxyIoHandler"
		class="org.red5.server.net.proxy.DebugProxyHandler">
		<property name="codecFactory" ref="rtmpCodecFactory" />
		<property name="forward" value="${proxy.destination_host}:${proxy.destination_port}" />
		<property name="dumpTo" value="./webapps/dump/" />
	</bean>
	-->
</beans>
