de.humatic.dsj.sink
Class HTTPAudioSink

java.lang.Object
  extended by de.humatic.dsj.sink.JSink
      extended by de.humatic.dsj.sink.HTTPAudioSink
All Implemented Interfaces:
java.beans.PropertyChangeListener, java.util.EventListener

public class HTTPAudioSink
extends JSink

Simple HTTP sink streaming audio data in G711 ulaw or AAC format.


Field Summary
static int HTTP_MULTI
           
 
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
 
Constructor Summary
HTTPAudioSink(DSFiltergraph src, int port, DSFilterInfo audioEncoder, int flags)
          Creates a server socket on the given port and streams the filtergraph's audio in either (single or multipart) G711 ulaw or alaw or AAC format (as determined by the output mediatype on the encoder filter and eventually the HTTP_MULTI flag) to clients accepting "audio/basic" or "audio/mpeg4-generic" mimetypes.
ulaw and alaw encoders ship with Windows ("CCITT u-Law / a-Law".
HTTPAudioSink(DSFiltergraph src, java.io.OutputStream out, DSFilterInfo audioEncoder, int flags)
          Instead of creating a ServerSocket will stream the encoded audio to the given OutputStream.
HTTPAudioSink(DSFiltergraph src, java.lang.String targetURL, java.lang.String userName, java.lang.String passWord, DSFilterInfo audioEncoder, int flags)
          Transmit singlepart G711 ulaw or AAC audio to a device at %targetURL.
 
Method Summary
 void close()
          Shuts down the sink and frees all resources it allocated.
 void sampleReceived(SampleBuffer inBuffer)
          Called from SampleAccessFilters used by this sink.
 
Methods inherited from class de.humatic.dsj.sink.JSink
create, getID, getOutputBufferSize, getOutputMediaType, propertyChange, setNetworkInterface, setSinkOption, setSocketOption
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HTTP_MULTI

public static final int HTTP_MULTI
See Also:
Constant Field Values
Constructor Detail

HTTPAudioSink

public HTTPAudioSink(DSFiltergraph src,
                     int port,
                     DSFilterInfo audioEncoder,
                     int flags)
              throws java.lang.Exception
Creates a server socket on the given port and streams the filtergraph's audio in either (single or multipart) G711 ulaw or alaw or AAC format (as determined by the output mediatype on the encoder filter and eventually the HTTP_MULTI flag) to clients accepting "audio/basic" or "audio/mpeg4-generic" mimetypes.
ulaw and alaw encoders ship with Windows ("CCITT u-Law / a-Law". Note that these can not alter the samplerate of incoming audio. Data reaching the sink must therefore be at the desired output rate - usually it should be at 8k, 16bit for ulaw or alaw)
AAC can be at arbitrary rates. Decoder configuration data will be passed in the initial content-type string.
There is no theoretical limit to the number of clients, but there is also no dedicated scaling functionality for large numbers.
Valid fields for the flags parameter:
JSink.LOCAL - keep local audio playback running,
JSink.SHOW_ENC_DLG - show encoder dialogs for configuration (Windows' ACM codecs have no properties pages),
JSink.SHOW_DLG_SAVE - save encoder states after configuration.
HTTPAudioSink.HTTP_MULTI - create a multipart stream instead of the default singlepart (not supported for AAC).

Throws:
java.lang.Exception

HTTPAudioSink

public HTTPAudioSink(DSFiltergraph src,
                     java.io.OutputStream out,
                     DSFilterInfo audioEncoder,
                     int flags)
              throws java.lang.Exception
Instead of creating a ServerSocket will stream the encoded audio to the given OutputStream. See first constructor for format details and valid flags.

Throws:
java.lang.Exception

HTTPAudioSink

public HTTPAudioSink(DSFiltergraph src,
                     java.lang.String targetURL,
                     java.lang.String userName,
                     java.lang.String passWord,
                     DSFilterInfo audioEncoder,
                     int flags)
              throws java.lang.Exception
Transmit singlepart G711 ulaw or AAC audio to a device at %targetURL. This is primarily intended for use with Axis devices using the "audio/transmit.cgi" and will perform some extra steps if audio/transmit.cgi is found in the target url. If this is not the case the class will setup and write to a straight POST connection.
A ulaw encoder ships with Windows ("CCITT u-Law") and will be used when %audioEncoder is null. Note that this encoder can not alter the samplerate of incoming audio. Data reaching the sink must therefore be at 8k, 16bit mono.
Valid fields for the flags parameter:
JSink.LOCAL - keep local audio playback running,
JSink.SHOW_ENC_DLG - show encoder dialogs for configuration (Windows' ACM codec has no properties page),
JSink.SHOW_DLG_SAVE - save encoder states after configuration.

Throws:
java.lang.Exception
Method Detail

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