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 * Represents settable properties that effect how AVPKit objects<br>
013 * operate.<br>
014 * <p><br>
015 * For example, setting the &quot;b&quot; property on an<br>
016 * {IStreamCoder} sets the bit-rate the coder will attempt<br>
017 * to encode at.<br>
018 * </p> 
019 */
020public class IProperty extends RefCounted {
021  // JNIHelper.swg: Start generated code
022  // >>>>>>>>>>>>>>>>>>>>>>>>>>>
023  /**
024   * This method is only here to use some references and remove
025   * a Eclipse compiler warning.
026   */
027  @SuppressWarnings("unused")
028  private void noop()
029  {
030    IBuffer.make(null, 1);
031  }
032   
033  private volatile long swigCPtr;
034
035  /**
036   * Internal Only.
037   */
038  protected IProperty(long cPtr, boolean cMemoryOwn) {
039    super(AVPKitJNI.IProperty_SWIGUpcast(cPtr), cMemoryOwn);
040    swigCPtr = cPtr;
041  }
042  
043  /**
044   * Internal Only.
045   */
046  protected IProperty(long cPtr, boolean cMemoryOwn,
047      java.util.concurrent.atomic.AtomicLong ref)
048  {
049    super(AVPKitJNI.IProperty_SWIGUpcast(cPtr),
050     cMemoryOwn, ref);
051    swigCPtr = cPtr;
052  }
053    
054  /**
055   * Internal Only.  Not part of public API.
056   *
057   * Get the raw value of the native object that obj is proxying for.
058   *   
059   * @param obj The java proxy object for a native object.
060   * @return The raw pointer obj is proxying for.
061   */
062  public static long getCPtr(IProperty obj) {
063    if (obj == null) return 0;
064    return obj.getMyCPtr();
065  }
066
067  /**
068   * Internal Only.  Not part of public API.
069   *
070   * Get the raw value of the native object that we're proxying for.
071   *   
072   * @return The raw pointer we're proxying for.
073   */  
074  public long getMyCPtr() {
075    if (swigCPtr == 0) throw new IllegalStateException("underlying native object already deleted");
076    return swigCPtr;
077  }
078  
079  /**
080   * Create a new IProperty object that is actually referring to the
081   * exact same underlying native object.
082   *
083   * @return the new Java object.
084   */
085  @Override
086  public IProperty copyReference() {
087    if (swigCPtr == 0)
088      return null;
089    else
090      return new IProperty(swigCPtr, swigCMemOwn, getJavaRefCount());
091  }
092
093  /**
094   * Compares two values, returning true if the underlying objects in native code are the same object.
095   *
096   * That means you can have two different Java objects, but when you do a comparison, you'll find out
097   * they are the EXACT same object.
098   *
099   * @return True if the underlying native object is the same.  False otherwise.
100   */
101  public boolean equals(Object obj) {
102    boolean equal = false;
103    if (obj instanceof IProperty)
104      equal = (((IProperty)obj).swigCPtr == this.swigCPtr);
105    return equal;
106  }
107  
108  /**
109   * Get a hashable value for this object.
110   *
111   * @return the hashable value.
112   */
113  public int hashCode() {
114     return (int)swigCPtr;
115  }
116  
117  // <<<<<<<<<<<<<<<<<<<<<<<<<<<
118  // JNIHelper.swg: End generated code
119  
120  /**
121   * Get the name for this property.<br>
122   * <br>
123   * @return the name.
124   */
125  public String getName() {
126    return AVPKitJNI.IProperty_getName(swigCPtr, this);
127  }
128
129  /**
130   * Get the (English) help string for this property.<br>
131   * <br>
132   * @return the help string
133   */
134  public String getHelp() {
135    return AVPKitJNI.IProperty_getHelp(swigCPtr, this);
136  }
137
138  /**
139   * Get any sub-unit this option or constant belongs to.<br>
140   * <br>
141   * @return the unit, or null if none.
142   */
143  public String getUnit() {
144    return AVPKitJNI.IProperty_getUnit(swigCPtr, this);
145  }
146
147  /**
148   * Get the underlying native type of this property.<br>
149   * <br>
150   * @return the type
151   */
152  public IProperty.Type getType() {
153    return IProperty.Type.swigToEnum(AVPKitJNI.IProperty_getType(swigCPtr, this));
154  }
155
156  /**
157   * Get any set flags (a bitmask) for this option.<br>
158   * <br>
159   * @return the flags
160   */
161  public int getFlags() {
162    return AVPKitJNI.IProperty_getFlags(swigCPtr, this);
163  }
164
165  /**
166   * Get the default setting this flag would have it not set.<br>
167   * <br>
168   * @return the default
169   */
170  public long getDefault() {
171    return AVPKitJNI.IProperty_getDefault(swigCPtr, this);
172  }
173
174  /**
175   * Get the default setting this flag would have it not set.<br>
176   * <br>
177   * @return the default
178   */
179  public double getDefaultAsDouble() {
180    return AVPKitJNI.IProperty_getDefaultAsDouble(swigCPtr, this);
181  }
182
183  /**
184   * If this IProperty is of the type {Type#PROPERTY_FLAGS}, this method will<br>
185   * tell you how many different flag settings it takes.<br>
186   * <br>
187   * @return Number of flag settings, or &lt;0 if not a FLAGS value
188   */
189  public int getNumFlagSettings() {
190    return AVPKitJNI.IProperty_getNumFlagSettings(swigCPtr, this);
191  }
192
193  /**
194   * If this IProperty is of the type {Type#PROPERTY_FLAGS}, this method will<br>
195   * give you another IProperty representing a constant setting for that flag.<br>
196   * <br>
197   * @param position The position number for the flag;  Must be in range 0 &lt;= position &lt;= #getNumFlagSettings().<br>
198   * <br>
199   * @return An IProperty object for the flag setting, or null if not available.
200   */
201  public IProperty getFlagConstant(int position) {
202    long cPtr = AVPKitJNI.IProperty_getFlagConstant__SWIG_0(swigCPtr, this, position);
203    return (cPtr == 0) ? null : new IProperty(cPtr, false);
204  }
205
206  /**
207   * If this IProperty is of the type {Type#PROPERTY_FLAGS}, this method will<br>
208   * give you another IProperty representing a constant setting for that flag.<br>
209   * <br>
210   * @param name The name of the constant.<br>
211   * <br>
212   * @return An IProperty object for the flag setting, or null if not available.
213   */
214  public IProperty getFlagConstant(String name) {
215    long cPtr = AVPKitJNI.IProperty_getFlagConstant__SWIG_1(swigCPtr, this, name);
216    return (cPtr == 0) ? null : new IProperty(cPtr, false);
217  }
218
219  /**
220   * The different type of options that are supported by AVPKit.<br>
221   * <br>
222   * Well, actually by FFMPEG, but you get the idea. see opt.h
223   */
224  public enum Type {
225    PROPERTY_FLAGS,
226    PROPERTY_INT,
227    PROPERTY_INT64,
228    PROPERTY_DOUBLE,
229    PROPERTY_FLOAT,
230    PROPERTY_STRING,
231    PROPERTY_RATIONAL,
232    /**
233     *  offset must point to a pointer immediately followed by an int for the length
234     */
235    PROPERTY_BINARY,
236    PROPERTY_DICT,
237    PROPERTY_UINT64,
238    PROPERTY_CONST,
239    /**
240     *  offset must point to two consecutive integers
241     */
242    PROPERTY_IMAGE_SIZE,
243    PROPERTY_PIXEL_FMT,
244    PROPERTY_SAMPLE_FMT,
245    /**
246     *  offset must point to AVRational
247     */
248    PROPERTY_VIDEO_RATE,
249    PROPERTY_DURATION,
250    PROPERTY_COLOR,
251    PROPERTY_CHANNEL_LAYOUT,
252    PROPERTY_BOOL,
253    PROPERTY_UNKNOWN(AVPKitJNI.IProperty_PROPERTY_UNKNOWN_get());
254
255    public final int swigValue() {
256      return swigValue;
257    }
258
259    public static Type swigToEnum(int swigValue) {
260      Type[] swigValues = Type.class.getEnumConstants();
261      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
262        return swigValues[swigValue];
263      for (Type swigEnum : swigValues)
264        if (swigEnum.swigValue == swigValue)
265          return swigEnum;
266      throw new IllegalArgumentException("No enum " + Type.class + " with value " + swigValue);
267    }
268
269    @SuppressWarnings("unused")
270    private Type() {
271      this.swigValue = SwigNext.next++;
272    }
273
274    @SuppressWarnings("unused")
275    private Type(int swigValue) {
276      this.swigValue = swigValue;
277      SwigNext.next = swigValue+1;
278    }
279
280    @SuppressWarnings("unused")
281    private Type(Type swigEnum) {
282      this.swigValue = swigEnum.swigValue;
283      SwigNext.next = this.swigValue+1;
284    }
285
286    private final int swigValue;
287
288    private static class SwigNext {
289      private static int next = 0;
290    }
291  }
292
293  public enum Flags {
294    FLAG_ENCODING_PARAM(AVPKitJNI.IProperty_FLAG_ENCODING_PARAM_get()),
295    FLAG_DECODING_PARAM(AVPKitJNI.IProperty_FLAG_DECODING_PARAM_get()),
296    FLAG_METADATA(AVPKitJNI.IProperty_FLAG_METADATA_get()),
297    FLAG_AUDIO_PARAM(AVPKitJNI.IProperty_FLAG_AUDIO_PARAM_get()),
298    FLAG_VIDEO_PARAM(AVPKitJNI.IProperty_FLAG_VIDEO_PARAM_get()),
299    FLAG_SUBTITLE_PARAM(AVPKitJNI.IProperty_FLAG_SUBTITLE_PARAM_get()),
300    FLAG_EXPORT(AVPKitJNI.IProperty_FLAG_EXPORT_get()),
301    FLAG_READONLY(AVPKitJNI.IProperty_FLAG_READONLY_get()),
302    FLAG_FILTERING_PARAM(AVPKitJNI.IProperty_FLAG_FILTERING_PARAM_get());
303
304    public final int swigValue() {
305      return swigValue;
306    }
307
308    public static Flags swigToEnum(int swigValue) {
309      Flags[] swigValues = Flags.class.getEnumConstants();
310      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
311        return swigValues[swigValue];
312      for (Flags swigEnum : swigValues)
313        if (swigEnum.swigValue == swigValue)
314          return swigEnum;
315      throw new IllegalArgumentException("No enum " + Flags.class + " with value " + swigValue);
316    }
317
318    @SuppressWarnings("unused")
319    private Flags() {
320      this.swigValue = SwigNext.next++;
321    }
322
323    @SuppressWarnings("unused")
324    private Flags(int swigValue) {
325      this.swigValue = swigValue;
326      SwigNext.next = swigValue+1;
327    }
328
329    @SuppressWarnings("unused")
330    private Flags(Flags swigEnum) {
331      this.swigValue = swigEnum.swigValue;
332      SwigNext.next = this.swigValue+1;
333    }
334
335    private final int swigValue;
336
337    private static class SwigNext {
338      private static int next = 0;
339    }
340  }
341
342  /**
343   * How to search options when looking for different values.
344   */
345  public enum Search {
346    /**
347     *  Do not search child options 
348     */
349    PROPERTY_SEARCH_DEFAULT(AVPKitJNI.IProperty_PROPERTY_SEARCH_DEFAULT_get()),
350    /**
351     *  Search children first 
352     */
353    PROPERTY_SEARCH_CHILDREN(AVPKitJNI.IProperty_PROPERTY_SEARCH_CHILDREN_get());
354
355    public final int swigValue() {
356      return swigValue;
357    }
358
359    public static Search swigToEnum(int swigValue) {
360      Search[] swigValues = Search.class.getEnumConstants();
361      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
362        return swigValues[swigValue];
363      for (Search swigEnum : swigValues)
364        if (swigEnum.swigValue == swigValue)
365          return swigEnum;
366      throw new IllegalArgumentException("No enum " + Search.class + " with value " + swigValue);
367    }
368
369    @SuppressWarnings("unused")
370    private Search() {
371      this.swigValue = SwigNext.next++;
372    }
373
374    @SuppressWarnings("unused")
375    private Search(int swigValue) {
376      this.swigValue = swigValue;
377      SwigNext.next = swigValue+1;
378    }
379
380    @SuppressWarnings("unused")
381    private Search(Search swigEnum) {
382      this.swigValue = swigEnum.swigValue;
383      SwigNext.next = this.swigValue+1;
384    }
385
386    private final int swigValue;
387
388    private static class SwigNext {
389      private static int next = 0;
390    }
391  }
392
393}