Demux and seek.
Demux and seek.
#include <iostream>
#include <set>
#include <map>
#include <memory>
#include <functional>
int main(int argc, char **argv)
{
if (argc < 2)
return 1;
av::setFFmpegLoggingLevel(AV_LOG_DEBUG);
string uri {argv[1]};
error_code ec;
clog <<
"Seekable: " << ictx.
seekable() << endl;
{
clog <<
"Seek 0: [" << pkt.
streamIndex() <<
"] pts=" << pkt.pts() <<
" / " << pkt.pts().seconds() << endl;
}
{
clog <<
"Seek 0: [" << pkt.
streamIndex() <<
"] pts=" << pkt.pts() <<
" / " << pkt.pts().seconds() << endl;
}
{
clog << "Seek 2:\n";
while (true) {
if (!pkt)
break;
clog <<
" [" << pkt.
streamIndex() <<
"] pts=" << pkt.pts() <<
" / " << pkt.pts().seconds() << endl;
}
}
{
clog << "Seek 3:\n";
size_t count = 100;
while (count --> 0) {
if (!pkt)
break;
clog <<
" [" << pkt.
streamIndex() <<
"] pts=" << pkt.pts() <<
" / " << pkt.pts().seconds() << endl;
}
}
}
Audio resampling with libswresample.
Common helpers: comparisons, value lookup, non-copyable base, string utilities.
Container context: the entry point for demuxing, muxing and seeking.
Definition formatcontext.h:153
void openInput(const std::string &uri, OptionalErrorCode ec=throws())
Open an input and probe its container.
void findStreamInfo(OptionalErrorCode ec=throws())
Read the stream parameters of an opened input.
bool seekable() const noexcept
Whether the container supports seeking.
void seek(const Timestamp ×tamp, OptionalErrorCode ec=throws())
Seek to a timestamp in any stream.
Packet readPacket(OptionalErrorCode ec=throws())
Read the next packet from any stream.
int streamIndex() const
Index of the stream the packet belongs to.
Codec descriptors and lookup by name or id.
Codec contexts: opening, configuring, encoding and decoding.
FFmpeg types re-exported for the public API and small value wrappers.
Container format contexts: opening, demuxing, muxing and seeking.
Root namespace of the library.
Definition audioresampler.h:19
void init()
Initialize all subsystems the library needs.
Compressed packets and their side data.
Video scaling and pixel format conversion with libswscale.