FFmpegPlayer/main.cpp
2024-01-18 22:22:26 +08:00

36 lines
1.3 KiB
C++

#include "AudioDecoder.h"
#include "Demuxer.h"
#include "IoContext.h"
#include "VideoDecoder.h"
#include "WebRTCPublisher.h"
#include <QApplication>
#include <QWidget>
#include <iostream>
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
auto ioContext = Amass::Singleton<IoContext>::instance<Amass::Construct>();
std::cout << "hello world." << std::endl;
constexpr auto path = "E:/Documents/juren-30s.mp4";
Demuxer demuxer;
demuxer.open(path);
// auto [audioCodec, audioCodecParameter] = demuxer.codecInformation(Stream::Audio);
// auto [videoCodec, videoCodecParameter] = demuxer.codecInformation(Stream::Video);
// VideoDecoder videoDecoder(videoCodec, videoCodecParameter);
// // AudioDecoder audioDecoder(audioCodec, audioCodecParameter);
// demuxer.setStreamPacketCallback(
// Stream::Video, [&videoDecoder](const std::shared_ptr<AVPacket> &packet) { videoDecoder.push(packet); });
// // demuxer.setStreamPacketCallback(Stream::Audio,
// // std::bind(&AudioDecoder::push, &audioDecoder, std::placeholders::_1));
// demuxer.start();
// videoDecoder.start();
QWidget w;
// w.show();
WebRTCPublisher rtc(*ioContext->ioContext());
ioContext->run<IoContext::Mode::Asynchronous>();
return app.exec();
}