|
avcpp 3.1.0
Wrapper for the FFmpeg that simplify usage from C++ projects.
|
Container context: the entry point for demuxing, muxing and seeking. More...
#include <formatcontext.h>
Public Member Functions | |
| void | setSocketTimeout (int64_t timeout) |
| Abort network operations that block for too long. | |
| void | setInterruptCallback (const AvioInterruptCb &cb) |
| Install a callback that can cancel blocking IO. | |
| void | setFormat (const InputFormat &format) |
| Force the demuxer used by openInput(). | |
| void | setFormat (const OutputFormat &format) |
| Force the muxer used by openOutput(). | |
| InputFormat | inputFormat () const |
| The demuxer in use. | |
| OutputFormat | outputFormat () const |
| The muxer in use. | |
| bool | isOutput () const |
| Whether this context writes instead of reads. | |
| bool | isOpened () const |
| Whether the container is open. | |
| void | flush () |
| Discard buffered packets and internal state. | |
| void | close () |
| Close the container and release its resources. | |
| void | dump () const |
| Print the container layout through the FFmpeg log system. | |
| size_t | streamsCount () const |
| Number of streams in the container. | |
| Stream | stream (size_t idx) |
| Stream by index. | |
| Stream | stream (size_t idx, OptionalErrorCode ec) |
| Stream by index, reporting an out-of-range index as an error. | |
| Stream | addStream (const Codec &codec, OptionalErrorCode ec=throws()) |
| Add a stream for the given codec. | |
| Stream | addStream (OptionalErrorCode ec=throws()) |
| Add a stream to an output container. | |
| Stream | addStream (const class VideoEncoderContext &encCtx, OptionalErrorCode ec=throws()) |
| Add a video stream configured from an encoder context. | |
| Stream | addStream (const class AudioEncoderContext &encCtx, OptionalErrorCode ec=throws()) |
| Add an audio stream configured from an encoder context. | |
| StreamsView | streams (OptionalErrorCode ec=throws()) const |
| All streams as a range, for range-based for and std algorithms. | |
| bool | seekable () const noexcept |
| Whether the container supports seeking. | |
| void | seek (const Timestamp ×tamp, OptionalErrorCode ec=throws()) |
| Seek to a timestamp in any stream. | |
| void | seek (const Timestamp ×tamp, size_t streamIndex, OptionalErrorCode ec=throws()) |
| Seek to a timestamp in a specific stream. | |
| void | seek (const Timestamp ×tamp, bool anyFrame, OptionalErrorCode ec=throws()) |
| Seek to a timestamp, choosing between key frames and any frame. | |
| void | seek (const Timestamp ×tamp, size_t streamIndex, bool anyFrame, OptionalErrorCode ec=throws()) |
| Seek to a timestamp in a specific stream, choosing the frame kind. | |
| void | seek (int64_t position, int streamIndex, int flags, OptionalErrorCode ec=throws()) |
| Seek with raw FFmpeg arguments. | |
| Timestamp | startTime () const noexcept |
| Start time of the container. | |
| Timestamp | duration () const noexcept |
| Duration of the container. | |
| void | substractStartTime (bool enable) |
| Shift timestamps so the file starts at zero. | |
| int | eventFlags () const noexcept |
| Flags to the user to detect events happening on the file. | |
| bool | eventFlags (int flags) const noexcept |
| Whether any of the given events happened. | |
| void | eventFlagsClear (int flags) noexcept |
| Acknowledge events. | |
| void | openInput (const std::string &uri, OptionalErrorCode ec=throws()) |
| Open an input and probe its container. | |
| void | openInput (const std::string &uri, Dictionary &formatOptions, OptionalErrorCode ec=throws()) |
| Open an input with demuxer options. | |
| void | openInput (const std::string &uri, Dictionary &&formatOptions, OptionalErrorCode ec=throws()) |
| Open an input with demuxer options, taking ownership of the dictionary. | |
| void | openInput (const std::string &uri, InputFormat format, OptionalErrorCode ec=throws()) |
| Open an input with an explicit demuxer. | |
| void | openInput (const std::string &uri, Dictionary &formatOptions, InputFormat format, OptionalErrorCode ec=throws()) |
| Open an input with an explicit demuxer and options. | |
| void | openInput (const std::string &uri, Dictionary &&formatOptions, InputFormat format, OptionalErrorCode ec=throws()) |
| Open an input with an explicit demuxer and options, moving the dictionary. | |
| void | openInput (CustomIO *io, OptionalErrorCode ec=throws(), size_t internalBufferSize=CUSTOM_IO_DEFAULT_BUFFER_SIZE) |
| Open an input on a custom IO object. | |
| void | openInput (CustomIO *io, Dictionary &formatOptions, OptionalErrorCode ec=throws(), size_t internalBufferSize=CUSTOM_IO_DEFAULT_BUFFER_SIZE) |
| Open an input on a custom IO object with demuxer options. | |
| void | openInput (CustomIO *io, Dictionary &&formatOptions, OptionalErrorCode ec=throws(), size_t internalBufferSize=CUSTOM_IO_DEFAULT_BUFFER_SIZE) |
| Open an input on a custom IO object with demuxer options, moving the dictionary. | |
| void | openInput (CustomIO *io, InputFormat format, OptionalErrorCode ec=throws(), size_t internalBufferSize=CUSTOM_IO_DEFAULT_BUFFER_SIZE) |
| Open an input on a custom IO object with an explicit demuxer. | |
| void | openInput (CustomIO *io, Dictionary &formatOptions, InputFormat format, OptionalErrorCode ec=throws(), size_t internalBufferSize=CUSTOM_IO_DEFAULT_BUFFER_SIZE) |
| Open an input on a custom IO object with an explicit demuxer and options. | |
| void | openInput (CustomIO *io, Dictionary &&formatOptions, InputFormat format, OptionalErrorCode ec=throws(), size_t internalBufferSize=CUSTOM_IO_DEFAULT_BUFFER_SIZE) |
| Open an input on a custom IO object with an explicit demuxer and options, moving the dictionary. | |
| void | findStreamInfo (OptionalErrorCode ec=throws()) |
| Read the stream parameters of an opened input. | |
| void | findStreamInfo (DictionaryArray &streamsOptions, OptionalErrorCode ec=throws()) |
| Read the stream parameters with per-stream options. | |
| void | findStreamInfo (DictionaryArray &&streamsOptions, OptionalErrorCode ec=throws()) |
| Read the stream parameters with per-stream options, moving them in. | |
| Packet | readPacket (OptionalErrorCode ec=throws()) |
| Read the next packet from any stream. | |
| void | openOutput (const std::string &uri, OptionalErrorCode ec=throws()) |
| Open an output. | |
| void | openOutput (const std::string &uri, Dictionary &options, OptionalErrorCode ec=throws()) |
| Open an output with muxer options. | |
| void | openOutput (const std::string &uri, Dictionary &&options, OptionalErrorCode ec=throws()) |
| Open an output with muxer options, moving the dictionary. | |
| void | openOutput (const std::string &uri, OutputFormat format, OptionalErrorCode ec=throws()) |
| Open an output with an explicit muxer. | |
| void | openOutput (const std::string &uri, Dictionary &options, OutputFormat format, OptionalErrorCode ec=throws()) |
| Open an output with an explicit muxer and options. | |
| void | openOutput (const std::string &uri, Dictionary &&options, OutputFormat format, OptionalErrorCode ec=throws()) |
| Open an output with an explicit muxer and options, moving the dictionary. | |
| void | writeHeader (OptionalErrorCode ec=throws()) |
| Write the container header. | |
| void | writeHeader (Dictionary &options, OptionalErrorCode ec=throws()) |
| Write the container header with muxer options. | |
| void | writeHeader (Dictionary &&options, OptionalErrorCode ec=throws()) |
| Write the container header with muxer options, moving the dictionary. | |
| void | writePacket (OptionalErrorCode ec=throws()) |
| Flush the muxer queue. | |
| void | writePacket (const Packet &pkt, OptionalErrorCode ec=throws()) |
| Write one packet. | |
| void | writePacketDirect (OptionalErrorCode ec=throws()) |
| Flush the muxer queue without intercepting FFmpeg errors. | |
| void | writePacketDirect (const Packet &pkt, OptionalErrorCode ec=throws()) |
| Write one packet without intercepting FFmpeg errors. | |
| bool | checkUncodedFrameWriting (size_t streamIndex, std::error_code &ec) noexcept |
| Whether an uncompressed frame can be written to a stream. | |
| bool | checkUncodedFrameWriting (size_t streamIndex) noexcept |
| Whether an uncompressed frame can be written to a stream. | |
| void | writeUncodedFrame (class VideoFrame &frame, size_t streamIndex, OptionalErrorCode ec=throws()) |
| Write an uncompressed video frame through the muxer. | |
| void | writeUncodedFrameDirect (class VideoFrame &frame, size_t streamIndex, OptionalErrorCode ec=throws()) |
| Write an uncompressed video frame without intercepting FFmpeg errors. | |
| void | writeUncodedFrame (class AudioSamples &frame, size_t streamIndex, OptionalErrorCode ec=throws()) |
| Write uncompressed audio samples through the muxer. | |
| void | writeUncodedFrameDirect (class AudioSamples &frame, size_t streamIndex, OptionalErrorCode ec=throws()) |
| Write uncompressed audio samples without intercepting FFmpeg errors. | |
| void | writeTrailer (OptionalErrorCode ec=throws()) |
| Write the container trailer and close the output. | |
| void | openOutput (CustomIO *io, OptionalErrorCode ec=throws(), size_t internalBufferSize=CUSTOM_IO_DEFAULT_BUFFER_SIZE) |
| Open output on a custom IO object. | |
| bool | openOutput (CustomIO *io, Dictionary &formatOptions, OptionalErrorCode ec=throws(), size_t internalBufferSize=CUSTOM_IO_DEFAULT_BUFFER_SIZE) |
| Open output on a custom IO object with explicit muxer options. | |
| bool | openOutput (CustomIO *io, Dictionary &&formatOptions, OptionalErrorCode ec=throws(), size_t internalBufferSize=CUSTOM_IO_DEFAULT_BUFFER_SIZE) |
| Open output on a custom IO object with muxer options, moving the dictionary. | |
| void | openOutput (CustomIO *io, OutputFormat format, OptionalErrorCode ec=throws(), size_t internalBufferSize=CUSTOM_IO_DEFAULT_BUFFER_SIZE) |
| Open output on a custom IO object with an explicit output format. | |
| bool | openOutput (CustomIO *io, Dictionary &formatOptions, OutputFormat format, OptionalErrorCode ec=throws(), size_t internalBufferSize=CUSTOM_IO_DEFAULT_BUFFER_SIZE) |
| Open output on a custom IO object with an explicit output format and muxer options. | |
| bool | openOutput (CustomIO *io, Dictionary &&formatOptions, OutputFormat format, OptionalErrorCode ec=throws(), size_t internalBufferSize=CUSTOM_IO_DEFAULT_BUFFER_SIZE) |
| Open output on a custom IO object with an explicit format and options, moving the dictionary. | |
| bool | initOutput (OptionalErrorCode ec=throws()) |
| Init output without writing the header. | |
| bool | initOutput (Dictionary &options, OptionalErrorCode ec=throws()) |
| Init the output with muxer options instead of writing the header. | |
| bool | initOutput (Dictionary &&options, OptionalErrorCode ec=throws()) |
| Init the output with muxer options, moving the dictionary. | |
| Public Member Functions inherited from FFWrapperPtr< AVFormatContext > | |
| FFWrapperPtr ()=default | |
| Create an empty wrapper; isNull() is true. | |
| const AVFormatContext * | raw () const |
| Read access to the wrapped object. | |
| void | reset (AVFormatContext *raw=nullptr) |
| Replace the stored pointer. | |
| bool | isNull () const |
| Whether the wrapper is empty. | |
| void | _log (int level, const char *fmt) const |
| Log through the FFmpeg log system, using this wrapper as the context. | |
Static Public Attributes | |
| static constexpr size_t | CUSTOM_IO_DEFAULT_BUFFER_SIZE = 200000 |
| Default size of the buffer avcpp allocates around a custom IO object. | |
Additional Inherited Members | |
| Protected Member Functions inherited from av::noncopyable | |
| noncopyable (const noncopyable &)=delete | |
| void | operator= (const noncopyable &)=delete |
| Protected Attributes inherited from FFWrapperPtr< AVFormatContext > | |
| AVFormatContext * | m_raw |
| The wrapped pointer; owned by the derived class, not by this template. | |
The context owns the streams and the streams own the packets that come out of them. Reading is a loop of readPacket()/writePacket(); the container itself is opened once and closed by the destructor.
The context is not copyable: it owns resources and FFmpeg refers to it by pointer, so moving it would invalidate the relationships between the streams, the packets and the IO layer.
| Stream av::FormatContext::addStream | ( | const class AudioEncoderContext & | encCtx, |
| OptionalErrorCode | ec = throws() ) |
| encCtx | an opened audio encoder; its parameters are copied |
| ec | holder for the error code |
| Stream av::FormatContext::addStream | ( | const class VideoEncoderContext & | encCtx, |
| OptionalErrorCode | ec = throws() ) |
| encCtx | an opened video encoder; its parameters are copied |
| ec | holder for the error code |
| Stream av::FormatContext::addStream | ( | const Codec & | codec, |
| OptionalErrorCode | ec = throws() ) |
| codec | codec the stream is created for |
| ec | holder for the error code; when it is not throws() an error is reported through it instead of an exception |
| Stream av::FormatContext::addStream | ( | OptionalErrorCode | ec = throws() | ) |
The stream parameters are set afterwards, usually by copying them from an input stream or by attaching a configured encoder context.
| ec | holder for the error code |
|
noexcept |
| streamIndex | index of the output stream |
|
noexcept |
Some muxers accept raw frames instead of encoded packets; this checks the stream configuration before the frame is handed over.
| streamIndex | index of the output stream |
| ec | set when the check fails |
| void av::FormatContext::close | ( | ) |
Called by the destructor; call it explicitly only to release file handles early.
| void av::FormatContext::dump | ( | ) | const |
Diagnostic only: streams, codecs and formats are written at info level.
|
noexcept |
|
noexcept |
A combination of AVFMT_EVENT_FLAG_*. Must be cleared by the user.
|
noexcept |
| flags | combination of AVFMT_EVENT_FLAG_* to test |
|
noexcept |
| flags | the AVFMT_EVENT_FLAG_* bits to clear |
| void av::FormatContext::findStreamInfo | ( | DictionaryArray && | streamsOptions, |
| OptionalErrorCode | ec = throws() ) |
| streamsOptions | one dictionary per stream, moved into the call |
| ec | holder for the error code |
| void av::FormatContext::findStreamInfo | ( | DictionaryArray & | streamsOptions, |
| OptionalErrorCode | ec = throws() ) |
| streamsOptions | one dictionary per stream; FFmpeg removes the options it recognizes |
| ec | holder for the error code |
| void av::FormatContext::findStreamInfo | ( | OptionalErrorCode | ec = throws() | ) |
Required before streams carry usable codec parameters: probing fills them only partially.
| ec | holder for the error code |
| void av::FormatContext::flush | ( | ) |
Used after seeking, so that data read before the seek does not leak into the stream that follows it.
| bool av::FormatContext::initOutput | ( | Dictionary && | options, |
| OptionalErrorCode | ec = throws() ) |
| options | muxer options, moved into the call |
| ec | holder for the error code |
| bool av::FormatContext::initOutput | ( | Dictionary & | options, |
| OptionalErrorCode | ec = throws() ) |
| options | muxer options; the object stays usable, but FFmpeg removes the options it recognized |
| ec | holder for the error code |
| bool av::FormatContext::initOutput | ( | OptionalErrorCode | ec = throws() | ) |
All overloads accept the output options as a dictionary, or use the ones set on the context. If a dictionary is passed here, writeHeader() must not be called with the same dictionary.
| ec | holder for the error code; when it is not throws() an error is reported through it instead of an exception |
| true | format initialized in avformat_init_output(), |
| false | format will be initialized in avformat_write_header(), |
| InputFormat av::FormatContext::inputFormat | ( | ) | const |
| bool av::FormatContext::isOpened | ( | ) | const |
| bool av::FormatContext::isOutput | ( | ) | const |
| void av::FormatContext::openInput | ( | const std::string & | uri, |
| Dictionary && | formatOptions, | ||
| InputFormat | format, | ||
| OptionalErrorCode | ec = throws() ) |
| uri | resource name |
| formatOptions | demuxer options, moved into the call |
| format | the demuxer to use |
| ec | holder for the error code |
| void av::FormatContext::openInput | ( | const std::string & | uri, |
| Dictionary && | formatOptions, | ||
| OptionalErrorCode | ec = throws() ) |
| uri | resource name |
| formatOptions | demuxer options, moved into the call |
| ec | holder for the error code |
| void av::FormatContext::openInput | ( | const std::string & | uri, |
| Dictionary & | formatOptions, | ||
| InputFormat | format, | ||
| OptionalErrorCode | ec = throws() ) |
| uri | resource name |
| formatOptions | demuxer options; the object stays usable, but FFmpeg removes the options it recognized |
| format | the demuxer to use |
| ec | holder for the error code |
| void av::FormatContext::openInput | ( | const std::string & | uri, |
| Dictionary & | formatOptions, | ||
| OptionalErrorCode | ec = throws() ) |
| uri | resource name |
| formatOptions | demuxer options; the object stays usable, but FFmpeg removes the options it recognized |
| ec | holder for the error code |
| void av::FormatContext::openInput | ( | const std::string & | uri, |
| InputFormat | format, | ||
| OptionalErrorCode | ec = throws() ) |
| uri | resource name |
| format | the demuxer to use instead of probing |
| ec | holder for the error code |
| void av::FormatContext::openInput | ( | const std::string & | uri, |
| OptionalErrorCode | ec = throws() ) |
Probing reads the beginning of the stream, so the format is known without calling findStreamInfo().
| uri | resource name |
| ec | holder for the error code |
| void av::FormatContext::openInput | ( | CustomIO * | io, |
| Dictionary && | formatOptions, | ||
| InputFormat | format, | ||
| OptionalErrorCode | ec = throws(), | ||
| size_t | internalBufferSize = CUSTOM_IO_DEFAULT_BUFFER_SIZE ) |
| io | the source of the bytes; it must outlive the context |
| formatOptions | demuxer options, moved into the call |
| format | the demuxer to use |
| ec | holder for the error code |
| internalBufferSize | size of the IO buffer avcpp allocates |
|
inline |
| io | the source of the bytes; it must outlive the context |
| formatOptions | demuxer options, moved into the call |
| ec | holder for the error code |
| internalBufferSize | size of the IO buffer avcpp allocates |
| void av::FormatContext::openInput | ( | CustomIO * | io, |
| Dictionary & | formatOptions, | ||
| InputFormat | format, | ||
| OptionalErrorCode | ec = throws(), | ||
| size_t | internalBufferSize = CUSTOM_IO_DEFAULT_BUFFER_SIZE ) |
| io | the source of the bytes; it must outlive the context |
| formatOptions | demuxer options; the object stays usable, but FFmpeg removes the options it recognized |
| format | the demuxer to use |
| ec | holder for the error code |
| internalBufferSize | size of the IO buffer avcpp allocates |
|
inline |
| io | the source of the bytes; it must outlive the context |
| formatOptions | demuxer options; the object stays usable, but FFmpeg removes the options it recognized |
| ec | holder for the error code |
| internalBufferSize | size of the IO buffer avcpp allocates |
| void av::FormatContext::openInput | ( | CustomIO * | io, |
| InputFormat | format, | ||
| OptionalErrorCode | ec = throws(), | ||
| size_t | internalBufferSize = CUSTOM_IO_DEFAULT_BUFFER_SIZE ) |
| io | the source of the bytes; it must outlive the context |
| format | the demuxer to use instead of probing |
| ec | holder for the error code |
| internalBufferSize | size of the IO buffer avcpp allocates |
|
inline |
| io | the source of the bytes; it must outlive the context |
| ec | holder for the error code |
| internalBufferSize | size of the IO buffer avcpp allocates |
| void av::FormatContext::openOutput | ( | const std::string & | uri, |
| Dictionary && | options, | ||
| OptionalErrorCode | ec = throws() ) |
| uri | resource name |
| options | muxer options, moved into the call |
| ec | holder for the error code |
| void av::FormatContext::openOutput | ( | const std::string & | uri, |
| Dictionary && | options, | ||
| OutputFormat | format, | ||
| OptionalErrorCode | ec = throws() ) |
| uri | resource name |
| options | muxer options, moved into the call |
| format | the muxer to use |
| ec | holder for the error code |
| void av::FormatContext::openOutput | ( | const std::string & | uri, |
| Dictionary & | options, | ||
| OptionalErrorCode | ec = throws() ) |
| uri | resource name |
| options | muxer options; the object stays usable, but FFmpeg removes the options it recognized |
| ec | holder for the error code |
| void av::FormatContext::openOutput | ( | const std::string & | uri, |
| Dictionary & | options, | ||
| OutputFormat | format, | ||
| OptionalErrorCode | ec = throws() ) |
| uri | resource name |
| options | muxer options; the object stays usable, but FFmpeg removes the options it recognized |
| format | the muxer to use |
| ec | holder for the error code |
| void av::FormatContext::openOutput | ( | const std::string & | uri, |
| OptionalErrorCode | ec = throws() ) |
The muxer comes from the format set on the context or from the file name.
| uri | resource name |
| ec | holder for the error code |
| void av::FormatContext::openOutput | ( | const std::string & | uri, |
| OutputFormat | format, | ||
| OptionalErrorCode | ec = throws() ) |
| uri | resource name |
| format | the muxer to use |
| ec | holder for the error code |
| bool av::FormatContext::openOutput | ( | CustomIO * | io, |
| Dictionary && | formatOptions, | ||
| OptionalErrorCode | ec = throws(), | ||
| size_t | internalBufferSize = CUSTOM_IO_DEFAULT_BUFFER_SIZE ) |
| io | custom IO object that receives the output |
| formatOptions | muxer options, moved into the call |
| ec | holder for the error code |
| internalBufferSize | size of the buffer allocated around the custom IO object |
| bool av::FormatContext::openOutput | ( | CustomIO * | io, |
| Dictionary && | formatOptions, | ||
| OutputFormat | format, | ||
| OptionalErrorCode | ec = throws(), | ||
| size_t | internalBufferSize = CUSTOM_IO_DEFAULT_BUFFER_SIZE ) |
| io | custom IO object that receives the output |
| formatOptions | muxer options, moved into the call |
| format | muxer to use |
| ec | holder for the error code |
| internalBufferSize | size of the buffer allocated around the custom IO object |
| bool av::FormatContext::openOutput | ( | CustomIO * | io, |
| Dictionary & | formatOptions, | ||
| OptionalErrorCode | ec = throws(), | ||
| size_t | internalBufferSize = CUSTOM_IO_DEFAULT_BUFFER_SIZE ) |
The options are passed to initOutput(), so writeHeader() must not be called with the same dictionary.
| io | custom IO object that receives the output |
| formatOptions | muxer options |
| ec | holder for the error code |
| internalBufferSize | size of the buffer allocated around the custom IO object |
| true | the format was initialized during the call |
| false | the format will be initialized by writeHeader() |
| bool av::FormatContext::openOutput | ( | CustomIO * | io, |
| Dictionary & | formatOptions, | ||
| OutputFormat | format, | ||
| OptionalErrorCode | ec = throws(), | ||
| size_t | internalBufferSize = CUSTOM_IO_DEFAULT_BUFFER_SIZE ) |
| io | custom IO object that receives the output |
| formatOptions | muxer options, passed to initOutput() |
| format | muxer to use |
| ec | holder for the error code |
| internalBufferSize | size of the buffer allocated around the custom IO object |
| true | the format was initialized during the call |
| false | the format will be initialized by writeHeader() |
| void av::FormatContext::openOutput | ( | CustomIO * | io, |
| OptionalErrorCode | ec = throws(), | ||
| size_t | internalBufferSize = CUSTOM_IO_DEFAULT_BUFFER_SIZE ) |
The output format is deduced from the file name, from OutputFormat set on the context, or from the muxer passed explicitly in the overloads below.
| io | custom IO object that receives the output |
| ec | holder for the error code; when it is not throws() an error is reported through it instead of an exception |
| internalBufferSize | size of the buffer allocated around the custom IO object |
| void av::FormatContext::openOutput | ( | CustomIO * | io, |
| OutputFormat | format, | ||
| OptionalErrorCode | ec = throws(), | ||
| size_t | internalBufferSize = CUSTOM_IO_DEFAULT_BUFFER_SIZE ) |
| io | custom IO object that receives the output |
| format | muxer to use instead of deducing it from the name |
| ec | holder for the error code |
| internalBufferSize | size of the buffer allocated around the custom IO object |
| OutputFormat av::FormatContext::outputFormat | ( | ) | const |
| Packet av::FormatContext::readPacket | ( | OptionalErrorCode | ec = throws() | ) |
| ec | holder for the error code |
| void av::FormatContext::seek | ( | const Timestamp & | timestamp, |
| bool | anyFrame, | ||
| OptionalErrorCode | ec = throws() ) |
| timestamp | target position |
| anyFrame | true stops at any frame, false at a key frame, which is what a decoder needs to start from |
| ec | holder for the error code |
| void av::FormatContext::seek | ( | const Timestamp & | timestamp, |
| OptionalErrorCode | ec = throws() ) |
| timestamp | target position; a default timestamp seeks to the start |
| ec | holder for the error code |
| void av::FormatContext::seek | ( | const Timestamp & | timestamp, |
| size_t | streamIndex, | ||
| bool | anyFrame, | ||
| OptionalErrorCode | ec = throws() ) |
| timestamp | target position in that stream's time base |
| streamIndex | index of the stream to seek in |
| anyFrame | true stops at any frame, false at a key frame |
| ec | holder for the error code |
| void av::FormatContext::seek | ( | const Timestamp & | timestamp, |
| size_t | streamIndex, | ||
| OptionalErrorCode | ec = throws() ) |
| timestamp | target position in that stream's time base |
| streamIndex | index of the stream to seek in |
| ec | holder for the error code |
| void av::FormatContext::seek | ( | int64_t | position, |
| int | streamIndex, | ||
| int | flags, | ||
| OptionalErrorCode | ec = throws() ) |
| position | byte position in AV_TIME_BASE units when streamIndex is -1, otherwise in the stream time base |
| streamIndex | stream to seek in, or -1 for the container default |
| flags | combination of AVSEEK_FLAG_* |
| ec | holder for the error code |
|
noexcept |
| void av::FormatContext::setFormat | ( | const InputFormat & | format | ) |
| format | the input format; an empty one restores probing by name |
| void av::FormatContext::setFormat | ( | const OutputFormat & | format | ) |
| format | the output format; must be set before addStream() |
| void av::FormatContext::setInterruptCallback | ( | const AvioInterruptCb & | cb | ) |
| cb | the callback; it is copied and called from the IO thread |
| void av::FormatContext::setSocketTimeout | ( | int64_t | timeout | ) |
| timeout | milliseconds without progress before the operation is interrupted; a negative value disables the check |
|
noexcept |
| Stream av::FormatContext::stream | ( | size_t | idx | ) |
| idx | zero-based index; must be less than streamsCount() |
| Stream av::FormatContext::stream | ( | size_t | idx, |
| OptionalErrorCode | ec ) |
| idx | zero-based index |
| ec | holder for the error code |
| StreamsView av::FormatContext::streams | ( | OptionalErrorCode | ec = throws() | ) | const |
| ec | holder for the error code |
| size_t av::FormatContext::streamsCount | ( | ) | const |
| void av::FormatContext::substractStartTime | ( | bool | enable | ) |
| enable | true subtracts startTime() from every timestamp handed out |
| void av::FormatContext::writeHeader | ( | Dictionary && | options, |
| OptionalErrorCode | ec = throws() ) |
| options | muxer options, moved into the call |
| ec | holder for the error code |
| void av::FormatContext::writeHeader | ( | Dictionary & | options, |
| OptionalErrorCode | ec = throws() ) |
| options | muxer options; the object stays usable, but FFmpeg removes the options it recognized |
| ec | holder for the error code |
| void av::FormatContext::writeHeader | ( | OptionalErrorCode | ec = throws() | ) |
Must be called after the streams are added and the output is opened, and before the first packet is written.
| ec | holder for the error code |
| void av::FormatContext::writePacket | ( | const Packet & | pkt, |
| OptionalErrorCode | ec = throws() ) |
The packet must already carry the output stream index and timestamps in that stream's time base.
| pkt | the packet to write |
| ec | holder for the error code |
| void av::FormatContext::writePacket | ( | OptionalErrorCode | ec = throws() | ) |
Call it before writeTrailer() when the muxer may still hold packets, which some formats do for reordering.
| ec | holder for the error code |
| void av::FormatContext::writePacketDirect | ( | const Packet & | pkt, |
| OptionalErrorCode | ec = throws() ) |
Used when the caller needs the raw error codes instead of the avcpp categories.
| pkt | the packet to write |
| ec | holder for the error code |
| void av::FormatContext::writePacketDirect | ( | OptionalErrorCode | ec = throws() | ) |
| ec | holder for the error code |
| void av::FormatContext::writeTrailer | ( | OptionalErrorCode | ec = throws() | ) |
Without it a file can be unplayable even though its size looks plausible: the index is written here.
| ec | holder for the error code |
| void av::FormatContext::writeUncodedFrame | ( | class AudioSamples & | frame, |
| size_t | streamIndex, | ||
| OptionalErrorCode | ec = throws() ) |
| frame | the samples to write |
| streamIndex | index of the output stream |
| ec | holder for the error code |
| void av::FormatContext::writeUncodedFrame | ( | class VideoFrame & | frame, |
| size_t | streamIndex, | ||
| OptionalErrorCode | ec = throws() ) |
Only formats that accept raw video take this path; check it with checkUncodedFrameWriting() first.
| frame | the frame to write; the muxer may reference it |
| streamIndex | index of the output stream |
| ec | holder for the error code |
| void av::FormatContext::writeUncodedFrameDirect | ( | class AudioSamples & | frame, |
| size_t | streamIndex, | ||
| OptionalErrorCode | ec = throws() ) |
| frame | the samples to write |
| streamIndex | index of the output stream |
| ec | holder for the error code |
| void av::FormatContext::writeUncodedFrameDirect | ( | class VideoFrame & | frame, |
| size_t | streamIndex, | ||
| OptionalErrorCode | ec = throws() ) |
| frame | the frame to write |
| streamIndex | index of the output stream |
| ec | holder for the error code |