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 * The work horse of the AVPKit: Takes {IPacket} data from an {IContainer}<br>
013 * (representing an {IStream}) and an {ICodec} and allows you to decode or encode<br>
014 * that data.
015 */
016public class IStreamCoder extends RefCounted implements com.avpkit.core.IConfigurable {
017  // JNIHelper.swg: Start generated code
018  // >>>>>>>>>>>>>>>>>>>>>>>>>>>
019  /**
020   * This method is only here to use some references and remove
021   * a Eclipse compiler warning.
022   */
023  @SuppressWarnings("unused")
024  private void noop()
025  {
026    IBuffer.make(null, 1);
027  }
028   
029  private volatile long swigCPtr;
030
031  /**
032   * Internal Only.
033   */
034  protected IStreamCoder(long cPtr, boolean cMemoryOwn) {
035    super(AVPKitJNI.IStreamCoder_SWIGUpcast(cPtr), cMemoryOwn);
036    swigCPtr = cPtr;
037  }
038  
039  /**
040   * Internal Only.
041   */
042  protected IStreamCoder(long cPtr, boolean cMemoryOwn,
043      java.util.concurrent.atomic.AtomicLong ref)
044  {
045    super(AVPKitJNI.IStreamCoder_SWIGUpcast(cPtr),
046     cMemoryOwn, ref);
047    swigCPtr = cPtr;
048  }
049    
050  /**
051   * Internal Only.  Not part of public API.
052   *
053   * Get the raw value of the native object that obj is proxying for.
054   *   
055   * @param obj The java proxy object for a native object.
056   * @return The raw pointer obj is proxying for.
057   */
058  public static long getCPtr(IStreamCoder obj) {
059    if (obj == null) return 0;
060    return obj.getMyCPtr();
061  }
062
063  /**
064   * Internal Only.  Not part of public API.
065   *
066   * Get the raw value of the native object that we're proxying for.
067   *   
068   * @return The raw pointer we're proxying for.
069   */  
070  public long getMyCPtr() {
071    if (swigCPtr == 0) throw new IllegalStateException("underlying native object already deleted");
072    return swigCPtr;
073  }
074  
075  /**
076   * Create a new IStreamCoder object that is actually referring to the
077   * exact same underlying native object.
078   *
079   * @return the new Java object.
080   */
081  @Override
082  public IStreamCoder copyReference() {
083    if (swigCPtr == 0)
084      return null;
085    else
086      return new IStreamCoder(swigCPtr, swigCMemOwn, getJavaRefCount());
087  }
088
089  /**
090   * Compares two values, returning true if the underlying objects in native code are the same object.
091   *
092   * That means you can have two different Java objects, but when you do a comparison, you'll find out
093   * they are the EXACT same object.
094   *
095   * @return True if the underlying native object is the same.  False otherwise.
096   */
097  public boolean equals(Object obj) {
098    boolean equal = false;
099    if (obj instanceof IStreamCoder)
100      equal = (((IStreamCoder)obj).swigCPtr == this.swigCPtr);
101    return equal;
102  }
103  
104  /**
105   * Get a hashable value for this object.
106   *
107   * @return the hashable value.
108   */
109  public int hashCode() {
110     return (int)swigCPtr;
111  }
112  
113  // <<<<<<<<<<<<<<<<<<<<<<<<<<<
114  // JNIHelper.swg: End generated code
115  
116
117  /**
118   * Returns the fourcc tag, in order of least significant byte
119   * to most significant byte.
120   *
121   * @return a 4 char array of the fourcc
122   */
123  
124  public char[] getCodecTagArray()
125  {
126    char[] retval = new char[4];
127    int fourcc = this.getCodecTag();
128    
129    retval[0] = (char)(fourcc & 0xFF);
130    retval[1] = (char)((fourcc >> 8) & 0xFF);
131    retval[2] = (char)((fourcc >> 16) & 0xFF);
132    retval[3] = (char)((fourcc >> 24) & 0xFF);
133    return retval;
134  }
135  /**
136   * Set the fourcc tag.
137   *
138   * @param fourcc A four char array, in order of least significant byte
139   *  to most significant byte.
140   *
141   * @throws IllegalArgumentException if the array passed in is not exactly 4 bytes.
142   */
143   
144   public void setCodecTag(char[] fourcc)
145   {
146     if (fourcc == null || fourcc.length != 4)
147      throw new IllegalArgumentException();
148     int tag = 0;
149     tag = (fourcc[3]<<24)+(fourcc[2]<<16)+(fourcc[1]<<8)+fourcc[0];
150     this.setCodecTag(tag);
151   }
152   
153   /**
154    * Prints  details on this IStreamCoder
155    *
156    * @return key details for this IStreamCoder
157    */
158    
159  @Override
160  public String toString()
161  {
162    StringBuilder result = new StringBuilder();
163    ICodec.Type type = getCodecType();
164    
165    result.append(this.getClass().getName()+"@"+hashCode()+"[");
166    result.append("codec="+getCodec()+";");
167    result.append("time base="+getTimeBase()+";");
168    result.append("frame rate="+getFrameRate()+";");
169    switch(type)
170    {
171      case CODEC_TYPE_VIDEO:
172        result.append("pixel type="+getPixelType()+";");
173        result.append("width="+getWidth()+";");
174        result.append("height="+getHeight()+";");
175        break;
176      case CODEC_TYPE_AUDIO:
177        result.append("sample rate="+getSampleRate()+";");
178        result.append("channels="+getChannels()+";");
179        break;
180      default:
181        break;
182    }
183    result.append("]");
184    return result.toString();
185  }
186  
187  /**
188   * {@inheritDoc}
189   */
190  public java.util.Collection<String> getPropertyNames()
191  {
192    java.util.Collection<String> retval = new java.util.LinkedList<String>();
193    int numProperties = this.getNumProperties();
194    for(int i = 0; i < numProperties; i++)
195    {
196      IProperty property = this.getPropertyMetaData(i);
197      String name = property.getName();
198      retval.add(name);
199    }
200    return retval;
201  }
202
203  /**
204   * Returns <strong>a read-only copy</strong> of the extra data in this stream coder as a new {@link IBuffer}.
205   * @return the extra data, or null if none or error.
206   * @since 3.3
207   */
208  public IBuffer getExtraData()
209  {
210    int size = getExtraDataSize();
211    if (size <= 0)
212      return null;
213    
214    IBuffer retval = IBuffer.make(this, size);
215    if (retval == null)
216      return null;
217    if (getExtraData(retval, 0, size) != size) {
218      retval.delete();
219      retval = null;
220    }
221    return retval;
222  }
223 
224
225
226  /**
227   *  Get the direction.<br>
228   * @return The direction this StreamCoder works in.
229   */
230  public IStreamCoder.Direction getDirection() {
231    return IStreamCoder.Direction.swigToEnum(AVPKitJNI.IStreamCoder_getDirection(swigCPtr, this));
232  }
233
234  /**
235   * The associated Stream we're working on.<br>
236   * <br>
237   * @return The stream associated with this object.
238   */
239  public IStream getStream() {
240    long cPtr = AVPKitJNI.IStreamCoder_getStream(swigCPtr, this);
241    return (cPtr == 0) ? null : new IStream(cPtr, false);
242  }
243
244  /**
245   * The Codec this StreamCoder will use.<br>
246   * <br>
247   * @return The Codec used by this StreamCoder, or 0 (null) if none.
248   */
249  public ICodec getCodec() {
250    long cPtr = AVPKitJNI.IStreamCoder_getCodec(swigCPtr, this);
251    return (cPtr == 0) ? null : new ICodec(cPtr, false);
252  }
253
254  /**
255   * A short hand for getCodec().getType().<br>
256   * <br>
257   * <p><br>
258   * <b><br>
259   * Note for Native (C++) users:<br>
260   * </b><br>
261   * </p><br>
262   * If you actually write code like the above<br>
263   * from Native code, you'd leak<br>
264   * a Codec() since you didn't call release() on it.<br>
265   * This method is a short hand way to avoid you having to<br>
266   * worry about releasing in between.<br>
267   * <br>
268   * @return The Type of the Codec we'll use.
269   */
270  public ICodec.Type getCodecType() {
271    return ICodec.Type.swigToEnum(AVPKitJNI.IStreamCoder_getCodecType(swigCPtr, this));
272  }
273
274  /**
275   * A short hand for getCodec().getID().<br>
276   * <br>
277   * <p><br>
278   * <b><br>
279   * Note for Native (C++) users:<br>
280   * </b><br>
281   * </p><br>
282   * If you actually write code like the above<br>
283   * from Native code, you'd leak<br>
284   * a Codec() since you didn't call release() on it.<br>
285   * This method is a short hand way to avoid you having to<br>
286   * worry about releasing in between.<br>
287   * <br>
288   * @return The ID of the Codec we'll use.
289   */
290  public ICodec.ID getCodecID() {
291    return ICodec.ID.swigToEnum(AVPKitJNI.IStreamCoder_getCodecID(swigCPtr, this));
292  }
293
294  /**
295   * Set the Codec to the passed in Codec, discarding the old<br>
296   * Codec if set.<br>
297   * <p><br>
298   * Once you call setCodec, all settings on the IStreamCoder are<br>
299   * reset to default values.  So you probably want to call this <br>
300   * first.<br>
301   * </p><br>
302   * <br>
303   * @param codec Codec to set.
304   */
305  public void setCodec(ICodec codec) {
306    AVPKitJNI.IStreamCoder_setCodec__SWIG_0(swigCPtr, this, ICodec.getCPtr(codec), codec);
307  }
308
309  /**
310   * Look up a Codec based on the passed in ID, and then set it.<br>
311   * <p><br>
312   * To see if you actually set the correct ID, call getCodec() and<br>
313   * check for 0 (null).<br>
314   * </p><br>
315   * <p><br>
316   * Once you call setCodec, all settings on the IStreamCoder are<br>
317   * reset to default values.  So you probably want to call this <br>
318   * first.<br>
319   * </p><br>
320   * <br>
321   * @param id ID of codec to set.
322   */
323  public void setCodec(ICodec.ID id) {
324    AVPKitJNI.IStreamCoder_setCodec__SWIG_1(swigCPtr, this, id.swigValue());
325  }
326
327  /**
328   * The bit rate.<br>
329   * <br>
330   * @return The bit-rate the stream is, or will be, encoded in.
331   */
332  public int getBitRate() {
333    return AVPKitJNI.IStreamCoder_getBitRate(swigCPtr, this);
334  }
335
336  /**
337   * When ENCODING, sets the bit rate to use.  No-op when DECODING.<br>
338   * @see #getBitRate()<br>
339   * <br>
340   * @param rate The bit rate to use.
341   */
342  public void setBitRate(int rate) {
343    AVPKitJNI.IStreamCoder_setBitRate(swigCPtr, this, rate);
344  }
345
346  /**
347   * The bit rate tolerance<br>
348   * <br>
349   * @return The bit-rate tolerance
350   */
351  public int getBitRateTolerance() {
352    return AVPKitJNI.IStreamCoder_getBitRateTolerance(swigCPtr, this);
353  }
354
355  /**
356   * When ENCODING set the bit rate tolerance.  No-op when DECODING.<br>
357   * <br>
358   * @param tolerance The bit rate tolerance
359   */
360  public void setBitRateTolerance(int tolerance) {
361    AVPKitJNI.IStreamCoder_setBitRateTolerance(swigCPtr, this, tolerance);
362  }
363
364  /**
365   * The height, in pixels.<br>
366   * <br>
367   * @return The height of the video frames in the attached stream<br>
368   *   or -1 if an audio stream, or we cannot determine the height.
369   */
370  public int getHeight() {
371    return AVPKitJNI.IStreamCoder_getHeight(swigCPtr, this);
372  }
373
374  /**
375   * Set the height, in pixels.<br>
376   * <br>
377   * @see #getHeight()<br>
378   * <br>
379   * @param height Sets the height of video frames we'll encode.  No-op when DECODING.
380   */
381  public void setHeight(int height) {
382    AVPKitJNI.IStreamCoder_setHeight(swigCPtr, this, height);
383  }
384
385  /**
386   * The width, in pixels.<br>
387   * <br>
388   * @return The width of the video frames in the attached stream<br>
389   *   or -1 if an audio stream, or we cannot determine the width.
390   */
391  public int getWidth() {
392    return AVPKitJNI.IStreamCoder_getWidth(swigCPtr, this);
393  }
394
395  /**
396   * Set the width, in pixels<br>
397   * <br>
398   * @see #getWidth()<br>
399   * <br>
400   * @param width Sets the width of video frames we'll encode.  No-op when DECODING.
401   */
402  public void setWidth(int width) {
403    AVPKitJNI.IStreamCoder_setWidth(swigCPtr, this, width);
404  }
405
406  /**
407   * Get the time base this stream will ENCODE in, or the time base we<br>
408   * detect while DECODING.<br>
409   * <br>
410   * Caller must call release() on the returned value.<br>
411   * <br>
412   * @return The time base this StreamCoder is using.
413   */
414  public IRational getTimeBase() {
415    long cPtr = AVPKitJNI.IStreamCoder_getTimeBase(swigCPtr, this);
416    return (cPtr == 0) ? null : new IRational(cPtr, false);
417  }
418
419  /**
420   * Set the time base we'll use to ENCODE with.  A no-op when DECODING.<br>
421   * <br>
422   * As a convenience, we forward this call to the Stream#setTimeBase()<br>
423   * method.<br>
424   * <br>
425   * @see #getTimeBase()<br>
426   * <br>
427   * @param newTimeBase The new time base to use.
428   */
429  public void setTimeBase(IRational newTimeBase) {
430    AVPKitJNI.IStreamCoder_setTimeBase(swigCPtr, this, IRational.getCPtr(newTimeBase), newTimeBase);
431  }
432
433  /**
434   * Get the frame-rate the attached stream claims to be using when<br>
435   * DECODING, or the frame-rate we'll claim we're using when ENCODING.<br>
436   * <br>
437   * @return The frame rate.
438   */
439  public IRational getFrameRate() {
440    long cPtr = AVPKitJNI.IStreamCoder_getFrameRate(swigCPtr, this);
441    return (cPtr == 0) ? null : new IRational(cPtr, false);
442  }
443
444  /**
445   * Set the frame rate we'll set in the headers of this stream while<br>
446   * ENCODING.  Note that you can set whatever frame-rate you'd like,<br>
447   * but the TimeBase and the PTS you set on the encoded audio<br>
448   * and video frames can override this.<br>
449   * <br>
450   * As a convenience, we forward this call to the Stream::setFrameRate()<br>
451   * method.<br>
452   * <br>
453   * @see #getFrameRate()<br>
454   * <br>
455   * @param newFrameRate The new frame rate to use.
456   */
457  public void setFrameRate(IRational newFrameRate) {
458    AVPKitJNI.IStreamCoder_setFrameRate(swigCPtr, this, IRational.getCPtr(newFrameRate), newFrameRate);
459  }
460
461  /**
462   * The the number of pictures in this Group of Pictures (GOP).  See the<br>
463   * MPEG specs for what a GOP is officially, but this is the minimum<br>
464   * number of frames between key-frames (or Intra-Frames in MPEG speak).<br>
465   * <br>
466   * @return the GOPS for this stream.
467   */
468  public int getNumPicturesInGroupOfPictures() {
469    return AVPKitJNI.IStreamCoder_getNumPicturesInGroupOfPictures(swigCPtr, this);
470  }
471
472  /**
473   * Set the GOPS on this stream.  Ignored if DECODING.<br>
474   * <br>
475   * @see #getNumPicturesInGroupOfPictures()<br>
476   * <br>
477   * @param gops The new GOPS for the stream we're encoding.
478   */
479  public void setNumPicturesInGroupOfPictures(int gops) {
480    AVPKitJNI.IStreamCoder_setNumPicturesInGroupOfPictures(swigCPtr, this, gops);
481  }
482
483  /**
484   * For Video streams, get the Pixel Format in use by the stream.<br>
485   * <br>
486   * @return the Pixel format, or IPixelFormat::NONE if audio.
487   */
488  public IPixelFormat.Type getPixelType() {
489    return IPixelFormat.Type.swigToEnum(AVPKitJNI.IStreamCoder_getPixelType(swigCPtr, this));
490  }
491
492  /**
493   * Set the pixel format to ENCODE with.  Ignored if audio or<br>
494   * DECODING.<br>
495   * <br>
496   * @param pixelFmt Pixel format to use.
497   */
498  public void setPixelType(IPixelFormat.Type pixelFmt) {
499    AVPKitJNI.IStreamCoder_setPixelType(swigCPtr, this, pixelFmt.swigValue());
500  }
501
502  /**
503   * Get the sample rate we use for this stream.<br>
504   * <br>
505   * @return The sample rate (in Hz) we use for this stream, or -1 if unknown or video.
506   */
507  public int getSampleRate() {
508    return AVPKitJNI.IStreamCoder_getSampleRate(swigCPtr, this);
509  }
510
511  /**
512   * Set the sample rate to use when ENCODING.  Ignored if DECODING<br>
513   * or a non-audio stream.<br>
514   * <br>
515   * @param sampleRate New sample rate (in Hz) to use.
516   */
517  public void setSampleRate(int sampleRate) {
518    AVPKitJNI.IStreamCoder_setSampleRate(swigCPtr, this, sampleRate);
519  }
520
521  /**
522   * Get the audio sample format.<br>
523   * <br>
524   * @return The sample format of samples for encoding/decoding.
525   */
526  public IAudioSamples.Format getSampleFormat() {
527    return IAudioSamples.Format.swigToEnum(AVPKitJNI.IStreamCoder_getSampleFormat(swigCPtr, this));
528  }
529
530  /**
531   * Set the sample format when ENCODING.  Ignored if DECODING<br>
532   * or if the coder is already open.<br>
533   * <br>
534   * @param aFormat The sample format.
535   */
536  public void setSampleFormat(IAudioSamples.Format aFormat) {
537    AVPKitJNI.IStreamCoder_setSampleFormat(swigCPtr, this, aFormat.swigValue());
538  }
539
540  /**
541   * Get the number of channels in this audio stream<br>
542   * <br>
543   * @return The sample rate (in Hz) we use for this stream, or 0 if unknown.
544   */
545  public int getChannels() {
546    return AVPKitJNI.IStreamCoder_getChannels(swigCPtr, this);
547  }
548
549  /**
550   * Set the number of channels to use when ENCODING.  Ignored if a<br>
551   * non audio stream, or if DECODING.<br>
552   * <br>
553   * @param channels The number of channels we'll encode with.
554   */
555  public void setChannels(int channels) {
556    AVPKitJNI.IStreamCoder_setChannels(swigCPtr, this, channels);
557  }
558
559  /**
560   * For this stream, get the number of audio samples that are<br>
561   * represented in a packet of information.<br>
562   * <br>
563   * @return Number of samples per 'frame' of encoded audio
564   */
565  public int getAudioFrameSize() {
566    return AVPKitJNI.IStreamCoder_getAudioFrameSize(swigCPtr, this);
567  }
568
569  /**
570   * Get the Global Quality setting this codec uses for video if<br>
571   * a VideoPicture doesn't have a quality set.<br>
572   * <br>
573   * @return The global quality.
574   */
575  public int getGlobalQuality() {
576    return AVPKitJNI.IStreamCoder_getGlobalQuality(swigCPtr, this);
577  }
578
579  /**
580   * Set the Global Quality to a new value.<br>
581   * <br>
582   * @param newQuality The new global quality.
583   */
584  public void setGlobalQuality(int newQuality) {
585    AVPKitJNI.IStreamCoder_setGlobalQuality(swigCPtr, this, newQuality);
586  }
587
588  /**
589   * Get the flags associated with this codec.<br>
590   * <br>
591   * @return The (compacted) value of all flags set.
592   */
593  public int getFlags() {
594    return AVPKitJNI.IStreamCoder_getFlags(swigCPtr, this);
595  }
596
597  /**
598   * Set the FFMPEG flags to use with this codec.  All values<br>
599   * must be ORed (|) together.<br>
600   * <br>
601   * @see Flags<br>
602   * <br>
603   * @param newFlags The new set flags for this codec.
604   */
605  public void setFlags(int newFlags) {
606    AVPKitJNI.IStreamCoder_setFlags(swigCPtr, this, newFlags);
607  }
608
609  /**
610   * Get the setting for the specified flag<br>
611   * <br>
612   * @param flag The flag you want to find the setting for<br>
613   * <br>
614   * @return 0 for false; non-zero for true
615   */
616  public boolean getFlag(IStreamCoder.Flags flag) {
617    return AVPKitJNI.IStreamCoder_getFlag(swigCPtr, this, flag.swigValue());
618  }
619
620  /**
621   * Set the flag.<br>
622   * <br>
623   * @param flag The flag to set<br>
624   * @param value The value to set it to (true or false)
625   */
626  public void setFlag(IStreamCoder.Flags flag, boolean value) {
627    AVPKitJNI.IStreamCoder_setFlag(swigCPtr, this, flag.swigValue(), value);
628  }
629
630  /**
631   * For this stream, get the next Pts that we expect to decode.<br>
632   * <br>
633   * Note that this may not actually be the next Pts (for example<br>
634   * due to transmission packet drops in the input source).  Still<br>
635   * it can be a useful tool.<br>
636   * <br>
637   * @return The next presentation time stamp we expect to decode<br>
638   *   on this stream.  This is always in units of 1/1,000,000 seconds
639   */
640  public long getNextPredictedPts() {
641    return AVPKitJNI.IStreamCoder_getNextPredictedPts(swigCPtr, this);
642  }
643
644  /**
645   * @deprecated Use {#open(IMetaData,IMetaData)} instead.<br>
646   * Open the Codec associated with this StreamCoder.<br>
647   * <br>
648   * You can get the codec through getCodec(...) and<br>
649   * set it with setCodec(...).  You cannot call any<br>
650   * set* methods after you've called open() on this StreamCoder<br>
651   * until you close() it.<br>
652   * <br>
653   * You must call close() when you're done, but if you don't,<br>
654   * the container will clean up after you (but yell at you)<br>
655   * when it is closed.<br>
656   * <br>
657   * @return &gt;= 0 on success; &lt; 0 on error.
658   */
659  @Deprecated public int open() {
660    return AVPKitJNI.IStreamCoder_open__SWIG_0(swigCPtr, this);
661  }
662
663  /**
664   * Close a Codec that was opened on this StreamCoder.<br>
665   * <br>
666   * @return &gt;= 0 on success; &lt; 0 on error.
667   */
668  public int close() {
669    return AVPKitJNI.IStreamCoder_close(swigCPtr, this);
670  }
671
672  /**
673   * Decode this packet into pOutSamples.  It will<br>
674   * try to fill up the audio samples object, starting<br>
675   * from the byteOffset inside this packet.<br>
676   * <p><br>
677   * The caller is responsible for allocating the<br>
678   * IAudioSamples object.  This function will overwrite<br>
679   * any data in the samples object.<br>
680   * </p><br>
681   * <p><br>
682   * Note that the IAudioSamples object passed in must have<br>
683   * a {IAudioSamples#getMaxBufferSize()} of at least<br>
684   * 192kbytes.  Sorry, but this requirement is imposed<br>
685   * on us via FFmpeg.  If the buffer is not large enough,<br>
686   * this method will reallocate the underlying buffers to<br>
687   * make them at least 192kbytes.<br>
688   * </p><br>
689   * @param pOutSamples The AudioSamples we decode to<br>
690   * @param packet    The packet we're attempting to decode from.<br>
691   * @param byteOffset Where in the packet payload to start decoding<br>
692   * <br>
693   * @return number of bytes actually processed from the packet, or negative for error
694   */
695  public int decodeAudio(IAudioSamples pOutSamples, IPacket packet, int byteOffset) {
696    return AVPKitJNI.IStreamCoder_decodeAudio(swigCPtr, this, IAudioSamples.getCPtr(pOutSamples), pOutSamples, IPacket.getCPtr(packet), packet, byteOffset);
697  }
698
699  /**
700   * Decode this packet into pOutFrame.<br>
701   * <br>
702   * The caller is responsible for allocating the<br>
703   * IVideoPicture object.  This function will potentially<br>
704   * overwrite any data in the frame object, but<br>
705   * you should pass the same IVideoPicture into this function<br>
706   * repeatedly until IVideoPicture::isComplete() is true.<br>
707   * <br>
708   * @param pOutFrame The AudioSamples we decode.<br>
709   * @param packet    The packet we're attempting to decode from.<br>
710   * @param byteOffset Where in the packet payload to start decoding<br>
711   * <br>
712   * @return number of bytes actually processed from the packet, or negative for error
713   */
714  public int decodeVideo(IVideoPicture pOutFrame, IPacket packet, int byteOffset) {
715    return AVPKitJNI.IStreamCoder_decodeVideo(swigCPtr, this, IVideoPicture.getCPtr(pOutFrame), pOutFrame, IPacket.getCPtr(packet), packet, byteOffset);
716  }
717
718  /**
719   * Encode the given frame using this StreamCoder.<br>
720   * <br>
721   * The VideoPicture will allocate a buffer to use internally for this, and<br>
722   * will free it when the frame destroys itself.<br>
723   * <br>
724   * Also, when done in order to flush the encoder, caller should call<br>
725   * this method passing in 0 (null) for pFrame to tell the encoder<br>
726   * to flush any data it was keeping a hold of.<br>
727   * <br>
728   * @param pOutPacket [out] The packet to encode into.  It will point<br>
729   *     to a buffer allocated in the frame.  Caller should check IPacket::isComplete()<br>
730   *     after call to find out if we had enough information to encode a full packet.<br>
731   * @param pFrame [in/out] The frame to encode<br>
732   * @param suggestedBufferSize The suggested buffer size to allocate or -1 for choose ourselves.<br>
733   *        If -1 we'll allocate a buffer exactly the same size (+1) as the decoded frame<br>
734   *        with the guess that you're encoding a frame because you want to use LESS space<br>
735   *        than that.<br>
736   * <br>
737   * @ return &gt;= 0 on success; &lt;0 on error.
738   */
739  public int encodeVideo(IPacket pOutPacket, IVideoPicture pFrame, int suggestedBufferSize) {
740    return AVPKitJNI.IStreamCoder_encodeVideo(swigCPtr, this, IPacket.getCPtr(pOutPacket), pOutPacket, IVideoPicture.getCPtr(pFrame), pFrame, suggestedBufferSize);
741  }
742
743  /**
744   * Encode the given samples using this StreamCoder.<br>
745   * <br>
746   * The VideoPicture will allocate a buffer to use internally for this, and<br>
747   * will free it when the frame destroys itself.<br>
748   * <br>
749   * Callers should call this repeatedly on a set of samples until<br>
750   * we consume all the samples.<br>
751   * <br>
752   * Also, when done in order to flush the encoder, caller should call<br>
753   * this method passing in 0 (null) for pSamples to tell the encoder<br>
754   * to flush any data it was keeping a hold of.<br>
755   * <br>
756   * @param pOutPacket [out] The packet to encode into.  It will point<br>
757   *          to a buffer allocated in the frame.  Caller should check IPacket::isComplete()<br>
758   *     after call to find out if we had enough information to encode a full packet.<br>
759   * @param pSamples [in] The samples to consume<br>
760   * @param sampleToStartFrom [in] Which sample you want to start with<br>
761   *          This is usually zero, but if you're using a codec that<br>
762   *          packetizes output with small number of samples, you may<br>
763   *          need to call encodeAudio repeatedly with different starting<br>
764   *          samples to consume all of your samples.<br>
765   * <br>
766   * @return number of samples we consumed when encoding, or negative for errors.
767   */
768  public int encodeAudio(IPacket pOutPacket, IAudioSamples pSamples, int sampleToStartFrom) {
769    return AVPKitJNI.IStreamCoder_encodeAudio(swigCPtr, this, IPacket.getCPtr(pOutPacket), pOutPacket, IAudioSamples.getCPtr(pSamples), pSamples, sampleToStartFrom);
770  }
771
772  /**
773   * @deprecated Use {#make(Direction, ICodec)} instead.<br>
774   * Create a standalone StreamCoder that can decode data without regard to<br>
775   * which IStream or IContainer it came from.<br>
776   * <p><br>
777   * If you're reading or writing to a AVPKIT file or URL you almost definitely<br>
778   * don't want to use this method.  Use the {IContainer#getStream(long)}<br>
779   * and {IStream#getStreamCoder()} methods instead as it will set up the<br>
780   * resulting IStreamCoder with sensible defaults.  Use of a un-attached<br>
781   * StreamCoder returned from this method is for advanced users only.<br>
782   * </p><br>
783   * @param direction The direction this StreamCoder will work in.<br>
784   * @return a new stream coder, or null if error.
785   */
786  @Deprecated public static IStreamCoder make(IStreamCoder.Direction direction) {
787    long cPtr = AVPKitJNI.IStreamCoder_make__SWIG_0(direction.swigValue());
788    return (cPtr == 0) ? null : new IStreamCoder(cPtr, false);
789  }
790
791  /**
792   * Returns the 4-byte FOURCC tag (Least Significant Byte first).<br>
793   * <br>
794   * This is really a packed 4-byte array so it's only useful if you use<br>
795   * bit-wise operations on it.  Some language wrappings may provide more<br>
796   * obvious ways of manipulating, but this is the safest way to do this that<br>
797   * will work with all wrappers.<br>
798   * <br>
799   * @return the FOURCC tag.
800   */
801  public int getCodecTag() {
802    return AVPKitJNI.IStreamCoder_getCodecTag(swigCPtr, this);
803  }
804
805  /**
806   * Set the 4-byte FOURCC tag for this coder.<br>
807   * @param fourcc The FOURCC to set, with Least Significant Byte first.
808   */
809  public void setCodecTag(int fourcc) {
810    AVPKitJNI.IStreamCoder_setCodecTag(swigCPtr, this, fourcc);
811  }
812
813  /**
814   * Returns the total number of settable properties on this object<br>
815   * <br>
816   * @return total number of options (not including constant definitions)
817   */
818  public int getNumProperties() {
819    return AVPKitJNI.IStreamCoder_getNumProperties(swigCPtr, this);
820  }
821
822  /**
823   * Returns the name of the numbered property.<br>
824   * <br>
825   * @param propertyNo The property number in the options list.<br>
826   * <br>
827   * @return an IProperty value for this properties meta-data
828   */
829  public IProperty getPropertyMetaData(int propertyNo) {
830    long cPtr = AVPKitJNI.IStreamCoder_getPropertyMetaData__SWIG_0(swigCPtr, this, propertyNo);
831    return (cPtr == 0) ? null : new IProperty(cPtr, false);
832  }
833
834  /**
835   * Returns the name of the numbered property.<br>
836   * <br>
837   * @param name  The property name.<br>
838   * <br>
839   * @return an IProperty value for this properties meta-data
840   */
841  public IProperty getPropertyMetaData(String name) {
842    long cPtr = AVPKitJNI.IStreamCoder_getPropertyMetaData__SWIG_1(swigCPtr, this, name);
843    return (cPtr == 0) ? null : new IProperty(cPtr, false);
844  }
845
846  /**
847   * Sets a property on this Object.<br>
848   * <br>
849   * All AVOptions supported by the underlying AVClass are supported.<br>
850   * <br>
851   * @param name The property name.  For example "b" for bit-rate.<br>
852   * @param value The value of the property. <br>
853   * <br>
854   * @return &gt;= 0 if the property was successfully set; &lt;0 on error
855   */
856  public int setProperty(String name, String value) {
857    return AVPKitJNI.IStreamCoder_setProperty__SWIG_0(swigCPtr, this, name, value);
858  }
859
860  /**
861   * Looks up the property 'name' and sets the<br>
862   * value of the property to 'value'.<br>
863   * <br>
864   * @param name name of option<br>
865   * @param value Value of option<br>
866   * <br>
867   * @return &gt;= 0 on success; &lt;0 on error.
868   */
869  public int setProperty(String name, double value) {
870    return AVPKitJNI.IStreamCoder_setProperty__SWIG_1(swigCPtr, this, name, value);
871  }
872
873  /**
874   * Looks up the property 'name' and sets the<br>
875   * value of the property to 'value'.<br>
876   * <br>
877   * @param name name of option<br>
878   * @param value Value of option<br>
879   * <br>
880   * @return &gt;= 0 on success; &lt;0 on error.
881   */
882  public int setProperty(String name, long value) {
883    return AVPKitJNI.IStreamCoder_setProperty__SWIG_2(swigCPtr, this, name, value);
884  }
885
886  /**
887   * Looks up the property 'name' and sets the<br>
888   * value of the property to 'value'.<br>
889   * <br>
890   * @param name name of option<br>
891   * @param value Value of option<br>
892   * <br>
893   * @return &gt;= 0 on success; &lt;0 on error.
894   */
895  public int setProperty(String name, boolean value) {
896    return AVPKitJNI.IStreamCoder_setProperty__SWIG_3(swigCPtr, this, name, value);
897  }
898
899  /**
900   * Looks up the property 'name' and sets the<br>
901   * value of the property to 'value'.<br>
902   * <br>
903   * @param name name of option<br>
904   * @param value Value of option<br>
905   * <br>
906   * @return &gt;= 0 on success; &lt;0 on error.
907   */
908  public int setProperty(String name, IRational value) {
909    return AVPKitJNI.IStreamCoder_setProperty__SWIG_4(swigCPtr, this, name, IRational.getCPtr(value), value);
910  }
911
912  /**
913   * Gets a property on this Object.<br>
914   * <br>
915   * Note for C++ callers; you must free the returned array with<br>
916   * delete[] in order to avoid a memory leak.  Other language<br>
917   * folks need not worry.<br>
918   * <br>
919   * @param name property name<br>
920   * <br>
921   * @return an string copy of the option value, or null if the option doesn't exist.
922   */
923  public String getPropertyAsString(String name) {
924    return AVPKitJNI.IStreamCoder_getPropertyAsString(swigCPtr, this, name);
925  }
926
927  /**
928   * Gets the value of this property, and returns as a double;<br>
929   * <br>
930   * @param name name of option<br>
931   * <br>
932   * @return double value of property, or 0 on error.
933   */
934  public double getPropertyAsDouble(String name) {
935    return AVPKitJNI.IStreamCoder_getPropertyAsDouble(swigCPtr, this, name);
936  }
937
938  /**
939   * Gets the value of this property, and returns as an long;<br>
940   * <br>
941   * @param name name of option<br>
942   * <br>
943   * @return long value of property, or 0 on error.
944   */
945  public long getPropertyAsLong(String name) {
946    return AVPKitJNI.IStreamCoder_getPropertyAsLong(swigCPtr, this, name);
947  }
948
949  /**
950   * Gets the value of this property, and returns as an IRational;<br>
951   * <br>
952   * @param name name of option<br>
953   * <br>
954   * @return long value of property, or 0 on error.
955   */
956  public IRational getPropertyAsRational(String name) {
957    long cPtr = AVPKitJNI.IStreamCoder_getPropertyAsRational(swigCPtr, this, name);
958    return (cPtr == 0) ? null : new IRational(cPtr, false);
959  }
960
961  /**
962   * Gets the value of this property, and returns as a boolean<br>
963   * <br>
964   * @param name name of option<br>
965   * <br>
966   * @return boolean value of property, or false on error.
967   */
968  public boolean getPropertyAsBoolean(String name) {
969    return AVPKitJNI.IStreamCoder_getPropertyAsBoolean(swigCPtr, this, name);
970  }
971
972  /**
973   * Returns true if this IStreamCoder is currently open.<br>
974   * <br>
975   * @return true if open; false if not
976   */
977  public boolean isOpen() {
978    return AVPKitJNI.IStreamCoder_isOpen(swigCPtr, this);
979  }
980
981  /**
982   * Get the default audio frame size (in samples).<br>
983   * <br>
984   * Some codecs, especially raw codecs, like PCM, don't have<br>
985   * a standard frame size.  In those cases, we use the value<br>
986   * of this setting to determine how many samples to encode into<br>
987   * a single packet.<br>
988   * <br>
989   * @return the number of samples in an audio frame size if the codec<br>
990   *   doesn't specify the size.<br>
991   * @since 1.21
992   */
993  public int getDefaultAudioFrameSize() {
994    return AVPKitJNI.IStreamCoder_getDefaultAudioFrameSize(swigCPtr, this);
995  }
996
997  /**
998   * Set the default audio frame size.<br>
999   * <br>
1000   * @param aNewSize The new number of samples to use to encode<br>
1001   *   samples into a packet.  This setting is ignored if &lt;= 0<br>
1002   *   or if the codec requires it's own frame size (e.g. Nellymoser).<br>
1003   * <br>
1004   * @see #getDefaultAudioFrameSize()<br>
1005   * @since 1.21
1006   */
1007  public void setDefaultAudioFrameSize(int aNewSize) {
1008    AVPKitJNI.IStreamCoder_setDefaultAudioFrameSize(swigCPtr, this, aNewSize);
1009  }
1010
1011  /**
1012   * Creates a new IStreamCoder object by copying all the settings in copyCoder.<br>
1013   * <p><br>
1014   * The new IStreamCoder is created by copying all the current properties on the<br>
1015   * passed in StreamCoder.  If the passed in stream coder is in a different direction<br>
1016   * than the one you want, this method still set the same codec ID, and the<br>
1017   * IStreamCoder.open() method will check then to see if it can work in the<br>
1018   * specified direction.<br>
1019   * </p><br>
1020   * <p><br>
1021   * For example, imagine that direction is ENCODING and the copyCoder is a DECODING StreamCoder that is<br>
1022   * of the CODEC_ID_VP6 type.  The resulting new IStreamCoder has it's code set to CODEC_ID_VP6.  However<br>
1023   * (as of the writing of this comment) we don't support encoding to CODEC_ID_VP6, so when you<br>
1024   * try to open the codec we will fail.<br>
1025   * </p>  <br>
1026   * @param direction The direction you want the new IStreamCoder to work in.<br>
1027   * @param copyCoder The coder to copy settings from.<br>
1028   * <br>
1029   * @return A new IStreamCoder, or null on error.<br>
1030   * @since 1.22
1031   */
1032  public static IStreamCoder make(IStreamCoder.Direction direction, IStreamCoder copyCoder) {
1033    long cPtr = AVPKitJNI.IStreamCoder_make__SWIG_1(direction.swigValue(), IStreamCoder.getCPtr(copyCoder), copyCoder);
1034    return (cPtr == 0) ? null : new IStreamCoder(cPtr, false);
1035  }
1036
1037  /**
1038   * Get the number of frames this StreamCoder had to drop to<br>
1039   * encode at the specified {#getTimeBase()}<br>
1040   * <p><br>
1041   * IStreamCoder objects can encode audio and video, but<br>
1042   * guarantee that every packet outputted has monotonically<br>
1043   * increasing timestamps (i.e. 0, 1, 2, 3, 4, 5, etc. without<br>
1044   * repeats).  Sometimes data is passed too quickly into an<br>
1045   * IStreamCoder via {#encodeVideo} or {#encodeAudio},<br>
1046   * and the underlying codec can't handle it that quickly.  In those<br>
1047   * cases the IStreamCoder must drop the most recent frame of data.<br>
1048   * </p><br>
1049   * <p><br>
1050   * If you're seeing a lot of dropped frames you can try either<br>
1051   * sending less frequent data to the IStreamCoder, or adjusting<br>
1052   * the {#getTimeBase()} to the highest possible resolution.<br>
1053   * Be warned though; some codecs (such as MPEG2) require fixed<br>
1054   * time-bases (like 1/25) and so setting a higher resolution<br>
1055   * time base might end up with the codec not able to encode<br>
1056   * any data.<br>
1057   * </p><br>
1058   * @return the number of frames dropped.<br>
1059   * @since 3.1
1060   */
1061  public long getNumDroppedFrames() {
1062    return AVPKitJNI.IStreamCoder_getNumDroppedFrames(swigCPtr, this);
1063  }
1064
1065  /**
1066   * Should the {IStreamCoder} automatically adjust<br>
1067   * time stamps on output packets for the {IStream}<br>
1068   * it is ultimately destined for.<br>
1069   * <br>
1070   * <p><br>
1071   * <br>
1072   * If this {IStreamCoder} does not know which {IStream}<br>
1073   * it is destined for, or this {IStreamCoder} isn't used<br>
1074   * with an {IStream} at all, then this setting is ignored.<br>
1075   * <br>
1076   * </p><br>
1077   * <br>
1078   * @param value true to automatically adjust.<br>
1079   * @since 3.2
1080   */
1081  public void setAutomaticallyStampPacketsForStream(boolean value) {
1082    AVPKitJNI.IStreamCoder_setAutomaticallyStampPacketsForStream(swigCPtr, this, value);
1083  }
1084
1085  /**
1086   * Does this {IStreamCoder} automatically adjust<br>
1087   * time stamps on output packets for the {IStream} it<br>
1088   * is ultimately destined for.<br>
1089   * @return true for yes; false for no<br>
1090   * @see #setAutomaticallyStampPacketsForStream(boolean)<br>
1091   * @since 3.2
1092   */
1093  public boolean getAutomaticallyStampPacketsForStream() {
1094    return AVPKitJNI.IStreamCoder_getAutomaticallyStampPacketsForStream(swigCPtr, this);
1095  }
1096
1097  /**
1098   * Look up a Codec based on the passed in ID, and then set it.<br>
1099   * <p><br>
1100   * Forwards to {#setCodecID(com.avpkit.core.ICodec.ID)}  <br>
1101   * </p><br>
1102   * <p><br>
1103   * To see if you actually set the correct ID, call getCodec() and<br>
1104   * check for 0 (null).<br>
1105   * </p><br>
1106   * <p><br>
1107   * Once you call setCodec, all settings on the IStreamCoder are<br>
1108   * reset to default values.  So you probably want to call this <br>
1109   * first.<br>
1110   * </p><br>
1111   * <br>
1112   * @param id ID of codec to set.<br>
1113   * @since 3.2
1114   */
1115  public void setCodecID(ICodec.ID id) {
1116    AVPKitJNI.IStreamCoder_setCodecID(swigCPtr, this, id.swigValue());
1117  }
1118
1119  /**
1120   * Copies data from the given buffer into the extra-data area maintained<br>
1121   * by encoders.<br>
1122   * <p><br>
1123   * This is an extremely advanced method, and incorrect usage can result<br>
1124   * in Java crashes so take care.  In general people should not need to use this.<br>
1125   * </p><br>
1126   * <p><br>
1127   * For some codecs (e.g. for H264, this is global header information and<br>
1128   * for rv10 it is additional flags),<br>
1129   *  AVPKit maintains extra information about<br>
1130   * the codec in a extra data buffer.  In general AVPKit will allocate this<br>
1131   * data as needed and you never need to set it (or get it).  But if you know what you're<br>
1132   * doing, you can ask AVPKit to replace the existing extra data for the<br>
1133   * given codec with a copy of the data in the given buffer.<br>
1134   * </p><br>
1135   * <p><br>
1136   * You should call this method after you call {#open()} but before<br>
1137   * you encode or decode any media.<br>
1138   * </p><br>
1139   * @param src The data to copy<br>
1140   * @param offset The position, in bytes, to start copying data from src<br>
1141   * @param length The number of bytes to copy from data<br>
1142   * @param allocNew If true, and there is not enough space in the existing<br>
1143   *   extra data buffer, then AVPKit will discard the old buffer and allocate a new buffer.<br>
1144   *   If false, then AVPKit will attempt to copy the data into the existing buffer and if there<br>
1145   *   is not enough space in the existing buffer, no bytes will be copied and an error will<br>
1146   *   be returned.  In general, you should set this to false if that works for you.<br>
1147   * @return The number of bytes copied, or &lt; 0 on error.<br>
1148   * <br>
1149   * @since 3.3
1150   */
1151  public int setExtraData(IBuffer src, int offset, int length, boolean allocNew) {
1152    return AVPKitJNI.IStreamCoder_setExtraData(swigCPtr, this, IBuffer.getCPtr(src), src, offset, length, allocNew);
1153  }
1154
1155  /**
1156   * Copies the current content of the extra-data buffer maintained by this codec (e.g. header bytes)<br>
1157   * into the dest buffer.<br>
1158   * <br>
1159   * @param dest The buffer to copy to.<br>
1160   * @param offset The position, in bytes, to start writing data to in dest.<br>
1161   * @param maxBytesToCopy The maximum number of bytes to copy.<br>
1162   * @return The number of bytes copied, or &lt; 0 on error.<br>
1163   * <br>
1164   * @since 3.3
1165   */
1166  public int getExtraData(IBuffer dest, int offset, int maxBytesToCopy) {
1167    return AVPKitJNI.IStreamCoder_getExtraData(swigCPtr, this, IBuffer.getCPtr(dest), dest, offset, maxBytesToCopy);
1168  }
1169
1170  /**
1171   * Gets the current number of bytes of data maintained in the coder extra-data area.<br>
1172   * @return The number of bytes.  If 0, then no data is currently available.<br>
1173   * <br>
1174   * @since 3.3
1175   */
1176  public int getExtraDataSize() {
1177    return AVPKitJNI.IStreamCoder_getExtraDataSize(swigCPtr, this);
1178  }
1179
1180  /**
1181   * Gets the current level of standards compliance.<br>
1182   * @return The level of standards compliance.<br>
1183   * @see CodecStandardsCompliance<br>
1184   * @since 5.0
1185   */
1186  public IStreamCoder.CodecStandardsCompliance getStandardsCompliance() {
1187    return IStreamCoder.CodecStandardsCompliance.swigToEnum(AVPKitJNI.IStreamCoder_getStandardsCompliance(swigCPtr, this));
1188  }
1189
1190  /**
1191   * Set the level of standards compliance.  Only paid attention to<br>
1192   * before the code is opened.<br>
1193   * <br>
1194   * @param compliance The desired compliance level to set<br>
1195   * @return 0 on success; non-zero on failure<br>
1196   * @see CodecStandardsCompliance<br>
1197   * @since 5.0
1198   */
1199  public int setStandardsCompliance(IStreamCoder.CodecStandardsCompliance compliance) {
1200    return AVPKitJNI.IStreamCoder_setStandardsCompliance(swigCPtr, this, compliance.swigValue());
1201  }
1202
1203  /**
1204   * Open the codec with the given options.<br>
1205   * <br>
1206   * Callers must call {#setCodec} before calling this method.<br>
1207   * <br>
1208   * @param options If non-NULL, a dictionary of parameter options to set for this codec.<br>
1209   * @param unsetOptions If non-NULL, on successful return the prior contents of this set<br>
1210   *   of meta data will be replaced with any settings in 'options' that could not be set<br>
1211   *   on this codec.<br>
1212   * <br>
1213   * @return 0 on success; &lt;0 on error<br>
1214   * <br>
1215   * @since 5.0
1216   */
1217  public int open(IMetaData options, IMetaData unsetOptions) {
1218    return AVPKitJNI.IStreamCoder_open__SWIG_1(swigCPtr, this, IMetaData.getCPtr(options), options, IMetaData.getCPtr(unsetOptions), unsetOptions);
1219  }
1220
1221  /**
1222   * Create a standalone StreamCoder that can encode or decode data independent<br>
1223   * of the stream it is attached to.<br>
1224   * <br>
1225   * <p><br>
1226   * If you're reading or writing to a AVPKIT file or URL you almost definitely<br>
1227   * don't want to use this method.  Use the {IContainer#getStream(long)}<br>
1228   * and {IStream#getStreamCoder()} methods instead as it will set up the<br>
1229   * resulting IStreamCoder with sensible defaults.  Use of a un-attached<br>
1230   * StreamCoder returned from this method is for advanced users only.<br>
1231   * </p><br>
1232   * @param direction The direction this StreamCoder will work in.<br>
1233   * @param codec The codec you want to use (in lieu of calling {#setCodec}<br>
1234   * @return a new stream coder, or null if error.<br>
1235   * <br>
1236   * @since 5.0
1237   */
1238  public static IStreamCoder make(IStreamCoder.Direction direction, ICodec codec) {
1239    long cPtr = AVPKitJNI.IStreamCoder_make__SWIG_2(direction.swigValue(), ICodec.getCPtr(codec), codec);
1240    return (cPtr == 0) ? null : new IStreamCoder(cPtr, false);
1241  }
1242
1243  /**
1244   * Create a standalone StreamCoder that can encode or decode data independent<br>
1245   * of the stream it is attached to.<br>
1246   * <br>
1247   * <p><br>
1248   * If you're reading or writing to a AVPKIT file or URL you almost definitely<br>
1249   * don't want to use this method.  Use the {IContainer#getStream(long)}<br>
1250   * and {IStream#getStreamCoder()} methods instead as it will set up the<br>
1251   * resulting IStreamCoder with sensible defaults.  Use of a un-attached<br>
1252   * StreamCoder returned from this method is for advanced users only.<br>
1253   * </p><br>
1254   * @param direction The direction this StreamCoder will work in.<br>
1255   * @param id The codec id you want to use (in lieu of calling {#setCodec}<br>
1256   * @return a new stream coder, or null if error.<br>
1257   * <br>
1258   * @since 5.0
1259   */
1260  public static IStreamCoder make(IStreamCoder.Direction direction, ICodec.ID id) {
1261    long cPtr = AVPKitJNI.IStreamCoder_make__SWIG_3(direction.swigValue(), id.swigValue());
1262    return (cPtr == 0) ? null : new IStreamCoder(cPtr, false);
1263  }
1264
1265  /**
1266   * {
1267   */
1268  public int setProperty(IMetaData valuesToSet, IMetaData valuesNotFound) {
1269    return AVPKitJNI.IStreamCoder_setProperty__SWIG_5(swigCPtr, this, IMetaData.getCPtr(valuesToSet), valuesToSet, IMetaData.getCPtr(valuesNotFound), valuesNotFound);
1270  }
1271
1272  /**
1273   * Try to change current decoder to an HW decoder compatible with<br>
1274   * pixel format<br>
1275   * <br>
1276   * @param type an HW accelerated pixel format<br>
1277   * @return 0 on success; non-zero on failure
1278   */
1279  public int setHardwareDecoding(IPixelFormat.Type type) {
1280    return AVPKitJNI.IStreamCoder_setHardwareDecoding(swigCPtr, this, type.swigValue());
1281  }
1282
1283  /**
1284   * The Direction in which this StreamCoder will work.
1285   */
1286  public enum Direction {
1287    ENCODING,
1288    DECODING;
1289
1290    public final int swigValue() {
1291      return swigValue;
1292    }
1293
1294    public static Direction swigToEnum(int swigValue) {
1295      Direction[] swigValues = Direction.class.getEnumConstants();
1296      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
1297        return swigValues[swigValue];
1298      for (Direction swigEnum : swigValues)
1299        if (swigEnum.swigValue == swigValue)
1300          return swigEnum;
1301      throw new IllegalArgumentException("No enum " + Direction.class + " with value " + swigValue);
1302    }
1303
1304    @SuppressWarnings("unused")
1305    private Direction() {
1306      this.swigValue = SwigNext.next++;
1307    }
1308
1309    @SuppressWarnings("unused")
1310    private Direction(int swigValue) {
1311      this.swigValue = swigValue;
1312      SwigNext.next = swigValue+1;
1313    }
1314
1315    @SuppressWarnings("unused")
1316    private Direction(Direction swigEnum) {
1317      this.swigValue = swigEnum.swigValue;
1318      SwigNext.next = this.swigValue+1;
1319    }
1320
1321    private final int swigValue;
1322
1323    private static class SwigNext {
1324      private static int next = 0;
1325    }
1326  }
1327
1328  /**
1329   * AVPKIT Flags that can be passed to the setFlag(Flags, bool) method
1330   */
1331  public enum Flags {
1332    /**
1333     *  Use fixed qscale.
1334     */
1335    FLAG_QSCALE(AVPKitJNI.IStreamCoder_FLAG_QSCALE_get()),
1336    /**
1337     *  4 MV per MB allowed / advanced prediction for H.263.
1338     */
1339    FLAG_4MV(AVPKitJNI.IStreamCoder_FLAG_4MV_get()),
1340    /**
1341     *  Use qpel MC.
1342     */
1343    FLAG_QPEL(AVPKitJNI.IStreamCoder_FLAG_QPEL_get()),
1344    /**
1345     *  Use GMC.
1346     */
1347    FLAG_GMC(AVPKitJNI.IStreamCoder_FLAG_GMC_get()),
1348    FLAG_MV0(AVPKitJNI.IStreamCoder_FLAG_MV0_get()),
1349    /**
1350     * The parent program guarantees that the input for B-frames containing<br>
1351     * streams is not written to for at least s-&gt;max_b_frames+1 frames, if<br>
1352     * this is not set the input will be copied.
1353     */
1354    FLAG_INPUT_PRESERVED(AVPKitJNI.IStreamCoder_FLAG_INPUT_PRESERVED_get()),
1355    /**
1356     *  Use internal 2pass ratecontrol in first pass mode.
1357     */
1358    FLAG_PASS1(AVPKitJNI.IStreamCoder_FLAG_PASS1_get()),
1359    /**
1360     *  Use internal 2pass ratecontrol in second pass mode.
1361     */
1362    FLAG_PASS2(AVPKitJNI.IStreamCoder_FLAG_PASS2_get()),
1363    /**
1364     *  Only decode/encode grayscale.
1365     */
1366    FLAG_GRAY(AVPKitJNI.IStreamCoder_FLAG_GRAY_get()),
1367    /**
1368     *  Don't draw edges.
1369     */
1370    FLAG_EMU_EDGE(AVPKitJNI.IStreamCoder_FLAG_EMU_EDGE_get()),
1371    /**
1372     *  error[?] variables will be set during encoding.
1373     */
1374    FLAG_PSNR(AVPKitJNI.IStreamCoder_FLAG_PSNR_get()),
1375    FLAG_TRUNCATED(AVPKitJNI.IStreamCoder_FLAG_TRUNCATED_get()),
1376    /**
1377     *  Input bitstream might be truncated at a random<br>
1378     *                                                   location instead of only at frame boundaries.  Normalize adaptive quantization.
1379     */
1380    FLAG_NORMALIZE_AQP(AVPKitJNI.IStreamCoder_FLAG_NORMALIZE_AQP_get()),
1381    /**
1382     *  Use interlaced DCT.
1383     */
1384    FLAG_INTERLACED_DCT(AVPKitJNI.IStreamCoder_FLAG_INTERLACED_DCT_get()),
1385    /**
1386     *  Force low delay.
1387     */
1388    FLAG_LOW_DELAY(AVPKitJNI.IStreamCoder_FLAG_LOW_DELAY_get()),
1389    /**
1390     *  Place global headers in extradata instead of every keyframe.
1391     */
1392    FLAG_GLOBAL_HEADER(AVPKitJNI.IStreamCoder_FLAG_GLOBAL_HEADER_get()),
1393    /**
1394     *  Use only bitexact stuff (except (I)DCT).
1395     */
1396    FLAG_BITEXACT(AVPKitJNI.IStreamCoder_FLAG_BITEXACT_get()),
1397    /**
1398     *  H.263 advanced intra coding / MPEG-4 AC prediction
1399     */
1400    FLAG_AC_PRED(AVPKitJNI.IStreamCoder_FLAG_AC_PRED_get()),
1401    /**
1402     *  Use rate distortion optimization for cbp.
1403     */
1404    FLAG_CBP_RD(AVPKitJNI.IStreamCoder_FLAG_CBP_RD_get()),
1405    /**
1406     *  Use rate distortion optimization for qp selectioon.
1407     */
1408    FLAG_QP_RD(AVPKitJNI.IStreamCoder_FLAG_QP_RD_get()),
1409    /**
1410     *  loop filter
1411     */
1412    FLAG_LOOP_FILTER(AVPKitJNI.IStreamCoder_FLAG_LOOP_FILTER_get()),
1413    /**
1414     *  interlaced motion estimation
1415     */
1416    FLAG_INTERLACED_ME(AVPKitJNI.IStreamCoder_FLAG_INTERLACED_ME_get()),
1417    FLAG_CLOSED_GOP(AVPKitJNI.IStreamCoder_FLAG_CLOSED_GOP_get()),
1418    /**
1419     *  Allow non spec compliant speedup tricks.
1420     */
1421    FLAG2_FAST(AVPKitJNI.IStreamCoder_FLAG2_FAST_get()),
1422    /**
1423     *  Strictly enforce GOP size.
1424     */
1425    FLAG2_STRICT_GOP(AVPKitJNI.IStreamCoder_FLAG2_STRICT_GOP_get()),
1426    /**
1427     *  Skip bitstream encoding.
1428     */
1429    FLAG2_NO_OUTPUT(AVPKitJNI.IStreamCoder_FLAG2_NO_OUTPUT_get()),
1430    /**
1431     *  Place global headers at every keyframe instead of in extradata.
1432     */
1433    FLAG2_LOCAL_HEADER(AVPKitJNI.IStreamCoder_FLAG2_LOCAL_HEADER_get()),
1434    /**
1435     *  RD optimal MB level residual skipping
1436     */
1437    FLAG2_SKIP_RD(AVPKitJNI.IStreamCoder_FLAG2_SKIP_RD_get()),
1438    /**
1439     *  Input bitstream might be truncated at a packet boundaries instead of only at frame boundaries.
1440     */
1441    FLAG2_CHUNKS(AVPKitJNI.IStreamCoder_FLAG2_CHUNKS_get()),
1442    /**
1443     *  Show all frames before the first keyframe
1444     */
1445    FLAG2_SHOW_ALL(AVPKitJNI.IStreamCoder_FLAG2_SHOW_ALL_get());
1446
1447    public final int swigValue() {
1448      return swigValue;
1449    }
1450
1451    public static Flags swigToEnum(int swigValue) {
1452      Flags[] swigValues = Flags.class.getEnumConstants();
1453      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
1454        return swigValues[swigValue];
1455      for (Flags swigEnum : swigValues)
1456        if (swigEnum.swigValue == swigValue)
1457          return swigEnum;
1458      throw new IllegalArgumentException("No enum " + Flags.class + " with value " + swigValue);
1459    }
1460
1461    @SuppressWarnings("unused")
1462    private Flags() {
1463      this.swigValue = SwigNext.next++;
1464    }
1465
1466    @SuppressWarnings("unused")
1467    private Flags(int swigValue) {
1468      this.swigValue = swigValue;
1469      SwigNext.next = swigValue+1;
1470    }
1471
1472    @SuppressWarnings("unused")
1473    private Flags(Flags swigEnum) {
1474      this.swigValue = swigEnum.swigValue;
1475      SwigNext.next = this.swigValue+1;
1476    }
1477
1478    private final int swigValue;
1479
1480    private static class SwigNext {
1481      private static int next = 0;
1482    }
1483  }
1484
1485  /**
1486   * An enumeration of how strictly Codecs may follow the spec.<br>
1487   * Not all settings follow these requirements, but some<br>
1488   * experimental codecs require this flag to be set to use.<br>
1489   * <br>
1490   * @since 5.0
1491   */
1492  public enum CodecStandardsCompliance {
1493    /**
1494     * Strictly conform to an older more strict version of the spec or reference software.
1495     */
1496    COMPLIANCE_VERY_STRICT(AVPKitJNI.IStreamCoder_COMPLIANCE_VERY_STRICT_get()),
1497    /**
1498     * Strictly conform to all the things in the spec no matter what consequences
1499     */
1500    COMPLIANCE_STRICT(AVPKitJNI.IStreamCoder_COMPLIANCE_STRICT_get()),
1501    /**
1502     * Take normal liberties with the spec, including taking the spec out to dinner, and<br>
1503     * making suggestive comments to the spec.
1504     */
1505    COMPLIANCE_NORMAL(AVPKitJNI.IStreamCoder_COMPLIANCE_NORMAL_get()),
1506    /**
1507     * Allow unofficial, but still mostly chaste, extensions to the spec.
1508     */
1509    COMPLIANCE_UNOFFICIAL(AVPKitJNI.IStreamCoder_COMPLIANCE_UNOFFICIAL_get()),
1510    /**
1511     * Allow nonstandardized experimental things. Potentially deviant things.  The<br>
1512     * type of things spec authors don't like to talk about, but secretly<br>
1513     * fantasize about.  You know what I mean, MPEG Working Group.
1514     */
1515    COMPLIANCE_EXPERIMENTAL(AVPKitJNI.IStreamCoder_COMPLIANCE_EXPERIMENTAL_get());
1516
1517    public final int swigValue() {
1518      return swigValue;
1519    }
1520
1521    public static CodecStandardsCompliance swigToEnum(int swigValue) {
1522      CodecStandardsCompliance[] swigValues = CodecStandardsCompliance.class.getEnumConstants();
1523      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
1524        return swigValues[swigValue];
1525      for (CodecStandardsCompliance swigEnum : swigValues)
1526        if (swigEnum.swigValue == swigValue)
1527          return swigEnum;
1528      throw new IllegalArgumentException("No enum " + CodecStandardsCompliance.class + " with value " + swigValue);
1529    }
1530
1531    @SuppressWarnings("unused")
1532    private CodecStandardsCompliance() {
1533      this.swigValue = SwigNext.next++;
1534    }
1535
1536    @SuppressWarnings("unused")
1537    private CodecStandardsCompliance(int swigValue) {
1538      this.swigValue = swigValue;
1539      SwigNext.next = swigValue+1;
1540    }
1541
1542    @SuppressWarnings("unused")
1543    private CodecStandardsCompliance(CodecStandardsCompliance swigEnum) {
1544      this.swigValue = swigEnum.swigValue;
1545      SwigNext.next = this.swigValue+1;
1546    }
1547
1548    private final int swigValue;
1549
1550    private static class SwigNext {
1551      private static int next = 0;
1552    }
1553  }
1554
1555}