com.cloudgarden.audio
Class AudioMediaURLSink
java.lang.Object
|
+--com.cloudgarden.audio.DefaultAudioObject
|
+--com.cloudgarden.audio.DefaultAudioSink
|
+--com.cloudgarden.audio.AudioMediaURLSink
- All Implemented Interfaces:
- AudioObject, AudioSink, javax.media.ControllerListener, javax.media.datasink.DataSinkListener
- public class AudioMediaURLSink
- extends DefaultAudioSink
- implements javax.media.ControllerListener, javax.media.datasink.DataSinkListener
Writes audio data to a URL using the JMF packages, with content type defined by
one of the FileTypeDescriptor String fields, eg MPEG_AUDIO, QUICKTIME etc
Note: AudioSources that have an AudioFormat that is big-endian, or 8-bit often produce bad results.
Field Summary |
protected java.net.URL |
url
|
Constructor Summary |
AudioMediaURLSink(java.net.URL url,
java.lang.String outputContentType)
contentType should be one of the FileTypeDescriptor String fields, eg MPEG_AUDIO, QUICKTIME etc |
Method Summary |
void |
controllerUpdate(javax.media.ControllerEvent evt)
|
void |
dataSinkUpdate(javax.media.datasink.DataSinkEvent evt)
|
boolean |
getKeepOpen()
|
void |
setKeepOpen(boolean keepOpen)
Used to keep the sink open even after receiving zero bytes from
it's attached source - this allows RTP streams to operate correctly. |
int |
write(byte[] data,
int offset,
int length)
Used to write data to this sink - called by the AudioSource which this
sink is connected to (if its startSending method is used) so need
not be called explicitly by an application. |
Methods inherited from class com.cloudgarden.audio.DefaultAudioObject |
addTransferListener, blockWhilePaused, blockWhileWaiting, bytesTransferred, canSetAudioFormat, drain, getAudioFormat, getContentType, getLastException, isPaused, isWaiting, removeTransferListener, setPaused |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
url
protected java.net.URL url
AudioMediaURLSink
public AudioMediaURLSink(java.net.URL url,
java.lang.String outputContentType)
- contentType should be one of the FileTypeDescriptor String fields, eg MPEG_AUDIO, QUICKTIME etc
setKeepOpen
public void setKeepOpen(boolean keepOpen)
- Used to keep the sink open even after receiving zero bytes from
it's attached source - this allows RTP streams to operate correctly.
The default value is false.
getKeepOpen
public boolean getKeepOpen()
dataSinkUpdate
public void dataSinkUpdate(javax.media.datasink.DataSinkEvent evt)
- Specified by:
dataSinkUpdate
in interface javax.media.datasink.DataSinkListener
controllerUpdate
public void controllerUpdate(javax.media.ControllerEvent evt)
- Specified by:
controllerUpdate
in interface javax.media.ControllerListener
write
public int write(byte[] data,
int offset,
int length)
throws java.io.IOException
- Description copied from interface:
AudioSink
- Used to write data to this sink - called by the AudioSource which this
sink is connected to (if its startSending method is used) so need
not be called explicitly by an application. Blocks if this sink is paused.
- Following copied from interface:
com.cloudgarden.audio.AudioSink
- See Also:
AudioSink.setSource(com.cloudgarden.audio.AudioSource)
,
AudioSource.startSending()
,
AudioObject.setPaused(boolean)