Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.neomedia.codec.video
Class SwScaler

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.SwScaler
All Implemented Interfaces:
javax.media.Codec, javax.media.Controls, javax.media.PlugIn

public class SwScaler
extends net.sf.fmj.media.AbstractCodec

Implements a Codec which uses libswscale to scale images and convert between color spaces (typically, RGB and YUV).

Author:
Sebastien Vincent, Lyubomir Marinov

Field Summary
 
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
  SwScaler()
          Initializes a new SwScaler instance which doesn't have an output size and will use a default one when it becomes necessary unless an explicit one is specified in the meantime.
protected SwScaler(boolean fixOddYuv420Size)
          Initializes a new SwScaler instance which can optionally attempt to keep the width and height of YUV 420 output even.
 
Method Summary
 void close()
          Close codec.
 javax.media.Format getInputFormat()
          Gets the Format in which this Codec is currently configured to accept input media data.
static int getNativeRGBFormat(javax.media.format.RGBFormat rgb)
          Gets native (FFmpeg) RGB format.
 Dimension getOutputSize()
          Gets the output size.
 javax.media.Format[] getSupportedOutputFormats(javax.media.Format input)
          Gets the supported output formats for an input one.
 int process(javax.media.Buffer input, javax.media.Buffer output)
          Processes (converts color space and/or scales) a buffer.
 javax.media.Format setInputFormat(javax.media.Format format)
          Sets the input format.
 javax.media.Format setOutputFormat(javax.media.Format format)
          Sets the Format in which this Codec is to output media data.
 void setOutputSize(Dimension size)
          Sets the output size.
 
Methods inherited from class net.sf.fmj.media.AbstractCodec
checkInputBuffer, dump, getOutputFormat, getSupportedInputFormats, isEOM, propagateEOM
 
Methods inherited from class net.sf.fmj.media.AbstractPlugIn
getName, open, 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
getName, open, reset
 
Methods inherited from interface javax.media.Controls
getControl, getControls
 

Constructor Detail

SwScaler

public SwScaler()
Initializes a new SwScaler instance which doesn't have an output size and will use a default one when it becomes necessary unless an explicit one is specified in the meantime.


SwScaler

protected SwScaler(boolean fixOddYuv420Size)
Initializes a new SwScaler instance which can optionally attempt to keep the width and height of YUV 420 output even.

Parameters:
fixOddYuv420Size - true to keep the width and height of YUV 420 output even; otherwise, false
Method Detail

close

public void close()
Close codec.

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

getInputFormat

public javax.media.Format getInputFormat()
Gets the Format in which this Codec is currently configured to accept input media data.

Makes the protected super implementation public.

Overrides:
getInputFormat in class net.sf.fmj.media.AbstractCodec
Returns:
the Format in which this Codec is currently configured to accept input media data
See Also:
AbstractCodec.getInputFormat()

getNativeRGBFormat

public static int getNativeRGBFormat(javax.media.format.RGBFormat rgb)
Gets native (FFmpeg) RGB format.

Parameters:
rgb - JMF RGBFormat
Returns:
native RGB format

getOutputSize

public Dimension getOutputSize()
Gets the output size.

Returns:
the output size

getSupportedOutputFormats

public javax.media.Format[] getSupportedOutputFormats(javax.media.Format input)
Gets the supported output formats for an input one.

Specified by:
getSupportedOutputFormats in interface javax.media.Codec
Specified by:
getSupportedOutputFormats in class net.sf.fmj.media.AbstractCodec
Parameters:
input - input format to get supported output ones for
Returns:
array of supported output formats

process

public int process(javax.media.Buffer input,
                   javax.media.Buffer output)
Processes (converts color space and/or scales) a buffer.

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

setInputFormat

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

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

setOutputFormat

public javax.media.Format setOutputFormat(javax.media.Format format)
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:
format - 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

setOutputSize

public void setOutputSize(Dimension size)
Sets the output size.

Parameters:
size - the size to set as the output size

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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