feat: add avpipes
This commit is contained in:
32
app/mosh-pipe.cpp
Normal file
32
app/mosh-pipe.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
|
||||
#include "mosh-me/avpipe.hpp"
|
||||
#include <avcpp/av.h>
|
||||
#include <avcpp/codeccontext.h>
|
||||
#include <avcpp/formatcontext.h>
|
||||
#include <avcpp/stream.h>
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
if (argc < 3) {
|
||||
spdlog::error("Please invoke with {} <ifile> <ofile>", argv[0]);
|
||||
}
|
||||
|
||||
av::init();
|
||||
|
||||
try {
|
||||
auto pipe = mosh_me::VideoMuxer::link(std::filesystem::path(argv[2]))
|
||||
<< mosh_me::DropIFrames::link()
|
||||
<< mosh_me::MoshableVideoEncoder::link()
|
||||
<< mosh_me::VideoDecoder::link()
|
||||
<< mosh_me::VideoPacketSource::link(argv[1]);
|
||||
|
||||
pipe.propagateMeta();
|
||||
|
||||
if (auto result = pipe.pull(); !result.has_value()) {
|
||||
spdlog::error("Pipe failed");
|
||||
}
|
||||
|
||||
} catch (const av::Exception &e) {
|
||||
spdlog::error("{}", e.what());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user