avcpp
2.0
Wrapper for the FFmpeg that simplify usage from C++ projects.
|
Go to the documentation of this file.
18 #include <libavformat/avformat.h>
29 virtual int write(
const uint8_t *data,
size_t size)
31 static_cast<void>(data);
32 static_cast<void>(size);
35 virtual int read(uint8_t *data,
size_t size)
37 static_cast<void>(data);
38 static_cast<void>(size);
42 virtual int64_t
seek(int64_t offset,
int whence)
44 static_cast<void>(offset);
45 static_cast<void>(whence);
50 virtual const char*
name()
const {
return ""; }
81 [[deprecated(
"Codec is not used by the FFmpeg API. Use addStream() without codec and point configured codec context after")]]
208 void writeFrame(AVFrame *frame,
int streamIndex,
OptionalErrorCode ec,
int(*write_proc)(AVFormatContext*,
int,AVFrame*));
212 static int avioInterruptCb(
void *opaque);
213 int avioInterruptCb();
214 void setupInterruptHandling();
215 void resetSocketAccess();
217 void closeCodecContexts();
218 int checkPbError(
int stat);
225 std::shared_ptr<char> m_monitor {
new char};
226 std::chrono::time_point<std::chrono::system_clock> m_lastSocketAccess;
227 int64_t m_socketTimeout = -1;
230 bool m_isOpened =
false;
231 bool m_customIO =
false;
232 bool m_streamsInfoFound =
false;
233 bool m_headerWriten =
false;
234 bool m_substractStartTime =
false;
void dump() const
Definition: formatcontext.cpp:196
Stream stream(size_t idx)
Definition: formatcontext.cpp:209
void flush()
Definition: formatcontext.cpp:149
Array of Dictinaries wrapper.
Definition: dictionary.h:588
Implements interface to access to the AVDictionary entity.
Definition: dictionary.h:30
void openInput(CustomIO *io, Dictionary &formatOptions, OptionalErrorCode ec=throws(), size_t internalBufferSize=CUSTOM_IO_DEFAULT_BUFFER_SIZE)
Definition: formatcontext.h:134
virtual ~CustomIO()
Definition: formatcontext.h:28
void close()
Definition: formatcontext.cpp:157
InputFormat inputFormat() const
Definition: formatcontext.cpp:123
void writeUncodedFrame(class VideoFrame &frame, size_t streamIndex, OptionalErrorCode ec=throws())
Definition: formatcontext.cpp:791
virtual int read(uint8_t *data, size_t size)
Definition: formatcontext.h:35
void eventFlagsClear(int flags) noexcept
Definition: formatcontext.cpp:357
Stream addStream(const Codec &codec, OptionalErrorCode ec=throws())
Definition: formatcontext.cpp:232
void setSocketTimeout(int64_t timeout)
Definition: formatcontext.cpp:89
void setInterruptCallback(const AvioInterruptCb &cb)
Definition: formatcontext.cpp:94
void openInput(const std::string &uri, OptionalErrorCode ec=throws())
static constexpr size_t CUSTOM_IO_DEFAULT_BUFFER_SIZE
Definition: formatcontext.h:126
void writePacket(OptionalErrorCode ec=throws())
Definition: formatcontext.cpp:734
Timestamp duration() const noexcept
Definition: formatcontext.cpp:370
void findStreamInfo(OptionalErrorCode ec=throws())
Definition: formatcontext.cpp:477
void openOutput(const std::string &uri, OptionalErrorCode ec=throws())
bool checkUncodedFrameWriting(size_t streamIndex, std::error_code &ec) noexcept
void writePacketDirect(OptionalErrorCode ec=throws())
Definition: formatcontext.cpp:744
virtual int64_t seek(int64_t offset, int whence)
whence is a one of SEEK_* from stdio.h
Definition: formatcontext.h:42
Definition: formatcontext.h:26
Definition: codeccontext.h:28
Definition: codeccontext.h:442
int eventFlags() const noexcept
Flags to the user to detect events happening on the file.
Definition: formatcontext.cpp:343
virtual int seekable() const
Return combination of AVIO_SEEKABLE_* flags or zero.
Definition: formatcontext.h:49
~FormatContext()
Definition: formatcontext.cpp:80
virtual const char * name() const
Definition: formatcontext.h:50
void seek(const Timestamp ×tamp, OptionalErrorCode ec=throws())
Definition: formatcontext.cpp:300
Definition: audioresampler.cpp:8
Definition: codeccontext.h:588
bool isOutput() const
Definition: formatcontext.cpp:139
FormatContext()
Definition: formatcontext.cpp:74
virtual int write(const uint8_t *data, size_t size)
Definition: formatcontext.h:29
Packet readPacket(OptionalErrorCode ec=throws())
Definition: formatcontext.cpp:499
void writeUncodedFrameDirect(class VideoFrame &frame, size_t streamIndex, OptionalErrorCode ec=throws())
Definition: formatcontext.cpp:796
bool isOpened() const
Definition: formatcontext.cpp:144
std::function< int()> AvioInterruptCb
Definition: formatcontext.h:24
void substractStartTime(bool enable)
Definition: formatcontext.cpp:364
OutputFormat outputFormat() const
Definition: formatcontext.cpp:131
Definition: formatcontext.h:53
Timestamp startTime() const noexcept
Definition: formatcontext.cpp:334
The Timestamp class represents timestamp value and it timebase.
Definition: timestamp.h:13
void writeTrailer(OptionalErrorCode ec=throws())
Definition: formatcontext.cpp:915
void openInput(CustomIO *io, OptionalErrorCode ec=throws(), size_t internalBufferSize=CUSTOM_IO_DEFAULT_BUFFER_SIZE)
Definition: formatcontext.h:128
size_t streamsCount() const
Definition: formatcontext.cpp:204
void setFormat(const InputFormat &format)
Definition: formatcontext.cpp:99
void writeHeader(OptionalErrorCode ec=throws())
Definition: formatcontext.cpp:686
bool seekable() const noexcept
Definition: formatcontext.cpp:292
void openInput(CustomIO *io, Dictionary &&formatOptions, OptionalErrorCode ec=throws(), size_t internalBufferSize=CUSTOM_IO_DEFAULT_BUFFER_SIZE)
Definition: formatcontext.h:141