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 * Specifies format information than can be used to configure<br>
013 * an {IContainer} for input or output.<br>
014 * <p><br>
015 * Often times AVPKIT can guess the correct formats to put into<br>
016 * a given IContainer object, but sometimes it needs help.  You<br>
017 * can allocate an IContainerFormat object and specify information about<br>
018 * input or output containers, and then pass this to IContainer.open(...)<br>
019 * to help us guess.<br>
020 * </p>
021 */
022public class IContainerFormat extends RefCounted {
023  // JNIHelper.swg: Start generated code
024  // >>>>>>>>>>>>>>>>>>>>>>>>>>>
025  /**
026   * This method is only here to use some references and remove
027   * a Eclipse compiler warning.
028   */
029  @SuppressWarnings("unused")
030  private void noop()
031  {
032    IBuffer.make(null, 1);
033  }
034   
035  private volatile long swigCPtr;
036
037  /**
038   * Internal Only.
039   */
040  protected IContainerFormat(long cPtr, boolean cMemoryOwn) {
041    super(AVPKitJNI.IContainerFormat_SWIGUpcast(cPtr), cMemoryOwn);
042    swigCPtr = cPtr;
043  }
044  
045  /**
046   * Internal Only.
047   */
048  protected IContainerFormat(long cPtr, boolean cMemoryOwn,
049      java.util.concurrent.atomic.AtomicLong ref)
050  {
051    super(AVPKitJNI.IContainerFormat_SWIGUpcast(cPtr),
052     cMemoryOwn, ref);
053    swigCPtr = cPtr;
054  }
055    
056  /**
057   * Internal Only.  Not part of public API.
058   *
059   * Get the raw value of the native object that obj is proxying for.
060   *   
061   * @param obj The java proxy object for a native object.
062   * @return The raw pointer obj is proxying for.
063   */
064  public static long getCPtr(IContainerFormat obj) {
065    if (obj == null) return 0;
066    return obj.getMyCPtr();
067  }
068
069  /**
070   * Internal Only.  Not part of public API.
071   *
072   * Get the raw value of the native object that we're proxying for.
073   *   
074   * @return The raw pointer we're proxying for.
075   */  
076  public long getMyCPtr() {
077    if (swigCPtr == 0) throw new IllegalStateException("underlying native object already deleted");
078    return swigCPtr;
079  }
080  
081  /**
082   * Create a new IContainerFormat object that is actually referring to the
083   * exact same underlying native object.
084   *
085   * @return the new Java object.
086   */
087  @Override
088  public IContainerFormat copyReference() {
089    if (swigCPtr == 0)
090      return null;
091    else
092      return new IContainerFormat(swigCPtr, swigCMemOwn, getJavaRefCount());
093  }
094
095  /**
096   * Compares two values, returning true if the underlying objects in native code are the same object.
097   *
098   * That means you can have two different Java objects, but when you do a comparison, you'll find out
099   * they are the EXACT same object.
100   *
101   * @return True if the underlying native object is the same.  False otherwise.
102   */
103  public boolean equals(Object obj) {
104    boolean equal = false;
105    if (obj instanceof IContainerFormat)
106      equal = (((IContainerFormat)obj).swigCPtr == this.swigCPtr);
107    return equal;
108  }
109  
110  /**
111   * Get a hashable value for this object.
112   *
113   * @return the hashable value.
114   */
115  public int hashCode() {
116     return (int)swigCPtr;
117  }
118  
119  // <<<<<<<<<<<<<<<<<<<<<<<<<<<
120  // JNIHelper.swg: End generated code
121  
122
123  /**
124   * info about this format object
125   * @return information about this object
126   */
127   
128  @Override
129  public String toString()
130  {
131    StringBuilder result = new StringBuilder();
132    
133    result.append(this.getClass().getName()+"@"+hashCode()+"[");
134    if (isInput())
135    {
136      result.append("iname:"+getInputFormatShortName()+";");
137      result.append("ilongname:"+getInputFormatLongName()+";");
138    }
139    if (isOutput())
140    {
141      result.append("oname:"+getOutputFormatShortName()+";");
142      result.append("olongname:"+getOutputFormatLongName()+";");
143      result.append("omimetype:"+getOutputFormatMimeType()+";");
144      result.append("oextensions:"+getOutputExtensions()+";");
145    }
146    result.append("]");
147    return result.toString();
148  }
149  
150  /**
151   * Returns a list of all codecs supported for this Object.
152   *
153   * <p>
154   *
155   * If this object hasn't been set up for output, then
156   * we return null.
157   *
158   * </p>
159   *
160   * @return A list of supported codecs, in decreasing preferred order.
161   * @since 3.1
162   */
163  public java.util.List<ICodec.ID> getOutputCodecsSupported()
164  {
165    final java.util.List<ICodec.ID> retval =
166      new java.util.LinkedList<ICodec.ID>();
167    final java.util.Set<ICodec.ID> uniqueSet =
168      new java.util.HashSet<ICodec.ID>();
169    
170    int numCodecs = getOutputNumCodecsSupported();
171    for(int i = 0; i < numCodecs; i++)
172    {
173      ICodec.ID id = getOutputCodecID(i);
174      // remove duplicate IDs
175      if (id != ICodec.ID.AV_CODEC_ID_NONE && !uniqueSet.contains(id))
176        retval.add(id);
177      uniqueSet.add(id);
178    }    
179    return retval;
180  }
181
182  /**
183   * Returns a list of all codec tags supported for this container.
184   *
185   * <p>
186   *
187   * If this object hasn't been set up for output, then
188   * we return null.
189   *
190   * </p>
191   *
192   * @return A list of supported codec tags, in decreasing preferred order.
193   * @since 3.3
194   */
195  public java.util.List<Integer> getOutputTagsSupported()
196  {
197    final java.util.List<Integer> retval =
198      new java.util.LinkedList<Integer>();
199    final java.util.Set<Integer> uniqueSet =
200      new java.util.HashSet<Integer>();
201    
202    int numCodecs = getOutputNumCodecsSupported();
203    for(int i = 0; i < numCodecs; i++)
204    {
205      int tag = getOutputCodecTag(i);
206      ICodec.ID id = getOutputCodecID(i);
207      // remove duplicate tags
208      if (id != ICodec.ID.AV_CODEC_ID_NONE && !uniqueSet.contains(tag))
209        retval.add(tag);
210      uniqueSet.add(tag);
211    }    
212    return retval;
213  }
214  
215    /**
216   * Return a collection of all input formats installed on this system.
217   * @return the list.
218   */
219  public static java.util.Collection<IContainerFormat>
220  getInstalledInputFormats()
221  {
222    java.util.Collection<IContainerFormat> retval =
223      new java.util.HashSet<IContainerFormat>();
224    int count = getNumInstalledInputFormats();
225    for(int i = 0; i< count;++i)
226    {
227      IContainerFormat fmt = getInstalledInputFormat(i);
228      if (fmt != null)
229        retval.add(fmt);
230    }
231    return retval;
232  }
233  
234  /**
235   * Return a collection of all output formats installed on this system.
236   * @return the list.
237   */
238  public static java.util.Collection<IContainerFormat>
239  getInstalledOutputFormats()
240  {
241    java.util.Collection<IContainerFormat> retval =
242      new java.util.HashSet<IContainerFormat>();
243    int count = getNumInstalledOutputFormats();
244    for(int i = 0; i< count;++i)
245    {
246      IContainerFormat fmt = getInstalledOutputFormat(i);
247      if (fmt != null)
248        retval.add(fmt);
249    }
250    return retval;
251  }
252/**
253   * For a given output codec type guess the best codec
254   * for encoding into this container.
255   * 
256   * @param type the codec type
257   *
258   * @return the best guess output codec ID
259   * 
260   * @see #establishOutputCodecId(com.avpkit.core.ICodec.Type, com.avpkit.core.ICodec.ID)
261   * @throws IllegalArgumentException if type is null
262   *   or {@link #isOutput()} is false.
263   * @throws UnsupportedOperationException if we cannot establish
264   *   a codec.
265   */
266
267  public ICodec.ID establishOutputCodecId(ICodec.Type type)
268  {
269    return establishOutputCodecId(type, null);
270  }
271  
272  /**
273   * For a given input codec id guess an ID supported by this
274   * IContainerFormat that might be good for encoding.
275   * 
276   * @param inputCodecId the input codec id
277   *
278   * @return the best guess output codec ID
279   * 
280   * @see #establishOutputCodecId(com.avpkit.core.ICodec.Type, com.avpkit.core.ICodec.ID)
281   * @throws IllegalArgumentException if inputCodec is null
282   *   or {@link #isOutput()} is false.
283   * @throws UnsupportedOperationException if we cannot establish
284   *   a codec.
285   */
286
287  public ICodec.ID establishOutputCodecId(ICodec.ID inputCodecId)
288  {
289    ICodec codec = null;
290    try
291    {
292      if (inputCodecId == null || inputCodecId == ICodec.ID.AV_CODEC_ID_NONE)
293        throw new IllegalArgumentException("null inputCodecId");
294      
295      codec = ICodec.findDecodingCodec(inputCodecId);
296      if (codec == null)
297        throw new UnsupportedOperationException("could not find decoding codec");
298      return establishOutputCodecId(codec);
299    }
300    finally
301    {
302      if (codec != null)
303        codec.delete();
304    }
305  }
306  /**
307   * For a given input codec guess an ID supported by this
308   * IContainerFormat that might be good for encoding.
309   * 
310   * @param inputCodec the input codec
311   *
312   * @see #establishOutputCodecId(com.avpkit.core.ICodec.Type, com.avpkit.core.ICodec.ID)
313   * @return the best guess output codec ID
314   * 
315   * @throws IllegalArgumentException if inputCodec is null
316   *   or {@link #isOutput()} is false.
317   * @throws UnsupportedOperationException if we cannot establish
318   *   a codec.
319   */
320
321  public ICodec.ID establishOutputCodecId(ICodec inputCodec)
322  {
323    if (inputCodec == null)
324      throw new IllegalArgumentException();
325    return establishOutputCodecId(inputCodec.getType(), inputCodec.getID());
326  }
327
328  /**
329   * For a given input codec guess an ID supported by this
330   * IContainerFormat that might be good for encoding.
331   * 
332   * <p>
333   * For example, if the input codec ID was
334   * {@link ICodec.ID#CODEC_ID_FLAC} and you were trying
335   * to encoding into an "FLV" file that doesn't support that
336   * codec for outputting, this method will instead suggest
337   * {@link ICodec.ID#CODEC_ID_MP3} instead.
338   * </p>
339   * <p>
340   * The algorithm followed is:
341   * </p>
342   * <ul>
343   *   <li>If the container has a preferred codec for the given
344   *   codec type, use that; else</li>
345   *   <li>If the input codec can be used for encoding into this
346   *   container, and is installed on this system, use that; else</li>
347   *   <li>Query the container format to see what other formats it
348   *   can support, and are installed on this system, and choose the
349   *   first one that will work; else</li>
350   *   <li>Throw an {@link UnsupportedOperationException}.</li>
351   * </ul>
352   * 
353   * <p>
354   * This method relies on
355   * FFMPEGs internal database of codec IDs to identify the correct
356   * output codec IDs that can fit in this container.
357   * </p>
358   * 
359   * @param type the type of codec desired
360   * @param inputCodecId an input codec id to attempt to match, or null
361   *   if none.
362   *
363   * @return the best guess output codec ID
364   * 
365   * @throws IllegalArgumentException if inputCodecId is null
366   *   or equal to {@link ICodec.ID#CODEC_ID_NONE}, or 
367   *   {@link #isOutput()} is false.
368   * @throws UnsupportedOperationException if we cannot establish
369   *   a codec.
370   */
371
372  public ICodec.ID establishOutputCodecId(
373      ICodec.Type type,
374      ICodec.ID inputCodecId)
375  {
376    ICodec codec = null;
377    ICodec inputCodec = null;
378    try
379    {
380      if (type == null)
381        throw new IllegalArgumentException("null codec type");
382
383      if (!this.isOutput())
384        throw new IllegalArgumentException(
385            "passed output container format, actally an input container format");
386
387      if (inputCodecId != null && inputCodecId != ICodec.ID.AV_CODEC_ID_NONE)
388      {
389        inputCodec = ICodec.findDecodingCodec(inputCodecId);
390        if (inputCodec == null)
391          throw new IllegalArgumentException("could not find input codec id");
392        
393        if (inputCodec.getType() != type)
394          throw new IllegalArgumentException("inputCodecId of different type"+
395            " than expected");
396      }
397
398      // the would be output codec
399
400      ICodec.ID outputCodecId = null;
401
402      // find the default codec for the output container by input codec type
403
404      switch (type)
405      {
406        case CODEC_TYPE_AUDIO:
407          outputCodecId = this.getOutputDefaultAudioCodec();
408          break;
409        case CODEC_TYPE_VIDEO:
410          outputCodecId = this.getOutputDefaultVideoCodec();
411          break;
412        case CODEC_TYPE_SUBTITLE:
413          outputCodecId = this.getOutputDefaultSubtitleCodec();
414          break;
415      }
416      if (outputCodecId != null && outputCodecId != ICodec.ID.AV_CODEC_ID_NONE)
417      {
418        codec = ICodec.findEncodingCodec(outputCodecId);
419      }
420      if (codec != null)
421        return outputCodecId;
422
423      // ok, otherwise that didn't work, so try the input codec
424      if (inputCodec != null)
425      {
426        codec = ICodec.findEncodingCodec(inputCodecId);
427        if (codec != null &&
428            this.isCodecSupportedForOutput(codec.getID()))
429          return codec.getID();
430      }
431
432      // if there still isn't a valid codec, hunt through all the codecs
433      // for the output format and see if ANY match the input codec type
434
435      for (ICodec.ID codecId : this.getOutputCodecsSupported())
436      {
437        if (codec != null)
438          codec.delete();
439        codec = ICodec.findEncodingCodec(codecId);
440        if (codec != null && codec.getType() == type)
441        {
442          // if it is a valid codec break out of the search
443
444          outputCodecId = codec.getID();
445          if (codec.canEncode())
446          {
447            break;
448          }
449        }
450      }
451      if (outputCodecId == null || outputCodecId == ICodec.ID.AV_CODEC_ID_NONE)
452        throw new UnsupportedOperationException("could not guess codec");
453      return outputCodecId;
454    }
455    finally
456    {
457      if (codec != null)
458        codec.delete();
459      if (inputCodec != null)
460        inputCodec.delete();
461    }
462  }
463   
464
465  /**
466   * Sets the input format for this container.<br>
467   * <br>
468   * @param shortName The short name for this container (using FFMPEG's<br>
469   *   short name).<br>
470   * @return &gt;= 0 on success.  &lt; 0 if shortName cannot be found.
471   */
472  public int setInputFormat(String shortName) {
473    return AVPKitJNI.IContainerFormat_setInputFormat(swigCPtr, this, shortName);
474  }
475
476  /**
477   * Sets the output format for this container.<br>
478   * <br>
479   * We'll look at the shortName, url and mimeType and try to guess<br>
480   * a valid output container format.<br>
481   * <br>
482   * @param shortName The short name for this container (using FFMPEG's<br>
483   *   short name).<br>
484   * @param url The URL for this container.<br>
485   * @param mimeType The mime type for this container.<br>
486   * @return &gt;= 0 on success.  &lt; 0 if we cannot find a good container.
487   */
488  public int setOutputFormat(String shortName, String url, String mimeType) {
489    return AVPKitJNI.IContainerFormat_setOutputFormat(swigCPtr, this, shortName, url, mimeType);
490  }
491
492  /**
493   * Get the short name for the input format.<br>
494   * @return The short name for the input format, or null if none.
495   */
496  public String getInputFormatShortName() {
497    return AVPKitJNI.IContainerFormat_getInputFormatShortName(swigCPtr, this);
498  }
499
500  /**
501   * Get the long name for the input format.<br>
502   * @return The long name for the input format, or null if none.
503   */
504  public String getInputFormatLongName() {
505    return AVPKitJNI.IContainerFormat_getInputFormatLongName(swigCPtr, this);
506  }
507
508  /**
509   * Get the short name for the output format.<br>
510   * @return The short name for the output format, or null if none.
511   */
512  public String getOutputFormatShortName() {
513    return AVPKitJNI.IContainerFormat_getOutputFormatShortName(swigCPtr, this);
514  }
515
516  /**
517   * Get the long name for the output format.<br>
518   * @return The long name for the output format, or null if none.
519   */
520  public String getOutputFormatLongName() {
521    return AVPKitJNI.IContainerFormat_getOutputFormatLongName(swigCPtr, this);
522  }
523
524  /**
525   * Get the mime type for the output format.<br>
526   * @return The mime type for the output format, or null if none.
527   */
528  public String getOutputFormatMimeType() {
529    return AVPKitJNI.IContainerFormat_getOutputFormatMimeType(swigCPtr, this);
530  }
531
532  /**
533   * Create a new IContainerFormat object.<br>
534   * <br>
535   * @return a new object, or null on error.
536   */
537  public static IContainerFormat make() {
538    long cPtr = AVPKitJNI.IContainerFormat_make();
539    return (cPtr == 0) ? null : new IContainerFormat(cPtr, false);
540  }
541
542  /**
543   * Get the input flags associated with this object.<br>
544   * <br>
545   * @return The (compacted) value of all flags set.
546   */
547  public int getInputFlags() {
548    return AVPKitJNI.IContainerFormat_getInputFlags(swigCPtr, this);
549  }
550
551  /**
552   * Set the input flags to use with this object.  All values<br>
553   * must be ORed (|) together.<br>
554   * <br>
555   * @see Flags<br>
556   * <br>
557   * @param newFlags The new set flags for this codec.
558   */
559  public void setInputFlags(int newFlags) {
560    AVPKitJNI.IContainerFormat_setInputFlags(swigCPtr, this, newFlags);
561  }
562
563  /**
564   * Get the input setting for the specified flag<br>
565   * <br>
566   * @param flag The flag you want to find the setting for<br>
567   * <br>
568   * @return 0 for false; non-zero for true
569   */
570  public boolean getInputFlag(IContainerFormat.Flags flag) {
571    return AVPKitJNI.IContainerFormat_getInputFlag(swigCPtr, this, flag.swigValue());
572  }
573
574  /**
575   * Set the input flag.<br>
576   * <br>
577   * @param flag The flag to set<br>
578   * @param value The value to set it to (true or false)
579   */
580  public void setInputFlag(IContainerFormat.Flags flag, boolean value) {
581    AVPKitJNI.IContainerFormat_setInputFlag(swigCPtr, this, flag.swigValue(), value);
582  }
583
584  /**
585   * Get the output flags associated with this object.<br>
586   * <br>
587   * @return The (compacted) value of all flags set.
588   */
589  public int getOutputFlags() {
590    return AVPKitJNI.IContainerFormat_getOutputFlags(swigCPtr, this);
591  }
592
593  /**
594   * Set the output flags to use with this object.  All values<br>
595   * must be ORed (|) together.<br>
596   * <br>
597   * @see Flags<br>
598   * <br>
599   * @param newFlags The new set flags for this codec.
600   */
601  public void setOutputFlags(int newFlags) {
602    AVPKitJNI.IContainerFormat_setOutputFlags(swigCPtr, this, newFlags);
603  }
604
605  /**
606   * Get the output setting for the specified flag<br>
607   * <br>
608   * @param flag The flag you want to find the setting for<br>
609   * <br>
610   * @return 0 for false; non-zero for true
611   */
612  public boolean getOutputFlag(IContainerFormat.Flags flag) {
613    return AVPKitJNI.IContainerFormat_getOutputFlag(swigCPtr, this, flag.swigValue());
614  }
615
616  /**
617   * Set the output flag.<br>
618   * <br>
619   * @param flag The flag to set<br>
620   * @param value The value to set it to (true or false)
621   */
622  public void setOutputFlag(IContainerFormat.Flags flag, boolean value) {
623    AVPKitJNI.IContainerFormat_setOutputFlag(swigCPtr, this, flag.swigValue(), value);
624  }
625
626  /**
627   * Is this an output container format?<br>
628   * <br>
629   * @return true if output; false it not
630   */
631  public boolean isOutput() {
632    return AVPKitJNI.IContainerFormat_isOutput(swigCPtr, this);
633  }
634
635  /**
636   * Is this an input container format?<br>
637   * <br>
638   * @return true if input; false it not
639   */
640  public boolean isInput() {
641    return AVPKitJNI.IContainerFormat_isInput(swigCPtr, this);
642  }
643
644  /**
645   * Get the filename extensions that this output format prefers<br>
646   * (most common first).<br>
647   * <br>
648   * @return a command separated string of output extensions, or<br>
649   *   null if none.
650   */
651  public String getOutputExtensions() {
652    return AVPKitJNI.IContainerFormat_getOutputExtensions(swigCPtr, this);
653  }
654
655  /**
656   * Get the default audio codec this container prefers, if known.<br>
657   * <br>
658   * @return the default audio codec id, or {ICodec.ID#CODEC_ID_NONE}<br>
659   *   if unknown.
660   */
661  public ICodec.ID getOutputDefaultAudioCodec() {
662    return ICodec.ID.swigToEnum(AVPKitJNI.IContainerFormat_getOutputDefaultAudioCodec(swigCPtr, this));
663  }
664
665  /**
666   * Get the default video codec this container prefers, if known.<br>
667   * <br>
668   * @return the default video codec id, or {ICodec.ID#CODEC_ID_NONE}<br>
669   *   if unknown.
670   */
671  public ICodec.ID getOutputDefaultVideoCodec() {
672    return ICodec.ID.swigToEnum(AVPKitJNI.IContainerFormat_getOutputDefaultVideoCodec(swigCPtr, this));
673  }
674
675  /**
676   * Get the default subtitle codec this container prefers, if known.<br>
677   * <br>
678   * @return the default subtitle codec id, or {ICodec.ID#CODEC_ID_NONE}<br>
679   *   if unknown.
680   */
681  public ICodec.ID getOutputDefaultSubtitleCodec() {
682    return ICodec.ID.swigToEnum(AVPKitJNI.IContainerFormat_getOutputDefaultSubtitleCodec(swigCPtr, this));
683  }
684
685  /**
686   * Gets the number of different codecs this container<br>
687   * can include for encoding.<br>
688   * <br>
689   * This can be used as an upper bound when using the<br>
690   * {#getOutputCodecID(int)} and<br>
691   * {#getOutputCodecTag(int)}<br>
692   * methods to dynamically query the actual codecs.<br>
693   * <br>
694   * @return The total number of different codec types that can<br>
695   *   be encoded into this container format.
696   */
697  public int getOutputNumCodecsSupported() {
698    return AVPKitJNI.IContainerFormat_getOutputNumCodecsSupported(swigCPtr, this);
699  }
700
701  /**
702   * Queries for a supported codec id from the list of codecs<br>
703   * that can be encoded into this ContainerFormat.<br>
704   * <br>
705   * @param index The index in our lookup table.  Index &gt;= 0 and<br>
706   *   &lt; {#getOutputNumCodecsSupported()}.  Index values may<br>
707   *   change between releases, so always query.<br>
708   * <br>
709   * @return The codec id at this position, or<br>
710   *   {ICodec.ID#CODEC_ID_NONE}<br>
711   *   if there is none.
712   */
713  public ICodec.ID getOutputCodecID(int index) {
714    return ICodec.ID.swigToEnum(AVPKitJNI.IContainerFormat_getOutputCodecID(swigCPtr, this, index));
715  }
716
717  /**
718   * Queries for a supported codec tag from the list of codecs<br>
719   * that can be encoded into this ContainerFormat.<br>
720   * <p><br>
721   * Tags are 4-byte values that are often used as markers<br>
722   * in a container format for a codec type.<br>
723   * </p><br>
724   * @param index The index in our lookup table.  Index &gt;= 0 and<br>
725   *   &lt; {#getOutputNumCodecsSupported()}.  Index values may<br>
726   *   change between releases, so always query.<br>
727   * <br>
728   * @return The codec id tag this position, or 0 if there is none.
729   */
730  public int getOutputCodecTag(int index) {
731    return AVPKitJNI.IContainerFormat_getOutputCodecTag__SWIG_0(swigCPtr, this, index);
732  }
733
734  /**
735   * Get the 4-byte tag the container would output for<br>
736   * the given codec id.<br>
737   * <br>
738   * @param id the codec you are about<br>
739   * <br>
740   * @return the 4-byte codec tag, or 0 if that id is not<br>
741   *   supported. 
742   */
743  public int getOutputCodecTag(ICodec.ID id) {
744    return AVPKitJNI.IContainerFormat_getOutputCodecTag__SWIG_1(swigCPtr, this, id.swigValue());
745  }
746
747  /**
748   * Returns true if this container format can output media<br>
749   * encoded with the given codec.<br>
750   * <br>
751   * @param id the codec you care about.<br>
752   * <br>
753   * @return true if the codec can be put in this output container;<br>
754   *   false otherwise.
755   */
756  public boolean isCodecSupportedForOutput(ICodec.ID id) {
757    return AVPKitJNI.IContainerFormat_isCodecSupportedForOutput(swigCPtr, this, id.swigValue());
758  }
759
760  /**
761   * Get the number of input formats this install can demultiplex (read)<br>
762   * from.<br>
763   * <br>
764   * @return the number of formats
765   */
766  public static int getNumInstalledInputFormats() {
767    return AVPKitJNI.IContainerFormat_getNumInstalledInputFormats();
768  }
769
770  /**
771   * Return an object for the input format at the given index.<br>
772   * <br>
773   * @param index an index for the input format list we maintain<br>
774   * <br>
775   * @return a format object for that input or null if<br>
776   *   unknown, index &lt; 0 or index &gt;= {#getNumInstalledInputFormats()}
777   */
778  public static IContainerFormat getInstalledInputFormat(int index) {
779    long cPtr = AVPKitJNI.IContainerFormat_getInstalledInputFormat(index);
780    return (cPtr == 0) ? null : new IContainerFormat(cPtr, false);
781  }
782
783  /**
784   * Get the number of output formats this install can multiplex <br>
785   * (write) to.<br>
786   * <br>
787   * @return the number of formats
788   */
789  public static int getNumInstalledOutputFormats() {
790    return AVPKitJNI.IContainerFormat_getNumInstalledOutputFormats();
791  }
792
793  /**
794   * Return an object for the output format at the given index.<br>
795   * <br>
796   * @param index an index for the output format list we maintain<br>
797   * <br>
798   * @return a format object for that output or null if<br>
799   *   unknown, index &lt; 0 or index &gt;= {#getNumInstalledOutputFormats()}
800   */
801  public static IContainerFormat getInstalledOutputFormat(int index) {
802    long cPtr = AVPKitJNI.IContainerFormat_getInstalledOutputFormat(index);
803    return (cPtr == 0) ? null : new IContainerFormat(cPtr, false);
804  }
805
806  public enum Flags {
807    FLAG_NOFILE(AVPKitJNI.IContainerFormat_FLAG_NOFILE_get()),
808    FLAG_NEEDNUMBER(AVPKitJNI.IContainerFormat_FLAG_NEEDNUMBER_get()),
809    FLAG_SHOW_IDS(AVPKitJNI.IContainerFormat_FLAG_SHOW_IDS_get()),
810    FLAG_RAWPICTURE(AVPKitJNI.IContainerFormat_FLAG_RAWPICTURE_get()),
811    FLAG_GLOBALHEADER(AVPKitJNI.IContainerFormat_FLAG_GLOBALHEADER_get()),
812    FLAG_NOTIMESTAMPS(AVPKitJNI.IContainerFormat_FLAG_NOTIMESTAMPS_get()),
813    FLAG_GENERIC_INDEX(AVPKitJNI.IContainerFormat_FLAG_GENERIC_INDEX_get()),
814    FLAG_TS_DISCONT(AVPKitJNI.IContainerFormat_FLAG_TS_DISCONT_get());
815
816    public final int swigValue() {
817      return swigValue;
818    }
819
820    public static Flags swigToEnum(int swigValue) {
821      Flags[] swigValues = Flags.class.getEnumConstants();
822      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
823        return swigValues[swigValue];
824      for (Flags swigEnum : swigValues)
825        if (swigEnum.swigValue == swigValue)
826          return swigEnum;
827      throw new IllegalArgumentException("No enum " + Flags.class + " with value " + swigValue);
828    }
829
830    @SuppressWarnings("unused")
831    private Flags() {
832      this.swigValue = SwigNext.next++;
833    }
834
835    @SuppressWarnings("unused")
836    private Flags(int swigValue) {
837      this.swigValue = swigValue;
838      SwigNext.next = swigValue+1;
839    }
840
841    @SuppressWarnings("unused")
842    private Flags(Flags swigEnum) {
843      this.swigValue = swigEnum.swigValue;
844      SwigNext.next = this.swigValue+1;
845    }
846
847    private final int swigValue;
848
849    private static class SwigNext {
850      private static int next = 0;
851    }
852  }
853
854}