AVPKit
com::avpkit::core::IStreamCoder Class Referenceabstract

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>

Inheritance diagram for com::avpkit::core::IStreamCoder:
Collaboration diagram for com::avpkit::core::IStreamCoder:

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 IStreamgetStream ()=0
 The associated Stream we're working on. More...
 
virtual ICodecgetCodec ()=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 IRationalgetTimeBase ()=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 IRationalgetFrameRate ()=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 IPropertygetPropertyMetaData (int32_t propertyNo)=0
 Returns the name of the numbered property. More...
 
virtual IPropertygetPropertyMetaData (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 IRationalgetPropertyAsRational (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 RefCountedcopyReference ()
 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 IStreamCodermake (Direction direction)
 
static IStreamCodermake (Direction direction, IStreamCoder *copyCoder)
 Creates a new IStreamCoder object by copying all the settings in copyCoder. More...
 
static IStreamCodermake (Direction direction, ICodec *codec)
 Create a standalone StreamCoder that can encode or decode data independent of the stream it is attached to. More...
 
static IStreamCodermake (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
AtomicIntegermRefCount
 This is the internal reference count, represented as an AtomicInteger to make sure it is thread safe.
 
void * mAllocator
 Not part of public API.
 

Detailed Description

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.

Member Enumeration Documentation

◆ CodecStandardsCompliance

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.

Since
5.0
Enumerator
COMPLIANCE_VERY_STRICT 

Strictly conform to an older more strict version of the spec or reference software.

COMPLIANCE_STRICT 

Strictly conform to all the things in the spec no matter what consequences.

COMPLIANCE_NORMAL 

Take normal liberties with the spec, including taking the spec out to dinner, and making suggestive comments to the spec.

COMPLIANCE_UNOFFICIAL 

Allow unofficial, but still mostly chaste, extensions to the spec.

COMPLIANCE_EXPERIMENTAL 

Allow nonstandardized experimental things.

Potentially deviant things. The type of things spec authors don't like to talk about, but secretly fantasize about. You know what I mean, MPEG Working Group.

Definition at line 959 of file IStreamCoder.h.

959  {
CodecStandardsCompliance
An enumeration of how strictly Codecs may follow the spec.
Definition: IStreamCoder.h:959
@ COMPLIANCE_VERY_STRICT
Strictly conform to an older more strict version of the spec or reference software.
Definition: IStreamCoder.h:963
@ COMPLIANCE_EXPERIMENTAL
Allow nonstandardized experimental things.
Definition: IStreamCoder.h:982
@ COMPLIANCE_UNOFFICIAL
Allow unofficial, but still mostly chaste, extensions to the spec.
Definition: IStreamCoder.h:976
@ COMPLIANCE_NORMAL
Take normal liberties with the spec, including taking the spec out to dinner, and making suggestive c...
Definition: IStreamCoder.h:972
@ COMPLIANCE_STRICT
Strictly conform to all the things in the spec no matter what consequences.
Definition: IStreamCoder.h:967

◆ Flags

AVPKIT Flags that can be passed to the setFlag(Flags, bool) method.

Enumerator
FLAG_QSCALE 

Use fixed qscale.

FLAG_4MV 

4 MV per MB allowed / advanced prediction for H.263.

FLAG_QPEL 

Use qpel MC.

FLAG_GMC 

Use GMC.

FLAG_INPUT_PRESERVED 

The parent program guarantees that the input for B-frames containing streams is not written to for at least s->max_b_frames+1 frames, if this is not set the input will be copied.

FLAG_PASS1 

Use internal 2pass ratecontrol in first pass mode.

FLAG_PASS2 

Use internal 2pass ratecontrol in second pass mode.

FLAG_GRAY 

Only decode/encode grayscale.

FLAG_EMU_EDGE 

Don't draw edges.

FLAG_PSNR 

error[?] variables will be set during encoding.

FLAG_NORMALIZE_AQP 

Input bitstream might be truncated at a random location instead of only at frame boundaries.

Normalize adaptive quantization.

FLAG_INTERLACED_DCT 

Use interlaced DCT.

FLAG_LOW_DELAY 

Force low delay.

FLAG_GLOBAL_HEADER 

Place global headers in extradata instead of every keyframe.

FLAG_BITEXACT 

Use only bitexact stuff (except (I)DCT).

FLAG_AC_PRED 

H.263 advanced intra coding / MPEG-4 AC prediction.

FLAG_CBP_RD 

Use rate distortion optimization for cbp.

FLAG_QP_RD 

Use rate distortion optimization for qp selectioon.

FLAG_LOOP_FILTER 

loop filter

FLAG_INTERLACED_ME 

interlaced motion estimation

FLAG2_FAST 

Allow non spec compliant speedup tricks.

FLAG2_STRICT_GOP 

Strictly enforce GOP size.

FLAG2_NO_OUTPUT 

Skip bitstream encoding.

FLAG2_LOCAL_HEADER 

Place global headers at every keyframe instead of in extradata.

FLAG2_SKIP_RD 

RD optimal MB level residual skipping.

FLAG2_CHUNKS 

Input bitstream might be truncated at a packet boundaries instead of only at frame boundaries.

FLAG2_SHOW_ALL 

Show all frames before the first keyframe.

Definition at line 60 of file IStreamCoder.h.

60  {
61  FLAG_QSCALE=0x0002,
62  FLAG_4MV =0x0004,
63  FLAG_QPEL =0x0010,
64  FLAG_GMC =0x0020,
65  FLAG_MV0 =0x0040,
71  FLAG_INPUT_PRESERVED=0x0100,
72  FLAG_PASS1 =0x0200,
73  FLAG_PASS2 =0x0400,
74  FLAG_GRAY =0x2000,
75  FLAG_EMU_EDGE =0x4000,
76  FLAG_PSNR =0x8000,
77  FLAG_TRUNCATED =0x00010000,
79  FLAG_NORMALIZE_AQP =0x00020000,
80  FLAG_INTERLACED_DCT=0x00040000,
81  FLAG_LOW_DELAY =0x00080000,
82  FLAG_GLOBAL_HEADER =0x00400000,
83  FLAG_BITEXACT =0x00800000,
84  /* Fx : Flag for h263+ extra options */
85  FLAG_AC_PRED =0x01000000,
86  FLAG_CBP_RD =0x04000000,
87  FLAG_QP_RD =0x08000000,
88  FLAG_LOOP_FILTER =0x00000800,
89  FLAG_INTERLACED_ME =0x20000000,
90  FLAG_CLOSED_GOP =0x80000000,
91  FLAG2_FAST =0x00000001,
92  FLAG2_STRICT_GOP =0x00000002,
93  FLAG2_NO_OUTPUT =0x00000004,
94  FLAG2_LOCAL_HEADER =0x00000008,
95  FLAG2_SKIP_RD =0x00004000,
96  FLAG2_CHUNKS =0x00008000,
97  FLAG2_SHOW_ALL =0x00400000,
98  } Flags;
Flags
AVPKIT Flags that can be passed to the setFlag(Flags, bool) method.
Definition: IStreamCoder.h:60
@ FLAG2_LOCAL_HEADER
Place global headers at every keyframe instead of in extradata.
Definition: IStreamCoder.h:94
@ FLAG_BITEXACT
Use only bitexact stuff (except (I)DCT).
Definition: IStreamCoder.h:83
@ FLAG2_CHUNKS
Input bitstream might be truncated at a packet boundaries instead of only at frame boundaries.
Definition: IStreamCoder.h:96
@ FLAG_QP_RD
Use rate distortion optimization for qp selectioon.
Definition: IStreamCoder.h:87
@ FLAG_LOW_DELAY
Force low delay.
Definition: IStreamCoder.h:81
@ FLAG_CBP_RD
Use rate distortion optimization for cbp.
Definition: IStreamCoder.h:86
@ FLAG_NORMALIZE_AQP
Input bitstream might be truncated at a random location instead of only at frame boundaries.
Definition: IStreamCoder.h:79
@ FLAG_INTERLACED_DCT
Use interlaced DCT.
Definition: IStreamCoder.h:80
@ FLAG2_SHOW_ALL
Show all frames before the first keyframe.
Definition: IStreamCoder.h:97
@ FLAG_GLOBAL_HEADER
Place global headers in extradata instead of every keyframe.
Definition: IStreamCoder.h:82
@ FLAG_EMU_EDGE
Don't draw edges.
Definition: IStreamCoder.h:75
@ FLAG_GRAY
Only decode/encode grayscale.
Definition: IStreamCoder.h:74
@ FLAG2_FAST
Allow non spec compliant speedup tricks.
Definition: IStreamCoder.h:91
@ FLAG_PSNR
error[?] variables will be set during encoding.
Definition: IStreamCoder.h:76
@ FLAG2_STRICT_GOP
Strictly enforce GOP size.
Definition: IStreamCoder.h:92
@ FLAG2_SKIP_RD
RD optimal MB level residual skipping.
Definition: IStreamCoder.h:95
@ FLAG_INPUT_PRESERVED
The parent program guarantees that the input for B-frames containing streams is not written to for at...
Definition: IStreamCoder.h:71
@ FLAG2_NO_OUTPUT
Skip bitstream encoding.
Definition: IStreamCoder.h:93
@ FLAG_AC_PRED
H.263 advanced intra coding / MPEG-4 AC prediction.
Definition: IStreamCoder.h:85
@ FLAG_PASS2
Use internal 2pass ratecontrol in second pass mode.
Definition: IStreamCoder.h:73
@ FLAG_INTERLACED_ME
interlaced motion estimation
Definition: IStreamCoder.h:89
@ FLAG_4MV
4 MV per MB allowed / advanced prediction for H.263.
Definition: IStreamCoder.h:62
@ FLAG_QSCALE
Use fixed qscale.
Definition: IStreamCoder.h:61
@ FLAG_PASS1
Use internal 2pass ratecontrol in first pass mode.
Definition: IStreamCoder.h:72

Member Function Documentation

◆ close()

virtual int32_t com::avpkit::core::IStreamCoder::close ( )
pure virtual

Close a Codec that was opened on this StreamCoder.

Returns
>= 0 on success; < 0 on error.

Implemented in com::avpkit::core::StreamCoder.

◆ decodeAudio()

virtual int32_t com::avpkit::core::IStreamCoder::decodeAudio ( IAudioSamples pOutSamples,
IPacket packet,
int32_t  byteOffset 
)
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.

Parameters
pOutSamplesThe AudioSamples we decode to
packetThe packet we're attempting to decode from.
byteOffsetWhere in the packet payload to start decoding
Returns
number of bytes actually processed from the packet, or negative for error

Implemented in com::avpkit::core::StreamCoder.

◆ decodeVideo()

virtual int32_t com::avpkit::core::IStreamCoder::decodeVideo ( IVideoPicture pOutFrame,
IPacket packet,
int32_t  byteOffset 
)
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.

Parameters
pOutFrameThe AudioSamples we decode.
packetThe packet we're attempting to decode from.
byteOffsetWhere in the packet payload to start decoding
Returns
number of bytes actually processed from the packet, or negative for error

Implemented in com::avpkit::core::StreamCoder.

◆ encodeAudio()

virtual int32_t com::avpkit::core::IStreamCoder::encodeAudio ( IPacket pOutPacket,
IAudioSamples pSamples,
int32_t  sampleToStartFrom 
)
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.

Parameters
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.
Returns
number of samples we consumed when encoding, or negative for errors.

Implemented in com::avpkit::core::StreamCoder.

◆ encodeVideo()

virtual int32_t com::avpkit::core::IStreamCoder::encodeVideo ( IPacket pOutPacket,
IVideoPicture pFrame,
int32_t  suggestedBufferSize 
)
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.

Parameters
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
suggestedBufferSizeThe 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.

◆ getAudioFrameSize()

virtual int32_t com::avpkit::core::IStreamCoder::getAudioFrameSize ( )
pure virtual

For this stream, get the number of audio samples that are represented in a packet of information.

Returns
Number of samples per 'frame' of encoded audio

Implemented in com::avpkit::core::StreamCoder.

◆ getAutomaticallyStampPacketsForStream()

virtual bool com::avpkit::core::IStreamCoder::getAutomaticallyStampPacketsForStream ( )
pure virtual

Does this IStreamCoder automatically adjust time stamps on output packets for the IStream it is ultimately destined for.

Returns
true for yes; false for no
See also
setAutomaticallyStampPacketsForStream(bool)
Since
3.2

Implemented in com::avpkit::core::StreamCoder.

◆ getBitRate()

virtual int32_t com::avpkit::core::IStreamCoder::getBitRate ( )
pure virtual

The bit rate.

Returns
The bit-rate the stream is, or will be, encoded in.

Implemented in com::avpkit::core::StreamCoder.

◆ getBitRateTolerance()

virtual int32_t com::avpkit::core::IStreamCoder::getBitRateTolerance ( )
pure virtual

The bit rate tolerance.

Returns
The bit-rate tolerance

Implemented in com::avpkit::core::StreamCoder.

◆ getChannels()

virtual int32_t com::avpkit::core::IStreamCoder::getChannels ( )
pure virtual

Get the number of channels in this audio stream.

Returns
The sample rate (in Hz) we use for this stream, or 0 if unknown.

Implemented in com::avpkit::core::StreamCoder.

◆ getCodec()

virtual ICodec* com::avpkit::core::IStreamCoder::getCodec ( )
pure virtual

The Codec this StreamCoder will use.

Returns
The Codec used by this StreamCoder, or 0 (null) if none.

Implemented in com::avpkit::core::StreamCoder.

◆ getCodecID()

virtual ICodec::ID com::avpkit::core::IStreamCoder::getCodecID ( )
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.

Returns
The ID of the Codec we'll use.

Implemented in com::avpkit::core::StreamCoder.

◆ getCodecTag()

virtual int32_t com::avpkit::core::IStreamCoder::getCodecTag ( )
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.

Returns
the FOURCC tag.

Implemented in com::avpkit::core::StreamCoder.

◆ getCodecType()

virtual ICodec::Type com::avpkit::core::IStreamCoder::getCodecType ( )
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.

Returns
The Type of the Codec we'll use.

Implemented in com::avpkit::core::StreamCoder.

◆ getDefaultAudioFrameSize()

virtual int32_t com::avpkit::core::IStreamCoder::getDefaultAudioFrameSize ( )
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.

Returns
the number of samples in an audio frame size if the codec doesn't specify the size.
Since
1.21

Implemented in com::avpkit::core::StreamCoder.

◆ getDirection()

virtual Direction com::avpkit::core::IStreamCoder::getDirection ( )
pure virtual

Get the direction.

Returns
The direction this StreamCoder works in.

Implemented in com::avpkit::core::StreamCoder.

◆ getExtraData()

virtual int32_t com::avpkit::core::IStreamCoder::getExtraData ( com::avpkit::ferry::IBuffer dest,
int32_t  offset,
int32_t  maxBytesToCopy 
)
pure virtual

Copies the current content of the extra-data buffer maintained by this codec (e.g.

header bytes) into the dest buffer.

Parameters
destThe buffer to copy to.
offsetThe position, in bytes, to start writing data to in dest.
maxBytesToCopyThe maximum number of bytes to copy.
Returns
The number of bytes copied, or < 0 on error.
Since
3.3

Implemented in com::avpkit::core::StreamCoder.

◆ getExtraDataSize()

virtual int32_t com::avpkit::core::IStreamCoder::getExtraDataSize ( )
pure virtual

Gets the current number of bytes of data maintained in the coder extra-data area.

Returns
The number of bytes. If 0, then no data is currently available.
Since
3.3

Implemented in com::avpkit::core::StreamCoder.

◆ getFlag()

virtual bool com::avpkit::core::IStreamCoder::getFlag ( Flags  flag)
pure virtual

Get the setting for the specified flag.

Parameters
flagThe flag you want to find the setting for
Returns
0 for false; non-zero for true

Implemented in com::avpkit::core::StreamCoder.

◆ getFlags()

virtual int32_t com::avpkit::core::IStreamCoder::getFlags ( )
pure virtual

Get the flags associated with this codec.

Returns
The (compacted) value of all flags set.

Implemented in com::avpkit::core::StreamCoder.

◆ getFrameRate()

virtual IRational* com::avpkit::core::IStreamCoder::getFrameRate ( )
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.

Returns
The frame rate.

Implemented in com::avpkit::core::StreamCoder.

◆ getGlobalQuality()

virtual int32_t com::avpkit::core::IStreamCoder::getGlobalQuality ( )
pure virtual

Get the Global Quality setting this codec uses for video if a VideoPicture doesn't have a quality set.

Returns
The global quality.

Implemented in com::avpkit::core::StreamCoder.

◆ getHeight()

virtual int32_t com::avpkit::core::IStreamCoder::getHeight ( )
pure virtual

The height, in pixels.

Returns
The height of the video frames in the attached stream or -1 if an audio stream, or we cannot determine the height.

Implemented in com::avpkit::core::StreamCoder.

◆ getNextPredictedPts()

virtual int64_t com::avpkit::core::IStreamCoder::getNextPredictedPts ( )
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.

Returns
The next presentation time stamp we expect to decode on this stream. This is always in units of 1/1,000,000 seconds

Implemented in com::avpkit::core::StreamCoder.

◆ getNumDroppedFrames()

virtual int64_t com::avpkit::core::IStreamCoder::getNumDroppedFrames ( )
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.

Returns
the number of frames dropped.
Since
3.1

Implemented in com::avpkit::core::StreamCoder.

◆ getNumPicturesInGroupOfPictures()

virtual int32_t com::avpkit::core::IStreamCoder::getNumPicturesInGroupOfPictures ( )
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).

Returns
the GOPS for this stream.

Implemented in com::avpkit::core::StreamCoder.

◆ getNumProperties()

virtual int32_t com::avpkit::core::IStreamCoder::getNumProperties ( )
pure virtual

Returns the total number of settable properties on this object.

Returns
total number of options (not including constant definitions)

Implemented in com::avpkit::core::StreamCoder.

◆ getPixelType()

virtual IPixelFormat::Type com::avpkit::core::IStreamCoder::getPixelType ( )
pure virtual

For Video streams, get the Pixel Format in use by the stream.

Returns
the Pixel format, or IPixelFormat::NONE if audio.

Implemented in com::avpkit::core::StreamCoder.

◆ getPropertyAsBoolean()

virtual bool com::avpkit::core::IStreamCoder::getPropertyAsBoolean ( const char *  name)
pure virtual

Gets the value of this property, and returns as a boolean.

Parameters
namename of option
Returns
boolean value of property, or false on error.

Implemented in com::avpkit::core::StreamCoder.

◆ getPropertyAsDouble()

virtual double com::avpkit::core::IStreamCoder::getPropertyAsDouble ( const char *  name)
pure virtual

Gets the value of this property, and returns as a double;.

Parameters
namename of option
Returns
double value of property, or 0 on error.

Implemented in com::avpkit::core::StreamCoder.

◆ getPropertyAsLong()

virtual int64_t com::avpkit::core::IStreamCoder::getPropertyAsLong ( const char *  name)
pure virtual

Gets the value of this property, and returns as an long;.

Parameters
namename of option
Returns
long value of property, or 0 on error.

Implemented in com::avpkit::core::StreamCoder.

◆ getPropertyAsRational()

virtual IRational* com::avpkit::core::IStreamCoder::getPropertyAsRational ( const char *  name)
pure virtual

Gets the value of this property, and returns as an IRational;.

Parameters
namename of option
Returns
long value of property, or 0 on error.

Implemented in com::avpkit::core::StreamCoder.

◆ getPropertyAsString()

virtual char* com::avpkit::core::IStreamCoder::getPropertyAsString ( const char *  name)
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.

Parameters
nameproperty name
Returns
an string copy of the option value, or null if the option doesn't exist.

Implemented in com::avpkit::core::StreamCoder.

◆ getPropertyMetaData() [1/2]

virtual IProperty* com::avpkit::core::IStreamCoder::getPropertyMetaData ( const char *  name)
pure virtual

Returns the name of the numbered property.

Parameters
nameThe property name.
Returns
an IProperty value for this properties meta-data

Implemented in com::avpkit::core::StreamCoder.

◆ getPropertyMetaData() [2/2]

virtual IProperty* com::avpkit::core::IStreamCoder::getPropertyMetaData ( int32_t  propertyNo)
pure virtual

Returns the name of the numbered property.

Parameters
propertyNoThe property number in the options list.
Returns
an IProperty value for this properties meta-data

Implemented in com::avpkit::core::StreamCoder.

◆ getSampleFormat()

virtual IAudioSamples::Format com::avpkit::core::IStreamCoder::getSampleFormat ( )
pure virtual

Get the audio sample format.

Returns
The sample format of samples for encoding/decoding.

Implemented in com::avpkit::core::StreamCoder.

◆ getSampleRate()

virtual int32_t com::avpkit::core::IStreamCoder::getSampleRate ( )
pure virtual

Get the sample rate we use for this stream.

Returns
The sample rate (in Hz) we use for this stream, or -1 if unknown or video.

Implemented in com::avpkit::core::StreamCoder.

◆ getStandardsCompliance()

virtual CodecStandardsCompliance com::avpkit::core::IStreamCoder::getStandardsCompliance ( )
pure virtual

Gets the current level of standards compliance.

Returns
The level of standards compliance.
See also
CodecStandardsCompliance
Since
5.0

Implemented in com::avpkit::core::StreamCoder.

◆ getStream()

virtual IStream* com::avpkit::core::IStreamCoder::getStream ( )
pure virtual

The associated Stream we're working on.

Returns
The stream associated with this object.

Implemented in com::avpkit::core::StreamCoder.

◆ getTimeBase()

virtual IRational* com::avpkit::core::IStreamCoder::getTimeBase ( )
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.

Returns
The time base this StreamCoder is using.

Implemented in com::avpkit::core::StreamCoder.

◆ getWidth()

virtual int32_t com::avpkit::core::IStreamCoder::getWidth ( )
pure virtual

The width, in pixels.

Returns
The width of the video frames in the attached stream or -1 if an audio stream, or we cannot determine the width.

Implemented in com::avpkit::core::StreamCoder.

◆ isOpen()

virtual bool com::avpkit::core::IStreamCoder::isOpen ( )
pure virtual

Returns true if this IStreamCoder is currently open.

Returns
true if open; false if not

Implemented in com::avpkit::core::StreamCoder.

◆ make() [1/4]

IStreamCoder * com::avpkit::core::IStreamCoder::make ( Direction  direction)
static
Deprecated:
Use make(Direction, ICodec) instead.

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.

Parameters
directionThe direction this StreamCoder will work in.
Returns
a new stream coder, or null if error.

Definition at line 36 of file IStreamCoder.cpp.

37  {
38  Global::init();
39  return IStreamCoder::make(direction, (ICodec*)0);
40  }
static void init()
Internal Only.
Definition: Global.cpp:157
static IStreamCoder * make(Direction direction)

References com::avpkit::core::Global::init().

◆ make() [2/4]

IStreamCoder * com::avpkit::core::IStreamCoder::make ( Direction  direction,
ICodec codec 
)
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.

Parameters
directionThe direction this StreamCoder will work in.
codecThe codec you want to use (in lieu of calling setCodec
Returns
a new stream coder, or null if error.
Since
5.0

Definition at line 50 of file IStreamCoder.cpp.

51  {
52  Global::init();
53  return StreamCoder::make(direction, dynamic_cast<Codec*>(codec));
54  }
static StreamCoder * make(Direction direction)
This method creates a StreamCoder that is not tied to any container or stream.

References com::avpkit::core::Global::init(), and com::avpkit::core::StreamCoder::make().

◆ make() [3/4]

IStreamCoder * com::avpkit::core::IStreamCoder::make ( Direction  direction,
ICodec::ID  id 
)
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.

Parameters
directionThe direction this StreamCoder will work in.
idThe codec id you want to use (in lieu of calling setCodec
Returns
a new stream coder, or null if error.
Since
5.0

Definition at line 57 of file IStreamCoder.cpp.

58  {
59  Global::init();
60  return StreamCoder::make(direction, id);
61  }

References com::avpkit::core::Global::init(), and com::avpkit::core::StreamCoder::make().

◆ make() [4/4]

IStreamCoder * com::avpkit::core::IStreamCoder::make ( Direction  direction,
IStreamCoder copyCoder 
)
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.


Parameters
directionThe direction you want the new IStreamCoder to work in.
copyCoderThe coder to copy settings from.
Returns
A new IStreamCoder, or null on error.
Since
1.22

Definition at line 43 of file IStreamCoder.cpp.

44  {
45  Global::init();
46  return StreamCoder::make(direction, coder);
47  }

References com::avpkit::core::Global::init(), and com::avpkit::core::StreamCoder::make().

◆ open() [1/2]

virtual int32_t com::avpkit::core::IStreamCoder::open ( )
pure virtual
Deprecated:
Use open(IMetaData,IMetaData) instead.

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.

Returns
>= 0 on success; < 0 on error.

Implemented in com::avpkit::core::StreamCoder.

◆ open() [2/2]

virtual int32_t com::avpkit::core::IStreamCoder::open ( IMetaData options,
IMetaData unsetOptions 
)
pure virtual

Open the codec with the given options.

Callers must call setCodec before calling this method.

Parameters
optionsIf non-NULL, a dictionary of parameter options to set for this codec.
unsetOptionsIf 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.
Returns
0 on success; <0 on error
Since
5.0

Implemented in com::avpkit::core::StreamCoder.

◆ setAutomaticallyStampPacketsForStream()

virtual void com::avpkit::core::IStreamCoder::setAutomaticallyStampPacketsForStream ( bool  value)
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.

Parameters
valuetrue to automatically adjust.
Since
3.2

Implemented in com::avpkit::core::StreamCoder.

◆ setBitRate()

virtual void com::avpkit::core::IStreamCoder::setBitRate ( int32_t  rate)
pure virtual

When ENCODING, sets the bit rate to use.

No-op when DECODING.

See also
getBitRate()
Parameters
rateThe bit rate to use.

Implemented in com::avpkit::core::StreamCoder.

◆ setBitRateTolerance()

virtual void com::avpkit::core::IStreamCoder::setBitRateTolerance ( int32_t  tolerance)
pure virtual

When ENCODING set the bit rate tolerance.

No-op when DECODING.

Parameters
toleranceThe bit rate tolerance

Implemented in com::avpkit::core::StreamCoder.

◆ setChannels()

virtual void com::avpkit::core::IStreamCoder::setChannels ( int32_t  channels)
pure virtual

Set the number of channels to use when ENCODING.

Ignored if a non audio stream, or if DECODING.

Parameters
channelsThe number of channels we'll encode with.

Implemented in com::avpkit::core::StreamCoder.

◆ setCodec() [1/2]

virtual void com::avpkit::core::IStreamCoder::setCodec ( ICodec codec)
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.

Parameters
codecCodec to set.

Implemented in com::avpkit::core::StreamCoder.

◆ setCodec() [2/2]

virtual void com::avpkit::core::IStreamCoder::setCodec ( ICodec::ID  id)
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.

Parameters
idID of codec to set.

Implemented in com::avpkit::core::StreamCoder.

◆ setCodecID()

virtual void com::avpkit::core::IStreamCoder::setCodecID ( ICodec::ID  id)
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.

Parameters
idID of codec to set.
Since
3.2

Implemented in com::avpkit::core::StreamCoder.

◆ setCodecTag()

virtual void com::avpkit::core::IStreamCoder::setCodecTag ( int32_t  fourcc)
pure virtual

Set the 4-byte FOURCC tag for this coder.

Parameters
fourccThe FOURCC to set, with Least Significant Byte first.

Implemented in com::avpkit::core::StreamCoder.

◆ setDefaultAudioFrameSize()

virtual void com::avpkit::core::IStreamCoder::setDefaultAudioFrameSize ( int32_t  aNewSize)
pure virtual

Set the default audio frame size.

Parameters
aNewSizeThe 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).
See also
getDefaultAudioFrameSize()
Since
1.21

Implemented in com::avpkit::core::StreamCoder.

◆ setExtraData()

virtual int32_t com::avpkit::core::IStreamCoder::setExtraData ( com::avpkit::ferry::IBuffer src,
int32_t  offset,
int32_t  length,
bool  allocNew 
)
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.

Parameters
srcThe data to copy
offsetThe position, in bytes, to start copying data from src
lengthThe number of bytes to copy from data
allocNewIf 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.
Returns
The number of bytes copied, or < 0 on error.
Since
3.3

Implemented in com::avpkit::core::StreamCoder.

◆ setFlag()

virtual void com::avpkit::core::IStreamCoder::setFlag ( Flags  flag,
bool  value 
)
pure virtual

Set the flag.

Parameters
flagThe flag to set
valueThe value to set it to (true or false)

Implemented in com::avpkit::core::StreamCoder.

◆ setFlags()

virtual void com::avpkit::core::IStreamCoder::setFlags ( int32_t  newFlags)
pure virtual

Set the FFMPEG flags to use with this codec.

All values must be ORed (|) together.

See also
Flags
Parameters
newFlagsThe new set flags for this codec.

Implemented in com::avpkit::core::StreamCoder.

◆ setFrameRate()

virtual void com::avpkit::core::IStreamCoder::setFrameRate ( IRational newFrameRate)
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.

See also
getFrameRate()
Parameters
newFrameRateThe new frame rate to use.

Implemented in com::avpkit::core::StreamCoder.

◆ setGlobalQuality()

virtual void com::avpkit::core::IStreamCoder::setGlobalQuality ( int32_t  newQuality)
pure virtual

Set the Global Quality to a new value.

Parameters
newQualityThe new global quality.

Implemented in com::avpkit::core::StreamCoder.

◆ setHardwareDecoding()

virtual int32_t com::avpkit::core::IStreamCoder::setHardwareDecoding ( IPixelFormat::Type  type,
void *  surface = NULL 
)
pure virtual

Try to change current decoder to an HW decoder compatible with pixel format.

Parameters
typean HW accelerated pixel format
Returns
0 on success; non-zero on failure

Implemented in com::avpkit::core::StreamCoder.

◆ setHeight()

virtual void com::avpkit::core::IStreamCoder::setHeight ( int32_t  height)
pure virtual

Set the height, in pixels.

See also
getHeight()
Parameters
heightSets the height of video frames we'll encode. No-op when DECODING.

Implemented in com::avpkit::core::StreamCoder.

◆ setNumPicturesInGroupOfPictures()

virtual void com::avpkit::core::IStreamCoder::setNumPicturesInGroupOfPictures ( int32_t  gops)
pure virtual

Set the GOPS on this stream.

Ignored if DECODING.

See also
getNumPicturesInGroupOfPictures()
Parameters
gopsThe new GOPS for the stream we're encoding.

Implemented in com::avpkit::core::StreamCoder.

◆ setPixelType()

virtual void com::avpkit::core::IStreamCoder::setPixelType ( IPixelFormat::Type  pixelFmt)
pure virtual

Set the pixel format to ENCODE with.

Ignored if audio or DECODING.

Parameters
pixelFmtPixel format to use.

Implemented in com::avpkit::core::StreamCoder.

◆ setProperty() [1/5]

virtual int32_t com::avpkit::core::IStreamCoder::setProperty ( const char *  name,
bool  value 
)
pure virtual

Looks up the property 'name' and sets the value of the property to 'value'.

Parameters
namename of option
valueValue of option
Returns
>= 0 on success; <0 on error.

Implemented in com::avpkit::core::StreamCoder.

◆ setProperty() [2/5]

virtual int32_t com::avpkit::core::IStreamCoder::setProperty ( const char *  name,
const char *  value 
)
pure virtual

Sets a property on this Object.

All AVOptions supported by the underlying AVClass are supported.

Parameters
nameThe property name. For example "b" for bit-rate.
valueThe value of the property.
Returns
>= 0 if the property was successfully set; <0 on error

Implemented in com::avpkit::core::StreamCoder.

◆ setProperty() [3/5]

virtual int32_t com::avpkit::core::IStreamCoder::setProperty ( const char *  name,
double  value 
)
pure virtual

Looks up the property 'name' and sets the value of the property to 'value'.

Parameters
namename of option
valueValue of option
Returns
>= 0 on success; <0 on error.

Implemented in com::avpkit::core::StreamCoder.

◆ setProperty() [4/5]

virtual int32_t com::avpkit::core::IStreamCoder::setProperty ( const char *  name,
int64_t  value 
)
pure virtual

Looks up the property 'name' and sets the value of the property to 'value'.

Parameters
namename of option
valueValue of option
Returns
>= 0 on success; <0 on error.

Implemented in com::avpkit::core::StreamCoder.

◆ setProperty() [5/5]

virtual int32_t com::avpkit::core::IStreamCoder::setProperty ( const char *  name,
IRational value 
)
pure virtual

Looks up the property 'name' and sets the value of the property to 'value'.

Parameters
namename of option
valueValue of option
Returns
>= 0 on success; <0 on error.

Implemented in com::avpkit::core::StreamCoder.

◆ setSampleFormat()

virtual void com::avpkit::core::IStreamCoder::setSampleFormat ( IAudioSamples::Format  aFormat)
pure virtual

Set the sample format when ENCODING.

Ignored if DECODING or if the coder is already open.

Parameters
aFormatThe sample format.

Implemented in com::avpkit::core::StreamCoder.

◆ setSampleRate()

virtual void com::avpkit::core::IStreamCoder::setSampleRate ( int32_t  sampleRate)
pure virtual

Set the sample rate to use when ENCODING.

Ignored if DECODING or a non-audio stream.

Parameters
sampleRateNew sample rate (in Hz) to use.

Implemented in com::avpkit::core::StreamCoder.

◆ setStandardsCompliance()

virtual int32_t com::avpkit::core::IStreamCoder::setStandardsCompliance ( CodecStandardsCompliance  compliance)
pure virtual

Set the level of standards compliance.

Only paid attention to before the code is opened.

Parameters
complianceThe desired compliance level to set
Returns
0 on success; non-zero on failure
See also
CodecStandardsCompliance
Since
5.0

Implemented in com::avpkit::core::StreamCoder.

◆ setTimeBase()

virtual void com::avpkit::core::IStreamCoder::setTimeBase ( IRational newTimeBase)
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.

See also
getTimeBase()
Parameters
newTimeBaseThe new time base to use.

Implemented in com::avpkit::core::StreamCoder.

◆ setWidth()

virtual void com::avpkit::core::IStreamCoder::setWidth ( int32_t  width)
pure virtual

Set the width, in pixels.

See also
getWidth()
Parameters
widthSets the width of video frames we'll encode. No-op when DECODING.

Implemented in com::avpkit::core::StreamCoder.


The documentation for this class was generated from the following files: