diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c1b62a8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.pro.user +*.pro.user.* diff --git a/ajapreviewwidget.h b/ajapreviewwidget.h new file mode 100644 index 0000000..ab399a6 --- /dev/null +++ b/ajapreviewwidget.h @@ -0,0 +1,74 @@ +#ifndef AJAPREVIEW_WIDGET_H +#define AJAPREVIEW_WIDGET_H + +#include +#include +#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) + #include +#else + #include +#endif +#include +#include +#include +#if defined (INCLUDE_AJACC) + #include "ajacc/includes/ntv2caption608types.h" +#endif // defined (INCLUDE_AJACC) + +class AJAPreviewWidget; + +#define AJAPREVIEW_WIDGET_X (960) +#define AJAPREVIEW_WIDGET_Y (540) + +typedef struct +{ + bool display; + QRectF roiRect; /// normalize to width and height 0.0-1.0 + QColor roiRectColor; + +} ROIStruct; + +typedef QList ROIRectList; + + +class AJAPreviewWidget : public QFrame +{ + Q_OBJECT + + public: + AJAPreviewWidget (QWidget * parent = 0); + + signals: + void wheelDelta (int delta); + void droppedFile (QString fileName); + + public slots: + void updateFrame (const QImage &image,bool clear); + void updateFrameWithStatus (const QImage &image,const QString &statusString,bool clear); + void updateFrameWithROI (const QImage &image,ROIRectList roiList, bool clear); + void updateROI (ROIRectList roiList); + void updateStatusString (const QString statusString); + #if defined (INCLUDE_AJACC) + void updateCaptionScreen (const ushort * inScreen); + #endif // defined (INCLUDE_AJACC) + + protected: + void paintEvent (QPaintEvent * event); + void wheelEvent (QWheelEvent * event); + + void dragEnterEvent (QDragEnterEvent *event); + void dropEvent (QDropEvent *event); + + private: + QPixmap _pixmap; + QString _statusString; + int _step; + ROIRectList _roiList; + QSize _unscaledImageSize; + #if defined (INCLUDE_AJACC) + QString _captionStrings [15]; + #endif // defined (INCLUDE_AJACC) + +}; // AJAPreviewWidget + +#endif // AJAPREVIEW_WIDGET_H diff --git a/gui.pro b/gui.pro index 11c30c5..c37d56c 100644 --- a/gui.pro +++ b/gui.pro @@ -4,7 +4,7 @@ # #------------------------------------------------- -QT += core gui +QT += core multimedia widgets gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets @@ -15,17 +15,27 @@ TEMPLATE = app # any feature of Qt which as been marked as deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. -DEFINES += QT_DEPRECATED_WARNINGS +DEFINES += QT_DEPRECATED_WARNINGS AJALinux # You can also make your code fail to compile if you use deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 +QMAKE_LIBFLAGS += -lajantv2 #TODO - Figure out why/if this is needed SOURCES += main.cpp\ mainwindow.cpp -HEADERS += mainwindow.h +HEADERS += mainwindow.h \ + ntv2qtpreview.h + +NTV2_SDK_PATH=/home/mark/ntv2sdklinux_13.1.0.1 + +LIBS += $$NTV2_SDK_PATH/lib + +INCLUDEPATH += $$NTV2_SDK_PATH/ajalibraries/ajantv2/includes\ + $$NTV2_SDK_PATH/ajalibraries/ajantv2/src/lin\ + $$NTV2_SDK_PATH/ajalibraries/ FORMS += mainwindow.ui diff --git a/gui.pro.user b/gui.pro.user deleted file mode 100644 index 020b779..0000000 --- a/gui.pro.user +++ /dev/null @@ -1,874 +0,0 @@ - - - - - - EnvironmentId - {a42c32bb-2768-4cba-a3df-3e4658a2e0fb} - - - ProjectExplorer.Project.ActiveTarget - 0 - - - ProjectExplorer.Project.EditorSettings - - true - false - true - - Cpp - - CppGlobal - - - - QmlJS - - QmlJSGlobal - - - 2 - UTF-8 - false - 4 - false - 80 - true - true - 1 - true - false - 0 - true - true - 0 - 8 - true - 1 - true - true - true - false - - - - ProjectExplorer.Project.PluginSettings - - - - ProjectExplorer.Project.Target.0 - - Desktop Qt 5.8.0 clang 64bit - Desktop Qt 5.8.0 clang 64bit - qt.58.clang_64_kit - 0 - 0 - 0 - - /Users/markmniece/Projects/Qt/build-gui-Desktop_Qt_5_8_0_clang_64bit-Debug - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - - Qt4ProjectManager.Qt4BuildConfiguration - 2 - true - - - /Users/markmniece/Projects/Qt/build-gui-Desktop_Qt_5_8_0_clang_64bit-Release - - - true - qmake - - QtProjectManager.QMakeBuildStep - false - - false - false - false - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - - /Users/markmniece/Projects/Qt/build-gui-Desktop_Qt_5_8_0_clang_64bit-Profile - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - true - false - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - 3 - - - 0 - Deploy - - ProjectExplorer.BuildSteps.Deploy - - 1 - Deploy locally - - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - gui - - Qt4ProjectManager.Qt4RunConfiguration:/Users/markmniece/Projects/Qt/gui/gui.pro - true - - gui.pro - false - - /Users/markmniece/Projects/Qt/build-gui-Desktop_Qt_5_8_0_clang_64bit-Debug/gui.app/Contents/MacOS - 3768 - false - true - false - false - true - - 1 - - - - ProjectExplorer.Project.Target.1 - - iphoneos-clang Qt 5.8.0 for iOS - iphoneos-clang Qt 5.8.0 for iOS - {7b19bf33-f170-4e76-8200-0f179d9b5214} - 0 - 0 - 0 - - /Users/markmniece/Projects/Qt/build-gui-iphoneos_clang_Qt_5_8_0_for_iOS-Debug - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - - Qt4ProjectManager.Qt4BuildConfiguration - 2 - true - - - /Users/markmniece/Projects/Qt/build-gui-iphoneos_clang_Qt_5_8_0_for_iOS-Release - - - true - qmake - - QtProjectManager.QMakeBuildStep - false - - false - false - false - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - - /Users/markmniece/Projects/Qt/build-gui-iphoneos_clang_Qt_5_8_0_for_iOS-Profile - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - true - false - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - 3 - - - - true - Deploy to Mark Mniece’s iPhone - - Qt4ProjectManager.IosDeployStep - - 1 - Deploy - - ProjectExplorer.BuildSteps.Deploy - - 1 - Deploy to iOS - Deploy to iOS - Qt4ProjectManager.IosDeployConfiguration - - 1 - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - - - 0 - - - Run on Mark Mniece’s iPhone - Run gui on Mark Mniece’s iPhone - Qt4ProjectManager.IosRunConfiguration:/Users/markmniece/Projects/Qt/gui/gui.pro - 3768 - false - true - false - false - true - - 1 - - - - ProjectExplorer.Project.Target.2 - - iphonesimulator-clang Qt 5.8.0 for iOS - iphonesimulator-clang Qt 5.8.0 for iOS - {ed5df6b8-9d81-4ea4-8da1-dd9eb3020b18} - 0 - 0 - 0 - - /Users/markmniece/Projects/Qt/build-gui-iphonesimulator_clang_Qt_5_8_0_for_iOS-Debug - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - - Qt4ProjectManager.Qt4BuildConfiguration - 2 - true - - - /Users/markmniece/Projects/Qt/build-gui-iphonesimulator_clang_Qt_5_8_0_for_iOS-Release - - - true - qmake - - QtProjectManager.QMakeBuildStep - false - - false - false - false - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - - /Users/markmniece/Projects/Qt/build-gui-iphonesimulator_clang_Qt_5_8_0_for_iOS-Profile - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - true - false - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - 3 - - - - true - Deploy to iOS Simulator - - Qt4ProjectManager.IosDeployStep - - 1 - Deploy - - ProjectExplorer.BuildSteps.Deploy - - 1 - Deploy to iOS - Deploy to iOS - Qt4ProjectManager.IosDeployConfiguration - - 1 - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - iPhone SE, iOS 10.3 - 76BAE224-A000-4C97-A5FA-408C078A00A3 - 1 - - - Run on iOS Simulator - Run gui on iOS Simulator - Qt4ProjectManager.IosRunConfiguration:/Users/markmniece/Projects/Qt/gui/gui.pro - 3768 - false - true - false - false - true - - 1 - - - - ProjectExplorer.Project.TargetCount - 3 - - - ProjectExplorer.Project.Updater.FileVersion - 18 - - - Version - 18 - - diff --git a/gui.pro.user.a42c32b b/gui.pro.user.a42c32b deleted file mode 100644 index 32c3b9d..0000000 --- a/gui.pro.user.a42c32b +++ /dev/null @@ -1,874 +0,0 @@ - - - - - - EnvironmentId - {a42c32bb-2768-4cba-a3df-3e4658a2e0fb} - - - ProjectExplorer.Project.ActiveTarget - 2 - - - ProjectExplorer.Project.EditorSettings - - true - false - true - - Cpp - - CppGlobal - - - - QmlJS - - QmlJSGlobal - - - 2 - UTF-8 - false - 4 - false - 80 - true - true - 1 - true - false - 0 - true - true - 0 - 8 - true - 1 - true - true - true - false - - - - ProjectExplorer.Project.PluginSettings - - - - ProjectExplorer.Project.Target.0 - - Desktop Qt 5.8.0 clang 64bit - Desktop Qt 5.8.0 clang 64bit - qt.58.clang_64_kit - 0 - 0 - 0 - - /Users/markmniece/Projects/Qt/build-gui-Desktop_Qt_5_8_0_clang_64bit-Debug - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - - Qt4ProjectManager.Qt4BuildConfiguration - 2 - true - - - /Users/markmniece/Projects/Qt/build-gui-Desktop_Qt_5_8_0_clang_64bit-Release - - - true - qmake - - QtProjectManager.QMakeBuildStep - false - - false - false - false - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - - /Users/markmniece/Projects/Qt/build-gui-Desktop_Qt_5_8_0_clang_64bit-Profile - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - true - false - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - 3 - - - 0 - Deploy - - ProjectExplorer.BuildSteps.Deploy - - 1 - Deploy locally - - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - gui - - Qt4ProjectManager.Qt4RunConfiguration:/Users/markmniece/Projects/Qt/gui/gui.pro - true - - gui.pro - false - - /Users/markmniece/Projects/Qt/build-gui-iphonesimulator_clang_Qt_5_8_0_for_iOS-Debug/gui.app/Contents/MacOS - 3768 - false - true - false - false - true - - 1 - - - - ProjectExplorer.Project.Target.1 - - iphoneos-clang Qt 5.8.0 for iOS - iphoneos-clang Qt 5.8.0 for iOS - {7b19bf33-f170-4e76-8200-0f179d9b5214} - 0 - 0 - 0 - - /Users/markmniece/Projects/Qt/build-gui-iphoneos_clang_Qt_5_8_0_for_iOS-Debug - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - - Qt4ProjectManager.Qt4BuildConfiguration - 2 - true - - - /Users/markmniece/Projects/Qt/build-gui-iphoneos_clang_Qt_5_8_0_for_iOS-Release - - - true - qmake - - QtProjectManager.QMakeBuildStep - false - - false - false - false - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - - /Users/markmniece/Projects/Qt/build-gui-iphoneos_clang_Qt_5_8_0_for_iOS-Profile - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - true - false - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - 3 - - - - true - Deploy to Mark Mniece’s iPhone - - Qt4ProjectManager.IosDeployStep - - 1 - Deploy - - ProjectExplorer.BuildSteps.Deploy - - 1 - Deploy to iOS - Deploy to iOS - Qt4ProjectManager.IosDeployConfiguration - - 1 - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - - - 0 - - - Run on Mark Mniece’s iPhone - Run gui on Mark Mniece’s iPhone - Qt4ProjectManager.IosRunConfiguration:/Users/markmniece/Projects/Qt/gui/gui.pro - 3768 - false - true - false - false - true - - 1 - - - - ProjectExplorer.Project.Target.2 - - iphonesimulator-clang Qt 5.8.0 for iOS - iphonesimulator-clang Qt 5.8.0 for iOS - {ed5df6b8-9d81-4ea4-8da1-dd9eb3020b18} - 0 - 0 - 0 - - /Users/markmniece/Projects/Qt/build-gui-iphonesimulator_clang_Qt_5_8_0_for_iOS-Debug - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - - Qt4ProjectManager.Qt4BuildConfiguration - 2 - true - - - /Users/markmniece/Projects/Qt/build-gui-iphonesimulator_clang_Qt_5_8_0_for_iOS-Release - - - true - qmake - - QtProjectManager.QMakeBuildStep - false - - false - false - false - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - - /Users/markmniece/Projects/Qt/build-gui-iphonesimulator_clang_Qt_5_8_0_for_iOS-Profile - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - true - false - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - 3 - - - - true - Deploy to iOS Simulator - - Qt4ProjectManager.IosDeployStep - - 1 - Deploy - - ProjectExplorer.BuildSteps.Deploy - - 1 - Deploy to iOS - Deploy to iOS - Qt4ProjectManager.IosDeployConfiguration - - 1 - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - iPhone SE, iOS 10.2 - 97411DE5-69F7-45FB-984A-AC4DEA85CFCE - 1 - - - Run on iOS Simulator - Run gui on iOS Simulator - Qt4ProjectManager.IosRunConfiguration:/Users/markmniece/Projects/Qt/gui/gui.pro - 3768 - false - true - false - false - true - - 1 - - - - ProjectExplorer.Project.TargetCount - 3 - - - ProjectExplorer.Project.Updater.FileVersion - 18 - - - Version - 18 - - diff --git a/gui.pro.user.ee88e62 b/gui.pro.user.ee88e62 deleted file mode 100644 index 10d1017..0000000 --- a/gui.pro.user.ee88e62 +++ /dev/null @@ -1,315 +0,0 @@ - - - - - - EnvironmentId - {ee88e623-359e-49e7-a99d-b12446cd9adf} - - - ProjectExplorer.Project.ActiveTarget - 0 - - - ProjectExplorer.Project.EditorSettings - - true - false - true - - Cpp - - CppGlobal - - - - QmlJS - - QmlJSGlobal - - - 2 - UTF-8 - false - 4 - false - 80 - true - true - 1 - true - false - 0 - true - true - 0 - 8 - true - 1 - true - true - true - false - - - - ProjectExplorer.Project.PluginSettings - - - - ProjectExplorer.Project.Target.0 - - Desktop Qt 5.8.0 clang 64bit - Desktop Qt 5.8.0 clang 64bit - qt.58.clang_64_kit - 0 - 0 - 0 - - /Users/markmniece/Projects/Qt/build-gui-Desktop_Qt_5_8_0_clang_64bit-Debug - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Make - - Qt4ProjectManager.MakeStep - - false - - - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - - Qt4ProjectManager.Qt4BuildConfiguration - 2 - true - - - /Users/markmniece/Projects/Qt/build-gui-Desktop_Qt_5_8_0_clang_64bit-Release - - - true - qmake - - QtProjectManager.QMakeBuildStep - false - - false - false - false - - - true - Make - - Qt4ProjectManager.MakeStep - - false - - - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - - /Users/markmniece/Projects/Qt/build-gui-Desktop_Qt_5_8_0_clang_64bit-Profile - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - true - false - - - true - Make - - Qt4ProjectManager.MakeStep - - false - - - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - 3 - - - 0 - Deploy - - ProjectExplorer.BuildSteps.Deploy - - 1 - Deploy locally - - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - - - %{buildDir} - Custom Executable - - ProjectExplorer.CustomExecutableRunConfiguration - 3768 - false - true - false - false - true - - 1 - - - - ProjectExplorer.Project.TargetCount - 1 - - - ProjectExplorer.Project.Updater.FileVersion - 18 - - - Version - 18 - - diff --git a/main.cpp b/main.cpp index d4ab8e5..cce41a8 100644 --- a/main.cpp +++ b/main.cpp @@ -1,22 +1,22 @@ #include "mainwindow.h" #include +#include "ntv2qtpreview.h" -int main(int argc, char *argv[]) -{ - QApplication a(argc, argv); - MainWindow w; - +#include +#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) + #include +#else + #include +#endif +int main (int argc, char * argv []) +{ + QApplication app (argc, argv); + NTV2QtPreview window; - /*QGraphicsView* w = new QGraphicsView(); - QGraphicsScene *scn = new QGraphicsScene( w ); - scn->setSceneRect( w->rect() ); - w->setScene( scn ); - w->setFixedSize( 400, 400 ); - QPixmap pix( "c:\\pix_jpg.jpg" ); - scn->addPixmap( pix );*/ + window.setWindowTitle ("NTV2 Qt Preview"); + window.show (); - w.show(); + return app.exec (); - return a.exec(); } diff --git a/ntv2framegrabber.h b/ntv2framegrabber.h new file mode 100644 index 0000000..018f7ac --- /dev/null +++ b/ntv2framegrabber.h @@ -0,0 +1,194 @@ +/** + @file ntv2framegrabber.h + @brief Header file for the NTV2FrameGrabber class. + @copyright Copyright (C) 2013-2014 AJA Video Systems, Inc. All rights reserved. +**/ + +#ifndef NTV2FRAMEGRABBER_H +#define NTV2FRAMEGRABBER_H + +#include +#include +#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) + #include +#else + #include +#endif +#include +#include +#include "ntv2card.h" +#include "ntv2enums.h" +#include "ntv2task.h" +#include "ntv2rp188.h" +#include "ajabase/common/types.h" +#include "ajabase/system/process.h" +#if defined (INCLUDE_AJACC) + #include "ajacc/includes/ntv2captiondecoder608.h" + #include "ajacc/includes/ntv2captiondecoder708.h" +#endif // INCLUDE_AJACC + +#define QTPREVIEW_WIDGET_X (960) +#define QTPREVIEW_WIDGET_Y (540) + + + +/** + @brief A QThread that captures audio/video from NTV2-compatible AJA devices and uses Qt signals to emit ARGB video frames. + To simplify things, I assume the input signal is YCbCr, and the input goes through a color space converter (CSC) to an + ARGB FrameStore. I can also output 2 channels of Audio to the host audio system using Qt's QAudioOutput device. +**/ + +class NTV2FrameGrabber : public QThread +{ + Q_OBJECT + + // Instance Methods + public: + /** + @brief Constructs me. + @param[in] pInParentObject Optionally specifies my parent object. Defaults to NULL (no parent). + **/ + NTV2FrameGrabber (QObject * pInParentObject = NULL); + + virtual ~NTV2FrameGrabber (); ///< @brief My destructor. + + /** + @brief Sets the input to be used for capture on the AJA device being used. + @param[in] inInputSource Specifies the input source to be used. + **/ + void SetInputSource (const NTV2InputSource inInputSource); + + /** + @brief Enables or disables host audio playback. + @param[in] inWithAudio If true, enables host audio playback; otherwise disables it. + **/ + inline void SetWithAudio (const bool inWithAudio) {mbWithAudio = inWithAudio; mRestart = true;} + + /** + @brief Sets the AJA device to be used for capture. + @param[in] inDeviceIndex Specifies the zero-based index number of the device to be used. + **/ + void SetDeviceIndex (const UWord inDeviceIndex); + + void SetTimeCodeSource (const NTV2TCIndex inTCSource); + + UWord GetDeviceIndex (void) const; + + /** + @brief Enables or disables checking for 4K/UHD video (on devices that supported 4K/UHD). + @param[in] inCheckFor4K If true, enables checking for 4K/UHD video; otherwise disables it. + **/ + inline void CheckFor4kInput (const bool inCheckFor4K) {mCheckFor4K = inCheckFor4K;} + + /** + @brief Enables or disables deinterlacing of non-progressive video. + @param[in] inDeinterlace If true, enables deinterlacing of non-progressive video; otherwise disables it. + **/ + inline void SetDeinterlaceNonProgressiveVideo (const bool inDeinterlace) {mDeinterlace = inDeinterlace;} + + inline bool GetDeinterlaceNonProgressiveVideo (void) const {return mDeinterlace;} ///< @return True if deinterlacing is enabled; otherwise false. + + protected: + void ClearCaptionBuffer (const bool inSignalClients = false); + void GrabCaptions (void); ///< @brief Performs caption data extraction & decoding + + + signals: + /** + @brief This is signaled (called) when a new frame has been captured and is available for display. + @param[in] inImage A QImage that contains the frame image. + @param[in] inClear True if a redraw should take place -- i.e., if the frame is the first of a valid video stream, + or if there is currently no valid video. + **/ + void newFrame (const QImage & inImage, const bool inClear); + + /** + @brief This is signaled (called) when my status string changes. + @param[in] inStatus The QString containing the status message. + **/ + void newStatusString (const QString & inStatus); + + /** + @brief This is signaled (called) when my caption screen buffer changes. + @param[in] pInScreen Points to the (screen) array of Utf16 characters. + **/ + void captionScreenChanged (const ushort * pInScreen); + + private slots: + void changeCaptionChannel (int id); ///< @brief This gets called when a different NTV2Line21Channel is requested. + + + protected: + virtual void run (void); ///< @brief My thread function. + + bool SetupInput (void); ///< @brief Configures my AJA device for capture + void StopAutoCirculate (void); ///< @brief Stops capturing + void SetupAudio (void); ///< @brief Performs audio configuration + + /** + @brief Writes audio samples for channels 1 and 2 that are in the given audio buffer to my QAudioOutput device, + which should play out on the host. + + @param pInOutAudioBuffer Specifies a valid, non-NULL pointer to a buffer containing the audio samples + that were captured from my AJA device for a single frame. This is not a 'const' + pointer because the buffer content will be changed. + On entry, the buffer will contain 6, 8 or 16 channels of 4-byte (32-bit) audio + samples: 0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF... + On exit, the buffer will contain unsigned 2-byte (16-bit) samples in LRLRLRLR order, + which is what Qt's QAudioOutput object is expecting. (The least significant 16 bits + of each sample from the AJA device are discarded.) + + @param inNumValidBytes Specifies the number of valid bytes that are in the audio buffer. + **/ + void OutputAudio (ULWord * pInOutAudioBuffer, const ULWord inNumValidBytes); + + bool CheckForValidInput (void); + + NTV2VideoFormat GetVideoFormatFromInputSource (void); + + bool IsInput3Gb (const NTV2InputSource inputSource); + + // Instance Data + private: + bool mRestart; ///< @brief Set true to reconfigure me and restart AutoCirculate + bool mAbort; ///< @brief Used in my destructor to immediately cause me to exit + bool mCheckFor4K; ///< @brief Check for 4K/UHD video? + bool mDeinterlace; ///< @brief De-interlace non-progressive video? + + CNTV2Card mNTV2Card; ///< @brief Used to talk to monitor & control the device + UWord mBoardNumber; ///< @brief Index number of the device I'm using + NTV2DeviceID mDeviceID; ///< @brief Device ID of the device I'm using + NTV2Channel mChannel; ///< @brief AutoCirculate capture + ULWord mNumChannels; ///< @brief Number of capture frame channels + NTV2VideoFormat mCurrentVideoFormat; ///< @brief Current video format seen on selected device input + NTV2VideoFormat mLastVideoFormat; ///< @brief Used to detect input video format changes + ULWord mDebounceCounter; ///< @brief Used for detecting stable input video + bool mFormatIsProgressive; ///< @brief True if input video format is progressive (not interlaced) + NTV2InputSource mInputSource; ///< @brief User-selected input source + NTV2FrameDimensions mFrameDimensions; ///< @brief Frame dimensions, pixels X lines + NTV2FrameBufferFormat mFrameBufferFormat; ///< @brief My frame buffer format + AUTOCIRCULATE_TRANSFER mTransferStruct; ///< @brief AutoCirculate transfer object + NTV2EveryFrameTaskMode mSavedTaskMode; ///< @brief Used to restore the previous task mode + + bool mbWithAudio; ///< @brief Capture audio? + QAudioOutput * mAudioOutput; ///< @brief Used to play captured audio on host audio system + QAudioFormat mFormat; ///< @brief Output audio stream format information + QIODevice * mAudioDevice; ///< @brief Host audio device + ULWord mNumAudioChannels; ///< @brief Number of audio channels being captured on the AJA device + NTV2AudioSystem mAudioSystem; ///< @brief Audio subsystem to use + + std::string mTimeCode; ///< @brief Currently displayed timecode + NTV2TCIndex mTimeCodeSource; ///< @brief Timecode source + #if defined (INCLUDE_AJACC) + CNTV2CaptionDecoder608Ptr m608Decoder; ///< @brief My 608 closed-caption decoder + CNTV2CaptionDecoder708Ptr m708Decoder; ///< @brief My 708 closed-caption decoder + ushort mScreenBuffer [15][32]; ///< @brief My caption buffer + + static void Caption608Changed (void * pInstance, const NTV2Caption608ChangeInfo & inChangeInfo); + void caption608Changed (const NTV2Caption608ChangeInfo & inChangeInfo); + #endif // defined (INCLUDE_AJACC) + +}; // class NTV2FrameGrabber + + +#endif // NTV2FRAMEGRABBER_H diff --git a/ntv2qtpreview.h b/ntv2qtpreview.h new file mode 100644 index 0000000..ffbca48 --- /dev/null +++ b/ntv2qtpreview.h @@ -0,0 +1,76 @@ +/** + @file ntv2qtpreview.h + @brief Header file for NTV2QtPreview demo application. + Demonstrates how to capture audio/video from NTV2-based AJA devices. + @copyright (C) 2013-2017 AJA Video Systems, Inc. Proprietary and confidential information. +**/ + +#ifndef NTV2QTPREVIEW_H +#define NTV2QTPREVIEW_H + + +#include +#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) + #include +#else + #include +#endif + +#include "ajapreviewwidget.h" +#include "ntv2framegrabber.h" +#include "ntv2devicescanner.h" +#include "ajabase/pnp/pnp.h" + + +/** + @brief I am a QDialog that displays, in a two-up layout, whatever stereo video is present on the + SDI inputs of an AJA device. I also have a popup menu for choosing a different capture device. +**/ +class NTV2QtPreview : public QDialog +{ + Q_OBJECT + + // Instance Methods + public: + NTV2QtPreview (QWidget * parent = NULL, Qt::WindowFlags flags = 0); + ~NTV2QtPreview (); + + // Private Instance Methods + private: + void timerEvent (QTimerEvent * event); + void updateInputs (void); + + static void PnpCallback (AJAPnpMessage inMessage, void * pUserData); + + private slots: + /** + @brief This gets called when the user selects a different device from the device selector popup menu. + @param inDeviceIndexNum Specifies which item in the device selector popup menu was chosen, + where 0 is the first item. + **/ + void RequestDeviceChange (const int inDeviceIndexNum); + + void devicesChanged (); ///< @brief This gets called when an AJA device is attached or detached to/from the host. + void inputChanged (int id); ///< @brief This gets called when a different NTV2InputSource is selected by the user. + void withAudioChanged (int state); ///< @brief This gets called when the Audio checkbox is toggled. + void checkFor4kChanged (int state); ///< @brief This gets called when the 4K checkbox is toggled. + + // Instance Data + private: + QDialogButtonBox * mCloseBox; ///< @brief My "Close" button + QCheckBox * mWithAudioCheckBox; ///< @brief My "with audio" checkbox + QCheckBox * mCheckFor4kCheckBox; ///< @brief My "check for 4K" checkbox + QComboBox * mBoardChoiceCombo; ///< @brief My device selector popup menu + QButtonGroup * mInputButtonGroup; ///< @brief My input selection radio buttons (Off|SDI1|2|3|4|5|6|7|8|HDMI|Analog) + AJAPreviewWidget * mVideoPreviewWidget; ///< @brief My AJAPreviewWidget + AJAPnp mPnp; ///< @brief Used to detect device removal/addition + QPixmap mPixmap; ///< @brief My QPixmap + int mTimerID; ///< @brief My timer ID + NTV2FrameGrabber * mFrameGrabber; ///< @brief My frame grabber + #if defined (INCLUDE_AJACC) + QButtonGroup * mCaptionButtonGroup; ///< @brief My caption channel radio buttons (Off|CC1|CC2|CC3|CC4|TXT1|TXT2|TXT3|TXT4) + #endif // defined (INCLUDE_AJACC) + +}; // class NTV2QtPreview + +#endif // NTV2QTPREVIEW_H