com.xuggle.xuggler
Class ICodec

Package class diagram package ICodec
java.lang.Object
  extended by com.xuggle.ferry.RefCounted
      extended by com.xuggle.xuggler.ICodec

public class ICodec
extends RefCounted

A "key" to an IStreamCoder that tells it how to encode or decode data. Use these objects to tell a IStreamCoder you want to use MP3 or NellyMoser for example.


Nested Class Summary
static class ICodec.Capabilities
           
static class ICodec.ID
           
static class ICodec.Type
           
 
Field Summary
 
Fields inherited from class com.xuggle.ferry.RefCounted
swigCMemOwn
 
Constructor Summary
protected ICodec(long cPtr, boolean cMemoryOwn)
          Internal Only.
protected ICodec(long cPtr, boolean cMemoryOwn, AtomicLong ref)
          Internal Only.
 
Method Summary
 boolean canDecode()
          Can this codec be used for decoding?
 boolean canEncode()
          Can this codec be used for encoding?
 ICodec copyReference()
          Create a new ICodec object that is actually referring to the exact same underlying native object.
 boolean equals(Object obj)
          Compares two values, returning true if the underlying objects in native code are the same object.
static ICodec findDecodingCodec(ICodec.ID id)
          Find a codec that can be used for decoding.
static ICodec findDecodingCodecByIntID(int id)
          Find a codec that can be used for decoding.
static ICodec findDecodingCodecByName(String id)
          Find a codec that can be used for decoding.
static ICodec findEncodingCodec(ICodec.ID id)
          Find a codec that can be used for encoding.
static ICodec findEncodingCodecByIntID(int id)
          Find a codec that can be used for encoding.
static ICodec findEncodingCodecByName(String id)
          Find a codec that can be used for encoding.
 int getCapabilities()
          Get the capabilites flag from the codec
static long getCPtr(ICodec obj)
          Internal Only.
 ICodec.ID getID()
          Get the ID of this codec as an enumeration.
 int getIDAsInt()
          Get the ID of this codec, as an integer.
static ICodec getInstalledCodec(int index)
          Get the ICodec at the given index.
static Collection<ICodec> getInstalledCodecs()
          Gets a collection of ALL codecs installed on this system.
 String getLongName()
          Get the long name for this codec.
 long getMyCPtr()
          Internal Only.
 String getName()
          Get the name of the codec.
static int getNumInstalledCodecs()
          Get the number of installed codecs on this system.
 int getNumSupportedAudioChannelLayouts()
          Get the number of different audio channel layouts this codec supports for encoding.
 int getNumSupportedAudioSampleFormats()
          Get the number of different audio sample formats this codec supports for encoding.
 int getNumSupportedAudioSampleRates()
          Get the number of different audio sample rates this codec supports for encoding.
 int getNumSupportedVideoFrameRates()
          Not all codecs will report this number.
 int getNumSupportedVideoPixelFormats()
          Get the number of supported video pixel formats this codec supports for encoding.
 long getSupportedAudioChannelLayout(int index)
          Get the supported audio channel layout at this index.
 List<Long> getSupportedAudioChannelLayouts()
          Returns a list of supported audio channel layouts this codec can encode audio in.
 IAudioSamples.Format getSupportedAudioSampleFormat(int index)
          Get the supported sample format at this index.
 List<IAudioSamples.Format> getSupportedAudioSampleFormats()
          Returns a list of supported audio sample formats this codec can encode audio in.
 int getSupportedAudioSampleRate(int index)
          Return the support audio sample rate at the given index.
 List<Integer> getSupportedAudioSampleRates()
          Returns a list of supported audio sample rates this codec can encode audio in.
 IRational getSupportedVideoFrameRate(int index)
          Return the supported frame rate at the given index.
 List<IRational> getSupportedVideoFrameRates()
          Returns a list of supported frame-rates this codec can encode video to.
 IPixelFormat.Type getSupportedVideoPixelFormat(int index)
          Return the supported video pixel format at the given index.
 List<IPixelFormat.Type> getSupportedVideoPixelFormats()
          Returns a list of supported pixel formats this codec can encode video in.
 ICodec.Type getType()
          Get the type of this codec.
static ICodec guessEncodingCodec(IContainerFormat fmt, String shortName, String url, String mimeType, ICodec.Type type)
          Ask us to guess an encoding codec based on the inputs passed in.
 boolean hasCapability(ICodec.Capabilities capability)
          Convenience method to check individual capability flags.
 int hashCode()
          Get a hashable value for this object.
 String toString()
          Prints the type and id of this codec
 
Methods inherited from class com.xuggle.ferry.RefCounted
acquire, delete, getCPtr, getCurrentRefCount, getJavaRefCount, release
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ICodec

protected ICodec(long cPtr,
                 boolean cMemoryOwn)
Internal Only.


ICodec

protected ICodec(long cPtr,
                 boolean cMemoryOwn,
                 AtomicLong ref)
Internal Only.

Method Detail

getCPtr

public static long getCPtr(ICodec obj)
Internal Only. Not part of public API. Get the raw value of the native object that obj is proxying for.

Parameters:
obj - The java proxy object for a native object.
Returns:
The raw pointer obj is proxying for.

getMyCPtr

public long getMyCPtr()
Internal Only. Not part of public API. Get the raw value of the native object that we're proxying for.

Overrides:
getMyCPtr in class RefCounted
Returns:
The raw pointer we're proxying for.

copyReference

public ICodec copyReference()
Create a new ICodec object that is actually referring to the exact same underlying native object.

Overrides:
copyReference in class RefCounted
Returns:
the new Java object.

equals

public boolean equals(Object obj)
Compares two values, returning true if the underlying objects in native code are the same object. That means you can have two different Java objects, but when you do a comparison, you'll find out they are the EXACT same object.

Overrides:
equals in class Object
Returns:
True if the underlying native object is the same. False otherwise.

hashCode

public int hashCode()
Get a hashable value for this object.

Overrides:
hashCode in class Object
Returns:
the hashable value.

toString

public String toString()
Prints the type and id of this codec

Overrides:
toString in class Object
Returns:
the type and id

getInstalledCodecs

public static Collection<ICodec> getInstalledCodecs()
Gets a collection of ALL codecs installed on this system.

Returns:
A collection of all installed codecs.

getSupportedVideoFrameRates

public List<IRational> getSupportedVideoFrameRates()
Returns a list of supported frame-rates this codec can encode video to.

Not all codecs support reporting this, in which case the returned list will be empty.

Returns:
a list

getSupportedVideoPixelFormats

public List<IPixelFormat.Type> getSupportedVideoPixelFormats()
Returns a list of supported pixel formats this codec can encode video in.

Not all codecs support reporting this, in which case the returned list will be empty.

Returns:
a list

getSupportedAudioSampleRates

public List<Integer> getSupportedAudioSampleRates()
Returns a list of supported audio sample rates this codec can encode audio in.

Not all codecs support reporting this, in which case the returned list will be empty.

Returns:
a list

getSupportedAudioSampleFormats

public List<IAudioSamples.Format> getSupportedAudioSampleFormats()
Returns a list of supported audio sample formats this codec can encode audio in.

Not all codecs support reporting this, in which case the returned list will be empty.

Returns:
a list

getSupportedAudioChannelLayouts

public List<Long> getSupportedAudioChannelLayouts()
Returns a list of supported audio channel layouts this codec can encode audio in.

Not all codecs support reporting this, in which case the returned list will be empty.

Returns:
a list

getName

public String getName()
Get the name of the codec.

Returns:
The name of this Codec.

getIDAsInt

public int getIDAsInt()
Get the ID of this codec, as an integer.

Returns:
the ID of this codec, as an integer.

getID

public ICodec.ID getID()
Get the ID of this codec as an enumeration.

Returns:
the ID of this codec, an enum ID

getType

public ICodec.Type getType()
Get the type of this codec.

Returns:
The type of this Codec, as a enum Type

canDecode

public boolean canDecode()
Can this codec be used for decoding?

Returns:
Can this Codec decode?

canEncode

public boolean canEncode()
Can this codec be used for encoding?

Returns:
Can this Codec encode?

findEncodingCodec

public static ICodec findEncodingCodec(ICodec.ID id)
Find a codec that can be used for encoding.

Parameters:
id - The id of the codec
Returns:
the codec, or null if we can't find it.

findEncodingCodecByIntID

public static ICodec findEncodingCodecByIntID(int id)
Find a codec that can be used for encoding.

Parameters:
id - The id of the codec, as an integer.
Returns:
the codec, or null if we can't find it.

findEncodingCodecByName

public static ICodec findEncodingCodecByName(String id)
Find a codec that can be used for encoding.

Parameters:
id - The id of the codec, as a FFMPEG short-name string (for example, "mpeg4").
Returns:
the codec, or null if we can't find it.

findDecodingCodec

public static ICodec findDecodingCodec(ICodec.ID id)
Find a codec that can be used for decoding.

Parameters:
id - The id of the codec
Returns:
the codec, or null if we can't find it.

findDecodingCodecByIntID

public static ICodec findDecodingCodecByIntID(int id)
Find a codec that can be used for decoding.

Parameters:
id - The id of the codec, as an integer
Returns:
the codec, or null if we can't find it.

findDecodingCodecByName

public static ICodec findDecodingCodecByName(String id)
Find a codec that can be used for decoding.

Parameters:
id - The id of the codec, as a FFMPEG short-name string (for example, "mpeg4")
Returns:
the codec, or null if we can't find it.

guessEncodingCodec

public static ICodec guessEncodingCodec(IContainerFormat fmt,
                                        String shortName,
                                        String url,
                                        String mimeType,
                                        ICodec.Type type)
Ask us to guess an encoding codec based on the inputs passed in.

You must pass in at least one non null fmt, shortName, url or mime_type.

Parameters:
fmt - An IContainerFormat for the container you'll want to encode into.
shortName - The FFMPEG short name of the codec (e.g. "mpeg4").
url - The URL you'll be writing packets to.
mimeType - The mime type of the container.
type - The codec type.
Returns:
the codec, or null if we can't find it.

getLongName

public String getLongName()
Get the long name for this codec.

Returns:
the long name.

getCapabilities

public int getCapabilities()
Get the capabilites flag from the codec

Returns:
the capabilities flag

hasCapability

public boolean hasCapability(ICodec.Capabilities capability)
Convenience method to check individual capability flags.

Parameters:
capability - the capability
Returns:
true if flag is set; false otherwise.

getNumInstalledCodecs

public static int getNumInstalledCodecs()
Get the number of installed codecs on this system.

Returns:
the number of installed codecs.

getInstalledCodec

public static ICodec getInstalledCodec(int index)
Get the ICodec at the given index.

Parameters:
index - the index in our list
Returns:
the codec, or null if index < 0 or index >= getNumInstalledCodecs()

getNumSupportedVideoFrameRates

public int getNumSupportedVideoFrameRates()
Not all codecs will report this number.

Returns:
the number or 0 if we don't know.

getSupportedVideoFrameRate

public IRational getSupportedVideoFrameRate(int index)
Return the supported frame rate at the given index.

Parameters:
index - the index in our list.
Returns:
the frame rate, or null if unknown, if index <0 or if index >= getNumSupportedVideoFrameRates()

getNumSupportedVideoPixelFormats

public int getNumSupportedVideoPixelFormats()
Get the number of supported video pixel formats this codec supports for encoding. Not all codecs will report this.

Returns:
the number or 0 if we don't know.

getSupportedVideoPixelFormat

public IPixelFormat.Type getSupportedVideoPixelFormat(int index)
Return the supported video pixel format at the given index.

Parameters:
index - the index in our list.
Returns:
the pixel format, or IPixelFormat.Type.NONE if unknown, if index <0 or if index >= getNumSupportedVideoPixelFormats()

getNumSupportedAudioSampleRates

public int getNumSupportedAudioSampleRates()
Get the number of different audio sample rates this codec supports for encoding. Not all codecs will report this.

Returns:
the number or 0 if we don't know.

getSupportedAudioSampleRate

public int getSupportedAudioSampleRate(int index)
Return the support audio sample rate at the given index.

Parameters:
index - the index in our list.
Returns:
the sample rate, or 0 if unknown, index < 0 or index >= getNumSupportedAudioSampleRates()

getNumSupportedAudioSampleFormats

public int getNumSupportedAudioSampleFormats()
Get the number of different audio sample formats this codec supports for encoding. Not all codecs will report this.

Returns:
the number or 0 if we don't know.

getSupportedAudioSampleFormat

public IAudioSamples.Format getSupportedAudioSampleFormat(int index)
Get the supported sample format at this index.

Parameters:
index - the index in our list. unknown, index < 0 or index >= getNumSupportedAudioSampleFormats().

getNumSupportedAudioChannelLayouts

public int getNumSupportedAudioChannelLayouts()
Get the number of different audio channel layouts this codec supports for encoding. Not all codecs will report this.

Returns:
the number or 0 if we don't know.

getSupportedAudioChannelLayout

public long getSupportedAudioChannelLayout(int index)
Get the supported audio channel layout at this index. The value returned is a bit flag representing the different types of audio layout this codec can support. Test the values by bit-comparing them to the IAudioSamples.ChannelLayout enum types.

Parameters:
index - the index
Returns:
the channel layout, or 0 if unknown, index < 0 or index >= getNumSupportedAudioChannelLayouts().


Copyright © 2008, 2010 Xuggle