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.*;
011public class IBufferSink extends IMediaFilter {
012  // JNIHelper.swg: Start generated code
013  // >>>>>>>>>>>>>>>>>>>>>>>>>>>
014  /**
015   * This method is only here to use some references and remove
016   * a Eclipse compiler warning.
017   */
018  @SuppressWarnings("unused")
019  private void noop()
020  {
021    IBuffer.make(null, 1);
022  }
023   
024  private volatile long swigCPtr;
025
026  /**
027   * Internal Only.
028   */
029  protected IBufferSink(long cPtr, boolean cMemoryOwn) {
030    super(AVPKitJNI.IBufferSink_SWIGUpcast(cPtr), cMemoryOwn);
031    swigCPtr = cPtr;
032  }
033  
034  /**
035   * Internal Only.
036   */
037  protected IBufferSink(long cPtr, boolean cMemoryOwn,
038      java.util.concurrent.atomic.AtomicLong ref)
039  {
040    super(AVPKitJNI.IBufferSink_SWIGUpcast(cPtr),
041     cMemoryOwn, ref);
042    swigCPtr = cPtr;
043  }
044    
045  /**
046   * Internal Only.  Not part of public API.
047   *
048   * Get the raw value of the native object that obj is proxying for.
049   *   
050   * @param obj The java proxy object for a native object.
051   * @return The raw pointer obj is proxying for.
052   */
053  public static long getCPtr(IBufferSink obj) {
054    if (obj == null) return 0;
055    return obj.getMyCPtr();
056  }
057
058  /**
059   * Internal Only.  Not part of public API.
060   *
061   * Get the raw value of the native object that we're proxying for.
062   *   
063   * @return The raw pointer we're proxying for.
064   */  
065  public long getMyCPtr() {
066    if (swigCPtr == 0) throw new IllegalStateException("underlying native object already deleted");
067    return swigCPtr;
068  }
069  
070  /**
071   * Create a new IBufferSink object that is actually referring to the
072   * exact same underlying native object.
073   *
074   * @return the new Java object.
075   */
076  @Override
077  public IBufferSink copyReference() {
078    if (swigCPtr == 0)
079      return null;
080    else
081      return new IBufferSink(swigCPtr, swigCMemOwn, getJavaRefCount());
082  }
083
084  /**
085   * Compares two values, returning true if the underlying objects in native code are the same object.
086   *
087   * That means you can have two different Java objects, but when you do a comparison, you'll find out
088   * they are the EXACT same object.
089   *
090   * @return True if the underlying native object is the same.  False otherwise.
091   */
092  public boolean equals(Object obj) {
093    boolean equal = false;
094    if (obj instanceof IBufferSink)
095      equal = (((IBufferSink)obj).swigCPtr == this.swigCPtr);
096    return equal;
097  }
098  
099  /**
100   * Get a hashable value for this object.
101   *
102   * @return the hashable value.
103   */
104  public int hashCode() {
105     return (int)swigCPtr;
106  }
107  
108  // <<<<<<<<<<<<<<<<<<<<<<<<<<<
109  // JNIHelper.swg: End generated code
110  
111  /**
112   * Returns the sample rate of output filtered samples.<br>
113   * <br>
114   * @return the sample rate
115   */
116  public int getSampleRate() {
117    return AVPKitJNI.IBufferSink_getSampleRate(swigCPtr, this);
118  }
119
120  /**
121   * Returns the channel number of output filtered samples.<br>
122   * <br>
123   * @return the channel number
124   */
125  public int getChannels() {
126    return AVPKitJNI.IBufferSink_getChannels(swigCPtr, this);
127  }
128
129  /**
130   * Returns the width of output filtered picture.<br>
131   * <br>
132   * @return the width
133   */
134  public int getWidth() {
135    return AVPKitJNI.IBufferSink_getWidth(swigCPtr, this);
136  }
137
138  /**
139   * Returns the height of output filtered picture.<br>
140   * <br>
141   * @return the height
142   */
143  public int getHeight() {
144    return AVPKitJNI.IBufferSink_getHeight(swigCPtr, this);
145  }
146
147  /**
148   * Returns the frame rate output filtered picture.<br>
149   * <br>
150   * @return the frame rate
151   */
152  public IRational getFrameRate() {
153    long cPtr = AVPKitJNI.IBufferSink_getFrameRate(swigCPtr, this);
154    return (cPtr == 0) ? null : new IRational(cPtr, false);
155  }
156
157  /**
158   * Returns the frame rate output filtered picture.<br>
159   * <br>
160   * @return the frame rate
161   */
162  public IRational getTimeBase() {
163    long cPtr = AVPKitJNI.IBufferSink_getTimeBase(swigCPtr, this);
164    return (cPtr == 0) ? null : new IRational(cPtr, false);
165  }
166
167  /**
168   * Sets the number of samples for each output filtered samples.<br>
169   * The last buffer will be padded with 0.<br>
170   * <br>
171   * @param frameSize the number of samples of output
172   */
173  public void setNumSamples(int frameSize) {
174    AVPKitJNI.IBufferSink_setNumSamples(swigCPtr, this, frameSize);
175  }
176
177  /**
178   * Fills this audio samples with filtered data <br>
179   * <br>
180   * @param samples the audio samples filled with filtered data<br>
181   * <br>
182   * @return 0 on success or &lt;0 if an error occurs
183   */
184  public int fillAudioSamples(IAudioSamples samples) {
185    return AVPKitJNI.IBufferSink_fillAudioSamples(swigCPtr, this, IAudioSamples.getCPtr(samples), samples);
186  }
187
188  /**
189   * Fills this video picture with filtered data <br>
190   * <br>
191   * <br>
192   * <br>
193   * @return 0 on success or &lt;0 if an error occurs
194   */
195  public int fillVideoPicture(IVideoPicture picture) {
196    return AVPKitJNI.IBufferSink_fillVideoPicture(swigCPtr, this, IVideoPicture.getCPtr(picture), picture);
197  }
198
199}