Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.neomedia.codec.video.h264
Class JNIEncoder

java.lang.Object
  extended by net.sf.fmj.media.AbstractControls
      extended by net.sf.fmj.media.AbstractPlugIn
          extended by net.sf.fmj.media.AbstractCodec
              extended by net.java.sip.communicator.impl.neomedia.codec.video.h264.JNIEncoder
All Implemented Interfaces:
javax.media.Codec, javax.media.Controls, javax.media.PlugIn, RTCPFeedbackListener

public class JNIEncoder
extends net.sf.fmj.media.AbstractCodec
implements RTCPFeedbackListener

Implements a H.264 encoder.

Author:
Damian Minkov, Lyubomir Marinov, Sebastien Vincent

Field Summary
static String BASELINE_PROFILE
          The name of the baseline H.264 (encoding) profile.
static String DEFAULT_DEFAULT_PROFILE
          The default value of the DEFAULT_PROFILE_PNAME ConfigurationService property.
(package private) static int DEFAULT_FRAME_RATE
          The frame rate to be assumed by JNIEncoder instance in the absence of any other frame rate indication.
static String DEFAULT_PROFILE_PNAME
          The name of the ConfigurationService property which specifies the H.264 (encoding) profile to be used in the absence of negotiation.
(package private) static int IFRAME_INTERVAL
          Key frame every 150 frames.
static String MAIN_PROFILE
          The name of the main H.264 (encoding) profile.
static String PACKETIZATION_MODE_FMTP
          The name of the format parameter which specifies the packetization mode of H.264 RTP payload.
(package private) static javax.media.Format[] SUPPORTED_OUTPUT_FORMATS
          The list of Formats supported by JNIEncoder instances as output.
 
Fields inherited from class net.sf.fmj.media.AbstractCodec
inputFormat, inputFormats, opened, outputFormat
 
Fields inherited from interface javax.media.PlugIn
BUFFER_PROCESSED_FAILED, BUFFER_PROCESSED_OK, INPUT_BUFFER_NOT_CONSUMED, OUTPUT_BUFFER_NOT_FILLED, PLUGIN_TERMINATED
 
Constructor Summary
JNIEncoder()
          Initializes a new JNIEncoder instance.
 
Method Summary
 void close()
          Closes this Codec.
 void feedbackReceived(RTCPFeedbackEvent event)
          Event fired when RTCP feedback message is received.
 String getName()
          Gets the name of this Codec.
 javax.media.Format[] getSupportedOutputFormats(javax.media.Format in)
          Returns the list of formats supported at the output.
 void open()
          Opens this Codec.
 int process(javax.media.Buffer inBuffer, javax.media.Buffer outBuffer)
          Processes/encodes a buffer.
 void setAdditionalCodecSettings(Map<String,String> settings)
          Sets additional settings for the codec.
 javax.media.Format setInputFormat(javax.media.Format in)
          Sets the input format.
 void setKeyFrameControl(KeyFrameControl keyFrameControl)
          Sets the KeyFrameControl to be used by this JNIEncoder as a means of control over its key frame-related logic.
 javax.media.Format setOutputFormat(javax.media.Format out)
          Sets the Format in which this Codec is to output media data.
 void setPacketizationMode(String packetizationMode)
          Sets the packetization mode to be used for the H.264 RTP payload output by this JNIEncoder and the associated packetizer.
 
Methods inherited from class net.sf.fmj.media.AbstractCodec
checkInputBuffer, dump, getInputFormat, getOutputFormat, getSupportedInputFormats, isEOM, propagateEOM
 
Methods inherited from class net.sf.fmj.media.AbstractPlugIn
reset
 
Methods inherited from class net.sf.fmj.media.AbstractControls
addControl, getControl, getControls, removeControl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.media.PlugIn
reset
 
Methods inherited from interface javax.media.Controls
getControl, getControls
 

Field Detail

BASELINE_PROFILE

public static final String BASELINE_PROFILE
The name of the baseline H.264 (encoding) profile.

See Also:
Constant Field Values

DEFAULT_FRAME_RATE

static final int DEFAULT_FRAME_RATE
The frame rate to be assumed by JNIEncoder instance in the absence of any other frame rate indication.

See Also:
Constant Field Values

DEFAULT_PROFILE_PNAME

public static final String DEFAULT_PROFILE_PNAME
The name of the ConfigurationService property which specifies the H.264 (encoding) profile to be used in the absence of negotiation. Though it seems that RFC 3984 "RTP Payload Format for H.264 Video" specifies the baseline profile as the default, we have till the time of this writing defaulted to the main profile and we do not currently want to change from the main to the base profile unless we really have to.

See Also:
Constant Field Values

IFRAME_INTERVAL

static final int IFRAME_INTERVAL
Key frame every 150 frames.

See Also:
Constant Field Values

MAIN_PROFILE

public static final String MAIN_PROFILE
The name of the main H.264 (encoding) profile.

See Also:
Constant Field Values

DEFAULT_DEFAULT_PROFILE

public static final String DEFAULT_DEFAULT_PROFILE
The default value of the DEFAULT_PROFILE_PNAME ConfigurationService property.

See Also:
Constant Field Values

PACKETIZATION_MODE_FMTP

public static final String PACKETIZATION_MODE_FMTP
The name of the format parameter which specifies the packetization mode of H.264 RTP payload.

See Also:
Constant Field Values

SUPPORTED_OUTPUT_FORMATS

static final javax.media.Format[] SUPPORTED_OUTPUT_FORMATS
The list of Formats supported by JNIEncoder instances as output.

Constructor Detail

JNIEncoder

public JNIEncoder()
Initializes a new JNIEncoder instance.

Method Detail

close

public void close()
Closes this Codec.

Specified by:
close in interface javax.media.PlugIn
Overrides:
close in class net.sf.fmj.media.AbstractPlugIn

feedbackReceived

public void feedbackReceived(RTCPFeedbackEvent event)
Event fired when RTCP feedback message is received.

Specified by:
feedbackReceived in interface RTCPFeedbackListener
Parameters:
event - RTCPFeedbackEvent

getName

public String getName()
Gets the name of this Codec.

Specified by:
getName in interface javax.media.PlugIn
Overrides:
getName in class net.sf.fmj.media.AbstractPlugIn
Returns:
codec name

getSupportedOutputFormats

public javax.media.Format[] getSupportedOutputFormats(javax.media.Format in)
Returns the list of formats supported at the output.

Specified by:
getSupportedOutputFormats in interface javax.media.Codec
Specified by:
getSupportedOutputFormats in class net.sf.fmj.media.AbstractCodec
Parameters:
in - input Format to determine corresponding output Formats
Returns:
array of formats supported at output

open

public void open()
          throws javax.media.ResourceUnavailableException
Opens this Codec.

Specified by:
open in interface javax.media.PlugIn
Overrides:
open in class net.sf.fmj.media.AbstractPlugIn
Throws:
javax.media.ResourceUnavailableException

process

public int process(javax.media.Buffer inBuffer,
                   javax.media.Buffer outBuffer)
Processes/encodes a buffer.

Specified by:
process in interface javax.media.Codec
Specified by:
process in class net.sf.fmj.media.AbstractCodec
Parameters:
inBuffer - input buffer
outBuffer - output buffer
Returns:
BUFFER_PROCESSED_OK if buffer has been successfully processed

setInputFormat

public javax.media.Format setInputFormat(javax.media.Format in)
Sets the input format.

Specified by:
setInputFormat in interface javax.media.Codec
Overrides:
setInputFormat in class net.sf.fmj.media.AbstractCodec
Parameters:
in - format to set
Returns:
format

setKeyFrameControl

public void setKeyFrameControl(KeyFrameControl keyFrameControl)
Sets the KeyFrameControl to be used by this JNIEncoder as a means of control over its key frame-related logic.

Parameters:
keyFrameControl - the KeyFrameControl to be used by this JNIEncoder as a means of control over its key frame-related logic

setOutputFormat

public javax.media.Format setOutputFormat(javax.media.Format out)
Sets the Format in which this Codec is to output media data.

Specified by:
setOutputFormat in interface javax.media.Codec
Overrides:
setOutputFormat in class net.sf.fmj.media.AbstractCodec
Parameters:
out - the Format in which this Codec is to output media data
Returns:
the Format in which this Codec is currently configured to output media data or null if format was found to be incompatible with this Codec

setPacketizationMode

public void setPacketizationMode(String packetizationMode)
Sets the packetization mode to be used for the H.264 RTP payload output by this JNIEncoder and the associated packetizer.

Parameters:
packetizationMode - the packetization mode to be used for the H.264 RTP payload output by this JNIEncoder and the associated packetizer

setAdditionalCodecSettings

public void setAdditionalCodecSettings(Map<String,String> settings)
Sets additional settings for the codec.

Parameters:
settings - additional settings

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.