001/* ---------------------------------------------------------------------------- 002 * This file was automatically generated by SWIG (http://www.swig.org). 003 * Version 4.0.2 004 * 005 * Do not make changes to this file unless you know what you are doing--modify 006 * the SWIG interface file instead. 007 * ----------------------------------------------------------------------------- */ 008 009package com.avpkit.core; 010import com.avpkit.ferry.*; 011/** 012 * Converts {IVideoPicture} objects of a given width, height and format to a new<br> 013 * width, height or format. 014 */ 015public class IVideoResampler extends RefCounted implements com.avpkit.core.IConfigurable { 016 // JNIHelper.swg: Start generated code 017 // >>>>>>>>>>>>>>>>>>>>>>>>>>> 018 /** 019 * This method is only here to use some references and remove 020 * a Eclipse compiler warning. 021 */ 022 @SuppressWarnings("unused") 023 private void noop() 024 { 025 IBuffer.make(null, 1); 026 } 027 028 private volatile long swigCPtr; 029 030 /** 031 * Internal Only. 032 */ 033 protected IVideoResampler(long cPtr, boolean cMemoryOwn) { 034 super(AVPKitJNI.IVideoResampler_SWIGUpcast(cPtr), cMemoryOwn); 035 swigCPtr = cPtr; 036 } 037 038 /** 039 * Internal Only. 040 */ 041 protected IVideoResampler(long cPtr, boolean cMemoryOwn, 042 java.util.concurrent.atomic.AtomicLong ref) 043 { 044 super(AVPKitJNI.IVideoResampler_SWIGUpcast(cPtr), 045 cMemoryOwn, ref); 046 swigCPtr = cPtr; 047 } 048 049 /** 050 * Internal Only. Not part of public API. 051 * 052 * Get the raw value of the native object that obj is proxying for. 053 * 054 * @param obj The java proxy object for a native object. 055 * @return The raw pointer obj is proxying for. 056 */ 057 public static long getCPtr(IVideoResampler obj) { 058 if (obj == null) return 0; 059 return obj.getMyCPtr(); 060 } 061 062 /** 063 * Internal Only. Not part of public API. 064 * 065 * Get the raw value of the native object that we're proxying for. 066 * 067 * @return The raw pointer we're proxying for. 068 */ 069 public long getMyCPtr() { 070 if (swigCPtr == 0) throw new IllegalStateException("underlying native object already deleted"); 071 return swigCPtr; 072 } 073 074 /** 075 * Create a new IVideoResampler object that is actually referring to the 076 * exact same underlying native object. 077 * 078 * @return the new Java object. 079 */ 080 @Override 081 public IVideoResampler copyReference() { 082 if (swigCPtr == 0) 083 return null; 084 else 085 return new IVideoResampler(swigCPtr, swigCMemOwn, getJavaRefCount()); 086 } 087 088 /** 089 * Compares two values, returning true if the underlying objects in native code are the same object. 090 * 091 * That means you can have two different Java objects, but when you do a comparison, you'll find out 092 * they are the EXACT same object. 093 * 094 * @return True if the underlying native object is the same. False otherwise. 095 */ 096 public boolean equals(Object obj) { 097 boolean equal = false; 098 if (obj instanceof IVideoResampler) 099 equal = (((IVideoResampler)obj).swigCPtr == this.swigCPtr); 100 return equal; 101 } 102 103 /** 104 * Get a hashable value for this object. 105 * 106 * @return the hashable value. 107 */ 108 public int hashCode() { 109 return (int)swigCPtr; 110 } 111 112 // <<<<<<<<<<<<<<<<<<<<<<<<<<< 113 // JNIHelper.swg: End generated code 114 115 116 /** 117 * {@inheritDoc} 118 */ 119 public java.util.Collection<String> getPropertyNames() 120 { 121 java.util.Collection<String> retval = new java.util.LinkedList<String>(); 122 int numProperties = this.getNumProperties(); 123 for(int i = 0; i < numProperties; i++) 124 { 125 IProperty property = this.getPropertyMetaData(i); 126 String name = property.getName(); 127 retval.add(name); 128 } 129 return retval; 130 } 131 132 /** 133 * Get the width in pixels we expect on the input frame to the resampler.<br> 134 * @return The width we expect on the input frame to the resampler. 135 */ 136 public int getInputWidth() { 137 return AVPKitJNI.IVideoResampler_getInputWidth(swigCPtr, this); 138 } 139 140 /** 141 * Get the height in pixels we expect on the input frame to the resampler.<br> 142 * @return The height we expect on the input frame to the resampler. 143 */ 144 public int getInputHeight() { 145 return AVPKitJNI.IVideoResampler_getInputHeight(swigCPtr, this); 146 } 147 148 /** 149 * Get the input pixel format.<br> 150 * @return The pixel format we expect on the input frame to the resampler. 151 */ 152 public IPixelFormat.Type getInputPixelFormat() { 153 return IPixelFormat.Type.swigToEnum(AVPKitJNI.IVideoResampler_getInputPixelFormat(swigCPtr, this)); 154 } 155 156 /** 157 * Get the output width, in pixels.<br> 158 * @return The width we will resample the output frame to 159 */ 160 public int getOutputWidth() { 161 return AVPKitJNI.IVideoResampler_getOutputWidth(swigCPtr, this); 162 } 163 164 /** 165 * Get the output height, in pixels.<br> 166 * @return The height we will resample the output frame to 167 */ 168 public int getOutputHeight() { 169 return AVPKitJNI.IVideoResampler_getOutputHeight(swigCPtr, this); 170 } 171 172 /** 173 * Get the output pixel format.<br> 174 * @return The pixel format we will resample the output frame to 175 */ 176 public IPixelFormat.Type getOutputPixelFormat() { 177 return IPixelFormat.Type.swigToEnum(AVPKitJNI.IVideoResampler_getOutputPixelFormat(swigCPtr, this)); 178 } 179 180 /** 181 * Resample in to out based on the resampler parameters.<br> 182 * <br> 183 * Resamples the in picture based on the parameters set when<br> 184 * this resampler was constructed.<br> 185 * <br> 186 * @param outVideoPicture The picture we'll resample to. Check<br> 187 * {IVideoPicture#isComplete()} after the call.<br> 188 * @param inVideoPicture The picture we'll resample from.<br> 189 * <br> 190 * @return >= 0 on success; <0 on error. 191 */ 192 public int resample(IVideoPicture outVideoPicture, IVideoPicture inVideoPicture) { 193 return AVPKitJNI.IVideoResampler_resample(swigCPtr, this, IVideoPicture.getCPtr(outVideoPicture), outVideoPicture, IVideoPicture.getCPtr(inVideoPicture), inVideoPicture); 194 } 195 196 /** 197 * Returns the total number of settable properties on this object<br> 198 * <br> 199 * @return total number of options (not including constant definitions) 200 */ 201 public int getNumProperties() { 202 return AVPKitJNI.IVideoResampler_getNumProperties(swigCPtr, this); 203 } 204 205 /** 206 * Returns the name of the numbered property.<br> 207 * <br> 208 * @param propertyNo The property number in the options list.<br> 209 * <br> 210 * @return an IProperty value for this properties meta-data 211 */ 212 public IProperty getPropertyMetaData(int propertyNo) { 213 long cPtr = AVPKitJNI.IVideoResampler_getPropertyMetaData__SWIG_0(swigCPtr, this, propertyNo); 214 return (cPtr == 0) ? null : new IProperty(cPtr, false); 215 } 216 217 /** 218 * Returns the name of the numbered property.<br> 219 * <br> 220 * @param name The property name.<br> 221 * <br> 222 * @return an IProperty value for this properties meta-data 223 */ 224 public IProperty getPropertyMetaData(String name) { 225 long cPtr = AVPKitJNI.IVideoResampler_getPropertyMetaData__SWIG_1(swigCPtr, this, name); 226 return (cPtr == 0) ? null : new IProperty(cPtr, false); 227 } 228 229 /** 230 * Sets a property on this Object.<br> 231 * <br> 232 * All AVOptions supported by the underlying AVClass are supported.<br> 233 * <br> 234 * @param name The property name. For example "b" for bit-rate.<br> 235 * @param value The value of the property. <br> 236 * <br> 237 * @return >= 0 if the property was successfully set; <0 on error 238 */ 239 public int setProperty(String name, String value) { 240 return AVPKitJNI.IVideoResampler_setProperty__SWIG_0(swigCPtr, this, name, value); 241 } 242 243 /** 244 * Looks up the property 'name' and sets the<br> 245 * value of the property to 'value'.<br> 246 * <br> 247 * @param name name of option<br> 248 * @param value Value of option<br> 249 * <br> 250 * @return >= 0 on success; <0 on error. 251 */ 252 public int setProperty(String name, double value) { 253 return AVPKitJNI.IVideoResampler_setProperty__SWIG_1(swigCPtr, this, name, value); 254 } 255 256 /** 257 * Looks up the property 'name' and sets the<br> 258 * value of the property to 'value'.<br> 259 * <br> 260 * @param name name of option<br> 261 * @param value Value of option<br> 262 * <br> 263 * @return >= 0 on success; <0 on error. 264 */ 265 public int setProperty(String name, long value) { 266 return AVPKitJNI.IVideoResampler_setProperty__SWIG_2(swigCPtr, this, name, value); 267 } 268 269 /** 270 * Looks up the property 'name' and sets the<br> 271 * value of the property to 'value'.<br> 272 * <br> 273 * @param name name of option<br> 274 * @param value Value of option<br> 275 * <br> 276 * @return >= 0 on success; <0 on error. 277 */ 278 public int setProperty(String name, boolean value) { 279 return AVPKitJNI.IVideoResampler_setProperty__SWIG_3(swigCPtr, this, name, value); 280 } 281 282 /** 283 * Looks up the property 'name' and sets the<br> 284 * value of the property to 'value'.<br> 285 * <br> 286 * @param name name of option<br> 287 * @param value Value of option<br> 288 * <br> 289 * @return >= 0 on success; <0 on error. 290 */ 291 public int setProperty(String name, IRational value) { 292 return AVPKitJNI.IVideoResampler_setProperty__SWIG_4(swigCPtr, this, name, IRational.getCPtr(value), value); 293 } 294 295 /** 296 * Gets a property on this Object.<br> 297 * <br> 298 * Note for C++ callers; you must free the returned array with<br> 299 * delete[] in order to avoid a memory leak. Other language<br> 300 * folks need not worry.<br> 301 * <br> 302 * @param name property name<br> 303 * <br> 304 * @return an string copy of the option value, or null if the option doesn't exist. 305 */ 306 public String getPropertyAsString(String name) { 307 return AVPKitJNI.IVideoResampler_getPropertyAsString(swigCPtr, this, name); 308 } 309 310 /** 311 * Gets the value of this property, and returns as a double;<br> 312 * <br> 313 * @param name name of option<br> 314 * <br> 315 * @return double value of property, or 0 on error. 316 */ 317 public double getPropertyAsDouble(String name) { 318 return AVPKitJNI.IVideoResampler_getPropertyAsDouble(swigCPtr, this, name); 319 } 320 321 /** 322 * Gets the value of this property, and returns as an long;<br> 323 * <br> 324 * @param name name of option<br> 325 * <br> 326 * @return long value of property, or 0 on error. 327 */ 328 public long getPropertyAsLong(String name) { 329 return AVPKitJNI.IVideoResampler_getPropertyAsLong(swigCPtr, this, name); 330 } 331 332 /** 333 * Gets the value of this property, and returns as an IRational;<br> 334 * <br> 335 * @param name name of option<br> 336 * <br> 337 * @return long value of property, or 0 on error. 338 */ 339 public IRational getPropertyAsRational(String name) { 340 long cPtr = AVPKitJNI.IVideoResampler_getPropertyAsRational(swigCPtr, this, name); 341 return (cPtr == 0) ? null : new IRational(cPtr, false); 342 } 343 344 /** 345 * Gets the value of this property, and returns as a boolean<br> 346 * <br> 347 * @param name name of option<br> 348 * <br> 349 * @return boolean value of property, or false on error. 350 */ 351 public boolean getPropertyAsBoolean(String name) { 352 return AVPKitJNI.IVideoResampler_getPropertyAsBoolean(swigCPtr, this, name); 353 } 354 355 /** 356 * Get a new video resampler. Returns null if {#isSupported(Feature)} returns false.<br> 357 * <br> 358 * @param outputWidth The width in pixels you want to output frame to have.<br> 359 * @param outputHeight The height in pixels you want to output frame to have.<br> 360 * @param outputFmt The pixel format of the output frame.<br> 361 * @param inputWidth The width in pixels the input frame will be in.<br> 362 * @param inputHeight The height in pixels the input frame will be in.<br> 363 * @param inputFmt The pixel format of the input frame.<br> 364 * @return a new object, or null if we cannot allocate one. 365 */ 366 public static IVideoResampler make(int outputWidth, int outputHeight, IPixelFormat.Type outputFmt, int inputWidth, int inputHeight, IPixelFormat.Type inputFmt) { 367 long cPtr = AVPKitJNI.IVideoResampler_make(outputWidth, outputHeight, outputFmt.swigValue(), inputWidth, inputHeight, inputFmt.swigValue()); 368 return (cPtr == 0) ? null : new IVideoResampler(cPtr, false); 369 } 370 371 /** 372 * Returns true if the asked for feature is supported.<br> 373 * <br> 374 * @param feature The feature you want to find out is supported.<br> 375 * @return true if the IVideoResampler supports this feature; false otherwise. 376 */ 377 public static boolean isSupported(IVideoResampler.Feature feature) { 378 return AVPKitJNI.IVideoResampler_isSupported(feature.swigValue()); 379 } 380 381 /** 382 * { 383 */ 384 public int setProperty(IMetaData valuesToSet, IMetaData valuesNotFound) { 385 return AVPKitJNI.IVideoResampler_setProperty__SWIG_5(swigCPtr, this, IMetaData.getCPtr(valuesToSet), valuesToSet, IMetaData.getCPtr(valuesNotFound), valuesNotFound); 386 } 387 388 /** 389 * Features that the VideoResampler may optionally support. 390 */ 391 public enum Feature { 392 FEATURE_IMAGERESCALING, 393 FEATURE_COLORSPACECONVERSION; 394 395 public final int swigValue() { 396 return swigValue; 397 } 398 399 public static Feature swigToEnum(int swigValue) { 400 Feature[] swigValues = Feature.class.getEnumConstants(); 401 if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue) 402 return swigValues[swigValue]; 403 for (Feature swigEnum : swigValues) 404 if (swigEnum.swigValue == swigValue) 405 return swigEnum; 406 throw new IllegalArgumentException("No enum " + Feature.class + " with value " + swigValue); 407 } 408 409 @SuppressWarnings("unused") 410 private Feature() { 411 this.swigValue = SwigNext.next++; 412 } 413 414 @SuppressWarnings("unused") 415 private Feature(int swigValue) { 416 this.swigValue = swigValue; 417 SwigNext.next = swigValue+1; 418 } 419 420 @SuppressWarnings("unused") 421 private Feature(Feature swigEnum) { 422 this.swigValue = swigEnum.swigValue; 423 SwigNext.next = this.swigValue+1; 424 } 425 426 private final int swigValue; 427 428 private static class SwigNext { 429 private static int next = 0; 430 } 431 } 432 433}