mirror of
https://github.com/lostjared/Acid.Cam.v2.Qt.git
synced 2025-12-13 18:30:02 +01:00
adding stuff
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
|
||||
#include"qtheaders.h"
|
||||
|
||||
|
||||
class DisplayWindow : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
@@ -85,6 +85,11 @@ AC_MainWindow::AC_MainWindow(QWidget *parent) : QMainWindow(parent) {
|
||||
take_snapshot = false;
|
||||
goto_window = new GotoWindow(this);
|
||||
disp = new DisplayWindow(this);
|
||||
disp2 = new DisplayWindow(this);
|
||||
disp2->setFixedSize(640, 480);
|
||||
disp2->setGeometry(100, 100, 640, 480);
|
||||
disp2->hide();
|
||||
disp2->setWindowTitle("View Window");
|
||||
playback = new Playback();
|
||||
|
||||
goto_window->setParent(this);
|
||||
@@ -475,6 +480,9 @@ void AC_MainWindow::createMenu() {
|
||||
connect(show_fullscreen, SIGNAL(triggered()), this, SLOT(showFull()));
|
||||
controls_menu->addAction(show_image_window);
|
||||
connect(show_image_window, SIGNAL(triggered()), this, SLOT(showImageWindow()));
|
||||
show_control_window = new QAction(tr("Show View Window"), this);
|
||||
connect(show_control_window, SIGNAL(triggered()), this, SLOT(controls_ShowDisp2()));
|
||||
controls_menu->addAction(show_control_window);
|
||||
|
||||
reset_filters = new QAction(tr("Reset Filters"), this);
|
||||
reset_filters->setShortcut(tr("Ctrl+R"));
|
||||
@@ -896,7 +904,11 @@ bool AC_MainWindow::startCamera(int res, int dev, const QString &outdir, bool re
|
||||
struct tm *m;
|
||||
m = localtime(&t);
|
||||
QString ext;
|
||||
ext = (type == 0) ? ".mov" : ".avi";
|
||||
if(type >= 0 && type < 3)
|
||||
ext = ".mp4";
|
||||
else
|
||||
ext = ".avi";
|
||||
//ext = (type == 0) ? ".mov" : ".avi";
|
||||
Log(tr("Capture Device Opened [Camera]\n"));
|
||||
std::ostringstream time_stream;
|
||||
time_stream << "-" << (m->tm_year + 1900) << "." << (m->tm_mon + 1) << "." << m->tm_mday << "_" << m->tm_hour << "." << m->tm_min << "." << m->tm_sec << "_";
|
||||
@@ -931,7 +943,22 @@ bool AC_MainWindow::startCamera(int res, int dev, const QString &outdir, bool re
|
||||
|
||||
if(recording) {
|
||||
video_file_name = output_name;
|
||||
writer = cv::VideoWriter(output_name.toStdString(), (type == 0) ? cv::VideoWriter::fourcc('m', 'p', '4', 'v') : cv::VideoWriter::fourcc('X','V','I','D'), video_fps, cv::Size(res_w, res_h), true);
|
||||
int c_type = 0;
|
||||
switch(type) {
|
||||
case 0:
|
||||
c_type = cv::VideoWriter::fourcc('m', 'p', '4', 'v');
|
||||
break;
|
||||
case 1:
|
||||
c_type = cv::VideoWriter::fourcc('a', 'v', 'c', '3');
|
||||
break;
|
||||
case 2:
|
||||
c_type = cv::VideoWriter::fourcc('h', 'e', 'v', '1');
|
||||
break;
|
||||
case '3':
|
||||
c_type = cv::VideoWriter::fourcc('X', 'V', 'I', 'D');
|
||||
break;
|
||||
}
|
||||
writer = cv::VideoWriter(output_name.toStdString(), c_type, video_fps, cv::Size(res_w, res_h), true);
|
||||
|
||||
if(!writer.isOpened()) {
|
||||
Log(tr("Could not create video writer..\n"));
|
||||
@@ -998,7 +1025,11 @@ bool AC_MainWindow::startVideo(const QString &filename, const QString &outdir, b
|
||||
struct tm *m;
|
||||
m = localtime(&t);
|
||||
QString ext;
|
||||
ext = (type == 0) ? ".mov" : ".avi";
|
||||
if(type >= 0 && type < 3)
|
||||
ext = ".mp4";
|
||||
else
|
||||
ext = ".avi";
|
||||
//ext = (type == 0) ? ".mov" : ".avi";
|
||||
std::ostringstream time_stream;
|
||||
time_stream << "-" << (m->tm_year + 1900) << "." << (m->tm_mon + 1) << "." << m->tm_mday << "_" << m->tm_hour << "." << m->tm_min << "." << m->tm_sec << "_";
|
||||
stream_ << outdir << "/" << "Video" << time_stream.str().c_str() << "AC2.Output." << (++index) << ext;
|
||||
@@ -1006,7 +1037,22 @@ bool AC_MainWindow::startVideo(const QString &filename, const QString &outdir, b
|
||||
|
||||
if(recording) {
|
||||
video_file_name = output_name;
|
||||
writer = cv::VideoWriter(output_name.toStdString(), (type == 0) ? cv::VideoWriter::fourcc('m', 'p', '4', 'v') : cv::VideoWriter::fourcc('X','V','I','D'), video_fps, cv::Size(res_w, res_h), true);
|
||||
int c_type = 0;
|
||||
switch(type) {
|
||||
case 0:
|
||||
c_type = cv::VideoWriter::fourcc('m', 'p', '4', 'v');
|
||||
break;
|
||||
case 1:
|
||||
c_type = cv::VideoWriter::fourcc('a', 'v', 'c', '1');
|
||||
break;
|
||||
case 2:
|
||||
c_type = cv::VideoWriter::fourcc('h', 'e', 'v', '1');
|
||||
break;
|
||||
case '3':
|
||||
c_type = cv::VideoWriter::fourcc('X', 'V', 'I', 'D');
|
||||
break;
|
||||
}
|
||||
writer = cv::VideoWriter(output_name.toStdString(), c_type, video_fps, cv::Size(res_w, res_h), true);
|
||||
|
||||
if(!writer.isOpened()) {
|
||||
Log("Error could not open video writer.\n");
|
||||
@@ -1078,6 +1124,17 @@ void AC_MainWindow::controls_ShowVideo() {
|
||||
}
|
||||
}
|
||||
|
||||
void AC_MainWindow::controls_ShowDisp2() {
|
||||
QString st = show_control_window->text();
|
||||
if(st == "Hide Control Window") {
|
||||
disp2->hide();
|
||||
show_control_window->setText("Show View Window");
|
||||
} else {
|
||||
show_control_window->setText("Hide Control Window");
|
||||
disp2->show();
|
||||
}
|
||||
}
|
||||
|
||||
void AC_MainWindow::controls_Reset() {
|
||||
playback->reset_filters();
|
||||
}
|
||||
@@ -1201,6 +1258,7 @@ void AC_MainWindow::setFrameIndex(int index) {
|
||||
void AC_MainWindow::updateFrame(QImage img) {
|
||||
if(playback->isStopped() == false) {
|
||||
disp->displayImage(img);
|
||||
disp2->displayImage(img);
|
||||
frame_index++;
|
||||
QString frame_string;
|
||||
QTextStream frame_stream(&frame_string);
|
||||
|
||||
@@ -58,6 +58,7 @@ public:
|
||||
QAction *show_fullscreen;
|
||||
QAction *show_image_window;
|
||||
QAction *show_options_window;
|
||||
QAction *show_control_window;
|
||||
double speed_actions[7];
|
||||
QRadioButton *filter_single, *filter_custom;
|
||||
void updateList();
|
||||
@@ -84,6 +85,7 @@ public slots:
|
||||
void controls_ShowVideo();
|
||||
void controls_SetKey();
|
||||
void controls_Reset();
|
||||
void controls_ShowDisp2();
|
||||
void help_About();
|
||||
void updateFrame(QImage img);
|
||||
void stopRecording();
|
||||
@@ -128,6 +130,7 @@ private:
|
||||
void createControls();
|
||||
void createMenu();
|
||||
DisplayWindow *disp;
|
||||
DisplayWindow *disp2;
|
||||
CaptureCamera *cap_camera;
|
||||
CaptureVideo *cap_video;
|
||||
SearchWindow *search_box;
|
||||
|
||||
@@ -50,8 +50,10 @@ void CaptureCamera::createControls() {
|
||||
|
||||
video_type = new QComboBox(this);
|
||||
video_type->setGeometry(80, 90, 90, 25);
|
||||
video_type->addItem("MOV");
|
||||
video_type->addItem("AVI");
|
||||
video_type->addItem("MP4 - MPEG-4");
|
||||
video_type->addItem("MP4 - AVC");
|
||||
video_type->addItem("MP4 - HEVC");
|
||||
video_type->addItem("AVI - XviD");
|
||||
}
|
||||
|
||||
void CaptureCamera::setParent(AC_MainWindow *p) {
|
||||
@@ -119,8 +121,10 @@ void CaptureVideo::createControls() {
|
||||
|
||||
video_type = new QComboBox(this);
|
||||
video_type->setGeometry(180, 55, 120, 25);
|
||||
video_type->addItem("MOV");
|
||||
video_type->addItem("AVI");
|
||||
video_type->addItem("MP4 - MPEG-4");
|
||||
video_type->addItem("MP4 - AVC");
|
||||
video_type->addItem("MP4 - HEVC");
|
||||
video_type->addItem("AVI - XviD");
|
||||
connect(btn_setedit, SIGNAL(clicked()), this, SLOT(btn_SetSourceFile()));
|
||||
connect(btn_setout, SIGNAL(clicked()), this, SLOT(btn_SetOutputDir()));
|
||||
connect(btn_start, SIGNAL(clicked()), this, SLOT(btn_Start()));
|
||||
|
||||
Reference in New Issue
Block a user