|
AVPKit
|
A file (or network data source) that contains one or more IStream objects of audio and video data. More...
#include <IContainer.h>
Public Types | |
| enum | Type { READ , WRITE } |
| The different types of Containers AVPKit supports. More... | |
| enum | Flags { FLAG_GENPTS =0x0001 , FLAG_IGNIDX =0x0002 , FLAG_NONBLOCK =0x0004 , FLAG_IGNDTS =0x0008 , FLAG_NOFILLIN =0x0010 , FLAG_NOPARSE =0x0020 , FLAG_NOBUFFER =0x0040 , FLAG_CUSTOM_IO =0x0080 , FLAG_DISCARD_CORRUPT =0x0100 , FLAG_FLUSH_PACKETS =0x0200 , FLAG_BITEXACT =0x0400 , FLAG_MP4A_LATM =0x8000 , FLAG_SORT_DTS =0x10000 , FLAG_PRIV_OPT =0x20000 , FLAG_KEEP_SIDE_DATA =0x40000 , FLAG_FAST_SEEK =0x80000 , FLAG_SHORTEST =0x100000 , FLAG_AUTO_BSF =0x200000 } |
| typedef enum com::avpkit::core::IContainer::Type | Type |
| The different types of Containers AVPKit supports. More... | |
| typedef enum com::avpkit::core::IContainer::Flags | Flags |
Public Member Functions | |
| virtual int32_t | setInputBufferLength (int32_t size)=0 |
| Set the buffer length AVPKit will suggest to FFMPEG for reading inputs. More... | |
| virtual int32_t | getInputBufferLength ()=0 |
| Return the input buffer length. More... | |
| virtual bool | isOpened ()=0 |
| Is this container opened? More... | |
| virtual bool | isHeaderWritten ()=0 |
| Has a header been successfully written? More... | |
| virtual int32_t | open (const char *url, Type type, IContainerFormat *pContainerFormat)=0 |
| Open this container and make it ready for reading or writing. More... | |
| virtual int32_t | open (const char *url, Type type, IContainerFormat *pContainerFormat, bool aStreamsCanBeAddedDynamically, bool aQueryStreamMetaData)=0 |
| Open this container and make it ready for reading or writing, optionally reading as far into the container as necessary to find all streams. More... | |
| virtual IStreamCoder::CodecStandardsCompliance | getStandardsCompliance ()=0 |
| Gets the current level of standards compliance. More... | |
| virtual int32_t | setStandardsCompliance (IStreamCoder::CodecStandardsCompliance compliance)=0 |
| Set the level of standards compliance. More... | |
| virtual IContainerFormat * | getContainerFormat ()=0 |
| Returns the IContainerFormat object being used for this IContainer, or null if the IContainer doesn't yet know. More... | |
| virtual int32_t | close (bool dangling=false)=0 |
| Close the container. More... | |
| virtual Type | getType ()=0 |
| Find out the type of this container. More... | |
| virtual int32_t | getNumStreams ()=0 |
| The number of streams in this container. More... | |
| virtual IStream * | getStream (int32_t streamIndex)=0 |
| Get the stream at the given position. More... | |
| virtual IStream * | addNewStream (int32_t id)=0 |
| virtual int32_t | writeHeader ()=0 |
| Adds a header, if needed, for this container. More... | |
| virtual int32_t | writeTrailer ()=0 |
| Adds a trailer, if needed, for this container. More... | |
| virtual int32_t | readNextPacket (IPacket *packet)=0 |
| Reads the next packet into the IPacket. More... | |
| virtual int32_t | writePacket (IPacket *packet, bool forceInterleave)=0 |
| Writes the contents of the packet to the container. More... | |
| virtual int32_t | writePacket (IPacket *packet)=0 |
| Writes the contents of the packet to the container, but make sure the packets are interleaved. More... | |
| virtual int32_t | queryStreamMetaData ()=0 |
| Attempts to read all the meta data in this stream, potentially by reading ahead and decoding packets. More... | |
| virtual int32_t | seekKeyFrame (int32_t streamIndex, int64_t timestamp, int32_t flags)=0 |
| Seeks to the key frame at (or the first one after) the given timestamp. More... | |
| virtual int64_t | getDuration ()=0 |
| Gets the duration, if known, of this container. More... | |
| virtual int64_t | getStartTime ()=0 |
| Get the starting timestamp in microseconds of the first packet of the earliest stream in this container. More... | |
| virtual int64_t | getFileSize ()=0 |
| Get the file size in bytes of this container. More... | |
| virtual int32_t | getBitRate ()=0 |
| Get the calculated overall bit rate of this file. 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 int32_t | getFlags ()=0 |
| Get the flags associated with this object. More... | |
| virtual void | setFlags (int32_t newFlags)=0 |
| Set the flags to use with this object. 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 const char * | getURL ()=0 |
| Get the URL the IContainer was opened with. More... | |
| virtual int32_t | flushPackets ()=0 |
| Flush all packets to output. More... | |
| virtual int32_t | getReadRetryCount ()=0 |
| Get the number of times IContainer#readNextPacket(IPacket) will retry a read if it gets a IError.Type#ERROR_AGAIN value back. More... | |
| virtual void | setReadRetryCount (int32_t count)=0 |
| Sets the read retry count. More... | |
| virtual bool | canStreamsBeAddedDynamically ()=0 |
| Can streams be added dynamically to this container? More... | |
| virtual IMetaData * | getMetaData ()=0 |
| Get the IMetaData for this object, or null if none. More... | |
| virtual void | setMetaData (IMetaData *data)=0 |
| Set the IMetaData on this object, overriding any previous meta data. More... | |
| virtual int32_t | createSDPData (com::avpkit::ferry::IBuffer *buffer)=0 |
| Fills the given buffer with a null-terminated ASCII set of bytes representing SDP data that is suitable for use with an RTSP-based system. More... | |
| virtual int32_t | setForcedAudioCodec (ICodec::ID id)=0 |
| Forces the IContainer to assume all audio streams are encoded with the given audio codec when demuxing. More... | |
| virtual int32_t | setForcedVideoCodec (ICodec::ID id)=0 |
| Forces the IContainer to assume all video streams are encoded with the given video codec when demuxing. More... | |
| virtual int32_t | setForcedSubtitleCodec (ICodec::ID id)=0 |
| Forces the IContainer to assume all subtitle streams are encoded with the given subtitle codec when demuxing. More... | |
| virtual int32_t | seekKeyFrame (int32_t streamIndex, int64_t minTimeStamp, int64_t targetTimeStamp, int64_t maxTimeStamp, int32_t flags)=0 |
| EXPERIMENTAL - Seeks to timestamp in the container. More... | |
| virtual int32_t | setPreload (int32_t preload)=0 |
| @Deprecated use setProperty instead. More... | |
| virtual int32_t | getPreload ()=0 |
| @Deprecated use getPropertyAsLong instead. More... | |
| virtual int32_t | setMaxDelay (int32_t maxdelay)=0 |
| Sets the max delay for the AVFormatContext.max_delay property. More... | |
| virtual int32_t | getMaxDelay ()=0 |
| Gets the AVFormatContext.max_delay property if possible. More... | |
| virtual IStream * | addNewStream (ICodec::ID id)=0 |
| Add a new stream that will use the given codec. More... | |
| virtual IStream * | addNewStream (ICodec *codec)=0 |
| Add a new stream that will use the given codec. More... | |
| virtual IStream * | addNewStream (IStreamCoder *coder)=0 |
| Add a new stream that will use the given StreamCoder. More... | |
| virtual int32_t | setProperty (IMetaData *valuesToSet, IMetaData *valuesNotFound)=0 |
| virtual IContainerFormat * | getFormat ()=0 |
| Get the IContainerFormat that is used by this IContainer. More... | |
| virtual int32_t | setFormat (IContainerFormat *format)=0 |
| Set the IContainerFormat to use with this IContainer. More... | |
| virtual int32_t | open (const char *url, Type type, IContainerFormat *containerFormat, bool streamsCanBeAddedDynamically, bool queryStreamMetaData, IMetaData *options, IMetaData *optionsNotSet)=0 |
| Open this container and make it ready for reading or writing, optionally reading as far into the container as necessary to find all streams. More... | |
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 IContainer * | make () |
| Create a new container object. More... | |
| static IContainer * | make (IContainerFormat *format) |
| Create a new IContainer and call setFormat(IContainerFormat) on it immediately. More... | |
Static Public Attributes | |
| static const int32_t | SEEK_FLAG_BACKWARDS =1 |
| Flag; Seek backwards. | |
| static const int32_t | SEEK_FLAG_BYTE =2 |
| Flag; Use bytes instead of time stamps for seeking. | |
| static const int32_t | SEEK_FLAG_ANY =4 |
| Flag; Seek to any frame, even non-keyframes. | |
| static const int32_t | SEEK_FLAG_FRAME =8 |
| Flag; Seek based on frame number instead of time stamps. | |
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. | |
A file (or network data source) that contains one or more IStream objects of audio and video data.
Typical usage for reading looks like this:
IContainer container = IContainer.make(); if (container.open("myfile.flv", IContainer.Type.READ, null) <0) throw new RuntimeException("failed to open"); int numStreams = container.getNumStreams(); for(i = 0; i < numStreams; i++) { IStream stream = container.getStream(i); ...query IStream for stream information... } IPacket packet = IPacket.make(); while(container.readNextPacket(packet) >= 0) { ... Do something with the packet... } container.close();
<p<blockquote>
Typical usage for writing looks like this (makes an FLV file with one audio track encoded as mp3 data):
IContainer container = IContainer.make(); if (container.open("myfile.flv", IContainer.Type.WRITE, null) <0) throw new RuntimeException("failed to open"); IStream stream = container.addNewStream(0); IStreamCoder coder = stream.getStreamCoder(); coder.setCodec(ICodec.ID.AV_CODEC_ID_MP3); coder.setSampleRate(22050); coder.setChannels(2); coder.setBitRate(64000); if (coder.open()<0) throw new RuntimeException("could not open coder"); if (container.writeHeader() < 0) throw new RuntimeException(); IPacket packet = IPacket.make(); while( ... have more data to process ... ) { ... Use the coder to encode audio data into packets then assuming it generated an IPacket for you... if (container.writePacket(packet)<0) throw new RuntimeException("could not write packet"); } if (container.writeTrailer() <0) throw new RuntimeException(); container.close();
Definition at line 99 of file IContainer.h.
The different types of Containers AVPKit supports.
A container may only be opened in a uni-directional mode.
The different types of Containers AVPKit supports.
A container may only be opened in a uni-directional mode.
Definition at line 106 of file IContainer.h.
Add a new stream that will use the given codec.
| codec | The codec that will be used to insert packets. |
Implemented in com::avpkit::core::Container.
|
pure virtual |
Add a new stream that will use the given codec.
| id | The id for the codec used to insert packets. If you are adding an arbitrary data stream, use ICodec.ID#AV_CODEC_ID_NONE, otherwise use the ID of the code type you plan to use. |
Implemented in com::avpkit::core::Container.
|
pure virtual |
Creates a new stream in this container and returns it.
| id | A format-dependent id for this stream. |
Implemented in com::avpkit::core::Container.
|
pure virtual |
Add a new stream that will use the given StreamCoder.
The StreamCoder passed in MUST contain the IStreamCoder#getExtraData that was used to encode the packet.
| coder | The IStreamCoder that contains the meta-information needed for decoding the packets that will be muexed into this stream. |
Implemented in com::avpkit::core::Container.
|
pure virtual |
Can streams be added dynamically to this container?
Implemented in com::avpkit::core::Container.
|
pure virtual |
Close the container.
open() must have been called first, or else an error is returned.
If the current thread is interrupted while this blocking method is running the method will return with a negative value. To check if the method exited because of an interruption pass the return value to IError#make(int) and then check IError#getType() to see if it is IError.Type#ERROR_INTERRUPTED.
If this method exits because of an interruption, all resources will be closed anyway.
Implemented in com::avpkit::core::Container.
|
pure virtual |
Fills the given buffer with a null-terminated ASCII set of bytes representing SDP data that is suitable for use with an RTSP-based system.
This method only works if AVPKit is linking against a version of FFmpeg that supports RTSP.
| buffer | the com.avpkit.ferry.IBuffer object to fill with data. |
Implemented in com::avpkit::core::Container.
|
pure virtual |
Flush all packets to output.
Will only work on IContainer.Type#WRITE containers.
If the current thread is interrupted while this blocking method is running the method will return with a negative value. To check if the method exited because of an interruption pass the return value to IError#make(int) and then check IError#getType() to see if it is IError.Type#ERROR_INTERRUPTED.
Implemented in com::avpkit::core::Container.
|
pure virtual |
Get the calculated overall bit rate of this file.
This will only return a valid value if the container is non-streamed and supports seek.
Implemented in com::avpkit::core::Container.
|
pure virtual |
Returns the IContainerFormat object being used for this IContainer, or null if the IContainer doesn't yet know.
Implemented in com::avpkit::core::Container.
|
pure virtual |
Gets the duration, if known, of this container.
This will only work for non-streamable containers where IContainer can calculate the container size.
Implemented in com::avpkit::core::Container.
|
pure virtual |
Get the file size in bytes of this container.
This will only return a valid value if the container is non-streamed and supports seek.
Implemented in com::avpkit::core::Container.
|
pure virtual |
Get the setting for the specified flag.
| flag | The flag you want to find the setting for |
Implemented in com::avpkit::core::Container.
|
pure virtual |
Get the flags associated with this object.
Implemented in com::avpkit::core::Container.
|
pure virtual |
Get the IContainerFormat that is used by this IContainer.
Implemented in com::avpkit::core::Container.
|
pure virtual |
Return the input buffer length.
Implemented in com::avpkit::core::Container.
|
pure virtual |
Gets the AVFormatContext.max_delay property if possible.
Implemented in com::avpkit::core::Container.
|
pure virtual |
Get the IMetaData for this object, or null if none.
If the IContainer or IStream object that this IMetaData came from was opened for reading, then changes via IMetaData#setValue(String, String) will have no effect on the underlying media.
If the IContainer or IStream object that this IMetaData came from was opened for writing, then changes via IMetaData#setValue(String, String) will have no effect after IContainer#writeHeader() is called.
Implemented in com::avpkit::core::Container.
|
pure virtual |
Returns the total number of settable properties on this object.
Implemented in com::avpkit::core::Container.
|
pure virtual |
The number of streams in this container.
If opened in IContainer.Type#READ mode, this will query the stream and find out how many streams are in it.
If opened in IContainer.Type#WRITE mode, this will return the number of streams the caller has added to date.
If the current thread is interrupted while this blocking method is running the method will return with a negative value. To check if the method exited because of an interruption pass the return value to IError#make(int) and then check IError#getType() to see if it is IError.Type#ERROR_INTERRUPTED.
Implemented in com::avpkit::core::Container.
|
pure virtual |
@Deprecated use getPropertyAsLong instead.
The amount container will attemtp to preload.
Implemented in com::avpkit::core::Container.
|
pure virtual |
Gets the value of this property, and returns as a boolean.
| name | name of option |
Implemented in com::avpkit::core::Container.
|
pure virtual |
Gets the value of this property, and returns as a double;.
| name | name of option |
Implemented in com::avpkit::core::Container.
|
pure virtual |
Gets the value of this property, and returns as an long;.
| name | name of option |
Implemented in com::avpkit::core::Container.
|
pure virtual |
Gets the value of this property, and returns as an IRational;.
| name | name of option |
Implemented in com::avpkit::core::Container.
|
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. If you call from Java or any other language, you don't need to worry about this.
| name | property name |
Implemented in com::avpkit::core::Container.
|
pure virtual |
Returns the name of the numbered property.
| name | The property name. |
Implemented in com::avpkit::core::Container.
|
pure virtual |
Returns the name of the numbered property.
| propertyNo | The property number in the options list. |
Implemented in com::avpkit::core::Container.
|
pure virtual |
Get the number of times IContainer#readNextPacket(IPacket) will retry a read if it gets a IError.Type#ERROR_AGAIN value back.
Defaults to 1 times. <0 means it will keep retrying indefinitely.
Implemented in com::avpkit::core::Container.
|
pure virtual |
Gets the current level of standards compliance.
Implemented in com::avpkit::core::Container.
|
pure virtual |
Get the starting timestamp in microseconds of the first packet of the earliest stream in this container.
This will only return value values either either (a) for non-streamable containers where IContainer can calculate the container size or (b) after IContainer has actually read the first packet from a streamable source.
Implemented in com::avpkit::core::Container.
|
pure virtual |
Get the stream at the given position.
| streamIndex | the index of this stream in the container |
Implemented in com::avpkit::core::Container.
|
pure virtual |
Find out the type of this container.
Implemented in com::avpkit::core::Container.
|
pure virtual |
Get the URL the IContainer was opened with.
May return null if unknown.
Implemented in com::avpkit::core::Container.
|
pure virtual |
Has a header been successfully written?
Implemented in com::avpkit::core::Container.
|
pure virtual |
Is this container opened?
Implemented in com::avpkit::core::Container.
|
static |
Create a new container object.
Definition at line 31 of file IContainer.cpp.
References com::avpkit::core::Global::init().
Referenced by make().
|
static |
Create a new IContainer and call setFormat(IContainerFormat) on it immediately.
| format | The format to pass to setFormat(IContainerFormat) |
Definition at line 38 of file IContainer.cpp.
References com::avpkit::core::Global::init(), and make().
|
pure virtual |
Open this container and make it ready for reading or writing, optionally reading as far into the container as necessary to find all streams.
The caller must call close() when done, but if not, the IContainer will eventually close them later but warn to the logging system.
If the current thread is interrupted while this blocking method is running the method will return with a negative value. To check if the method exited because of an interruption pass the return value to IError#make(int) and then check IError#getType() to see if it is IError.Type#ERROR_INTERRUPTED.
| url | The resource to open; The format of this string is any url that FFMPEG supports (including additional protocols if added through the core.io library). |
| type | The type of this container. |
| containerFormat | A pointer to a ContainerFormat object specifying the format of this container, or 0 (NULL) if you want us to guess. |
| streamsCanBeAddedDynamically | If true, open() will expect that new streams can be added at any time, even after the format header has been read. |
| queryStreamMetaData | If true, open() will call queryStreamMetaData() on this container, which will potentially block until it has ready enough data to find all streams in a container. If false, it will only block to read a minimal header for this container format. |
| options | If not null, a set of key-value pairs that will be set on the container immediately the format is determined. Some options cannot be set (especially for input containers) until the system has a chance to parse what data is in the file. |
| optionsNotSet | If not null, on return this IMetaData object will be cleared out, and replace with any key/value pairs that were in options but could not be set on this IContainer. |
Implemented in com::avpkit::core::Container.
|
pure virtual |
Open this container and make it ready for reading or writing.
The caller must call close() when done, but if not, the IContainer will eventually close them later but warn to the logging system.
This just forwards to open(String, Type, IContainerFormat, boolean, boolean) passing false for aStreamsCanBeAddedDynamically, and true for aLookForAllStreams.
If the current thread is interrupted while this blocking method is running the method will return with a negative value. To check if the method exited because of an interruption pass the return value to IError#make(int) and then check IError#getType() to see if it is IError.Type#ERROR_INTERRUPTED.
| url | The resource to open; The format of this string is any url that FFMPEG supports (including additional protocols if added through the core.io library). |
| type | The type of this container. |
| pContainerFormat | A pointer to a ContainerFormat object specifying the format of this container, or 0 (NULL) if you want us to guess. |
Implemented in com::avpkit::core::Container.
|
pure virtual |
Open this container and make it ready for reading or writing, optionally reading as far into the container as necessary to find all streams.
The caller must call close() when done, but if not, the IContainer will eventually close them later but warn to the logging system.
If the current thread is interrupted while this blocking method is running the method will return with a negative value. To check if the method exited because of an interruption pass the return value to IError#make(int) and then check IError#getType() to see if it is IError.Type#ERROR_INTERRUPTED.
| url | The resource to open; The format of this string is any url that FFMPEG supports (including additional protocols if added through the core.io library). |
| type | The type of this container. |
| pContainerFormat | A pointer to a ContainerFormat object specifying the format of this container, or 0 (NULL) if you want us to guess. |
| aStreamsCanBeAddedDynamically | If true, open() will expect that new streams can be added at any time, even after the format header has been read. |
| aQueryStreamMetaData | If true, open() will call queryStreamMetaData() on this container, which will potentially block until it has ready enough data to find all streams in a container. If false, it will only block to read a minimal header for this container format. |
Implemented in com::avpkit::core::Container.
|
pure virtual |
Attempts to read all the meta data in this stream, potentially by reading ahead and decoding packets.
Any packets this method reads ahead will be cached and correctly returned when you read packets, but this method can be non-blocking potentially until end of container to get all meta data. Take care when you call it.
After this method is called, other meta data methods like getDuration() should work.
If the current thread is interrupted while this blocking method is running the method will return with a negative value. To check if the method exited because of an interruption pass the return value to IError#make(int) and then check IError#getType() to see if it is IError.Type#ERROR_INTERRUPTED.
Implemented in com::avpkit::core::Container.
|
pure virtual |
Reads the next packet into the IPacket.
This method will release any buffers currently held by this packet and allocate new ones.
If the current thread is interrupted while this blocking method is running the method will return with a negative value. To check if the method exited because of an interruption pass the return value to IError#make(int) and then check IError#getType() to see if it is IError.Type#ERROR_INTERRUPTED.
| packet | [In/Out] The packet the IContainer will read into. |
Implemented in com::avpkit::core::Container.
|
pure virtual |
EXPERIMENTAL - Seeks to timestamp in the container.
Seeking will be done so that the point from which all active streams can be presented successfully will be closest to targetTimeStamp and within minTimeStamp/maxTimeStamp.
If flags contain SEEK_FLAG_BYTE, then all time stamps are in bytes and are the file position (this may not be supported by all demuxers). If flags contain SEEK_FLAG_FRAME, then all time stamps are in frames in the stream with streamIndex (this may not be supported by all demuxers). Otherwise all time stamps are in units of the stream selected by stream_index or if stream_index is -1, in microseconds. If flags contain SEEK_FLAG_ANY, then non-keyframes are treated as keyframes (this may not be supported by all demuxers). If flags contain SEEK_FLAG_BACKWARDS, then we will attempt to search backwards in the container (this may not be supported by all demuxers and file protocols).
This is part of the new seek API which is still under construction. It may change in future AVPKit versions.
| streamIndex | index of the stream which is used as time base reference |
| minTimeStamp | smallest acceptable time stamp. |
| targetTimeStamp | target time stamp. |
| maxTimeStamp | largest acceptable time stamp. |
| flags | A bitmask of the SEEK_FLAG_* flags, or 0 to turn all flags off. |
Implemented in com::avpkit::core::Container.
|
pure virtual |
Seeks to the key frame at (or the first one after) the given timestamp.
This method will always fail for any IContainer that is not seekable (e.g. is streamed). When successful the next call to readNextPacket(IPacket) will get the next keyframe from the sought for stream.
If the current thread is interrupted while this blocking method is running the method will return with a negative value. To check if the method exited because of an interruption pass the return value to IError#make(int) and then check IError#getType() to see if it is IError.Type#ERROR_INTERRUPTED.
WARNING:: This method will be deprecated in a future AVPKit release and replaced with the new API seekKeyFrame(int, long, long, long, int).
| streamIndex | The stream to search for the keyframe in; must be a stream the IContainer has either queried meta-data about or already ready a packet for. |
| timestamp | The timestamp, in the timebase of the stream you're looking in (not necessarily Microseconds). |
| flags | Flags to pass to com.avpkit.core.io.IURLProtocolHandler's seek method. |
|
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::Container.
|
pure virtual |
Set the flags to use with this object.
All values must be ORed (|) together.
| newFlags | The new set flags for this codec. |
Implemented in com::avpkit::core::Container.
|
pure virtual |
Forces the IContainer to assume all audio streams are encoded with the given audio codec when demuxing.
| id | The codec id |
Implemented in com::avpkit::core::Container.
|
pure virtual |
Forces the IContainer to assume all subtitle streams are encoded with the given subtitle codec when demuxing.
| id | The codec id |
Implemented in com::avpkit::core::Container.
|
pure virtual |
Forces the IContainer to assume all video streams are encoded with the given video codec when demuxing.
| id | The codec id |
Implemented in com::avpkit::core::Container.
|
pure virtual |
Set the IContainerFormat to use with this IContainer.
If called when the IContainer is opened, or if previously called with a non-null value, an error is returned and no action is taken.
| format | The format to use return 0 on success; <0 on failure |
Implemented in com::avpkit::core::Container.
|
pure virtual |
Set the buffer length AVPKit will suggest to FFMPEG for reading inputs.
If called when a IContainer is open, the call is ignored and -1 is returned.
| size | The suggested buffer size. |
Implemented in com::avpkit::core::Container.
|
pure virtual |
Sets the max delay for the AVFormatContext.max_delay property.
| maxdelay | maximum delay for container |
Implemented in com::avpkit::core::Container.
|
pure virtual |
Set the IMetaData on this object, overriding any previous meta data.
You should call this method on writable containers and before you call IContainer#writeHeader, as it probably won't do anything after that.
Implemented in com::avpkit::core::Container.
|
pure virtual |
@Deprecated use setProperty instead.
If the container has not already been opened, sets the AVFormatContext.preload property which can be useful in some circumstances such as when dealing with mpeg formats.
| preload | amount to preload |
Implemented in com::avpkit::core::Container.
|
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::Container.
|
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::Container.
|
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::Container.
|
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::Container.
|
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::Container.
|
pure virtual |
Sets the read retry count.
| count | The read retry count. <0 means keep trying. |
Implemented in com::avpkit::core::Container.
|
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::Container.
|
pure virtual |
Adds a header, if needed, for this container.
Call this AFTER you've added all streams you want to add, opened all IStreamCoders for those streams (with proper configuration) and before you write the first frame. If you attempt to write a header but haven't opened all codecs, this method will log a warning, and your output file will likely be corrupt.
If the current thread is interrupted while this blocking method is running the method will return with a negative value. To check if the method exited because of an interruption pass the return value to IError#make(int) and then check IError#getType() to see if it is IError.Type#ERROR_INTERRUPTED.
Implemented in com::avpkit::core::Container.
|
pure virtual |
Writes the contents of the packet to the container, but make sure the packets are interleaved.
This means the IContainer may have to queue up packets from one stream while waiting for packets from another.
If the current thread is interrupted while this blocking method is running the method will return with a negative value. To check if the method exited because of an interruption pass the return value to IError#make(int) and then check IError#getType() to see if it is IError.Type#ERROR_INTERRUPTED.
| packet | [In] The packet to write out. |
Implemented in com::avpkit::core::Container.
|
pure virtual |
Writes the contents of the packet to the container.
If the current thread is interrupted while this blocking method is running the method will return with a negative value. To check if the method exited because of an interruption pass the return value to IError#make(int) and then check IError#getType() to see if it is IError.Type#ERROR_INTERRUPTED.
| packet | [In] The packet to write out. |
| forceInterleave | [In] If true, then this IContainer will make sure all packets are interleaved by DTS (even across streams in a container). If false, the IContainer won't, and it's up to the caller to interleave if necessary. |
Implemented in com::avpkit::core::Container.
|
pure virtual |
Adds a trailer, if needed, for this container.
Call this AFTER you've written all data you're going to write to this container but BEFORE you call IStreamCoder#close() on your IStreamCoder objects.
You must call writeHeader() before you call this (and if you don't, the IContainer will warn loudly and not actually write the trailer).
If you have closed any of the IStreamCoder objects that were open when you called writeHeader(), then this method will fail.
If the current thread is interrupted while this blocking method is running the method will return with a negative value. To check if the method exited because of an interruption pass the return value to IError#make(int) and then check IError#getType() to see if it is IError.Type#ERROR_INTERRUPTED.
Implemented in com::avpkit::core::Container.