feat: add avpipes

This commit is contained in:
2026-03-14 02:56:51 +01:00
parent 5c08732f6c
commit 9e90e40fdd
5 changed files with 353 additions and 29 deletions

32
app/mosh-pipe.cpp Normal file
View 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());
}
}