de.humatic.dsj.sink
Class RTMPSink
java.lang.Object
de.humatic.dsj.sink.JSink
de.humatic.dsj.sink.RTMPSink
- All Implemented Interfaces:
- java.beans.PropertyChangeListener, java.util.EventListener
public class RTMPSink
- extends JSink
Streamsink for publishing audio and videodata to a Flash Media Server.
This class handles the RTMP packaging of samples received from DirectShow encoder filters. It currently supports
FLV1 and H264 video and mp3 and AAC audio. In order to use this class you must make sure that the desired encoders are installed
on the host system, dsj itself does not bring encoders, nor does it license you to use 3rd party components.
To configure media encoding the SHOW_ENC_DLG and SHOW_DLG_SAVE flags can be set to make dsj bring up the
filters' properties pages. Alternatively pass DSFilterInfos as returned by DSFilterInfo.filterInfoForCodecState to
set previously saved settings (not all codecs may support this...).
Other possible (OR combineable) values for %flags include:
JSink.LOCAL - to continue rendering a local preview
RTMPSink.RECORD - instructs FMS to record the published stream (must be supported by server application)
RTMPSink.APPEND - makes FMS append a recording to an existing recording under %streamName
JSink.UNCONNECTED - uncouples the DirectShow setup from connecting to the server (useful if you have other means for configuring encoders).
We have tested this functionality with the following encoders (others should work as well, but your mileage
may vary. Feedback is welcome):
FLV1 - ffdShow, libavcodec
H264 - Elecard AVC Video Encoder SD
- MainConcept AVC/H.264 Video Encoder
- ffdShow, x264
- Lead H264 Encoder (4.0), iPod/PSP mode only
MP3 - MPEG Layer-3 (built into Windows XP)
- Elecard MPEG Audio Encoder
- LAME Audio Encoder
- Lead MPEG Audio Encoder (2.0)
AAC - Elecard AAC Audio Encoder
- MainConcept AAC Encoder
- Monogram AAC Encoder (only works w/o preview)
Using AAC audio will require a larger buffer on the client side.
Mediatype and compression used are read from the encoder outputs on setup. There's no need to specify those in
any other place.
This class is new in 0_8_6 and will miss some implementation details.
| Fields inherited from class de.humatic.dsj.sink.JSink |
AV_SYNC_IN, BUFFER_OVERFLOW, CLOSED, CONNECT, CONNECTED, CONNECTION_TIMEOUT, DISPLAY_LOCAL, DUMP, ERROR, HTTP_AUDIO, LOCAL, MAX_BT_DROP, MAX_BT_WARN, MAX_DURATION, MIN_BT, MJPG, MKV, NO_AUDIO, NO_VIDEO, OFFSET_TIME_IN, OFFSET_TIME_OUT, OPT_PKT_SIZE, PIPE_SIZE, pipeSize, PREVIEW, RTMP, RTP, SHOW_DLG_SAVE, SHOW_ENC_DLG, SOCKET_ERROR, SOCKET_SBS, socketSendBufferSize, STARVING, TSNET, UNCONNECTED |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RECORD
public static final int RECORD
- See Also:
- Constant Field Values
APPEND
public static final int APPEND
- See Also:
- Constant Field Values
RTMPSink
public RTMPSink(DSFiltergraph src,
java.lang.String targetURL,
java.lang.String streamName,
DSFilterInfo videoEncoder,
DSFilterInfo audioEncoder,
int flags)
throws java.lang.Exception
- Throws:
java.lang.Exception
connect
public void connect()
throws java.lang.Exception
- When constructing the sink with the JSink.UNCONNECTED flag set, call this after encoders are configured.
Without the flag set, this will be called automatically.
- Throws:
java.lang.Exception
setConnectionTimeout
public static void setConnectionTimeout(int msecTimeout)
sendRTMP
public void sendRTMP(RTMPMessage msg)
throws java.lang.Exception
- Can be used to send AMF formatted messages to the server.
- Throws:
java.lang.Exception
getChunkSize
public int getChunkSize()
setChunkSize
public void setChunkSize(int chunkSize)
throws java.lang.Exception
- Throws:
java.lang.Exception
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent pe)
- Specified by:
propertyChange in interface java.beans.PropertyChangeListener- Overrides:
propertyChange in class JSink
close
public void close()
- Description copied from class:
JSink
- Shuts down the sink and frees all resources it allocated. This method is called internally when disposing off the
graph that was using this sink and is not normally used by application code.
- Overrides:
close in class JSink
sampleReceived
public void sampleReceived(SampleBuffer inBuffer)
- Description copied from class:
JSink
- Called from SampleAccessFilters used by this sink.
- Overrides:
sampleReceived in class JSink