Package com.avpkit.core
Class IVideoResampler
- java.lang.Object
-
- com.avpkit.ferry.RefCounted
-
- com.avpkit.core.IVideoResampler
-
- All Implemented Interfaces:
IConfigurable
public class IVideoResampler extends RefCounted implements IConfigurable
Converts {IVideoPicture} objects of a given width, height and format to a new
width, height or format.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classIVideoResampler.FeatureFeatures that the VideoResampler may optionally support.
-
Field Summary
-
Fields inherited from class com.avpkit.ferry.RefCounted
swigCMemOwn
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedIVideoResampler(long cPtr, boolean cMemoryOwn)Internal Only.protectedIVideoResampler(long cPtr, boolean cMemoryOwn, java.util.concurrent.atomic.AtomicLong ref)Internal Only.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description IVideoResamplercopyReference()Create a new IVideoResampler object that is actually referring to the exact same underlying native object.booleanequals(java.lang.Object obj)Compares two values, returning true if the underlying objects in native code are the same object.static longgetCPtr(IVideoResampler obj)Internal Only.intgetInputHeight()Get the height in pixels we expect on the input frame to the resampler.IPixelFormat.TypegetInputPixelFormat()Get the input pixel format.intgetInputWidth()Get the width in pixels we expect on the input frame to the resampler.longgetMyCPtr()Internal Only.intgetNumProperties()Returns the total number of settable properties on this object
intgetOutputHeight()Get the output height, in pixels.IPixelFormat.TypegetOutputPixelFormat()Get the output pixel format.intgetOutputWidth()Get the output width, in pixels.booleangetPropertyAsBoolean(java.lang.String name)Gets the value of this property, and returns as a boolean
doublegetPropertyAsDouble(java.lang.String name)Gets the value of this property, and returns as a double;
longgetPropertyAsLong(java.lang.String name)Gets the value of this property, and returns as an long;
IRationalgetPropertyAsRational(java.lang.String name)Gets the value of this property, and returns as an IRational;
java.lang.StringgetPropertyAsString(java.lang.String name)Gets a property on this Object.
Note for C++ callers; you must free the returned array with
delete[] in order to avoid a memory leak.IPropertygetPropertyMetaData(int propertyNo)Returns the name of the numbered property.
IPropertygetPropertyMetaData(java.lang.String name)Returns the name of the numbered property.
java.util.Collection<java.lang.String>getPropertyNames()Gets a collection of all properties settable on this object.inthashCode()Get a hashable value for this object.static booleanisSupported(IVideoResampler.Feature feature)Returns true if the asked for feature is supported.
static IVideoResamplermake(int outputWidth, int outputHeight, IPixelFormat.Type outputFmt, int inputWidth, int inputHeight, IPixelFormat.Type inputFmt)Get a new video resampler.intresample(IVideoPicture outVideoPicture, IVideoPicture inVideoPicture)Resample in to out based on the resampler parameters.
Resamples the in picture based on the parameters set when
this resampler was constructed.
intsetProperty(IMetaData valuesToSet, IMetaData valuesNotFound){intsetProperty(java.lang.String name, boolean value)Looks up the property 'name' and sets the
value of the property to 'value'.
intsetProperty(java.lang.String name, double value)Looks up the property 'name' and sets the
value of the property to 'value'.
intsetProperty(java.lang.String name, long value)Looks up the property 'name' and sets the
value of the property to 'value'.
intsetProperty(java.lang.String name, IRational value)Looks up the property 'name' and sets the
value of the property to 'value'.
intsetProperty(java.lang.String name, java.lang.String value)Sets a property on this Object.
All AVOptions supported by the underlying AVClass are supported.
-
Methods inherited from class com.avpkit.ferry.RefCounted
acquire, delete, getCPtr, getCurrentRefCount, getJavaRefCount, release
-
-
-
-
Constructor Detail
-
IVideoResampler
protected IVideoResampler(long cPtr, boolean cMemoryOwn)
Internal Only.
-
IVideoResampler
protected IVideoResampler(long cPtr, boolean cMemoryOwn, java.util.concurrent.atomic.AtomicLong ref)
Internal Only.
-
-
Method Detail
-
getCPtr
public static long getCPtr(IVideoResampler obj)
Internal Only. Not part of public API. Get the raw value of the native object that obj is proxying for.- Parameters:
obj- The java proxy object for a native object.- Returns:
- The raw pointer obj is proxying for.
-
getMyCPtr
public long getMyCPtr()
Internal Only. Not part of public API. Get the raw value of the native object that we're proxying for.- Overrides:
getMyCPtrin classRefCounted- Returns:
- The raw pointer we're proxying for.
-
copyReference
public IVideoResampler copyReference()
Create a new IVideoResampler object that is actually referring to the exact same underlying native object.- Overrides:
copyReferencein classRefCounted- Returns:
- the new Java object.
-
equals
public boolean equals(java.lang.Object obj)
Compares two values, returning true if the underlying objects in native code are the same object. That means you can have two different Java objects, but when you do a comparison, you'll find out they are the EXACT same object.- Overrides:
equalsin classjava.lang.Object- Returns:
- True if the underlying native object is the same. False otherwise.
-
hashCode
public int hashCode()
Get a hashable value for this object.- Overrides:
hashCodein classjava.lang.Object- Returns:
- the hashable value.
-
getPropertyNames
public java.util.Collection<java.lang.String> getPropertyNames()
Gets a collection of all properties settable on this object. You can then query current settings withIConfigurable.getPropertyAsString(String)and set properties withIConfigurable.setProperty(String, String).- Specified by:
getPropertyNamesin interfaceIConfigurable- Returns:
- a collection of all properties for this object.
-
getInputWidth
public int getInputWidth()
Get the width in pixels we expect on the input frame to the resampler.- Returns:
- The width we expect on the input frame to the resampler.
-
getInputHeight
public int getInputHeight()
Get the height in pixels we expect on the input frame to the resampler.- Returns:
- The height we expect on the input frame to the resampler.
-
getInputPixelFormat
public IPixelFormat.Type getInputPixelFormat()
Get the input pixel format.- Returns:
- The pixel format we expect on the input frame to the resampler.
-
getOutputWidth
public int getOutputWidth()
Get the output width, in pixels.- Returns:
- The width we will resample the output frame to
-
getOutputHeight
public int getOutputHeight()
Get the output height, in pixels.- Returns:
- The height we will resample the output frame to
-
getOutputPixelFormat
public IPixelFormat.Type getOutputPixelFormat()
Get the output pixel format.- Returns:
- The pixel format we will resample the output frame to
-
resample
public int resample(IVideoPicture outVideoPicture, IVideoPicture inVideoPicture)
Resample in to out based on the resampler parameters.
Resamples the in picture based on the parameters set when
this resampler was constructed.
- Parameters:
outVideoPicture- The picture we'll resample to. Check
{IVideoPicture#isComplete()} after the call.inVideoPicture- The picture we'll resample from.
- Returns:
- >= 0 on success; <0 on error.
-
getNumProperties
public int getNumProperties()
Returns the total number of settable properties on this object
- Specified by:
getNumPropertiesin interfaceIConfigurable- Returns:
- total number of options (not including constant definitions)
-
getPropertyMetaData
public IProperty getPropertyMetaData(int propertyNo)
Returns the name of the numbered property.
- Specified by:
getPropertyMetaDatain interfaceIConfigurable- Parameters:
propertyNo- The property number in the options list.
- Returns:
- an IProperty value for this properties meta-data
-
getPropertyMetaData
public IProperty getPropertyMetaData(java.lang.String name)
Returns the name of the numbered property.
- Specified by:
getPropertyMetaDatain interfaceIConfigurable- Parameters:
name- The property name.
- Returns:
- an IProperty value for this properties meta-data
-
setProperty
public int setProperty(java.lang.String name, java.lang.String value)
Sets a property on this Object.
All AVOptions supported by the underlying AVClass are supported.
- Specified by:
setPropertyin interfaceIConfigurable- Parameters:
name- The property name. For example "b" for bit-rate.value- The value of the property.
- Returns:
- >= 0 if the property was successfully set; <0 on error
-
setProperty
public int setProperty(java.lang.String name, double value)
Looks up the property 'name' and sets the
value of the property to 'value'.
- Specified by:
setPropertyin interfaceIConfigurable- Parameters:
name- name of optionvalue- Value of option
- Returns:
- >= 0 on success; <0 on error.
-
setProperty
public int setProperty(java.lang.String name, long value)
Looks up the property 'name' and sets the
value of the property to 'value'.
- Specified by:
setPropertyin interfaceIConfigurable- Parameters:
name- name of optionvalue- Value of option
- Returns:
- >= 0 on success; <0 on error.
-
setProperty
public int setProperty(java.lang.String name, boolean value)
Looks up the property 'name' and sets the
value of the property to 'value'.
- Specified by:
setPropertyin interfaceIConfigurable- Parameters:
name- name of optionvalue- Value of option
- Returns:
- >= 0 on success; <0 on error.
-
setProperty
public int setProperty(java.lang.String name, IRational value)
Looks up the property 'name' and sets the
value of the property to 'value'.
- Specified by:
setPropertyin interfaceIConfigurable- Parameters:
name- name of optionvalue- Value of option
- Returns:
- >= 0 on success; <0 on error.
-
getPropertyAsString
public java.lang.String getPropertyAsString(java.lang.String name)
Gets a property on this Object.
Note for C++ callers; you must free the returned array with
delete[] in order to avoid a memory leak. Other language
folks need not worry.
- Specified by:
getPropertyAsStringin interfaceIConfigurable- Parameters:
name- property name
- Returns:
- an string copy of the option value, or null if the option doesn't exist.
-
getPropertyAsDouble
public double getPropertyAsDouble(java.lang.String name)
Gets the value of this property, and returns as a double;
- Specified by:
getPropertyAsDoublein interfaceIConfigurable- Parameters:
name- name of option
- Returns:
- double value of property, or 0 on error.
-
getPropertyAsLong
public long getPropertyAsLong(java.lang.String name)
Gets the value of this property, and returns as an long;
- Specified by:
getPropertyAsLongin interfaceIConfigurable- Parameters:
name- name of option
- Returns:
- long value of property, or 0 on error.
-
getPropertyAsRational
public IRational getPropertyAsRational(java.lang.String name)
Gets the value of this property, and returns as an IRational;
- Specified by:
getPropertyAsRationalin interfaceIConfigurable- Parameters:
name- name of option
- Returns:
- long value of property, or 0 on error.
-
getPropertyAsBoolean
public boolean getPropertyAsBoolean(java.lang.String name)
Gets the value of this property, and returns as a boolean
- Specified by:
getPropertyAsBooleanin interfaceIConfigurable- Parameters:
name- name of option
- Returns:
- boolean value of property, or false on error.
-
make
public static IVideoResampler make(int outputWidth, int outputHeight, IPixelFormat.Type outputFmt, int inputWidth, int inputHeight, IPixelFormat.Type inputFmt)
Get a new video resampler. Returns null if {#isSupported(Feature)} returns false.
- Parameters:
outputWidth- The width in pixels you want to output frame to have.outputHeight- The height in pixels you want to output frame to have.outputFmt- The pixel format of the output frame.inputWidth- The width in pixels the input frame will be in.inputHeight- The height in pixels the input frame will be in.inputFmt- The pixel format of the input frame.- Returns:
- a new object, or null if we cannot allocate one.
-
isSupported
public static boolean isSupported(IVideoResampler.Feature feature)
Returns true if the asked for feature is supported.
- Parameters:
feature- The feature you want to find out is supported.- Returns:
- true if the IVideoResampler supports this feature; false otherwise.
-
setProperty
public int setProperty(IMetaData valuesToSet, IMetaData valuesNotFound)
{- Specified by:
setPropertyin interfaceIConfigurable- Parameters:
valuesToSet- The set of key-value pairs to try to setvaluesNotFound- If non null will contain all key-values pairs in valuesToSet that were not found in context.- Returns:
- 0 on success; <0 on failure
-
-