mutex frame_mu;
vector<int64_t> frames[MAX_STREAMS];
+QGLWidget *global_share_widget;
int record_thread_func();
av_register_all();
avformat_network_init();
+ QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true);
+
+ QSurfaceFormat fmt;
+ fmt.setDepthBufferSize(0);
+ fmt.setStencilBufferSize(0);
+ fmt.setProfile(QSurfaceFormat::CoreProfile);
+ fmt.setMajorVersion(3);
+ fmt.setMinorVersion(1);
+
+ // Turn off vsync, since Qt generally gives us at most frame rate
+ // (display frequency) / (number of QGLWidgets active).
+ fmt.setSwapInterval(0);
+
+ QSurfaceFormat::setDefaultFormat(fmt);
+
+ QGLFormat::setDefaultFormat(QGLFormat::fromSurfaceFormat(fmt));
+
QApplication app(argc, argv);
+ global_share_widget = new QGLWidget();
+ if (!global_share_widget->isValid()) {
+ fprintf(stderr, "Failed to initialize OpenGL. Futatabi needs at least OpenGL 3.1 to function properly.\n");
+ exit(1);
+ }
MainWindow mainWindow;
mainWindow.show();
thread(record_thread_func).detach();
- start_player_thread();
return app.exec();
}
if (av_read_frame(format_ctx.get(), &pkt) != 0) {
break;
}
- fprintf(stderr, "Got a frame from camera %d, pts = %ld, size = %d\n",
- pkt.stream_index, pkt.pts, pkt.size);
+ //fprintf(stderr, "Got a frame from camera %d, pts = %ld, size = %d\n",
+ // pkt.stream_index, pkt.pts, pkt.size);
string filename = filename_for_frame(pkt.stream_index, pkt.pts);
FILE *fp = fopen(filename.c_str(), "wb");
if (fp == nullptr) {
global_mainwindow->ui->input2_display->setFrame(pkt.stream_index, pkt.pts);
} else if (pkt.stream_index == 2) {
global_mainwindow->ui->input3_display->setFrame(pkt.stream_index, pkt.pts);
+ } else if (pkt.stream_index == 3) {
+ global_mainwindow->ui->input4_display->setFrame(pkt.stream_index, pkt.pts);
}
});