Class DtmfTransformEngine
- java.lang.Object
-
- org.jitsi.impl.neomedia.transform.SinglePacketTransformer
-
- org.jitsi.impl.neomedia.transform.dtmf.DtmfTransformEngine
-
- All Implemented Interfaces:
PacketTransformer,TransformEngine
public class DtmfTransformEngine extends SinglePacketTransformer implements TransformEngine
The class is responsible for sending DTMF tones in an RTP audio stream as described by RFC4733.- Author:
- Emil Ivov, Romain Philibert, Damian Minkov
-
-
Constructor Summary
Constructors Constructor Description DtmfTransformEngine(AudioMediaStreamImpl stream)Creates an engine instance that will be replacing audio packets with DTMF ones upon request.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close the transformer and underlying transform engine.PacketTransformergetRTCPTransformer()Always returns null since this engine does not require any RTCP transformations.PacketTransformergetRTPTransformer()Returns a reference to this class since it is performing RTP transformations in here.RawPacketreverseTransform(RawPacket pkt)A stub meant to handle incoming DTMF packets.voidstartSending(DTMFRtpTone tone, int minimalToneDuration, int maximalToneDuration, int volume)DTMF sending stub: this is where we should set the transformer in the proper state so that it would start replacing packets with dtmf codes.voidstop()Stops threads that this transform engine is using for even delivery.voidstopSendingDTMF()Interrupts transmission of a DTMFRtpTone started with the startSendingDTMF() method.RawPackettransform(RawPacket pkt)Replaces pkt with a DTMF packet if this engine is in a DTMF transmission mode or returns it unchanged otherwise.-
Methods inherited from class org.jitsi.impl.neomedia.transform.SinglePacketTransformer
reverseTransform, transform
-
-
-
-
Constructor Detail
-
DtmfTransformEngine
public DtmfTransformEngine(AudioMediaStreamImpl stream)
Creates an engine instance that will be replacing audio packets with DTMF ones upon request.- Parameters:
stream- the AudioMediaStream whose RTP packets we are going to be replacing with DTMF.
-
-
Method Detail
-
close
public void close()
Close the transformer and underlying transform engine. Nothing to do here.- Specified by:
closein interfacePacketTransformer- Overrides:
closein classSinglePacketTransformer
-
getRTCPTransformer
public PacketTransformer getRTCPTransformer()
Always returns null since this engine does not require any RTCP transformations.- Specified by:
getRTCPTransformerin interfaceTransformEngine- Returns:
- null since this engine does not require any RTCP transformations.
-
getRTPTransformer
public PacketTransformer getRTPTransformer()
Returns a reference to this class since it is performing RTP transformations in here.- Specified by:
getRTPTransformerin interfaceTransformEngine- Returns:
- a reference to this instance of the DtmfTransformEngine.
-
reverseTransform
public RawPacket reverseTransform(RawPacket pkt)
A stub meant to handle incoming DTMF packets.- Specified by:
reverseTransformin classSinglePacketTransformer- Parameters:
pkt- an incoming packet that we need to parse and handle in case we determine it to be DTMF.- Returns:
- the pkt if it is not a DTMF tone and null otherwise since we will be handling the packet ourselves and their's no point in feeding it to the application.
-
transform
public RawPacket transform(RawPacket pkt)
Replaces pkt with a DTMF packet if this engine is in a DTMF transmission mode or returns it unchanged otherwise.- Specified by:
transformin classSinglePacketTransformer- Parameters:
pkt- the audio packet that we may want to replace with a DTMF one.- Returns:
- pkt with a DTMF packet if this engine is in a DTMF transmission mode or returns it unchanged otherwise.
-
startSending
public void startSending(DTMFRtpTone tone, int minimalToneDuration, int maximalToneDuration, int volume)
DTMF sending stub: this is where we should set the transformer in the proper state so that it would start replacing packets with dtmf codes.- Parameters:
tone- the tone that we'd like to start sending.minimalToneDuration- The minimal DTMF tone duration.maximalToneDuration- The maximal DTMF tone duration.volume- The DTMF tone volume.
-
stopSendingDTMF
public void stopSendingDTMF()
Interrupts transmission of a DTMFRtpTone started with the startSendingDTMF() method. Has no effect if no tone is currently being sent.
-
stop
public void stop()
Stops threads that this transform engine is using for even delivery.
-
-