|
AVPKit
|
The work horse of the AVPKit: Takes IPacket data from an IContainer (representing an IStream) and an ICodec and allows you to decode or encode that data. More...
#include <IStreamCoder.h>


Public Types | |
| enum | Direction { ENCODING , DECODING } |
| The Direction in which this StreamCoder will work. | |
| enum | Flags { FLAG_QSCALE =0x0002 , FLAG_4MV =0x0004 , FLAG_QPEL =0x0010 , FLAG_GMC =0x0020 , FLAG_MV0 =0x0040 , FLAG_INPUT_PRESERVED =0x0100 , FLAG_PASS1 =0x0200 , FLAG_PASS2 =0x0400 , FLAG_GRAY =0x2000 , FLAG_EMU_EDGE =0x4000 , FLAG_PSNR =0x8000 , FLAG_TRUNCATED =0x00010000 , FLAG_NORMALIZE_AQP =0x00020000 , FLAG_INTERLACED_DCT =0x00040000 , FLAG_LOW_DELAY =0x00080000 , FLAG_GLOBAL_HEADER =0x00400000 , FLAG_BITEXACT =0x00800000 , FLAG_AC_PRED =0x01000000 , FLAG_CBP_RD =0x04000000 , FLAG_QP_RD =0x08000000 , FLAG_LOOP_FILTER =0x00000800 , FLAG_INTERLACED_ME =0x20000000 , FLAG_CLOSED_GOP =0x80000000 , FLAG2_FAST =0x00000001 , FLAG2_STRICT_GOP =0x00000002 , FLAG2_NO_OUTPUT =0x00000004 , FLAG2_LOCAL_HEADER =0x00000008 , FLAG2_SKIP_RD =0x00004000 , FLAG2_CHUNKS =0x00008000 , FLAG2_SHOW_ALL =0x00400000 } |
| AVPKIT Flags that can be passed to the setFlag(Flags, bool) method. More... | |
| enum | CodecStandardsCompliance { COMPLIANCE_VERY_STRICT =2 , COMPLIANCE_STRICT =1 , COMPLIANCE_NORMAL =0 , COMPLIANCE_UNOFFICIAL =-1 , COMPLIANCE_EXPERIMENTAL =-2 } |
| An enumeration of how strictly Codecs may follow the spec. More... | |
| typedef enum com::avpkit::core::IStreamCoder::Direction | Direction |
| The Direction in which this StreamCoder will work. | |
| typedef enum com::avpkit::core::IStreamCoder::Flags | Flags |
| AVPKIT Flags that can be passed to the setFlag(Flags, bool) method. | |
Public Member Functions | |
| virtual Direction | getDirection ()=0 |
| Get the direction. More... | |
| virtual IStream * | getStream ()=0 |
| The associated Stream we're working on. More... | |
| virtual ICodec * | getCodec ()=0 |
| The Codec this StreamCoder will use. More... | |
| virtual ICodec::Type | getCodecType ()=0 |
| A short hand for getCodec().getType(). More... | |
| virtual ICodec::ID | getCodecID ()=0 |
| A short hand for getCodec().getID(). More... | |
| virtual void | setCodec (ICodec *codec)=0 |
| Set the Codec to the passed in Codec, discarding the old Codec if set. More... | |
| virtual void | setCodec (ICodec::ID id)=0 |
| Look up a Codec based on the passed in ID, and then set it. More... | |
| virtual int32_t | getBitRate ()=0 |
| The bit rate. More... | |
| virtual void | setBitRate (int32_t rate)=0 |
| When ENCODING, sets the bit rate to use. More... | |
| virtual int32_t | getBitRateTolerance ()=0 |
| The bit rate tolerance. More... | |
| virtual void | setBitRateTolerance (int32_t tolerance)=0 |
| When ENCODING set the bit rate tolerance. More... | |
| virtual int32_t | getHeight ()=0 |
| The height, in pixels. More... | |
| virtual void | setHeight (int32_t height)=0 |
| Set the height, in pixels. More... | |
| virtual int32_t | getWidth ()=0 |
| The width, in pixels. More... | |
| virtual void | setWidth (int32_t width)=0 |
| Set the width, in pixels. More... | |
| virtual IRational * | getTimeBase ()=0 |
| Get the time base this stream will ENCODE in, or the time base we detect while DECODING. More... | |
| virtual void | setTimeBase (IRational *newTimeBase)=0 |
| Set the time base we'll use to ENCODE with. More... | |
| virtual IRational * | getFrameRate ()=0 |
| Get the frame-rate the attached stream claims to be using when DECODING, or the frame-rate we'll claim we're using when ENCODING. More... | |
| virtual void | setFrameRate (IRational *newFrameRate)=0 |
| Set the frame rate we'll set in the headers of this stream while ENCODING. More... | |
| virtual int32_t | getNumPicturesInGroupOfPictures ()=0 |
| The the number of pictures in this Group of Pictures (GOP). More... | |
| virtual void | setNumPicturesInGroupOfPictures (int32_t gops)=0 |
| Set the GOPS on this stream. More... | |
| virtual IPixelFormat::Type | getPixelType ()=0 |
| For Video streams, get the Pixel Format in use by the stream. More... | |
| virtual void | setPixelType (IPixelFormat::Type pixelFmt)=0 |
| Set the pixel format to ENCODE with. More... | |
| virtual int32_t | getSampleRate ()=0 |
| Get the sample rate we use for this stream. More... | |
| virtual void | setSampleRate (int32_t sampleRate)=0 |
| Set the sample rate to use when ENCODING. More... | |
| virtual IAudioSamples::Format | getSampleFormat ()=0 |
| Get the audio sample format. More... | |
| virtual void | setSampleFormat (IAudioSamples::Format aFormat)=0 |
| Set the sample format when ENCODING. More... | |
| virtual int32_t | getChannels ()=0 |
| Get the number of channels in this audio stream. More... | |
| virtual void | setChannels (int32_t channels)=0 |
| Set the number of channels to use when ENCODING. More... | |
| virtual int32_t | getAudioFrameSize ()=0 |
| For this stream, get the number of audio samples that are represented in a packet of information. More... | |
| virtual int32_t | getGlobalQuality ()=0 |
| Get the Global Quality setting this codec uses for video if a VideoPicture doesn't have a quality set. More... | |
| virtual void | setGlobalQuality (int32_t newQuality)=0 |
| Set the Global Quality to a new value. More... | |
| virtual int32_t | getFlags ()=0 |
| Get the flags associated with this codec. More... | |
| virtual void | setFlags (int32_t newFlags)=0 |
| Set the FFMPEG flags to use with this codec. More... | |
| virtual bool | getFlag (Flags flag)=0 |
| Get the setting for the specified flag. More... | |
| virtual void | setFlag (Flags flag, bool value)=0 |
| Set the flag. More... | |
| virtual int64_t | getNextPredictedPts ()=0 |
| For this stream, get the next Pts that we expect to decode. More... | |
| virtual int32_t | open ()=0 |
| virtual int32_t | close ()=0 |
| Close a Codec that was opened on this StreamCoder. More... | |
| virtual int32_t | decodeAudio (IAudioSamples *pOutSamples, IPacket *packet, int32_t byteOffset)=0 |
| Decode this packet into pOutSamples. More... | |
| virtual int32_t | decodeVideo (IVideoPicture *pOutFrame, IPacket *packet, int32_t byteOffset)=0 |
| Decode this packet into pOutFrame. More... | |
| virtual int32_t | encodeVideo (IPacket *pOutPacket, IVideoPicture *pFrame, int32_t suggestedBufferSize)=0 |
| Encode the given frame using this StreamCoder. More... | |
| virtual int32_t | encodeAudio (IPacket *pOutPacket, IAudioSamples *pSamples, int32_t sampleToStartFrom)=0 |
| Encode the given samples using this StreamCoder. More... | |
| virtual int32_t | getCodecTag ()=0 |
| Returns the 4-byte FOURCC tag (Least Significant Byte first). More... | |
| virtual void | setCodecTag (int32_t fourcc)=0 |
| Set the 4-byte FOURCC tag for this coder. More... | |
| virtual int32_t | getNumProperties ()=0 |
| Returns the total number of settable properties on this object. More... | |
| virtual IProperty * | getPropertyMetaData (int32_t propertyNo)=0 |
| Returns the name of the numbered property. More... | |
| virtual IProperty * | getPropertyMetaData (const char *name)=0 |
| Returns the name of the numbered property. More... | |
| virtual int32_t | setProperty (const char *name, const char *value)=0 |
| Sets a property on this Object. More... | |
| virtual int32_t | setProperty (const char *name, double value)=0 |
| Looks up the property 'name' and sets the value of the property to 'value'. More... | |
| virtual int32_t | setProperty (const char *name, int64_t value)=0 |
| Looks up the property 'name' and sets the value of the property to 'value'. More... | |
| virtual int32_t | setProperty (const char *name, bool value)=0 |
| Looks up the property 'name' and sets the value of the property to 'value'. More... | |
| virtual int32_t | setProperty (const char *name, IRational *value)=0 |
| Looks up the property 'name' and sets the value of the property to 'value'. More... | |
| virtual char * | getPropertyAsString (const char *name)=0 |
| Gets a property on this Object. More... | |
| virtual double | getPropertyAsDouble (const char *name)=0 |
| Gets the value of this property, and returns as a double;. More... | |
| virtual int64_t | getPropertyAsLong (const char *name)=0 |
| Gets the value of this property, and returns as an long;. More... | |
| virtual IRational * | getPropertyAsRational (const char *name)=0 |
| Gets the value of this property, and returns as an IRational;. More... | |
| virtual bool | getPropertyAsBoolean (const char *name)=0 |
| Gets the value of this property, and returns as a boolean. More... | |
| virtual bool | isOpen ()=0 |
| Returns true if this IStreamCoder is currently open. More... | |
| virtual int32_t | getDefaultAudioFrameSize ()=0 |
| Get the default audio frame size (in samples). More... | |
| virtual void | setDefaultAudioFrameSize (int32_t aNewSize)=0 |
| Set the default audio frame size. More... | |
| virtual int64_t | getNumDroppedFrames ()=0 |
| Get the number of frames this StreamCoder had to drop to encode at the specified getTimeBase(). More... | |
| virtual void | setAutomaticallyStampPacketsForStream (bool value)=0 |
| Should the IStreamCoder automatically adjust time stamps on output packets for the IStream it is ultimately destined for. More... | |
| virtual bool | getAutomaticallyStampPacketsForStream ()=0 |
| Does this IStreamCoder automatically adjust time stamps on output packets for the IStream it is ultimately destined for. More... | |
| virtual void | setCodecID (ICodec::ID id)=0 |
| Look up a Codec based on the passed in ID, and then set it. More... | |
| virtual int32_t | setExtraData (com::avpkit::ferry::IBuffer *src, int32_t offset, int32_t length, bool allocNew)=0 |
| Copies data from the given buffer into the extra-data area maintained by encoders. More... | |
| virtual int32_t | getExtraData (com::avpkit::ferry::IBuffer *dest, int32_t offset, int32_t maxBytesToCopy)=0 |
| Copies the current content of the extra-data buffer maintained by this codec (e.g. More... | |
| virtual int32_t | getExtraDataSize ()=0 |
| Gets the current number of bytes of data maintained in the coder extra-data area. More... | |
| virtual CodecStandardsCompliance | getStandardsCompliance ()=0 |
| Gets the current level of standards compliance. More... | |
| virtual int32_t | setStandardsCompliance (CodecStandardsCompliance compliance)=0 |
| Set the level of standards compliance. More... | |
| virtual int32_t | setHardwareDecoding (IPixelFormat::Type type, void *surface=NULL)=0 |
| Try to change current decoder to an HW decoder compatible with pixel format. More... | |
| virtual void * | getHardwareSurface ()=0 |
| virtual int32_t | open (IMetaData *options, IMetaData *unsetOptions)=0 |
| Open the codec with the given options. More... | |
| virtual int32_t | setProperty (IMetaData *valuesToSet, IMetaData *valuesNotFound)=0 |
Public Member Functions inherited from com::avpkit::ferry::RefCounted | |
| virtual int32_t | acquire () |
| Internal Only. More... | |
| virtual int32_t | release () |
| Internal Only. More... | |
| virtual RefCounted * | copyReference () |
| Create a new Java object that refers to the same native object. More... | |
| virtual int32_t | getCurrentRefCount () |
| Return the current reference count on this object. More... | |
| void | setJavaAllocator (void *allocator) |
| This method is public but not part of the standard API. More... | |
| void * | getJavaAllocator () |
| This method is public but not part of the standard API. More... | |
Static Public Member Functions | |
| static IStreamCoder * | make (Direction direction) |
| static IStreamCoder * | make (Direction direction, IStreamCoder *copyCoder) |
| Creates a new IStreamCoder object by copying all the settings in copyCoder. More... | |
| static IStreamCoder * | make (Direction direction, ICodec *codec) |
| Create a standalone StreamCoder that can encode or decode data independent of the stream it is attached to. More... | |
| static IStreamCoder * | make (Direction direction, ICodec::ID id) |
| Create a standalone StreamCoder that can encode or decode data independent of the stream it is attached to. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from com::avpkit::ferry::RefCounted | |
| virtual void | destroy () |
| This method is called by RefCounted objects when their Ref Count reaches zero and they are about to be destroyed. | |
Protected Attributes inherited from com::avpkit::ferry::RefCounted | |
| AtomicInteger * | mRefCount |
| This is the internal reference count, represented as an AtomicInteger to make sure it is thread safe. | |
| void * | mAllocator |
| Not part of public API. | |
The work horse of the AVPKit: Takes IPacket data from an IContainer (representing an IStream) and an ICodec and allows you to decode or encode that data.
Definition at line 44 of file IStreamCoder.h.
An enumeration of how strictly Codecs may follow the spec.
Not all settings follow these requirements, but some experimental codecs require this flag to be set to use.
Definition at line 959 of file IStreamCoder.h.
AVPKIT Flags that can be passed to the setFlag(Flags, bool) method.
Definition at line 60 of file IStreamCoder.h.
|
pure virtual |
Close a Codec that was opened on this StreamCoder.
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Decode this packet into pOutSamples.
It will try to fill up the audio samples object, starting from the byteOffset inside this packet.
The caller is responsible for allocating the IAudioSamples object. This function will overwrite any data in the samples object.
Note that the IAudioSamples object passed in must have a IAudioSamples#getMaxBufferSize() of at least 192kbytes. Sorry, but this requirement is imposed on us via FFmpeg. If the buffer is not large enough, this method will reallocate the underlying buffers to make them at least 192kbytes.
| pOutSamples | The AudioSamples we decode to |
| packet | The packet we're attempting to decode from. |
| byteOffset | Where in the packet payload to start decoding |
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Decode this packet into pOutFrame.
The caller is responsible for allocating the IVideoPicture object. This function will potentially overwrite any data in the frame object, but you should pass the same IVideoPicture into this function repeatedly until IVideoPicture::isComplete() is true.
| pOutFrame | The AudioSamples we decode. |
| packet | The packet we're attempting to decode from. |
| byteOffset | Where in the packet payload to start decoding |
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Encode the given samples using this StreamCoder.
The VideoPicture will allocate a buffer to use internally for this, and will free it when the frame destroys itself.
Callers should call this repeatedly on a set of samples until we consume all the samples.
Also, when done in order to flush the encoder, caller should call this method passing in 0 (null) for pSamples to tell the encoder to flush any data it was keeping a hold of.
| pOutPacket | [out] The packet to encode into. It will point to a buffer allocated in the frame. Caller should check IPacket::isComplete() after call to find out if we had enough information to encode a full packet. |
| pSamples | [in] The samples to consume |
| sampleToStartFrom | [in] Which sample you want to start with This is usually zero, but if you're using a codec that packetizes output with small number of samples, you may need to call encodeAudio repeatedly with different starting samples to consume all of your samples. |
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Encode the given frame using this StreamCoder.
The VideoPicture will allocate a buffer to use internally for this, and will free it when the frame destroys itself.
Also, when done in order to flush the encoder, caller should call this method passing in 0 (null) for pFrame to tell the encoder to flush any data it was keeping a hold of.
| pOutPacket | [out] The packet to encode into. It will point to a buffer allocated in the frame. Caller should check IPacket::isComplete() after call to find out if we had enough information to encode a full packet. |
| pFrame | [in/out] The frame to encode |
| suggestedBufferSize | The suggested buffer size to allocate or -1 for choose ourselves. If -1 we'll allocate a buffer exactly the same size (+1) as the decoded frame with the guess that you're encoding a frame because you want to use LESS space than that. |
@ return >= 0 on success; <0 on error.
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
For this stream, get the number of audio samples that are represented in a packet of information.
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Does this IStreamCoder automatically adjust time stamps on output packets for the IStream it is ultimately destined for.
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
The bit rate.
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
The bit rate tolerance.
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Get the number of channels in this audio stream.
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
The Codec this StreamCoder will use.
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
A short hand for getCodec().getID().
Note for Native (C++) users:
If you actually write code like the above from Native code, you'd leak a Codec() since you didn't call release() on it. This method is a short hand way to avoid you having to worry about releasing in between.
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Returns the 4-byte FOURCC tag (Least Significant Byte first).
This is really a packed 4-byte array so it's only useful if you use bit-wise operations on it. Some language wrappings may provide more obvious ways of manipulating, but this is the safest way to do this that will work with all wrappers.
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
A short hand for getCodec().getType().
Note for Native (C++) users:
If you actually write code like the above from Native code, you'd leak a Codec() since you didn't call release() on it. This method is a short hand way to avoid you having to worry about releasing in between.
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Get the default audio frame size (in samples).
Some codecs, especially raw codecs, like PCM, don't have a standard frame size. In those cases, we use the value of this setting to determine how many samples to encode into a single packet.
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Get the direction.
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Copies the current content of the extra-data buffer maintained by this codec (e.g.
header bytes) into the dest buffer.
| dest | The buffer to copy to. |
| offset | The position, in bytes, to start writing data to in dest. |
| maxBytesToCopy | The maximum number of bytes to copy. |
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Gets the current number of bytes of data maintained in the coder extra-data area.
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Get the setting for the specified flag.
| flag | The flag you want to find the setting for |
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Get the flags associated with this codec.
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Get the frame-rate the attached stream claims to be using when DECODING, or the frame-rate we'll claim we're using when ENCODING.
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Get the Global Quality setting this codec uses for video if a VideoPicture doesn't have a quality set.
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
The height, in pixels.
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
For this stream, get the next Pts that we expect to decode.
Note that this may not actually be the next Pts (for example due to transmission packet drops in the input source). Still it can be a useful tool.
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Get the number of frames this StreamCoder had to drop to encode at the specified getTimeBase().
IStreamCoder objects can encode audio and video, but guarantee that every packet outputted has monotonically increasing timestamps (i.e. 0, 1, 2, 3, 4, 5, etc. without repeats). Sometimes data is passed too quickly into an IStreamCoder via encodeVideo or encodeAudio, and the underlying codec can't handle it that quickly. In those cases the IStreamCoder must drop the most recent frame of data.
If you're seeing a lot of dropped frames you can try either sending less frequent data to the IStreamCoder, or adjusting the getTimeBase() to the highest possible resolution. Be warned though; some codecs (such as MPEG2) require fixed time-bases (like 1/25) and so setting a higher resolution time base might end up with the codec not able to encode any data.
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
The the number of pictures in this Group of Pictures (GOP).
See the MPEG specs for what a GOP is officially, but this is the minimum number of frames between key-frames (or Intra-Frames in MPEG speak).
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Returns the total number of settable properties on this object.
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
For Video streams, get the Pixel Format in use by the stream.
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Gets the value of this property, and returns as a boolean.
| name | name of option |
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Gets the value of this property, and returns as a double;.
| name | name of option |
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Gets the value of this property, and returns as an long;.
| name | name of option |
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Gets the value of this property, and returns as an IRational;.
| name | name of option |
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Gets a property on this Object.
Note for C++ callers; you must free the returned array with delete[] in order to avoid a memory leak. Other language folks need not worry.
| name | property name |
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Returns the name of the numbered property.
| name | The property name. |
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Returns the name of the numbered property.
| propertyNo | The property number in the options list. |
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Get the audio sample format.
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Get the sample rate we use for this stream.
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Gets the current level of standards compliance.
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
The associated Stream we're working on.
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Get the time base this stream will ENCODE in, or the time base we detect while DECODING.
Caller must call release() on the returned value.
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
The width, in pixels.
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Returns true if this IStreamCoder is currently open.
Implemented in com::avpkit::core::StreamCoder.
|
static |
Create a standalone StreamCoder that can decode data without regard to which IStream or IContainer it came from.
If you're reading or writing to a AVPKIT file or URL you almost definitely don't want to use this method. Use the IContainer#getStream(long) and IStream#getStreamCoder() methods instead as it will set up the resulting IStreamCoder with sensible defaults. Use of a un-attached StreamCoder returned from this method is for advanced users only.
| direction | The direction this StreamCoder will work in. |
Definition at line 36 of file IStreamCoder.cpp.
References com::avpkit::core::Global::init().
|
static |
Create a standalone StreamCoder that can encode or decode data independent of the stream it is attached to.
If you're reading or writing to a AVPKIT file or URL you almost definitely don't want to use this method. Use the IContainer#getStream(long) and IStream#getStreamCoder() methods instead as it will set up the resulting IStreamCoder with sensible defaults. Use of a un-attached StreamCoder returned from this method is for advanced users only.
| direction | The direction this StreamCoder will work in. |
| codec | The codec you want to use (in lieu of calling setCodec |
Definition at line 50 of file IStreamCoder.cpp.
References com::avpkit::core::Global::init(), and com::avpkit::core::StreamCoder::make().
|
static |
Create a standalone StreamCoder that can encode or decode data independent of the stream it is attached to.
If you're reading or writing to a AVPKIT file or URL you almost definitely don't want to use this method. Use the IContainer#getStream(long) and IStream#getStreamCoder() methods instead as it will set up the resulting IStreamCoder with sensible defaults. Use of a un-attached StreamCoder returned from this method is for advanced users only.
| direction | The direction this StreamCoder will work in. |
| id | The codec id you want to use (in lieu of calling setCodec |
Definition at line 57 of file IStreamCoder.cpp.
References com::avpkit::core::Global::init(), and com::avpkit::core::StreamCoder::make().
|
static |
Creates a new IStreamCoder object by copying all the settings in copyCoder.
The new IStreamCoder is created by copying all the current properties on the passed in StreamCoder. If the passed in stream coder is in a different direction than the one you want, this method still set the same codec ID, and the IStreamCoder.open() method will check then to see if it can work in the specified direction.
For example, imagine that direction is ENCODING and the copyCoder is a DECODING StreamCoder that is of the CODEC_ID_VP6 type. The resulting new IStreamCoder has it's code set to CODEC_ID_VP6. However (as of the writing of this comment) we don't support encoding to CODEC_ID_VP6, so when you try to open the codec we will fail.
| direction | The direction you want the new IStreamCoder to work in. |
| copyCoder | The coder to copy settings from. |
Definition at line 43 of file IStreamCoder.cpp.
References com::avpkit::core::Global::init(), and com::avpkit::core::StreamCoder::make().
|
pure virtual |
Open the Codec associated with this StreamCoder.
You can get the codec through getCodec(...) and set it with setCodec(...). You cannot call any set* methods after you've called open() on this StreamCoder until you close() it.
You must call close() when you're done, but if you don't, the container will clean up after you (but yell at you) when it is closed.
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Open the codec with the given options.
Callers must call setCodec before calling this method.
| options | If non-NULL, a dictionary of parameter options to set for this codec. |
| unsetOptions | If non-NULL, on successful return the prior contents of this set of meta data will be replaced with any settings in 'options' that could not be set on this codec. |
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Should the IStreamCoder automatically adjust time stamps on output packets for the IStream it is ultimately destined for.
If this IStreamCoder does not know which IStream it is destined for, or this IStreamCoder isn't used with an IStream at all, then this setting is ignored.
| value | true to automatically adjust. |
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
When ENCODING, sets the bit rate to use.
No-op when DECODING.
| rate | The bit rate to use. |
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
When ENCODING set the bit rate tolerance.
No-op when DECODING.
| tolerance | The bit rate tolerance |
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Set the number of channels to use when ENCODING.
Ignored if a non audio stream, or if DECODING.
| channels | The number of channels we'll encode with. |
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Set the Codec to the passed in Codec, discarding the old Codec if set.
Once you call setCodec, all settings on the IStreamCoder are reset to default values. So you probably want to call this first.
| codec | Codec to set. |
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Look up a Codec based on the passed in ID, and then set it.
To see if you actually set the correct ID, call getCodec() and check for 0 (null).
Once you call setCodec, all settings on the IStreamCoder are reset to default values. So you probably want to call this first.
| id | ID of codec to set. |
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Look up a Codec based on the passed in ID, and then set it.
Forwards to setCodecID(com.avpkit.core.ICodec.ID)
To see if you actually set the correct ID, call getCodec() and check for 0 (null).
Once you call setCodec, all settings on the IStreamCoder are reset to default values. So you probably want to call this first.
| id | ID of codec to set. |
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Set the 4-byte FOURCC tag for this coder.
| fourcc | The FOURCC to set, with Least Significant Byte first. |
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Set the default audio frame size.
| aNewSize | The new number of samples to use to encode samples into a packet. This setting is ignored if <= 0 or if the codec requires it's own frame size (e.g. Nellymoser). |
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Copies data from the given buffer into the extra-data area maintained by encoders.
This is an extremely advanced method, and incorrect usage can result in Java crashes so take care. In general people should not need to use this.
For some codecs (e.g. for H264, this is global header information and for rv10 it is additional flags), AVPKit maintains extra information about the codec in a extra data buffer. In general AVPKit will allocate this data as needed and you never need to set it (or get it). But if you know what you're doing, you can ask AVPKit to replace the existing extra data for the given codec with a copy of the data in the given buffer.
You should call this method after you call open() but before you encode or decode any media.
| src | The data to copy |
| offset | The position, in bytes, to start copying data from src |
| length | The number of bytes to copy from data |
| allocNew | If true, and there is not enough space in the existing extra data buffer, then AVPKit will discard the old buffer and allocate a new buffer. If false, then AVPKit will attempt to copy the data into the existing buffer and if there is not enough space in the existing buffer, no bytes will be copied and an error will be returned. In general, you should set this to false if that works for you. |
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Set the flag.
| flag | The flag to set |
| value | The value to set it to (true or false) |
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Set the FFMPEG flags to use with this codec.
All values must be ORed (|) together.
| newFlags | The new set flags for this codec. |
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Set the frame rate we'll set in the headers of this stream while ENCODING.
Note that you can set whatever frame-rate you'd like, but the TimeBase and the PTS you set on the encoded audio and video frames can override this.
As a convenience, we forward this call to the Stream::setFrameRate() method.
| newFrameRate | The new frame rate to use. |
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Set the Global Quality to a new value.
| newQuality | The new global quality. |
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Try to change current decoder to an HW decoder compatible with pixel format.
| type | an HW accelerated pixel format |
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Set the height, in pixels.
| height | Sets the height of video frames we'll encode. No-op when DECODING. |
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Set the GOPS on this stream.
Ignored if DECODING.
| gops | The new GOPS for the stream we're encoding. |
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Set the pixel format to ENCODE with.
Ignored if audio or DECODING.
| pixelFmt | Pixel format to use. |
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Looks up the property 'name' and sets the value of the property to 'value'.
| name | name of option |
| value | Value of option |
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Sets a property on this Object.
All AVOptions supported by the underlying AVClass are supported.
| name | The property name. For example "b" for bit-rate. |
| value | The value of the property. |
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Looks up the property 'name' and sets the value of the property to 'value'.
| name | name of option |
| value | Value of option |
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Looks up the property 'name' and sets the value of the property to 'value'.
| name | name of option |
| value | Value of option |
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Looks up the property 'name' and sets the value of the property to 'value'.
| name | name of option |
| value | Value of option |
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Set the sample format when ENCODING.
Ignored if DECODING or if the coder is already open.
| aFormat | The sample format. |
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Set the sample rate to use when ENCODING.
Ignored if DECODING or a non-audio stream.
| sampleRate | New sample rate (in Hz) to use. |
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Set the level of standards compliance.
Only paid attention to before the code is opened.
| compliance | The desired compliance level to set |
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Set the time base we'll use to ENCODE with.
A no-op when DECODING.
As a convenience, we forward this call to the Stream::setTimeBase() method.
| newTimeBase | The new time base to use. |
Implemented in com::avpkit::core::StreamCoder.
|
pure virtual |
Set the width, in pixels.
| width | Sets the width of video frames we'll encode. No-op when DECODING. |
Implemented in com::avpkit::core::StreamCoder.