public class MediaServiceImpl extends PropertyChangeNotifier implements MediaService
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DISABLE_AUDIO_SUPPORT_PNAME
The name of the boolean ConfigurationService property
which indicates whether the detection of audio CaptureDevices is
to be disabled.
|
static java.lang.String |
DISABLE_SET_AUDIO_SYSTEM_PNAME
The name of the boolean ConfigurationService property
which indicates whether the method
DeviceConfiguration.setAudioSystem(AudioSystem, boolean) is to be
considered disabled for the user i.e. |
static java.lang.String |
DISABLE_VIDEO_SUPPORT_PNAME
The name of the boolean ConfigurationService property
which indicates whether the detection of video CaptureDevices is
to be disabled.
|
DEFAULT_DEVICE, ENABLE_FFMPEG_CODECS_PNAME, ENABLE_H264_FORMAT_PNAME
Constructor and Description |
---|
MediaServiceImpl()
Initializes a new MediaServiceImpl instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addRecorderListener(Recorder.Listener listener)
Those interested in Recorder events add listener through MediaService.
|
EncodingConfiguration |
createEmptyEncodingConfiguration()
Returns a new
EncodingConfiguration instance that can be
used by other bundles. |
MediaStream |
createMediaStream(MediaDevice device)
Create a MediaStream which will use a specific
MediaDevice for capture and playback of media.
|
MediaStream |
createMediaStream(MediaType mediaType)
Initializes a new MediaStream of a specific MediaType.
|
MediaStream |
createMediaStream(StreamConnector connector,
MediaDevice device)
Creates a new MediaStream instance which will use the specified
MediaDevice for both capture and playback of media exchanged
via the specified StreamConnector.
|
MediaStream |
createMediaStream(StreamConnector connector,
MediaDevice device,
SrtpControl srtpControl)
Creates a new MediaStream instance which will use the specified
MediaDevice for both capture and playback of media exchanged
via the specified StreamConnector.
|
MediaStream |
createMediaStream(StreamConnector connector,
MediaType mediaType)
Initializes a new MediaStream instance which is to exchange
media of a specific MediaType via a specific
StreamConnector.
|
MediaStream |
createMediaStream(StreamConnector connector,
MediaType mediaType,
SrtpControl srtpControl) |
MediaDevice |
createMixer(MediaDevice device)
Creates a new MediaDevice which uses a specific
MediaDevice to capture and play back media and performs mixing
of the captured media and the media played back by any other users of the
returned MediaDevice.
|
Recorder |
createRecorder(MediaDevice device)
Creates a new Recorder instance that can be used to record a
call which captures and plays back media using a specific
MediaDevice.
|
Recorder |
createRecorder(RTPTranslator translator)
Creates a new Recorder instance that can be used to record media
from a specific RTPTranslator.
|
RecorderEventHandler |
createRecorderEventHandlerJson(java.lang.String filename)
Creates a RecorderEventHandler instance that saves received
events in JSON format.
|
RTPTranslator |
createRTPTranslator()
Initializes a new RTPTranslator which is to forward RTP and RTCP
traffic between multiple MediaStreams.
|
SrtpControl |
createSrtpControl(SrtpControlType srtpControlType)
Initializes a new SrtpControl instance with a specific
SrtpControlType.
|
java.util.List<ScreenDevice> |
getAvailableScreenDevices()
Get available screens.
|
EncodingConfiguration |
getCurrentEncodingConfiguration()
Returns the current encoding configuration -- the instance that contains
the global settings.
|
MediaDevice |
getDefaultDevice(MediaType mediaType,
MediaUseCase useCase)
Gets the default MediaDevice for the specified
MediaType.
|
ScreenDevice |
getDefaultScreenDevice()
Get default screen device.
|
DeviceConfiguration |
getDeviceConfiguration()
Gets the CaptureDevice user choices such as the default audio
and video capture devices.
|
java.util.List<MediaDevice> |
getDevices(MediaType mediaType,
MediaUseCase useCase)
Gets a list of the MediaDevices known to this
MediaService and handling the specified MediaType.
|
java.util.Map<MediaFormat,java.lang.Byte> |
getDynamicPayloadTypePreferences()
Returns a
Map that binds indicates whatever preferences this
media service implementation may have for the RTP payload type numbers
that get dynamically assigned to MediaFormat s with no static
payload type. |
MediaFormatFactory |
getFormatFactory()
Gets the MediaFormatFactory through which MediaFormat
instances may be created for the purposes of working with the
MediaStreams created by this MediaService.
|
VolumeControl |
getInputVolumeControl()
Gets the VolumeControl which controls the volume level of audio
input/capture.
|
MediaDevice |
getMediaDeviceForPartialDesktopStreaming(int width,
int height,
int x,
int y)
Get a MediaDevice for a part of desktop streaming/sharing.
|
java.awt.Point |
getOriginForDesktopStreamingDevice(MediaDevice mediaDevice)
Gets the origin of a specific desktop streaming device.
|
VolumeControl |
getOutputVolumeControl()
Gets the VolumeControl which controls the volume level of audio
output/playback.
|
java.util.Iterator<Recorder.Listener> |
getRecorderListeners()
Gives access to currently registered Recorder.Listeners.
|
java.lang.String |
getRtpCname()
Returns the value which will be used for the canonical end-point
identifier (CNAME) in RTCP packets sent by this running instance of
libjitsi.
|
ScreenDevice |
getScreenForPoint(java.awt.Point p)
Find the screen device that contains specified point.
|
java.lang.Object |
getVideoPreviewComponent(MediaDevice device,
int preferredWidth,
int preferredHeight)
Creates a preview component for the specified device(video device) used
to show video preview from that device.
|
static boolean |
isJmfRegistryDisableLoad()
Gets the indicator which determines whether the loading of the JMF/FMJ
Registry has been disabled.
|
static boolean |
isMediaTypeSupportEnabled(MediaType mediaType)
Determines whether the support for a specific MediaType is
enabled.
|
boolean |
isPartialStreaming(MediaDevice mediaDevice)
If the MediaDevice corresponds to partial desktop streaming
device.
|
void |
removeRecorderListener(Recorder.Listener listener)
Removes an existing Recorder.Listener from the list of listeners
interested in notifications from Recorders.
|
addPropertyChangeListener, firePropertyChange, getPropertyChangeSource, removePropertyChangeListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addPropertyChangeListener, removePropertyChangeListener
public static final java.lang.String DISABLE_AUDIO_SUPPORT_PNAME
public static final java.lang.String DISABLE_SET_AUDIO_SYSTEM_PNAME
DeviceConfiguration.setAudioSystem(AudioSystem, boolean)
is to be
considered disabled for the user i.e. the user is not presented with user
interface which allows selecting a particular AudioSystem.public static final java.lang.String DISABLE_VIDEO_SUPPORT_PNAME
public MediaServiceImpl()
public MediaStream createMediaStream(MediaDevice device)
createMediaStream
in interface MediaService
device
- the MediaDevice to be used by the new instance for
capture and playback of mediaMediaService.createMediaStream(MediaDevice)
public MediaStream createMediaStream(MediaType mediaType)
MediaDevice.getMediaType()
equals
mediaType.
Implements MediaService.createMediaStream(MediaType)
. Initializes
a new AudioMediaStreamImpl or VideoMediaStreamImpl in
accord with mediaTypecreateMediaStream
in interface MediaService
mediaType
- the MediaType of the new instance to be
initializedpublic MediaStream createMediaStream(StreamConnector connector, MediaDevice device)
createMediaStream
in interface MediaService
connector
- the StreamConnector that the new
MediaStream instance is to use for sending and receiving mediadevice
- the MediaDevice that the new MediaStream
instance is to use for both capture and playback of media exchanged via
the specified connectorMediaService.createMediaStream(StreamConnector, MediaDevice)
public MediaStream createMediaStream(StreamConnector connector, MediaType mediaType)
createMediaStream
in interface MediaService
connector
- the StreamConnector the stream should use for
sending and receiving media or null if the stream is to not have
a StreamConnector configured at initialization time and a
StreamConnector is to be specified later onmediaType
- the MediaType of the media to be exchanged by
the new instance via the specified connectorpublic MediaStream createMediaStream(StreamConnector connector, MediaDevice device, SrtpControl srtpControl)
createMediaStream
in interface MediaService
connector
- the StreamConnector that the new
MediaStream instance is to use for sending and receiving mediadevice
- the MediaDevice that the new MediaStream
instance is to use for both capture and playback of media exchanged via
the specified connectorsrtpControl
- a control which is already created, used to control
the SRTP operations.MediaService.createMediaStream(StreamConnector, MediaDevice)
public MediaStream createMediaStream(StreamConnector connector, MediaType mediaType, SrtpControl srtpControl)
createMediaStream
in interface MediaService
connector
- the StreamConnector the stream should use for
sending and receiving media or null if the stream is to not have
a StreamConnector configured at initialization time and a
StreamConnector is to be specified later onmediaType
- the MediaType of the media to be exchanged by
the new instance via the specified connectorsrtpControl
- the SrtpControl to control the security of
the media exchangepublic MediaDevice createMixer(MediaDevice device)
createMixer
in interface MediaService
device
- the MediaDevice which is to be used by the
returned MediaDevice to actually capture and play back mediaMediaService.createMixer(MediaDevice)
public MediaDevice getDefaultDevice(MediaType mediaType, MediaUseCase useCase)
getDefaultDevice
in interface MediaService
mediaType
- a MediaType value indicating the type of media
to be handled by the MediaDevice to be obtaineduseCase
- the MediaUseCase to obtain the
MediaDevice list forMediaService.getDefaultDevice(MediaType, MediaUseCase)
public DeviceConfiguration getDeviceConfiguration()
public java.util.List<MediaDevice> getDevices(MediaType mediaType, MediaUseCase useCase)
getDevices
in interface MediaService
mediaType
- the MediaType to obtain the
MediaDevice list foruseCase
- the MediaUseCase to obtain the
MediaDevice list forMediaService.getDevices(MediaType, MediaUseCase)
public EncodingConfiguration getCurrentEncodingConfiguration()
getCurrentEncodingConfiguration
in interface MediaService
public MediaFormatFactory getFormatFactory()
getFormatFactory
in interface MediaService
MediaService.getFormatFactory()
public SrtpControl createSrtpControl(SrtpControlType srtpControlType)
createSrtpControl
in interface MediaService
srtpControlType
- the SrtpControlType of the new instancepublic VolumeControl getOutputVolumeControl()
getOutputVolumeControl
in interface MediaService
MediaService.getOutputVolumeControl()
public VolumeControl getInputVolumeControl()
getInputVolumeControl
in interface MediaService
MediaService.getInputVolumeControl()
public java.util.List<ScreenDevice> getAvailableScreenDevices()
getAvailableScreenDevices
in interface MediaService
public ScreenDevice getDefaultScreenDevice()
getDefaultScreenDevice
in interface MediaService
public Recorder createRecorder(MediaDevice device)
createRecorder
in interface MediaService
device
- the MediaDevice which is used for media capture
and playback by the call to be recordedMediaService.createRecorder(MediaDevice)
public Recorder createRecorder(RTPTranslator translator)
createRecorder
in interface MediaService
translator
- the RTPTranslator for which to create a
Recorderpublic java.util.Map<MediaFormat,java.lang.Byte> getDynamicPayloadTypePreferences()
Map
that binds indicates whatever preferences this
media service implementation may have for the RTP payload type numbers
that get dynamically assigned to MediaFormat
s with no static
payload type. The method is useful for formats such as "telephone-event"
for example that is statically assigned the 101 payload type by some
legacy systems. Signaling protocol implementations such as SIP and XMPP
should make sure that, whenever this is possible, they assign to formats
the dynamic payload type returned in this Map
.getDynamicPayloadTypePreferences
in interface MediaService
Map
binding some formats to a preferred dynamic RTP
payload type number.public java.lang.Object getVideoPreviewComponent(MediaDevice device, int preferredWidth, int preferredHeight)
getVideoPreviewComponent
in interface MediaService
device
- the video devicepreferredWidth
- the width we prefer for the componentpreferredHeight
- the height we prefer for the componentpublic MediaDevice getMediaDeviceForPartialDesktopStreaming(int width, int height, int x, int y)
getMediaDeviceForPartialDesktopStreaming
in interface MediaService
width
- width of the partheight
- height of the partx
- origin of the x coordinate (relative to the full desktop)y
- origin of the y coordinate (relative to the full desktop)public boolean isPartialStreaming(MediaDevice mediaDevice)
isPartialStreaming
in interface MediaService
mediaDevice
- MediaDevicepublic ScreenDevice getScreenForPoint(java.awt.Point p)
p
- point coordinatespublic java.awt.Point getOriginForDesktopStreamingDevice(MediaDevice mediaDevice)
getOriginForDesktopStreamingDevice
in interface MediaService
mediaDevice
- the desktop streaming device to get the origin onpublic void addRecorderListener(Recorder.Listener listener)
addRecorderListener
in interface MediaService
listener
- the new Recorder.Listener to be added to the
list of listeners interested in notifications from Recorders.public void removeRecorderListener(Recorder.Listener listener)
removeRecorderListener
in interface MediaService
listener
- the existing Listener to be removed from the
list of listeners interested in notifications from Recorderspublic java.util.Iterator<Recorder.Listener> getRecorderListeners()
getRecorderListeners
in interface MediaService
public RTPTranslator createRTPTranslator()
createRTPTranslator
in interface MediaService
MediaService.createRTPTranslator()
public static boolean isJmfRegistryDisableLoad()
public EncodingConfiguration createEmptyEncodingConfiguration()
EncodingConfiguration
instance that can be
used by other bundles.createEmptyEncodingConfiguration
in interface MediaService
EncodingConfiguration
instance.public static boolean isMediaTypeSupportEnabled(MediaType mediaType)
DISABLE_AUDIO_SUPPORT_PNAME
and
DISABLE_VIDEO_SUPPORT_PNAME
allow disabling the support for,
respectively, MediaType.AUDIO
and MediaType.VIDEO
.mediaType
- the MediaType to be determined whether the
support for it is enabledpublic java.lang.String getRtpCname()
getRtpCname
in interface MediaService
public RecorderEventHandler createRecorderEventHandlerJson(java.lang.String filename) throws java.io.IOException
createRecorderEventHandlerJson
in interface MediaService
filename
- the filename into which the created
RecorderEventHandler will save received events.java.io.IOException
- if a RecorderEventHandler could not be
created for filename.
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.