Class SwScale
- java.lang.Object
-
- net.sf.fmj.media.AbstractControls
-
- net.sf.fmj.media.AbstractPlugIn
-
- net.sf.fmj.media.AbstractCodec
-
- org.jitsi.impl.neomedia.codec.video.SwScale
-
- All Implemented Interfaces:
javax.media.Codec,javax.media.Controls,javax.media.PlugIn
public class SwScale extends net.sf.fmj.media.AbstractCodecImplements an FMJ Codec which uses libswscale to scale images and convert between color spaces (typically, RGB and YUV).- Author:
- Sebastien Vincent, Lyubomir Marinov
-
-
Field Summary
Fields Modifier and Type Field Description static intMIN_SWS_SCALE_HEIGHT_OR_WIDTHThe minimum height and/or width of the input and/or output to be passed to sws_scale in order to prevent its crashing.
-
Constructor Summary
Constructors Constructor Description SwScale()Initializes a new SwScale 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.SwScale(boolean fixOddYuv420Size)Initializes a new SwScale instance which can optionally attempt to keep the width and height of YUV 420 output even.SwScale(boolean fixOddYuv420Size, boolean preserveAspectRatio)Initializes a new SwScale instance which can optionally attempt to keep the width and height of YUV 420 output even and to preserve the aspect ratio of the video frames provided to the instance as input to be processed.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close codec.javax.media.FormatgetInputFormat()Gets the Format in which this Codec is currently configured to accept input media data.DimensiongetOutputSize()Gets the output size.javax.media.Format[]getSupportedOutputFormats(javax.media.Format input)Gets the supported output formats for an input one.intprocess(javax.media.Buffer in, javax.media.Buffer out)Processes (converts color space and/or scales) an input Buffer into an output Buffer.javax.media.FormatsetInputFormat(javax.media.Format format)Sets the input format.javax.media.FormatsetOutputFormat(javax.media.Format format)Sets the Format in which this Codec is to output media data.voidsetOutputSize(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.AbstractControls
addControl, getControl, getControls, removeControl
-
-
-
-
Field Detail
-
MIN_SWS_SCALE_HEIGHT_OR_WIDTH
public static final int MIN_SWS_SCALE_HEIGHT_OR_WIDTH
The minimum height and/or width of the input and/or output to be passed to sws_scale in order to prevent its crashing.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SwScale
public SwScale()
Initializes a new SwScale 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.
-
SwScale
public SwScale(boolean fixOddYuv420Size)
Initializes a new SwScale instance which can optionally attempt to keep the width and height of YUV 420 output even.- Parameters:
fixOddYuv420Size- true to have the new instance keep the width and height of YUV 420 output even; otherwise, false
-
SwScale
public SwScale(boolean fixOddYuv420Size, boolean preserveAspectRatio)Initializes a new SwScale instance which can optionally attempt to keep the width and height of YUV 420 output even and to preserve the aspect ratio of the video frames provided to the instance as input to be processed.- Parameters:
fixOddYuv420Size- true to have the new instance keep the width and height of YUV 420 output even; otherwise, falsepreserveAspectRatio- true to have the new instance preserve the aspect ratio of the video frames provided to it as input to be processed; otherwise, false
-
-
Method Detail
-
close
public void close()
Close codec.- Specified by:
closein interfacejavax.media.PlugIn- Overrides:
closein classnet.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:
getInputFormatin classnet.sf.fmj.media.AbstractCodec- Returns:
- the Format in which this Codec is currently configured to accept input media data
- See Also:
AbstractCodec.getInputFormat()
-
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:
getSupportedOutputFormatsin interfacejavax.media.Codec- Specified by:
getSupportedOutputFormatsin classnet.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 in, javax.media.Buffer out)Processes (converts color space and/or scales) an input Buffer into an output Buffer.- Specified by:
processin interfacejavax.media.Codec- Specified by:
processin classnet.sf.fmj.media.AbstractCodec- Parameters:
in- the input Buffer to process (from)out- the output Buffer to process into- Returns:
- BUFFER_PROCESSED_OK if in has been successfully processed into out
-
setInputFormat
public javax.media.Format setInputFormat(javax.media.Format format)
Sets the input format.- Specified by:
setInputFormatin interfacejavax.media.Codec- Overrides:
setInputFormatin classnet.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:
setOutputFormatin interfacejavax.media.Codec- Overrides:
setOutputFormatin classnet.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
-
-