20 #ifndef ISTREAMCODER_H_
21 #define ISTREAMCODER_H_
23 #include <com/avpkit/ferry/RefCounted.h>
24 #include <com/avpkit/core/AVPKit.h>
25 #include <com/avpkit/core/ICodec.h>
26 #include <com/avpkit/core/IRational.h>
27 #include <com/avpkit/core/IPixelFormat.h>
28 #include <com/avpkit/core/IAudioSamples.h>
29 #include <com/avpkit/core/IVideoPicture.h>
30 #include <com/avpkit/core/IPacket.h>
31 #include <com/avpkit/core/IProperty.h>
32 #include <com/avpkit/core/IMetaData.h>
34 namespace com {
namespace avpkit {
namespace core
71 FLAG_INPUT_PRESERVED=0x0100,
75 FLAG_EMU_EDGE =0x4000,
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,
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,
491 IPacket *packet, int32_t byteOffset)=0;
509 IPacket *packet, int32_t byteOffset)=0;
644 virtual int32_t
setProperty(
const char *name,
const char* value)=0;
692 %newobject getPropertyAsString(
const char*);
693 %typemap(newfree)
char *
"free($1);";
927 int32_t length,
bool allocNew)=0;
942 int32_t maxBytesToCopy)=0;
963 COMPLIANCE_VERY_STRICT=2,
976 COMPLIANCE_UNOFFICIAL=-1,
982 COMPLIANCE_EXPERIMENTAL=-2,
983 } CodecStandardsCompliance;
1014 virtual void* getHardwareSurface()=0;
A set of raw (decoded) samples, plus a timestamp for when to play those samples relative to other ite...
Format
The format we use to represent audio.
A "key" to an IStreamCoder that tells it how to encode or decode data.
ID
These are the codecs this library currently supports.
Type
The different types of Codecs that can exist in the system.
Represents an encoded piece of data that can be placed in an IContainer for a given IStream of data.
Represents settable properties that effect how AVPKit objects operate.
This class wraps represents a Rational number for the AVPKit.
The work horse of the AVPKit: Takes IPacket data from an IContainer (representing an IStream) and an ...
virtual int32_t setProperty(const char *name, bool value)=0
Looks up the property 'name' and sets the value of the property to 'value'.
virtual int64_t getNumDroppedFrames()=0
Get the number of frames this StreamCoder had to drop to encode at the specified getTimeBase().
virtual int32_t setStandardsCompliance(CodecStandardsCompliance compliance)=0
Set the level of standards compliance.
virtual int32_t setHardwareDecoding(IPixelFormat::Type type, void *surface=NULL)=0
Try to change current decoder to an HW decoder compatible with pixel format.
virtual void setBitRateTolerance(int32_t tolerance)=0
When ENCODING set the bit rate tolerance.
virtual int32_t getBitRateTolerance()=0
The bit rate tolerance.
virtual void setChannels(int32_t channels)=0
Set the number of channels to use when ENCODING.
virtual int32_t getBitRate()=0
The bit rate.
virtual void setPixelType(IPixelFormat::Type pixelFmt)=0
Set the pixel format to ENCODE with.
virtual int32_t getSampleRate()=0
Get the sample rate we use for this stream.
virtual int32_t close()=0
Close a Codec that was opened on this StreamCoder.
virtual void setSampleRate(int32_t sampleRate)=0
Set the sample rate to use when ENCODING.
virtual int32_t getExtraDataSize()=0
Gets the current number of bytes of data maintained in the coder extra-data area.
virtual Direction getDirection()=0
Get the direction.
CodecStandardsCompliance
An enumeration of how strictly Codecs may follow the spec.
virtual void setHeight(int32_t height)=0
Set the height, in pixels.
virtual void setTimeBase(IRational *newTimeBase)=0
Set the time base we'll use to ENCODE with.
virtual int32_t getWidth()=0
The width, in pixels.
virtual int32_t getGlobalQuality()=0
Get the Global Quality setting this codec uses for video if a VideoPicture doesn't have a quality set...
virtual int32_t getDefaultAudioFrameSize()=0
Get the default audio frame size (in samples).
virtual int32_t getFlags()=0
Get the flags associated with this codec.
virtual void setAutomaticallyStampPacketsForStream(bool value)=0
Should the IStreamCoder automatically adjust time stamps on output packets for the IStream it is ulti...
virtual int32_t setProperty(const char *name, IRational *value)=0
Looks up the property 'name' and sets the value of the property to 'value'.
virtual void setCodec(ICodec *codec)=0
Set the Codec to the passed in Codec, discarding the old Codec if set.
virtual void setGlobalQuality(int32_t newQuality)=0
Set the Global Quality to a new value.
Flags
AVPKIT Flags that can be passed to the setFlag(Flags, bool) method.
virtual IProperty * getPropertyMetaData(int32_t propertyNo)=0
Returns the name of the numbered property.
virtual void setFlags(int32_t newFlags)=0
Set the FFMPEG flags to use with this codec.
virtual IRational * getTimeBase()=0
Get the time base this stream will ENCODE in, or the time base we detect while DECODING.
virtual int32_t open(IMetaData *options, IMetaData *unsetOptions)=0
Open the codec with the given options.
virtual void setCodecTag(int32_t fourcc)=0
Set the 4-byte FOURCC tag for this coder.
virtual void setSampleFormat(IAudioSamples::Format aFormat)=0
Set the sample format when ENCODING.
virtual void setFrameRate(IRational *newFrameRate)=0
Set the frame rate we'll set in the headers of this stream while ENCODING.
virtual void setWidth(int32_t width)=0
Set the width, in pixels.
virtual CodecStandardsCompliance getStandardsCompliance()=0
Gets the current level of standards compliance.
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'.
virtual int32_t setProperty(IMetaData *valuesToSet, IMetaData *valuesNotFound)=0
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.
virtual ICodec * getCodec()=0
The Codec this StreamCoder will use.
virtual double getPropertyAsDouble(const char *name)=0
Gets the value of this property, and returns as a double;.
virtual void setCodec(ICodec::ID id)=0
Look up a Codec based on the passed in ID, and then set it.
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.
virtual void setDefaultAudioFrameSize(int32_t aNewSize)=0
Set the default audio frame size.
virtual int32_t getNumPicturesInGroupOfPictures()=0
The the number of pictures in this Group of Pictures (GOP).
Direction
The Direction in which this StreamCoder will work.
virtual IPixelFormat::Type getPixelType()=0
For Video streams, get the Pixel Format in use by the stream.
virtual int32_t setProperty(const char *name, const char *value)=0
Sets a property on this Object.
virtual char * getPropertyAsString(const char *name)=0
Gets a property on this Object.
virtual void setNumPicturesInGroupOfPictures(int32_t gops)=0
Set the GOPS on this stream.
virtual int32_t getAudioFrameSize()=0
For this stream, get the number of audio samples that are represented in a packet of information.
virtual int32_t encodeAudio(IPacket *pOutPacket, IAudioSamples *pSamples, int32_t sampleToStartFrom)=0
Encode the given samples using this StreamCoder.
virtual IRational * getFrameRate()=0
Get the frame-rate the attached stream claims to be using when DECODING, or the frame-rate we'll clai...
virtual int64_t getNextPredictedPts()=0
For this stream, get the next Pts that we expect to decode.
virtual int32_t getNumProperties()=0
Returns the total number of settable properties on this object.
virtual IRational * getPropertyAsRational(const char *name)=0
Gets the value of this property, and returns as an IRational;.
virtual ICodec::ID getCodecID()=0
A short hand for getCodec().getID().
virtual void setCodecID(ICodec::ID id)=0
Look up a Codec based on the passed in ID, and then set it.
virtual IStream * getStream()=0
The associated Stream we're working on.
virtual int32_t encodeVideo(IPacket *pOutPacket, IVideoPicture *pFrame, int32_t suggestedBufferSize)=0
Encode the given frame using this StreamCoder.
virtual IProperty * getPropertyMetaData(const char *name)=0
Returns the name of the numbered property.
virtual void setBitRate(int32_t rate)=0
When ENCODING, sets the bit rate to use.
virtual bool getPropertyAsBoolean(const char *name)=0
Gets the value of this property, and returns as a boolean.
virtual bool getAutomaticallyStampPacketsForStream()=0
Does this IStreamCoder automatically adjust time stamps on output packets for the IStream it is ultim...
virtual int32_t getCodecTag()=0
Returns the 4-byte FOURCC tag (Least Significant Byte first).
virtual int32_t getChannels()=0
Get the number of channels in this audio stream.
virtual bool getFlag(Flags flag)=0
Get the setting for the specified flag.
virtual bool isOpen()=0
Returns true if this IStreamCoder is currently open.
virtual int32_t decodeAudio(IAudioSamples *pOutSamples, IPacket *packet, int32_t byteOffset)=0
Decode this packet into pOutSamples.
virtual int64_t getPropertyAsLong(const char *name)=0
Gets the value of this property, and returns as an long;.
virtual int32_t decodeVideo(IVideoPicture *pOutFrame, IPacket *packet, int32_t byteOffset)=0
Decode this packet into pOutFrame.
virtual int32_t getHeight()=0
The height, in pixels.
virtual void setFlag(Flags flag, bool value)=0
Set the flag.
virtual int32_t setProperty(const char *name, double value)=0
Looks up the property 'name' and sets the value of the property to 'value'.
virtual IAudioSamples::Format getSampleFormat()=0
Get the audio sample format.
virtual ICodec::Type getCodecType()=0
A short hand for getCodec().getType().
Represents a stream of similar data (eg video) in a IContainer.
Represents one raw (undecoded) picture in a video stream, plus a timestamp for when to display that v...
Allows Java code to get data from a native buffers, and optionally modify native memory directly.
Parent of all Ferry objects – it mains reference counts in native code.
WARNING: Do not use logging in this class, and do not set any static file variables to values other t...