mirror of https://github.com/sipwise/jitsi.git
Adds local representations of MediaFormats. Part of issue #701
parent
ec2295eb2b
commit
9beca59d52
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
|
||||
*
|
||||
* Distributable under LGPL license.
|
||||
* See terms of license at gnu.org.
|
||||
*/
|
||||
package net.java.sip.communicator.service.media.format;
|
||||
|
||||
/**
|
||||
* The interface represents an audio format. Audio formats characterize audio
|
||||
* streams and the <tt>AudioMediaFormat</tt> interface gives access to some of its
|
||||
* properties such as encoding, clock rate, and number of channels.
|
||||
*
|
||||
* @author Emil Ivov
|
||||
*/
|
||||
public interface AudioMediaFormat extends MediaFormat
|
||||
{
|
||||
/**
|
||||
* Returns the number of audio channels associated with this
|
||||
* <tt>AudioMediaFormat</tt>.
|
||||
*
|
||||
* @return the number of audio channels associated with this
|
||||
* <tt>AudioMediaFormat</tt>.
|
||||
*/
|
||||
public int getChannels();
|
||||
}
|
||||
@ -0,0 +1,84 @@
|
||||
/*
|
||||
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
|
||||
*
|
||||
* Distributable under LGPL license.
|
||||
* See terms of license at gnu.org.
|
||||
*/
|
||||
package net.java.sip.communicator.service.media.format;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* The <tt>MediaFormat</tt> interface represents a generic (i.e. audio/video or
|
||||
* other) format used to represent media represent a media stream.
|
||||
* <p>
|
||||
* The interface contains utility methods for extracting common media format
|
||||
* properties such as the name of the underlying encoding, or clock rate or in
|
||||
* order comparing to compare formats. Extending interfaces representing audio
|
||||
* or video formats are likely to add other methods.
|
||||
* <p>
|
||||
* @author Emil Ivov
|
||||
*/
|
||||
public interface MediaFormat
|
||||
{
|
||||
/**
|
||||
* The <tt>MediaType</tt> enumeration contains a list of media types
|
||||
* currently known to and handled by the MediaService.
|
||||
*/
|
||||
public static enum MediaType { AUDIO, VIDEO };
|
||||
|
||||
/**
|
||||
* Returns the type of this <tt>MediaFormat</tt> (e.g. audio or video).
|
||||
*
|
||||
* @return the <tt>MediaType</tt> that this format represents (e.g. audio
|
||||
* or video).
|
||||
*/
|
||||
public MediaType getMediaType();
|
||||
|
||||
/**
|
||||
* Returns the name of the encoding (i.e. codec) used by this
|
||||
* <tt>MediaFormat</tt>.
|
||||
*
|
||||
* @return The name of the encoding that this <tt>MediaFormat</tt> is using.
|
||||
*/
|
||||
public String getEncoding();
|
||||
|
||||
/**
|
||||
* Returns the clock rate associated with this <tt>MediaFormat</tt>.
|
||||
*
|
||||
* @return The clock rate associated with this format..
|
||||
*/
|
||||
public float getClockRate();
|
||||
|
||||
/**
|
||||
* Determines whether this <tt>MediaFormat</tt> is equal to
|
||||
* <tt>mediaFormat</tt>, or in other words that they have the same encoding
|
||||
* and attributes (e.g. refreshRate, channels, etc.).
|
||||
*
|
||||
* @param mediaFormat The <tt>MediaFormat</tt> that we would like to compare
|
||||
* with the current one.
|
||||
* @return <tt>true</tt> if <tt>mediaFormat</tt> is equal to this format and
|
||||
* <tt>false</tt> otherwise.
|
||||
*/
|
||||
public boolean equals(Object mediaFormat);
|
||||
|
||||
/**
|
||||
* Returns a <tt>Map</tt> containing parameters specific to this
|
||||
* particular <tt>MediaFormat</tt>. The parameters returned here are meant
|
||||
* for use in SIP/SDP or XMPP session descriptions where they get
|
||||
* transported through the "fmtp:" attribute or <parameter/> tag
|
||||
* respectively.
|
||||
*
|
||||
* @return Returns a <tt>Map</tt> containing parameters specific to this
|
||||
* particular <tt>MediaFormat</tt>.
|
||||
*/
|
||||
public Map<String, String> getFormatParameters();
|
||||
|
||||
/**
|
||||
* Returns a <tt>String</tt> representation of this <tt>MediaFormat</tt>
|
||||
* containing important format attributes such as the encoding for example.
|
||||
*
|
||||
* @return a <tt>String</tt> representation of this <tt>MediaFormat</tt>.
|
||||
*/
|
||||
public String toString();
|
||||
}
|
||||
@ -0,0 +1,117 @@
|
||||
/*
|
||||
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
|
||||
*
|
||||
* Distributable under LGPL license.
|
||||
* See terms of license at gnu.org.
|
||||
*/
|
||||
package net.java.sip.communicator.service.media.format;
|
||||
|
||||
/**
|
||||
* The MediaFormatFactory allows creating instances of Audio and Video formats.
|
||||
*
|
||||
* @author Emil Ivov
|
||||
*/
|
||||
public interface MediaFormatFactory
|
||||
{
|
||||
/**
|
||||
* Creates an <tt>AudioMediaFormat</tt> for the specified <tt>encoding</tt>,
|
||||
* <tt>clockRate</tt>, a default clock rate for the specified
|
||||
* <tt>encoding</tt>, a single audio channel, and no format parameters.
|
||||
*
|
||||
* @param encoding the encoding of the format to create.
|
||||
*
|
||||
* @return a newly created <tt>AudioMediaFormat</tt> with the specified
|
||||
* parameters.
|
||||
*/
|
||||
public AudioMediaFormat createAudioMediaFormat(String encoding);
|
||||
|
||||
/**
|
||||
* Creates an <tt>AudioMediaFormat</tt> for the specified <tt>encoding</tt>,
|
||||
* <tt>clockRate</tt>, a single audio channel, and no format parameters.
|
||||
*
|
||||
* @param encoding the encoding of the format to create.
|
||||
* @param clockRate the rate in Hz of the audio format
|
||||
*
|
||||
* @return a newly created <tt>AudioMediaFormat</tt> with the specified
|
||||
* parameters.
|
||||
*/
|
||||
public AudioMediaFormat createAudioMediaFormat(
|
||||
String encoding, double clockRate);
|
||||
|
||||
/**
|
||||
* Creates an <tt>AudioMediaFormat</tt> for the specified <tt>encoding</tt>,
|
||||
* <tt>clockRate</tt>, <tt>channels</tt>, and no format parameters.
|
||||
*
|
||||
* @param encoding the encoding of the format to create.
|
||||
* @param clockRate the rate in Hz of the audio format
|
||||
* @param channels the number of availabe channels (1 for mono,
|
||||
* 2 for stereo)
|
||||
*
|
||||
* @return a newly created <tt>AudioMediaFormat</tt> with the specified
|
||||
* parameters.
|
||||
*/
|
||||
public AudioMediaFormat createAudioMediaFormat(
|
||||
String encoding, double clockRate, int channels);
|
||||
|
||||
/**
|
||||
* Creates an <tt>AudioMediaFormat</tt> for the specified <tt>encoding</tt>,
|
||||
* <tt>clockRate</tt>, <tt>formatParam</tt> parameters and a single audio
|
||||
* channel.
|
||||
*
|
||||
* @param encoding the encoding of the format to create.
|
||||
* @param clockRate the rate in Hz of the audio format
|
||||
* @param formatParams any codec specific params that have being received
|
||||
* via SIP/SDP or XMPP/Jingle.
|
||||
*
|
||||
* @return a newly created <tt>AudioMediaFormat</tt> with the specified
|
||||
* parameters.
|
||||
*/
|
||||
public AudioMediaFormat createAudioMediaFormat(
|
||||
String encoding, double clockRate, String formatParams);
|
||||
|
||||
/**
|
||||
* Creates an <tt>AudioMediaFormat</tt> for the specified <tt>encoding</tt>,
|
||||
* <tt>clockRate</tt>, <tt>channels</tt>, and <tt>formatParam</tt>
|
||||
* parameters.
|
||||
*
|
||||
* @param encoding the encoding of the format to create.
|
||||
* @param clockRate the rate in Hz of the audio format
|
||||
* @param channels the number of availabe channels (1 for mono,
|
||||
* 2 for stereo)
|
||||
* @param formatParams any codec specific params that have being received
|
||||
* via SIP/SDP or XMPP/Jingle.
|
||||
*
|
||||
* @return a newly created <tt>AudioMediaFormat</tt> with the specified
|
||||
* parameters.
|
||||
*/
|
||||
public AudioMediaFormat createAudioMediaFormat(
|
||||
String encoding, double clockRate,
|
||||
int channels, String formatParams);
|
||||
|
||||
/**
|
||||
* Creates a <tt>VideoMediaFormat</tt> for the specified <tt>encoding</tt>.
|
||||
*
|
||||
* @param encoding the encoding of the format to create.
|
||||
*
|
||||
* @return a newly created <tt>VideoMediaFormat</tt> with the specified
|
||||
* encoding.
|
||||
*/
|
||||
public VideoMediaFormat createVideoMediaFormat(String encoding);
|
||||
|
||||
/**
|
||||
* Creates an <tt>VideoMediaFormat</tt> for the specified <tt>encoding</tt>,
|
||||
* and <tt>frameRate</tt>.
|
||||
*
|
||||
* @param encoding the encoding of the format to create.
|
||||
* @param clockRate the the frame rate
|
||||
* @param channels thu number of availabel channels (1 for mono,
|
||||
* 2 for stereo)
|
||||
* @param formatParams any codec specific params that have being received
|
||||
* via SIP/SDP or XMPP/Jingle.
|
||||
*
|
||||
* @return a newly created <tt>AudioMediaFormat</tt> with the specified
|
||||
* parameters.
|
||||
*/
|
||||
public VideoMediaFormat createVideoMediaFormat(
|
||||
String encoding, double clockRate);
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
|
||||
*
|
||||
* Distributable under LGPL license.
|
||||
* See terms of license at gnu.org.
|
||||
*/
|
||||
package net.java.sip.communicator.service.media.format;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* The interface represents a video format. Video formats characterize video
|
||||
* streams and the <tt>VideoMediaFormat</tt> interface gives access to some of
|
||||
* their properties such as encoding and clock rate.
|
||||
*
|
||||
* @author Emil Ivov
|
||||
*/
|
||||
public interface VideoMediaFormat
|
||||
{
|
||||
/**
|
||||
* Returns the size of the image that this <tt>VideoMediaFormat</tt>
|
||||
* describes.
|
||||
*
|
||||
* @return a <tt>java.awt.Dimension</tt> instance indicating the image size
|
||||
* (in pixels) of this <tt>VideoMediaFormat</tt>.
|
||||
*/
|
||||
public Dimension getSize();
|
||||
}
|
||||
Loading…
Reference in new issue