diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ab9c2c..e721b67 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,11 +8,6 @@ cmake_minimum_required( VERSION 2.8.9 ) # Project Definition ###################################################################################### -IF(UNIX) - EXECUTE_PROCESS(COMMAND "date" "+%Y%m%d" OUTPUT_VARIABLE DAY) - string(STRIP ${DAY} DAY) -ENDIF(UNIX) - SET( PROJECT_NAME "playuver" ) PROJECT( ${PROJECT_NAME} ) @@ -20,109 +15,38 @@ INCLUDE( cmake/PlaYUVerVersion.cmake ) INCLUDE( cmake/CMakeMacros.cmake ) -# Project directories -SET( SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/source ) -SET( LIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/source/lib ) -SET( RSC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/resources ) -SET( UI_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ui ) -SET( EXTERNAL_SRC ${CMAKE_CURRENT_SOURCE_DIR}/external ) - -SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}") -# Find includes in corresponding build directories -SET( CMAKE_INCLUDE_CURRENT_DIR ON ) -# Instruct CMake to run moc automatically when needed. -SET( CMAKE_AUTOMOC ON ) - -INCLUDE_DIRECTORIES( ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${SRC_DIR}/app ${SRC_DIR}/lib ) - -FILE( GLOB SOURCES_FILES ${SRC_DIR}/app/*.cpp ) -FILE( GLOB FORMS_FILES ${UI_DIR}/*.ui ) -FILE( GLOB RESOURCES_FILES ${RSC_DIR}/*.qrc ) - # must go before the project command SET(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Configs" FORCE) IF(DEFINED CMAKE_BUILD_TYPE AND CMAKE_VERSION VERSION_GREATER "2.8") SET_PROPERTY( CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${CMAKE_CONFIGURATION_TYPES} ) ENDIF() -SET( CMAKE_CXX_FLAGS "" ) - -ADD_DEFINITIONS( "-DPLAYUVER" ) - ###################################################################################### # Variables ###################################################################################### ADD_OPTION(PLAYUVER_LONGVERSIONNAME "Use long version name in deb" OFF ) ADD_OPTION(PLAYUVER_WERROR "Warnings as errors" OFF ) ADD_OPTION(PLAYUVER_THREADED_MODULES "Use threads for modules" OFF ) -ADD_OPTION(PLAYUVER_INSTALL_LIBS "Install PlaYUVer Lib" ON ) ADD_OPTION(USE_QT4 "Build with QT4" OFF ) -ADD_OPTION(USE_OPENCV "Add OpenCV support" OFF ) -ADD_OPTION(USE_FFMPEG "Add FFMPEG support" OFF ) ADD_OPTION(USE_FERVOR "Add Fervor support" OFF ) -ADD_OPTION(USE_PIXFC "Add PIXFC support" OFF ) -###################################################################################### -# PlaYUVer lib -###################################################################################### -FILE( GLOB PLAYUVER_LIB_SOURCES_FILES ${SRC_DIR}/lib/*.cpp ) -INCLUDE_DIRECTORIES( ${SRC_DIR}/lib ) -ADD_LIBRARY( PlaYUVerLib ${PLAYUVER_LIB_SOURCES_FILES} ) - + + + ###################################################################################### # Dependencies ###################################################################################### INCLUDE( cmake/LibFervor.cmake ) INCLUDE( cmake/LibQT.cmake ) -INCLUDE( cmake/LibOpenCV.cmake ) INCLUDE( cmake/LibFFmpeg.cmake ) -INCLUDE( cmake/LibPixfc.cmake ) +INCLUDE( cmake/LibOpenCV.cmake ) -# Windows application icon -if (WIN32) -set(WINDOWS_RES_FILE ${CMAKE_CURRENT_BINARY_DIR}/resources.obj) -if (MSVC) -add_custom_command(OUTPUT ${WINDOWS_RES_FILE} -COMMAND rc.exe /fo ${WINDOWS_RES_FILE} playuver.rc -WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/resources -) -else() -add_custom_command(OUTPUT ${WINDOWS_RES_FILE} -COMMAND windres.exe playuver.rc ${WINDOWS_RES_FILE} -WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/resources -) -endif() -endif() - - -###################################################################################### -# PlaYUVer modules build -###################################################################################### -SET( MODULES_DIR ${SRC_DIR}/modules ) -INCLUDE_DIRECTORIES( ${MODULES_DIR} ) - -file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/ModulesListMacro.h "// This files defines the macro to \n" - "// define a list of modules\n" - "#ifndef __MODULESLISTMACRO_H__\n#define __MODULESLISTMACRO_H__\n" - "#define REGISTER_ALL_MODULES ") - -file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "// This files add the header files of each module\n" - - "#ifndef __MODULESLISTHEADER_H__\n#define __MODULESLISTHEADER_H__\n" ) - -# FILE( GLOB ModuleCMakeFiles ModuleDefinition.cmake ) -# INCLUDE( ${ModuleCMakeFiles} ) -INCLUDE( ModuleDefinition.cmake ) - -file( APPEND ${CMAKE_CURRENT_BINARY_DIR}/ModulesListMacro.h "\n#endif // __MODULESLISTMACRO_H__\n" ) -file( APPEND ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "#endif // __MODULESLISTHEADER_H__\n" ) ###################################################################################### # Configuration ###################################################################################### CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h ) -CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/PlaYUVerConfig.cmake.in ${CMAKE_BINARY_DIR}/PlaYUVerConfig.cmake @ONLY) CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/PlaYUVerUpdate.xml.in ${CMAKE_BINARY_DIR}/PlaYUVerUpdate.xml @ONLY) ###################################################################################### @@ -141,17 +65,51 @@ IF( PLAYUVER_WERROR ) SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror" ) ENDIF() -SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" ) +ADD_SUBDIRECTORY( lib ) +ADD_SUBDIRECTORY( modules ) +ADD_SUBDIRECTORY( app ) -ADD_EXECUTABLE( ${PROJECT_NAME} ${SOURCES_FILES} ${HEADERS_MOC_FILES} ${FORMS_HEADERS_FILES} ${RESOURCES_RCC_FILES} ${WINDOWS_RES_FILE} ) - -TARGET_LINK_LIBRARIES( ${PROJECT_NAME} PlaYUVerLib ${MODULES_LIBS} ${LINKER_LIBS} ) - -IF( NOT USE_QT4 ) - QT5_USE_MODULES( ${PROJECT_NAME} ${QT_MODULES} ) +IF( WIN32 ) + SET(MSVC_DLL_DIR "MSVC_DLL_DIR" CACHE PATH "Where to find MSVC dlls") + INSTALL(FILES ${MSVC_DLL_DIR}/msvcr120.dll DESTINATION bin ) + INSTALL(FILES ${MSVC_DLL_DIR}/msvcp120.dll DESTINATION bin ) ENDIF() -INCLUDE(cmake/Install.cmake) +###################################################################################### +# Create deb package +###################################################################################### + +SET(CPACK_PACKAGE_NAME ${PROJECT_NAME}) +SET(CPACK_PACKAGE_CONTACT "Joao Carreira (jfmcarreira@gmail.com), Luis Lucas (luisfrlucas@gmail.com)") +SET(CPACK_PACKAGE_VERSION_MAJOR ${PLAYUVER_VERSION_MAJOR}) +SET(CPACK_PACKAGE_VERSION_MINOR ${PLAYUVER_VERSION_MINOR}) +SET(CPACK_PACKAGE_VERSION_PATCH ${PLAYUVER_VERSION_PATH}) +SET(CPACK_PACKAGE_VERSION ${PLAYUVER_VERSION}) +SET(CPACK_PACKAGE_ARCHITECTURE "amd64") + +IF( UNIX ) + SET(CPACK_GENERATOR "DEB;ZIP") + SET(OS "Linux") + SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION "plaYUVer is an open-source QT based raw video player") + SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Joao Carreira (jfmcarreira@gmail.com), Luis Lucas (luisfrlucas@gmail.com)") + SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE ${CPACK_PACKAGE_ARCHITECTURE} ) + STRING(REPLACE ";" "" CPACK_DEBIAN_PACKAGE_DEPENDS ${CPACK_DEBIAN_PACKAGE_DEPENDS} ) +ENDIF() +IF( WIN32 ) + SET(CPACK_GENERATOR "ZIP") + SET(OS "Windows") + SET(GIT_BRANCH "master") # temp work around +ENDIF() + +IF( PLAYUVER_LONGVERSIONNAME ) + SET( CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}${APPEND_VERSION}-${OS}-${CPACK_PACKAGE_ARCHITECTURE}" ) + SET( PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME} ) +ELSE() + SET( CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${PACK_NAME}${APPEND_VERSION}-${OS}-${CPACK_PACKAGE_ARCHITECTURE}" ) + SET( PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME} ) +ENDIF() + +INCLUDE(CPack) ###################################################################################### # Final information dump @@ -168,5 +126,3 @@ status(" OpenCV:" USE_OPENCV THEN YES ELSE NO) status(" FFMPEG:" USE_FFMPEG THEN YES ELSE NO) status(" Fervor:" USE_FERVOR THEN YES ELSE NO) status(" Pixfc-sse:" USE_PIXFC THEN YES ELSE NO) -status("Features:") -status(" Modules List:" "${MODULES_LIST}" ) diff --git a/source/app/AboutDialog.cpp b/app/AboutDialog.cpp similarity index 100% rename from source/app/AboutDialog.cpp rename to app/AboutDialog.cpp diff --git a/source/app/AboutDialog.h b/app/AboutDialog.h similarity index 100% rename from source/app/AboutDialog.h rename to app/AboutDialog.h diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt new file mode 100644 index 0000000..7954528 --- /dev/null +++ b/app/CMakeLists.txt @@ -0,0 +1,78 @@ +### +### CMakeLists for playuver app component +### + +# This is hard way - please fix +INCLUDE_DIRECTORIES( ${CMAKE_BINARY_DIR} ../lib ../modules ${CMAKE_BINARY_DIR}/modules ) + +set(plaYUver_App_SRCS +# Main + main.cpp + plaYUVerApp.cpp + SubWindowHandle.cpp + ViewArea.cpp + ModulesHandle.cpp + PlaYUVerAppModuleIf.cpp + PlaYUVerSettings.cpp + GridManager.cpp +# Dialogs + AboutDialog.cpp + ConfigureFormatDialog.cpp + DialogSubWindowSelector.cpp +# Docks / Sidebars + ModuleHandleDock.cpp + PropertiesSidebar.cpp + PlaYUVerFrameStatistics.cpp + QualityMeasurementSidebar.cpp +# Widgets + HistogramWidget.cpp + WidgetFrameNumber.cpp + WidgetFrameNumber.cpp +) + +set(plaYUver_App_UI "" ) + +set(plaYUver_App_RCC + resources/playuver.qrc +) + +IF( USE_QT4 ) + QT4_WRAP_UI( plaYUver_App_UI_Wrap ${plaYUver_App_UI} ) + QT4_ADD_RESOURCES( plaYUver_App_RCC ${plaYUver_App_RCC} ) +ELSE() + QT5_WRAP_UI( plaYUver_App_UI_Wrap ${plaYUver_App_UI} ) + QT5_ADD_RESOURCES( plaYUver_App_RCC ${plaYUver_App_RCC} ) +ENDIF() + +# Instruct CMake to run moc automatically when needed. +SET( CMAKE_AUTOMOC ON ) + +# Windows application icon +IF( WIN32 ) + set(WINDOWS_RES_FILE ${CMAKE_CURRENT_BINARY_DIR}/resources.obj) + IF( MSVC ) + add_custom_command(OUTPUT ${WINDOWS_RES_FILE} + COMMAND rc.exe /fo ${WINDOWS_RES_FILE} playuver.rc + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/app/resources + ) + ELSE() + add_custom_command(OUTPUT ${WINDOWS_RES_FILE} + COMMAND windres.exe playuver.rc ${WINDOWS_RES_FILE} + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/app/resources + ) + ENDIF() +ENDIF() + + +ADD_EXECUTABLE( ${PROJECT_NAME} ${plaYUver_App_SRCS} ${HEADERS_MOC_FILES} ${plaYUver_App_UI_Wrap} ${plaYUver_App_RCC} ${WINDOWS_RES_FILE} ) + +TARGET_LINK_LIBRARIES( ${PROJECT_NAME} PlaYUVerLib PlaYUVerModules ${LINKER_LIBS} ) + +IF( NOT USE_QT4 ) + QT5_USE_MODULES( ${PROJECT_NAME} ${QT_MODULES} ) +ENDIF() + +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin ) +INSTALL(FILES resources/playuver.desktop DESTINATION share/applications ) +INSTALL(FILES resources/playuver.png DESTINATION share/icons ) +INSTALL(FILES resources/x-raw.xml DESTINATION share/mime/video ) \ No newline at end of file diff --git a/source/app/ConfigureFormatDialog.cpp b/app/ConfigureFormatDialog.cpp similarity index 100% rename from source/app/ConfigureFormatDialog.cpp rename to app/ConfigureFormatDialog.cpp diff --git a/source/app/ConfigureFormatDialog.h b/app/ConfigureFormatDialog.h similarity index 100% rename from source/app/ConfigureFormatDialog.h rename to app/ConfigureFormatDialog.h diff --git a/source/app/DialogSubWindowSelector.cpp b/app/DialogSubWindowSelector.cpp similarity index 100% rename from source/app/DialogSubWindowSelector.cpp rename to app/DialogSubWindowSelector.cpp diff --git a/source/app/DialogSubWindowSelector.h b/app/DialogSubWindowSelector.h similarity index 100% rename from source/app/DialogSubWindowSelector.h rename to app/DialogSubWindowSelector.h diff --git a/source/app/GridManager.cpp b/app/GridManager.cpp similarity index 100% rename from source/app/GridManager.cpp rename to app/GridManager.cpp diff --git a/source/app/GridManager.h b/app/GridManager.h similarity index 100% rename from source/app/GridManager.h rename to app/GridManager.h diff --git a/source/app/HistogramWidget.cpp b/app/HistogramWidget.cpp similarity index 100% rename from source/app/HistogramWidget.cpp rename to app/HistogramWidget.cpp diff --git a/source/app/HistogramWidget.h b/app/HistogramWidget.h similarity index 100% rename from source/app/HistogramWidget.h rename to app/HistogramWidget.h diff --git a/source/app/ModuleHandleDock.cpp b/app/ModuleHandleDock.cpp similarity index 90% rename from source/app/ModuleHandleDock.cpp rename to app/ModuleHandleDock.cpp index 7f80c04..6d0557e 100644 --- a/source/app/ModuleHandleDock.cpp +++ b/app/ModuleHandleDock.cpp @@ -24,18 +24,18 @@ #include #include "ModuleHandleDock.h" -#include "PlaYUVerModuleIf.h" +#include "PlaYUVerAppModuleIf.h" #include "ModulesHandle.h" namespace plaYUVer { -ModuleHandleDock::ModuleHandleDock( QWidget* parent, PlaYUVerModuleIf* moduleIf ) : +ModuleHandleDock::ModuleHandleDock( QWidget* parent, PlaYUVerAppModuleIf* moduleIf ) : QWidget( parent ), m_pcCurrModuleIf( moduleIf ) { - PlaYUVerModuleDefinition ModuleDef = moduleIf->getModuleDefinition(); + PlaYUVerModuleDefinition ModuleDef = moduleIf->m_pcModule->getModuleDefinition(); // ----------------- Dock definition ----------------- @@ -77,7 +77,7 @@ Void ModuleHandleDock::visibilityChangedSlot( bool visiblity ) { if( !visiblity && m_pcCurrModuleIf ) { - PlaYUVerModuleIf* pcCurrentModule = m_pcCurrModuleIf; + PlaYUVerAppModuleIf* pcCurrentModule = m_pcCurrModuleIf; m_pcCurrModuleIf = NULL; ModulesHandle::destroyModuleIf( pcCurrentModule ); } diff --git a/source/app/ModuleHandleDock.h b/app/ModuleHandleDock.h similarity index 92% rename from source/app/ModuleHandleDock.h rename to app/ModuleHandleDock.h index 72010bb..7dd3715 100644 --- a/source/app/ModuleHandleDock.h +++ b/app/ModuleHandleDock.h @@ -38,13 +38,13 @@ namespace plaYUVer { -class PlaYUVerModuleIf; +class PlaYUVerAppModuleIf; class ModuleHandleDock: public QWidget { Q_OBJECT public: - ModuleHandleDock( QWidget* parent, PlaYUVerModuleIf* moduleIf ); + ModuleHandleDock( QWidget* parent, PlaYUVerAppModuleIf* moduleIf ); ~ModuleHandleDock(); Void setModulueReturnValue( Double value ); @@ -53,7 +53,7 @@ public: private: - PlaYUVerModuleIf* m_pcCurrModuleIf; + PlaYUVerAppModuleIf* m_pcCurrModuleIf; Bool m_bIsVisible; QLabel* labelModulueValueLabel; diff --git a/source/app/ModulesHandle.cpp b/app/ModulesHandle.cpp similarity index 84% rename from source/app/ModulesHandle.cpp rename to app/ModulesHandle.cpp index 4ced82b..65ba8ea 100644 --- a/source/app/ModulesHandle.cpp +++ b/app/ModulesHandle.cpp @@ -50,9 +50,11 @@ ModulesHandle::~ModulesHandle() { } -Void ModulesHandle::appendModule( PlaYUVerModuleIf* pIfModule ) +Void ModulesHandle::appendModule( PlaYUVerModuleIf* pModuleIf ) { - m_pcPlaYUVerModules.append( pIfModule ); + PlaYUVerAppModuleIf* pcAppModuleIf = new PlaYUVerAppModuleIf; + pcAppModuleIf->m_pcModule = pModuleIf; + m_pcPlaYUVerModules.append( pcAppModuleIf ); m_uiModulesCount++; } @@ -65,7 +67,7 @@ SubWindowHandle* ModulesHandle::processModuleHandlingOpt() { if( m_iOptionSelected >= 0 ) { - PlaYUVerModuleIf* pcCurrModuleIf = m_pcPlaYUVerModules.at( m_iOptionSelected ); + PlaYUVerAppModuleIf* pcCurrModuleIf = m_pcPlaYUVerModules.at( m_iOptionSelected ); m_iOptionSelected = INVALID_OPT; if( pcCurrModuleIf->m_pcAction->isChecked() ) { @@ -98,7 +100,7 @@ SubWindowHandle* ModulesHandle::processModuleHandlingOpt() return NULL; } -SubWindowHandle* ModulesHandle::enableModuleIf( PlaYUVerModuleIf *pcCurrModuleIf ) +SubWindowHandle* ModulesHandle::enableModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf ) { Bool bShowModulesNewWindow = m_arrayActions[FORCE_NEW_WINDOW_ACT]->isChecked(); SubWindowHandle* pcSubWindow = qobject_cast( m_pcMdiArea->activeSubWindow() ); @@ -106,7 +108,7 @@ SubWindowHandle* ModulesHandle::enableModuleIf( PlaYUVerModuleIf *pcCurrModuleIf QString windowName; QVector subWindowList; - UInt numberOfFrames = pcCurrModuleIf->m_cModuleDef.m_uiNumberOfFrames; + UInt numberOfFrames = pcCurrModuleIf->m_pcModule->m_cModuleDef.m_uiNumberOfFrames; if( numberOfFrames > MODULE_REQUIRES_ONE_FRAME ) // Show dialog to select sub windows { DialogSubWindowSelector dialogWindowsSelection( m_pcParent, m_pcMdiArea, numberOfFrames, numberOfFrames ); @@ -152,7 +154,7 @@ SubWindowHandle* ModulesHandle::enableModuleIf( PlaYUVerModuleIf *pcCurrModuleIf } windowName.append( " <" ); - windowName.append( pcCurrModuleIf->m_cModuleDef.m_pchModuleName ); + windowName.append( pcCurrModuleIf->m_pcModule->m_cModuleDef.m_pchModuleName ); windowName.append( ">" ); for( Int i = 0; i < subWindowList.size(); i++ ) @@ -162,9 +164,9 @@ SubWindowHandle* ModulesHandle::enableModuleIf( PlaYUVerModuleIf *pcCurrModuleIf } pcCurrModuleIf->m_pcDisplaySubWindow = NULL; - if( pcCurrModuleIf->m_cModuleDef.m_iModuleType == FRAME_PROCESSING_MODULE ) + if( pcCurrModuleIf->m_pcModule->m_cModuleDef.m_iModuleType == FRAME_PROCESSING_MODULE ) { - if( ( pcCurrModuleIf->m_cModuleDef.m_uiModuleRequirements & MODULE_REQUIRES_NEW_WINDOW ) || bShowModulesNewWindow ) + if( ( pcCurrModuleIf->m_pcModule->m_cModuleDef.m_uiModuleRequirements & MODULE_REQUIRES_NEW_WINDOW ) || bShowModulesNewWindow ) { interfaceChild = new SubWindowHandle( m_pcParent, true ); interfaceChild->setWindowName( windowName ); @@ -174,13 +176,13 @@ SubWindowHandle* ModulesHandle::enableModuleIf( PlaYUVerModuleIf *pcCurrModuleIf pcCurrModuleIf->m_pcDisplaySubWindow->setModule( pcCurrModuleIf ); } } - else if( pcCurrModuleIf->m_cModuleDef.m_iModuleType == FRAME_MEASUREMENT_MODULE ) + else if( pcCurrModuleIf->m_pcModule->m_cModuleDef.m_iModuleType == FRAME_MEASUREMENT_MODULE ) { - if( pcCurrModuleIf->m_cModuleDef.m_uiModuleRequirements & MODULE_REQUIRES_SIDEBAR ) + if( pcCurrModuleIf->m_pcModule->m_cModuleDef.m_uiModuleRequirements & MODULE_REQUIRES_SIDEBAR ) { pcCurrModuleIf->m_pcModuleDock = new ModuleHandleDock( m_pcParent, pcCurrModuleIf ); QString titleDockWidget; - titleDockWidget.append( pcCurrModuleIf->m_cModuleDef.m_pchModuleName ); + titleDockWidget.append( pcCurrModuleIf->m_pcModule->m_cModuleDef.m_pchModuleName ); titleDockWidget.append( " Information" ); pcCurrModuleIf->m_pcDockWidget = new QDockWidget( titleDockWidget, m_pcParent ); pcCurrModuleIf->m_pcDockWidget->setFeatures( QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable ); @@ -191,7 +193,7 @@ SubWindowHandle* ModulesHandle::enableModuleIf( PlaYUVerModuleIf *pcCurrModuleIf } // Create Module - pcCurrModuleIf->create( pcCurrModuleIf->m_pcSubWindow[0]->getCurrFrame() ); + pcCurrModuleIf->m_pcModule->create( pcCurrModuleIf->m_pcSubWindow[0]->getCurrFrame() ); // Associate module with subwindows for( UInt i = 0; i < numberOfFrames; i++ ) @@ -203,7 +205,7 @@ SubWindowHandle* ModulesHandle::enableModuleIf( PlaYUVerModuleIf *pcCurrModuleIf return interfaceChild; } -Void ModulesHandle::destroyModuleIf( PlaYUVerModuleIf *pcCurrModuleIf ) +Void ModulesHandle::destroyModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf ) { if( pcCurrModuleIf->m_pcModuleDock ) { @@ -234,7 +236,7 @@ Void ModulesHandle::destroyModuleIf( PlaYUVerModuleIf *pcCurrModuleIf ) pcCurrModuleIf->m_pcModuleStream = NULL; } pcCurrModuleIf->m_pcAction->setChecked( false ); - pcCurrModuleIf->destroy(); + pcCurrModuleIf->m_pcModule->destroy(); } Void ModulesHandle::destroyAllModulesIf() @@ -245,10 +247,10 @@ Void ModulesHandle::destroyAllModulesIf() } } -Bool ModulesHandle::applyModuleIf( PlaYUVerModuleIf *pcCurrModuleIf, Bool isPlaying, Bool disableThreads ) +Bool ModulesHandle::applyModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf, Bool isPlaying, Bool disableThreads ) { Bool bRet = false; - if( !isPlaying || ( isPlaying && pcCurrModuleIf->m_cModuleDef.m_bApplyWhilePlaying ) ) + if( !isPlaying || ( isPlaying && pcCurrModuleIf->m_pcModule->m_cModuleDef.m_bApplyWhilePlaying ) ) { #ifdef PLAYUVER_THREADED_MODULES if( !disableThreads ) @@ -257,7 +259,7 @@ Bool ModulesHandle::applyModuleIf( PlaYUVerModuleIf *pcCurrModuleIf, Bool isPlay #endif pcCurrModuleIf->run(); - if( pcCurrModuleIf->m_pcDisplaySubWindow || pcCurrModuleIf->m_cModuleDef.m_iModuleType == FRAME_MEASUREMENT_MODULE ) + if( pcCurrModuleIf->m_pcDisplaySubWindow || pcCurrModuleIf->m_pcModule->m_cModuleDef.m_iModuleType == FRAME_MEASUREMENT_MODULE ) { bRet = true; } @@ -269,11 +271,11 @@ Bool ModulesHandle::applyModuleIf( PlaYUVerModuleIf *pcCurrModuleIf, Bool isPlay return bRet; } -Void ModulesHandle::applyAllModuleIf( PlaYUVerModuleIf *pcCurrModuleIf ) +Void ModulesHandle::applyAllModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf ) { if( pcCurrModuleIf->m_pcModuleStream ) { - UInt numberOfWindows = pcCurrModuleIf->m_cModuleDef.m_uiNumberOfFrames; + UInt numberOfWindows = pcCurrModuleIf->m_pcModule->m_cModuleDef.m_uiNumberOfFrames; UInt64 currFrames = 0; UInt64 numberOfFrames = INT_MAX; for( UInt i = 0; i < numberOfWindows; i++ ) @@ -303,7 +305,7 @@ Void ModulesHandle::applyAllModuleIf( PlaYUVerModuleIf *pcCurrModuleIf ) } } -Void ModulesHandle::openModuleIfStream( PlaYUVerModuleIf *pcCurrModuleIf ) +Void ModulesHandle::openModuleIfStream( PlaYUVerAppModuleIf *pcCurrModuleIf ) { if( pcCurrModuleIf ) { @@ -353,7 +355,7 @@ Void ModulesHandle::openModuleIfStream( PlaYUVerModuleIf *pcCurrModuleIf ) } } -Bool ModulesHandle::showModuleIf( PlaYUVerModuleIf *pcCurrModuleIf, PlaYUVerFrame* processedFrame ) +Bool ModulesHandle::showModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf, PlaYUVerFrame* processedFrame ) { Bool bRet = false; //if( processedFrame ) @@ -371,16 +373,16 @@ Bool ModulesHandle::showModuleIf( PlaYUVerModuleIf *pcCurrModuleIf, PlaYUVerFram return bRet; } -Bool ModulesHandle::showModuleIf( PlaYUVerModuleIf *pcCurrModuleIf, Double moduleResult ) +Bool ModulesHandle::showModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf, Double moduleResult ) { Bool bRet = false; pcCurrModuleIf->m_pcModuleDock->setModulueReturnValue( moduleResult ); return bRet; } -Void ModulesHandle::swapModulesWindowsIf( PlaYUVerModuleIf *pcCurrModuleIf ) +Void ModulesHandle::swapModulesWindowsIf( PlaYUVerAppModuleIf *pcCurrModuleIf ) { - if( pcCurrModuleIf->m_cModuleDef.m_uiNumberOfFrames == MODULE_REQUIRES_TWO_FRAMES ) + if( pcCurrModuleIf->m_pcModule->m_cModuleDef.m_uiNumberOfFrames == MODULE_REQUIRES_TWO_FRAMES ) { SubWindowHandle* auxWindowHandle = pcCurrModuleIf->m_pcSubWindow[0]; pcCurrModuleIf->m_pcSubWindow[0] = pcCurrModuleIf->m_pcSubWindow[1]; @@ -394,10 +396,10 @@ Void ModulesHandle::customEvent( QEvent *event ) { return; } - PlaYUVerModuleIf::EventData *eventData = ( PlaYUVerModuleIf::EventData* )event; + PlaYUVerAppModuleIf::EventData *eventData = ( PlaYUVerAppModuleIf::EventData* )event; if( eventData->m_bSuccess ) { - switch( eventData->m_pcModule->m_cModuleDef.m_iModuleType ) + switch( eventData->m_pcModule->m_pcModule->m_cModuleDef.m_iModuleType ) { case FRAME_PROCESSING_MODULE: showModuleIf( eventData->m_pcModule, eventData->m_pcModule->m_pcProcessedFrame ); @@ -411,7 +413,7 @@ Void ModulesHandle::customEvent( QEvent *event ) QMenu* ModulesHandle::createMenus( QMenuBar *MainAppMenuBar ) { - PlaYUVerModuleIf* pcCurrModuleIf; + PlaYUVerAppModuleIf* pcCurrModuleIf; QAction* currAction; QMenu* currSubMenu; @@ -428,11 +430,11 @@ QMenu* ModulesHandle::createMenus( QMenuBar *MainAppMenuBar ) pcCurrModuleIf->setParent( this ); currSubMenu = NULL; - if( pcCurrModuleIf->m_cModuleDef.m_pchModuleCategory ) + if( pcCurrModuleIf->m_pcModule->m_cModuleDef.m_pchModuleCategory ) { for( Int j = 0; j < m_pcModulesSubMenuList.size(); j++ ) { - if( m_pcModulesSubMenuList.at( j )->title() == QString( pcCurrModuleIf->m_cModuleDef.m_pchModuleCategory ) ) + if( m_pcModulesSubMenuList.at( j )->title() == QString( pcCurrModuleIf->m_pcModule->m_cModuleDef.m_pchModuleCategory ) ) { currSubMenu = m_pcModulesSubMenuList.at( j ); break; @@ -440,13 +442,13 @@ QMenu* ModulesHandle::createMenus( QMenuBar *MainAppMenuBar ) } if( !currSubMenu ) { - currSubMenu = m_pcModulesMenu->addMenu( pcCurrModuleIf->m_cModuleDef.m_pchModuleCategory ); + currSubMenu = m_pcModulesMenu->addMenu( pcCurrModuleIf->m_pcModule->m_cModuleDef.m_pchModuleCategory ); m_pcModulesSubMenuList.append( currSubMenu ); } } - currAction = new QAction( pcCurrModuleIf->m_cModuleDef.m_pchModuleName, parent() ); - currAction->setStatusTip( pcCurrModuleIf->m_cModuleDef.m_pchModuleTooltip ); + currAction = new QAction( pcCurrModuleIf->m_pcModule->m_cModuleDef.m_pchModuleName, parent() ); + currAction->setStatusTip( pcCurrModuleIf->m_pcModule->m_cModuleDef.m_pchModuleTooltip ); currAction->setCheckable( true ); connect( currAction, SIGNAL( triggered() ), m_pcActionMapper, SLOT( map() ) ); m_pcActionMapper->setMapping( currAction, i ); diff --git a/source/app/ModulesHandle.h b/app/ModulesHandle.h similarity index 74% rename from source/app/ModulesHandle.h rename to app/ModulesHandle.h index d65238d..0cf263b 100644 --- a/source/app/ModulesHandle.h +++ b/app/ModulesHandle.h @@ -36,13 +36,13 @@ #elif( QT_VERSION_PLAYUVER == 4 ) #include #endif -#include "PlaYUVerModuleIf.h" +#include "PlaYUVerAppModuleIf.h" #include "PlaYUVerFrame.h" namespace plaYUVer { -class PlaYUVerModuleIf; +class PlaYUVerAppModuleIf; class SubWindowHandle; class ModulesHandle: public QObject @@ -56,12 +56,12 @@ public: Void updateMenus( Bool hasSubWindow ); SubWindowHandle* processModuleHandlingOpt(); - static Void destroyModuleIf( PlaYUVerModuleIf* pcCurrModuleIf ); - static Bool applyModuleIf( PlaYUVerModuleIf* pcCurrModuleIf, Bool isPlaying, Bool disableThreads = false ); - static Void swapModulesWindowsIf( PlaYUVerModuleIf *pcCurrModuleIf ); - static Bool showModuleIf( PlaYUVerModuleIf *pcCurrModuleIf, PlaYUVerFrame* processedFrame ); - static Bool showModuleIf( PlaYUVerModuleIf *pcCurrModuleIf, Double moduleResult ); - static Void applyAllModuleIf( PlaYUVerModuleIf* pcCurrModuleIf ); + static Void destroyModuleIf( PlaYUVerAppModuleIf* pcCurrModuleIf ); + static Bool applyModuleIf( PlaYUVerAppModuleIf* pcCurrModuleIf, Bool isPlaying, Bool disableThreads = false ); + static Void swapModulesWindowsIf( PlaYUVerAppModuleIf *pcCurrModuleIf ); + static Bool showModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf, PlaYUVerFrame* processedFrame ); + static Bool showModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf, Double moduleResult ); + static Void applyAllModuleIf( PlaYUVerAppModuleIf* pcCurrModuleIf ); private: QMainWindow *m_pcParent; @@ -78,7 +78,7 @@ private: QMenu* m_pcModulesMenu; QList m_pcModulesSubMenuList; - QList m_pcPlaYUVerModules; + QList m_pcPlaYUVerModules; QSignalMapper* m_pcActionMapper; QVector m_arrayModulesActions; @@ -93,9 +93,9 @@ private: }; QVector m_arrayActions; - Void appendModule( PlaYUVerModuleIf* pcCurrModuleIf ); - SubWindowHandle* enableModuleIf( PlaYUVerModuleIf* pcCurrModuleIf ); - Void openModuleIfStream( PlaYUVerModuleIf *pcCurrModuleIf ); + Void appendModule( PlaYUVerModuleIf* pModuleIf ); + SubWindowHandle* enableModuleIf( PlaYUVerAppModuleIf* pcCurrModuleIf ); + Void openModuleIfStream( PlaYUVerAppModuleIf *pcCurrModuleIf ); Void customEvent( QEvent *event ); diff --git a/source/app/PlaYUVerModuleIf.cpp b/app/PlaYUVerAppModuleIf.cpp similarity index 60% rename from source/app/PlaYUVerModuleIf.cpp rename to app/PlaYUVerAppModuleIf.cpp index 3c3172b..bb063e7 100644 --- a/source/app/PlaYUVerModuleIf.cpp +++ b/app/PlaYUVerAppModuleIf.cpp @@ -18,23 +18,24 @@ */ /** - * \file PlaYUVerModuleIf.cpp + * \file PlaYUVerAppModuleIf.cpp * \brief PlaYUVer modules interface */ -#include "PlaYUVerModuleIf.h" +#include "PlaYUVerAppModuleIf.h" #include "SubWindowHandle.h" namespace plaYUVer { -PlaYUVerModuleIf::PlaYUVerModuleIf() : +PlaYUVerAppModuleIf::PlaYUVerAppModuleIf() : m_pcAction( NULL ), m_pcDisplaySubWindow( NULL ), m_pcDockWidget( NULL ), m_pcModuleDock( NULL ), m_pcModuleStream( NULL ), - m_pcProcessedFrame( NULL ) + m_pcProcessedFrame( NULL ), + m_dMeasurementResult( 0 ) { for( Int i = 0; i < MAX_NUMBER_FRAMES; i++ ) { @@ -42,38 +43,38 @@ PlaYUVerModuleIf::PlaYUVerModuleIf() : } } -void PlaYUVerModuleIf::run() +void PlaYUVerAppModuleIf::run() { m_pcProcessedFrame = NULL; m_dMeasurementResult = 0; - if( m_cModuleDef.m_iModuleType == FRAME_PROCESSING_MODULE ) + if( m_pcModule->m_cModuleDef.m_iModuleType == FRAME_PROCESSING_MODULE ) { - switch( m_cModuleDef.m_uiNumberOfFrames ) + switch( m_pcModule->m_cModuleDef.m_uiNumberOfFrames ) { case MODULE_REQUIRES_ONE_FRAME: - m_pcProcessedFrame = process( m_pcSubWindow[0]->getCurrFrame() ); + m_pcProcessedFrame = m_pcModule->process( m_pcSubWindow[0]->getCurrFrame() ); break; case MODULE_REQUIRES_TWO_FRAMES: - m_pcProcessedFrame = process( m_pcSubWindow[0]->getCurrFrame(), m_pcSubWindow[1]->getCurrFrame() ); + m_pcProcessedFrame = m_pcModule->process( m_pcSubWindow[0]->getCurrFrame(), m_pcSubWindow[1]->getCurrFrame() ); break; case MODULE_REQUIRES_THREE_FRAMES: - m_pcProcessedFrame = process( m_pcSubWindow[0]->getCurrFrame(), m_pcSubWindow[1]->getCurrFrame(), m_pcSubWindow[2]->getCurrFrame() ); + m_pcProcessedFrame = m_pcModule->process( m_pcSubWindow[0]->getCurrFrame(), m_pcSubWindow[1]->getCurrFrame(), m_pcSubWindow[2]->getCurrFrame() ); break; } } - else if( m_cModuleDef.m_iModuleType == FRAME_MEASUREMENT_MODULE ) + else if( m_pcModule->m_cModuleDef.m_iModuleType == FRAME_MEASUREMENT_MODULE ) { - switch( m_cModuleDef.m_uiNumberOfFrames ) + switch( m_pcModule->m_cModuleDef.m_uiNumberOfFrames ) { case MODULE_REQUIRES_ONE_FRAME: - m_dMeasurementResult = measure( m_pcSubWindow[0]->getCurrFrame() ); + m_dMeasurementResult = m_pcModule->measure( m_pcSubWindow[0]->getCurrFrame() ); break; case MODULE_REQUIRES_TWO_FRAMES: - m_dMeasurementResult = measure( m_pcSubWindow[0]->getCurrFrame(), m_pcSubWindow[1]->getCurrFrame() ); + m_dMeasurementResult = m_pcModule->measure( m_pcSubWindow[0]->getCurrFrame(), m_pcSubWindow[1]->getCurrFrame() ); break; case MODULE_REQUIRES_THREE_FRAMES: - m_dMeasurementResult = measure( m_pcSubWindow[0]->getCurrFrame(), m_pcSubWindow[1]->getCurrFrame(), m_pcSubWindow[2]->getCurrFrame() ); + m_dMeasurementResult = m_pcModule->measure( m_pcSubWindow[0]->getCurrFrame(), m_pcSubWindow[1]->getCurrFrame(), m_pcSubWindow[2]->getCurrFrame() ); break; } } @@ -85,7 +86,7 @@ void PlaYUVerModuleIf::run() return; } -Void PlaYUVerModuleIf::postProgress( Bool success ) +Void PlaYUVerAppModuleIf::postProgress( Bool success ) { EventData *eventData = new EventData( success, this ); if( parent() ) diff --git a/app/PlaYUVerAppModuleIf.h b/app/PlaYUVerAppModuleIf.h new file mode 100644 index 0000000..3395291 --- /dev/null +++ b/app/PlaYUVerAppModuleIf.h @@ -0,0 +1,109 @@ +/* This file is a part of plaYUVer project + * Copyright (C) 2014 by Luis Lucas (luisfrlucas@gmail.com) + * Joao Carreira (jfmcarreira@gmail.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + * \file PlaYUVerAppModuleIf.h + * \brief PlaYUVer App modules interface + */ + +#ifndef __PLAYUVERAPPMODULESIF_H__ +#define __PLAYUVERAPPMODULESIF_H__ + +#include "config.h" +#include "PlaYUVerDefs.h" +#include +#include +#include "PlaYUVerFrame.h" +#include "PlaYUVerStream.h" +#include "ModuleHandleDock.h" +#include "PlaYUVerModuleIf.h" + +class QAction; + +namespace plaYUVer +{ + +class SubWindowHandle; + +class PlaYUVerAppModuleIf +#ifdef PLAYUVER_THREADED_MODULES + : public QThread +#else + : public QObject +#endif +{ + friend class ModulesHandle; + friend class ModuleHandleDock; + +private: + + PlaYUVerModuleIf* m_pcModule; + + QAction* m_pcAction; + SubWindowHandle* m_pcSubWindow[MAX_NUMBER_FRAMES]; + + SubWindowHandle* m_pcDisplaySubWindow; + + QDockWidget* m_pcDockWidget; + ModuleHandleDock* m_pcModuleDock; + + PlaYUVerStream* m_pcModuleStream; + PlaYUVerFrame* m_pcProcessedFrame; + Double m_dMeasurementResult; + + Void postProgress( Bool success ); +public: + class EventData: public QEvent + { + public: + EventData( bool success = false, PlaYUVerAppModuleIf* module = NULL ) : + QEvent( QEvent::User ) + { + m_bSuccess = success; + m_pcModule = module; + } + Bool m_bSuccess; + PlaYUVerAppModuleIf* m_pcModule; + }; + + PlaYUVerAppModuleIf(); + virtual ~PlaYUVerAppModuleIf() {} + + +// virtual Void create() {} +// virtual Void create( PlaYUVerFrame* ) {} +// +// virtual PlaYUVerFrame* process( PlaYUVerFrame* ) { return NULL; } +// virtual PlaYUVerFrame* process( PlaYUVerFrame*, PlaYUVerFrame* ) { return NULL; } +// virtual PlaYUVerFrame* process( PlaYUVerFrame*, PlaYUVerFrame*, PlaYUVerFrame* ) { return NULL; } +// +// virtual Double measure( PlaYUVerFrame* ) { return 0; } +// virtual Double measure( PlaYUVerFrame*, PlaYUVerFrame* ) { return 0; } +// virtual Double measure( PlaYUVerFrame*, PlaYUVerFrame*, PlaYUVerFrame* ) { return 0; } +// +// virtual Void destroy() { } + +protected: + virtual void run(); +}; + +} // NAMESPACE + +#endif // __PLAYUVERAPPMODULESIF_H__ + diff --git a/source/app/PlaYUVerFrameStatistics.cpp b/app/PlaYUVerFrameStatistics.cpp similarity index 100% rename from source/app/PlaYUVerFrameStatistics.cpp rename to app/PlaYUVerFrameStatistics.cpp diff --git a/source/app/PlaYUVerFrameStatistics.h b/app/PlaYUVerFrameStatistics.h similarity index 100% rename from source/app/PlaYUVerFrameStatistics.h rename to app/PlaYUVerFrameStatistics.h diff --git a/source/app/PlaYUVerSettings.cpp b/app/PlaYUVerSettings.cpp similarity index 100% rename from source/app/PlaYUVerSettings.cpp rename to app/PlaYUVerSettings.cpp diff --git a/source/app/PlaYUVerSettings.h b/app/PlaYUVerSettings.h similarity index 100% rename from source/app/PlaYUVerSettings.h rename to app/PlaYUVerSettings.h diff --git a/source/app/PropertiesSidebar.cpp b/app/PropertiesSidebar.cpp similarity index 100% rename from source/app/PropertiesSidebar.cpp rename to app/PropertiesSidebar.cpp diff --git a/source/app/PropertiesSidebar.h b/app/PropertiesSidebar.h similarity index 100% rename from source/app/PropertiesSidebar.h rename to app/PropertiesSidebar.h diff --git a/source/app/QualityMeasurementSidebar.cpp b/app/QualityMeasurementSidebar.cpp similarity index 100% rename from source/app/QualityMeasurementSidebar.cpp rename to app/QualityMeasurementSidebar.cpp diff --git a/source/app/QualityMeasurementSidebar.h b/app/QualityMeasurementSidebar.h similarity index 100% rename from source/app/QualityMeasurementSidebar.h rename to app/QualityMeasurementSidebar.h diff --git a/source/app/SubWindowHandle.cpp b/app/SubWindowHandle.cpp similarity index 98% rename from source/app/SubWindowHandle.cpp rename to app/SubWindowHandle.cpp index 2f9317c..4bb7f9e 100644 --- a/source/app/SubWindowHandle.cpp +++ b/app/SubWindowHandle.cpp @@ -155,7 +155,7 @@ Void SubWindowHandle::updateSelectedArea( QRect area ) * Functions to enable a module in the * current SubWindow */ -Void SubWindowHandle::enableModule( PlaYUVerModuleIf* select_module ) +Void SubWindowHandle::enableModule( PlaYUVerAppModuleIf* select_module ) { if( m_pcCurrentModule ) { @@ -169,7 +169,7 @@ Void SubWindowHandle::disableModule() { if( m_pcCurrentModule ) { - PlaYUVerModuleIf* pcCurrentModule = m_pcCurrentModule; + PlaYUVerAppModuleIf* pcCurrentModule = m_pcCurrentModule; m_pcCurrentModule = NULL; ModulesHandle::destroyModuleIf( pcCurrentModule ); refreshFrame(); diff --git a/source/app/SubWindowHandle.h b/app/SubWindowHandle.h similarity index 96% rename from source/app/SubWindowHandle.h rename to app/SubWindowHandle.h index d94715a..55aa4c6 100644 --- a/source/app/SubWindowHandle.h +++ b/app/SubWindowHandle.h @@ -55,7 +55,7 @@ private: QRect m_cSelectedArea; QString m_cFilename; - PlaYUVerModuleIf* m_pcCurrentModule; + PlaYUVerAppModuleIf* m_pcCurrentModule; SubWindowHandle* m_pcReferenceSubWindow; @@ -125,11 +125,11 @@ public: return m_cViewArea->getZoomFactor(); } - Void setModule( PlaYUVerModuleIf* pcCurrentModule ) + Void setModule( PlaYUVerAppModuleIf* pcCurrentModule ) { m_pcCurrentModule = pcCurrentModule; } - PlaYUVerModuleIf* getModule() + PlaYUVerAppModuleIf* getModule() { return m_pcCurrentModule; } @@ -147,7 +147,7 @@ public: * Functions to enable a module in the * current SubWindow */ - Void enableModule( PlaYUVerModuleIf* select_module ); + Void enableModule( PlaYUVerAppModuleIf* select_module ); Void disableModule(); Void swapModuleFrames(); Void applyModuleAllFrames(); diff --git a/source/app/ViewArea.cpp b/app/ViewArea.cpp similarity index 100% rename from source/app/ViewArea.cpp rename to app/ViewArea.cpp diff --git a/source/app/ViewArea.h b/app/ViewArea.h similarity index 100% rename from source/app/ViewArea.h rename to app/ViewArea.h diff --git a/source/app/WidgetFrameNumber.cpp b/app/WidgetFrameNumber.cpp similarity index 100% rename from source/app/WidgetFrameNumber.cpp rename to app/WidgetFrameNumber.cpp diff --git a/source/app/WidgetFrameNumber.h b/app/WidgetFrameNumber.h similarity index 100% rename from source/app/WidgetFrameNumber.h rename to app/WidgetFrameNumber.h diff --git a/source/app/main.cpp b/app/main.cpp similarity index 100% rename from source/app/main.cpp rename to app/main.cpp diff --git a/source/app/plaYUVerApp.cpp b/app/plaYUVerApp.cpp similarity index 100% rename from source/app/plaYUVerApp.cpp rename to app/plaYUVerApp.cpp diff --git a/source/app/plaYUVerApp.h b/app/plaYUVerApp.h similarity index 100% rename from source/app/plaYUVerApp.h rename to app/plaYUVerApp.h diff --git a/resources/icons/.directory b/app/resources/icons/.directory similarity index 100% rename from resources/icons/.directory rename to app/resources/icons/.directory diff --git a/resources/icons/channel-all-16.png b/app/resources/icons/channel-all-16.png similarity index 100% rename from resources/icons/channel-all-16.png rename to app/resources/icons/channel-all-16.png diff --git a/resources/icons/channel-alpha-16.png b/app/resources/icons/channel-alpha-16.png similarity index 100% rename from resources/icons/channel-alpha-16.png rename to app/resources/icons/channel-alpha-16.png diff --git a/resources/icons/channel-blue-16.png b/app/resources/icons/channel-blue-16.png similarity index 100% rename from resources/icons/channel-blue-16.png rename to app/resources/icons/channel-blue-16.png diff --git a/resources/icons/channel-green-16.png b/app/resources/icons/channel-green-16.png similarity index 100% rename from resources/icons/channel-green-16.png rename to app/resources/icons/channel-green-16.png diff --git a/resources/icons/channel-luma-16.png b/app/resources/icons/channel-luma-16.png similarity index 100% rename from resources/icons/channel-luma-16.png rename to app/resources/icons/channel-luma-16.png diff --git a/resources/icons/channel-red-16.png b/app/resources/icons/channel-red-16.png similarity index 100% rename from resources/icons/channel-red-16.png rename to app/resources/icons/channel-red-16.png diff --git a/resources/icons/close.png b/app/resources/icons/close.png similarity index 100% rename from resources/icons/close.png rename to app/resources/icons/close.png diff --git a/resources/icons/configuredialog.png b/app/resources/icons/configuredialog.png similarity index 100% rename from resources/icons/configuredialog.png rename to app/resources/icons/configuredialog.png diff --git a/resources/icons/copy.png b/app/resources/icons/copy.png similarity index 100% rename from resources/icons/copy.png rename to app/resources/icons/copy.png diff --git a/resources/icons/exit.png b/app/resources/icons/exit.png similarity index 100% rename from resources/icons/exit.png rename to app/resources/icons/exit.png diff --git a/resources/icons/fittowindow.png b/app/resources/icons/fittowindow.png similarity index 100% rename from resources/icons/fittowindow.png rename to app/resources/icons/fittowindow.png diff --git a/resources/icons/histogram-lin.png b/app/resources/icons/histogram-lin.png similarity index 100% rename from resources/icons/histogram-lin.png rename to app/resources/icons/histogram-lin.png diff --git a/resources/icons/histogram-log.png b/app/resources/icons/histogram-log.png similarity index 100% rename from resources/icons/histogram-log.png rename to app/resources/icons/histogram-log.png diff --git a/resources/icons/image-full.png b/app/resources/icons/image-full.png similarity index 100% rename from resources/icons/image-full.png rename to app/resources/icons/image-full.png diff --git a/resources/icons/image-selection.png b/app/resources/icons/image-selection.png similarity index 100% rename from resources/icons/image-selection.png rename to app/resources/icons/image-selection.png diff --git a/resources/icons/open.png b/app/resources/icons/open.png similarity index 100% rename from resources/icons/open.png rename to app/resources/icons/open.png diff --git a/resources/icons/paste.png b/app/resources/icons/paste.png similarity index 100% rename from resources/icons/paste.png rename to app/resources/icons/paste.png diff --git a/resources/icons/qt.png b/app/resources/icons/qt.png similarity index 100% rename from resources/icons/qt.png rename to app/resources/icons/qt.png diff --git a/resources/icons/save.png b/app/resources/icons/save.png similarity index 100% rename from resources/icons/save.png rename to app/resources/icons/save.png diff --git a/resources/icons/saveas.png b/app/resources/icons/saveas.png similarity index 100% rename from resources/icons/saveas.png rename to app/resources/icons/saveas.png diff --git a/resources/icons/windowscascade.png b/app/resources/icons/windowscascade.png similarity index 100% rename from resources/icons/windowscascade.png rename to app/resources/icons/windowscascade.png diff --git a/resources/icons/windowstile.png b/app/resources/icons/windowstile.png similarity index 100% rename from resources/icons/windowstile.png rename to app/resources/icons/windowstile.png diff --git a/resources/icons/zoomin.png b/app/resources/icons/zoomin.png similarity index 100% rename from resources/icons/zoomin.png rename to app/resources/icons/zoomin.png diff --git a/resources/icons/zoomout.png b/app/resources/icons/zoomout.png similarity index 100% rename from resources/icons/zoomout.png rename to app/resources/icons/zoomout.png diff --git a/resources/icons/zoomtonormal.png b/app/resources/icons/zoomtonormal.png similarity index 100% rename from resources/icons/zoomtonormal.png rename to app/resources/icons/zoomtonormal.png diff --git a/resources/playuver-background-logo.png b/app/resources/playuver-background-logo.png similarity index 100% rename from resources/playuver-background-logo.png rename to app/resources/playuver-background-logo.png diff --git a/resources/playuver.desktop b/app/resources/playuver.desktop similarity index 100% rename from resources/playuver.desktop rename to app/resources/playuver.desktop diff --git a/resources/playuver.ico b/app/resources/playuver.ico similarity index 100% rename from resources/playuver.ico rename to app/resources/playuver.ico diff --git a/resources/playuver.png b/app/resources/playuver.png similarity index 100% rename from resources/playuver.png rename to app/resources/playuver.png diff --git a/resources/playuver.qrc b/app/resources/playuver.qrc similarity index 100% rename from resources/playuver.qrc rename to app/resources/playuver.qrc diff --git a/resources/playuver.rc b/app/resources/playuver.rc similarity index 100% rename from resources/playuver.rc rename to app/resources/playuver.rc diff --git a/resources/x-raw.xml b/app/resources/x-raw.xml similarity index 100% rename from resources/x-raw.xml rename to app/resources/x-raw.xml diff --git a/cmake/CMakeMacros.cmake b/cmake/CMakeMacros.cmake index e3fb168..31b2ceb 100644 --- a/cmake/CMakeMacros.cmake +++ b/cmake/CMakeMacros.cmake @@ -101,9 +101,7 @@ macro(ADD_MODULE name file ) set(__modulename "Module${name}") ADD_OPTION(MODULE_${name} "Use module ${name}" ON ) if( MODULE_${name} ) - add_library( ${__modulename} ${SRC_DIR}/modules/${file} ) - set(MODULES_LIBS ${MODULES_LIBS} ${__modulename}) - add_definitions( -DUSE_${name} ) + list(APPEND plaYUver_Mod_SRCS ${file} ) LIST(APPEND MODULES_LIST ${name} ) file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "#include \"${file}.h\"\n") file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/ModulesListMacro.h "\\\n REGISTER_MODULE( ${name} ); ") diff --git a/cmake/Install.cmake b/cmake/Install.cmake deleted file mode 100644 index 029dbc8..0000000 --- a/cmake/Install.cmake +++ /dev/null @@ -1,99 +0,0 @@ -###################################################################################### -# Install -###################################################################################### - -INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin ) -INSTALL(FILES ${RSC_DIR}/playuver.desktop DESTINATION share/applications ) -INSTALL(FILES ${RSC_DIR}/playuver.png DESTINATION share/icons ) -INSTALL(FILES ${RSC_DIR}/x-raw.xml DESTINATION share/mime/video ) -INSTALL(FILES ${CMAKE_BINARY_DIR}/PlaYUVerConfig.cmake DESTINATION share/playuver ) - -IF( WIN32 ) - - SET(MSVC_DLL_DIR "MSVC_DLL_DIR" CACHE PATH "Where to find MSVC dlls") - INSTALL(FILES ${MSVC_DLL_DIR}/msvcr120.dll DESTINATION bin ) - INSTALL(FILES ${MSVC_DLL_DIR}/msvcp120.dll DESTINATION bin ) - -ENDIF() - -IF( PLAYUVER_INSTALL_LIBS ) - FILE( GLOB PLAYUVER_LIB_INCLUDE_FILES ${SRC_DIR}/lib/*.h ) - INSTALL(FILES ${PLAYUVER_LIB_INCLUDE_FILES} DESTINATION include ) - INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libPlaYUVerLib.a DESTINATION lib ) -ENDIF() - - -###################################################################################### -# Create deb package -###################################################################################### - -SET(CPACK_PACKAGE_NAME ${PROJECT_NAME}) -SET(CPACK_PACKAGE_CONTACT "Joao Carreira (jfmcarreira@gmail.com), Luis Lucas (luisfrlucas@gmail.com)") -SET(CPACK_PACKAGE_VERSION_MAJOR ${PLAYUVER_VERSION_MAJOR}) -SET(CPACK_PACKAGE_VERSION_MINOR ${PLAYUVER_VERSION_MINOR}) -SET(CPACK_PACKAGE_VERSION_PATCH ${PLAYUVER_VERSION_PATH}) -SET(CPACK_PACKAGE_VERSION ${PLAYUVER_VERSION}) - -SET(CPACK_PACKAGE_ARCHITECTURE "amd64") - -IF( UNIX ) - - SET(CPACK_GENERATOR "DEB;ZIP") - SET(OS "Linux") - - SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION "plaYUVer is an open-source QT based raw video player") - SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Joao Carreira (jfmcarreira@gmail.com), Luis Lucas (luisfrlucas@gmail.com)") - SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE ${CPACK_PACKAGE_ARCHITECTURE} ) - SET(CPACK_DEBIAN_PACKAGE_DEPENDS "") - IF( USE_QT4 ) - LIST(APPEND CPACK_DEBIAN_PACKAGE_DEPENDS "libqtcore4 (>= 4:4.8.5), libqtgui4 (>= 4:4.8.5)" ) - ELSE() - LIST(APPEND CPACK_DEBIAN_PACKAGE_DEPENDS "libqt5core5a, libqt5gui5, libqt5widgets5") - ENDIF() - IF( USE_OPENCV ) - LIST(APPEND CPACK_DEBIAN_PACKAGE_DEPENDS ",") - LIST(APPEND CPACK_DEBIAN_PACKAGE_DEPENDS "libopencv-dev (>= 2.4.8)") - ENDIF() - IF( USE_FFMPEG ) - LIST(APPEND CPACK_DEBIAN_PACKAGE_DEPENDS ",") - LIST(APPEND CPACK_DEBIAN_PACKAGE_DEPENDS "libavformat54, libavcodec54, libavutil52") - ENDIF() - - STRING(REPLACE ";" "" CPACK_DEBIAN_PACKAGE_DEPENDS ${CPACK_DEBIAN_PACKAGE_DEPENDS} ) - - #EXECUTE_PROCESS(COMMAND "date" "+%Y%m%d" OUTPUT_VARIABLE DAY) - #string(STRIP ${DAY} DAY) - -ENDIF() - -IF( WIN32 ) - - SET(CPACK_GENERATOR "ZIP") - SET(OS "Windows") - SET(GIT_BRANCH "devel") # temp work around - #EXECUTE_PROCESS(COMMAND "cmd" " /C date /T" OUTPUT_VARIABLE ${DAY}) - #string(REGEX REPLACE "(..)/(..)/..(..).*" "\\1/\\2/\\3" ${DAY} ${${DAY}}) - -ENDIF() - -IF( USE_QT4 ) - SET( APPEND_VERSION "${APPEND_VERSION}_wQT4" ) -ELSE() - SET( APPEND_VERSION "${APPEND_VERSION}_wQT5" ) -ENDIF() -IF( USE_FFMPEG ) - SET( APPEND_VERSION "${APPEND_VERSION}_wFFmpeg" ) -ENDIF() -IF( USE_OPENCV ) - SET( APPEND_VERSION "${APPEND_VERSION}_wOpenCV" ) -ENDIF() - -IF( PLAYUVER_LONGVERSIONNAME ) - SET( CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}${APPEND_VERSION}-${OS}-${CPACK_PACKAGE_ARCHITECTURE}" ) - SET( PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME} ) -ELSE() - SET( CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${PACK_NAME}${APPEND_VERSION}-${OS}-${CPACK_PACKAGE_ARCHITECTURE}" ) - SET( PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME} ) -ENDIF() - -INCLUDE(CPack) diff --git a/cmake/LibFFmpeg.cmake b/cmake/LibFFmpeg.cmake index e59195c..3da0f72 100644 --- a/cmake/LibFFmpeg.cmake +++ b/cmake/LibFFmpeg.cmake @@ -109,12 +109,15 @@ IF( USE_FFMPEG ) SET( USE_FFMPEG FALSE ) ELSE() SET( DEPENDENCIES_STRING "${DEPENDENCIES_STRING}FFMPEG" ) - INCLUDE_DIRECTORIES( ${LIB_DIR}/ffmpeg ) + INCLUDE_DIRECTORIES( ffmpeg ) #SET( CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -D__STDC_CONSTANT_MACROS ) INCLUDE_DIRECTORIES(${FFMPEG_INCLUDE_DIR} ${FFMPEG_INCLUDE_DIRS}) - ADD_LIBRARY( FFmpeg ${LIB_DIR}/ffmpeg/LibAvContextHandle.cpp ) + ADD_LIBRARY( FFmpeg lib/ffmpeg/LibAvContextHandle.cpp ) TARGET_LINK_LIBRARIES( FFmpeg ${FFMPEG_LIBRARIES} ) - SET( LINKER_LIBS ${LINKER_LIBS} FFmpeg ) + LIST(APPEND LINKER_LIBS FFmpeg ) + LIST(APPEND CPACK_DEBIAN_PACKAGE_DEPENDS ",") + LIST(APPEND CPACK_DEBIAN_PACKAGE_DEPENDS "libavformat54, libavcodec54, libavutil52") + SET( APPEND_VERSION "${APPEND_VERSION}_wFFmpeg" ) ENDIF() ELSE() SET( USE_FFMPEG FALSE ) diff --git a/cmake/LibOpenCV.cmake b/cmake/LibOpenCV.cmake index acd36fa..4a69160 100644 --- a/cmake/LibOpenCV.cmake +++ b/cmake/LibOpenCV.cmake @@ -3,12 +3,14 @@ ###################################################################################### IF( USE_OPENCV ) + FIND_PACKAGE( OpenCV ) IF( NOT OpenCV_FOUND) SET(USE_OPENCV FALSE) ELSE() LIST(APPEND LINKER_LIBS ${OpenCV_LIBRARIES} ) ENDIF() + ENDIF() IF( USE_OPENCV ) @@ -34,4 +36,7 @@ IF( USE_OPENCV ) INSTALL(FILES ${OpenCV_DLL_DIR}/opencv_legacy${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.dll DESTINATION bin ) INSTALL(FILES ${OpenCV_DLL_DIR}/opencv_gpu${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.dll DESTINATION bin ) ENDIF() + LIST(APPEND CPACK_DEBIAN_PACKAGE_DEPENDS ",") + LIST(APPEND CPACK_DEBIAN_PACKAGE_DEPENDS "libopencv-dev (>= 2.4.8)") + SET( APPEND_VERSION "${APPEND_VERSION}_wOpenCV" ) ENDIF() diff --git a/cmake/LibQT.cmake b/cmake/LibQT.cmake index aa1a25a..5b11e8d 100644 --- a/cmake/LibQT.cmake +++ b/cmake/LibQT.cmake @@ -9,40 +9,27 @@ IF( WIN32 ) ENDIF() IF( USE_QT4 ) - SET( DEPENDENCIES_STRING "${DEPENDENCIES_STRING}QT4" ) - FIND_PACKAGE( Qt4 REQUIRED QtCore QtGui QtNetwork QtWebKit ) - IF( NOT QT4_FOUND) + IF( NOT QT4_FOUND ) SET(USE_QT4 FALSE) + ELSE() + INCLUDE( ${QT_USE_FILE} ) + ADD_DEFINITIONS( ${QT_DEFINITIONS} ) + LIST(APPEND LINKER_LIBS ${QT_LIBRARIES} ) ENDIF() - INCLUDE( ${QT_USE_FILE} ) - ADD_DEFINITIONS( ${QT_DEFINITIONS} ) - - QT4_WRAP_UI( FORMS_HEADERS_FILES ${FORMS_FILES} ) - QT4_ADD_RESOURCES( RESOURCES_RCC_FILES ${RESOURCES_FILES} ) - LIST(APPEND LINKER_LIBS ${QT_LIBRARIES} ) - ENDIF() IF( NOT USE_QT4 ) - SET( DEPENDENCIES_STRING "${DEPENDENCIES_STRING}QT5" ) - FIND_PACKAGE( Qt5Core REQUIRED ) FIND_PACKAGE( Qt5Gui REQUIRED ) FIND_PACKAGE( Qt5Widgets REQUIRED ) - INCLUDE_DIRECTORIES( ${Qt5Core_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ) - # QT5_WRAP_CPP( HEADERS_MOC_FILES ${HEADERS_FILES} ) - QT5_WRAP_UI( FORMS_HEADERS_FILES ${FORMS_FILES} ) - QT5_ADD_RESOURCES( RESOURCES_RCC_FILES ${RESOURCES_FILES} ) - # Add compiler flags for building executables (-fPIE) LIST(APPEND CMAKE_CXX_FLAGS ${Qt5Core_EXECUTABLE_COMPILE_FLAGS} ) - LIST(APPEND LINKER_LIBS ${Qt5Core_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Widgets_LIBRARIES} ) - + LIST(APPEND QT_MODULES Core Gui Widgets ) IF( WIN32 ) INSTALL(FILES ${QT_DIR}/bin/Qt5Core${QT_DLL_POSTFIX}.dll DESTINATION bin ) INSTALL(FILES ${QT_DIR}/bin/Qt5Gui${QT_DLL_POSTFIX}.dll DESTINATION bin ) @@ -52,12 +39,17 @@ IF( NOT USE_QT4 ) INSTALL(FILES ${QT_DIR}/bin/icudt52.dll DESTINATION bin ) INSTALL(FILES ${QT_DIR}/bin/icuin52.dll DESTINATION bin ) INSTALL(FILES ${QT_DIR}/bin/icuuc52.dll DESTINATION bin ) - INSTALL(FILES ${QT_DIR}/plugins/platforms/qminimal.dll DESTINATION bin/platforms ) INSTALL(FILES ${QT_DIR}/plugins/platforms/qoffscreen.dll DESTINATION bin/platforms ) INSTALL(FILES ${QT_DIR}/plugins/platforms/qwindows.dll DESTINATION bin/platforms ) ENDIF() - - LIST(APPEND QT_MODULES Core Gui Widgets ) - +ENDIF() + + +IF( USE_QT4 ) + LIST(APPEND CPACK_DEBIAN_PACKAGE_DEPENDS "libqtcore4 (>= 4:4.8.5), libqtgui4 (>= 4:4.8.5)" ) + SET( APPEND_VERSION "${APPEND_VERSION}_wQT4" ) +ELSE() + LIST(APPEND CPACK_DEBIAN_PACKAGE_DEPENDS "libqt5core5a, libqt5gui5, libqt5widgets5") + SET( APPEND_VERSION "${APPEND_VERSION}_wQT5" ) ENDIF() diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt new file mode 100644 index 0000000..f2e63b7 --- /dev/null +++ b/lib/CMakeLists.txt @@ -0,0 +1,32 @@ +### +### CMakeLists for playuver lib component +### + +INCLUDE_DIRECTORIES( ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ) + +ADD_OPTION(USE_OPENCV "Add OpenCV support" OFF ) +ADD_OPTION(USE_FFMPEG "Add FFMPEG support" OFF ) +ADD_OPTION(USE_PIXFC "Add PIXFC support" OFF ) + +set(plaYUver_Lib_SRCS + # Frame + PlaYUVerFrame.cpp + PlaYUVerFramePixelFormats.cpp + # Stream + PlaYUVerStream.cpp +) + +set(plaYUver_Lib_HEADERS + PlaYUVerFrame.h + PlaYUVerStream.h +) + +INCLUDE( LibPixfc.cmake ) + +CONFIGURE_FILE( PlaYUVerConfig.cmake.in ${CMAKE_BINARY_DIR}/PlaYUVerConfig.cmake @ONLY) + +ADD_LIBRARY( PlaYUVerLib ${plaYUver_Lib_SRCS} ) +TARGET_LINK_LIBRARIES( PlaYUVerLib ${LINKER_LIBS} ) + +INSTALL(FILES ${plaYUver_Lib_HEADERS} DESTINATION include ) +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libPlaYUVerLib.a DESTINATION lib ) diff --git a/source/lib/LibMemory.h b/lib/LibMemory.h similarity index 100% rename from source/lib/LibMemory.h rename to lib/LibMemory.h diff --git a/cmake/LibPixfc.cmake b/lib/LibPixfc.cmake similarity index 100% rename from cmake/LibPixfc.cmake rename to lib/LibPixfc.cmake diff --git a/cmake/PlaYUVerConfig.cmake.in b/lib/PlaYUVerConfig.cmake.in similarity index 100% rename from cmake/PlaYUVerConfig.cmake.in rename to lib/PlaYUVerConfig.cmake.in diff --git a/source/lib/PlaYUVerDefs.h b/lib/PlaYUVerDefs.h similarity index 100% rename from source/lib/PlaYUVerDefs.h rename to lib/PlaYUVerDefs.h diff --git a/source/lib/PlaYUVerFrame.cpp b/lib/PlaYUVerFrame.cpp similarity index 98% rename from source/lib/PlaYUVerFrame.cpp rename to lib/PlaYUVerFrame.cpp index 2764e6d..42ccf4f 100644 --- a/source/lib/PlaYUVerFrame.cpp +++ b/lib/PlaYUVerFrame.cpp @@ -362,9 +362,10 @@ Void PlaYUVerFrame::FrametoRGB8Pixfc() #endif } -#ifdef USE_OPENCV -Void PlaYUVerFrame::getCvMat( cv::Mat** ppCvFrame ) + +Void PlaYUVerFrame::getCvMat( Void** ppCvFrame ) { +#ifdef USE_OPENCV Int cvType = CV_8UC3; switch( m_iPixelFormat ) { @@ -383,8 +384,7 @@ Void PlaYUVerFrame::getCvMat( cv::Mat** ppCvFrame ) default: break; } - cv::Mat *pcCvFrame = *ppCvFrame = new cv::Mat( m_uiHeight, m_uiWidth, cvType ); - + cv::Mat *pcCvFrame = new cv::Mat( m_uiHeight, m_uiWidth, cvType ); if( m_iPixelFormat != GRAY ) { fillRGBBuffer(); @@ -394,10 +394,14 @@ Void PlaYUVerFrame::getCvMat( cv::Mat** ppCvFrame ) { memcpy( pcCvFrame->data, &( m_pppcInputPel[LUMA][0][0] ), m_uiWidth * m_uiHeight * sizeof(Pel) ); } + *ppCvFrame = pcCvFrame; +#endif } -Void PlaYUVerFrame::copyFrom( cv::Mat* opencvFrame ) +Void PlaYUVerFrame::fromCvMat( Void* voidFrame ) { +#ifdef USE_OPENCV + cv::Mat* opencvFrame = (cv::Mat*)voidFrame; if( m_iPixelFormat == NO_FMT ) { switch( opencvFrame->channels() ) @@ -440,8 +444,9 @@ Void PlaYUVerFrame::copyFrom( cv::Mat* opencvFrame ) { memcpy( m_pppcInputPel[LUMA][0], opencvFrame->data, m_uiWidth * m_uiHeight * sizeof(Pel) ); } -} #endif +} + /* diff --git a/source/lib/PlaYUVerFrame.h b/lib/PlaYUVerFrame.h similarity index 96% rename from source/lib/PlaYUVerFrame.h rename to lib/PlaYUVerFrame.h index fc5fcc0..b87eaa7 100644 --- a/source/lib/PlaYUVerFrame.h +++ b/lib/PlaYUVerFrame.h @@ -25,21 +25,13 @@ #ifndef __PLAYUVERFRAME_H__ #define __PLAYUVERFRAME_H__ -#ifdef PLAYUVER -#include "config.h" -#endif #include "PlaYUVerDefs.h" #include #include #include #include -#ifdef USE_OPENCV -#include -#endif - class PixFcSSE; -struct AVFrame; namespace plaYUVer { @@ -168,10 +160,8 @@ public: /** * Interface to other libs */ -#ifdef USE_OPENCV - Void getCvMat( cv::Mat** ); - Void copyFrom( cv::Mat* ); -#endif + Void getCvMat( Void** ); + Void fromCvMat( Void* ); /** * Quality metrics interface diff --git a/source/lib/PlaYUVerFramePixelFormats.cpp b/lib/PlaYUVerFramePixelFormats.cpp similarity index 100% rename from source/lib/PlaYUVerFramePixelFormats.cpp rename to lib/PlaYUVerFramePixelFormats.cpp diff --git a/source/lib/PlaYUVerFramePixelFormats.h b/lib/PlaYUVerFramePixelFormats.h similarity index 100% rename from source/lib/PlaYUVerFramePixelFormats.h rename to lib/PlaYUVerFramePixelFormats.h diff --git a/source/lib/PlaYUVerStream.cpp b/lib/PlaYUVerStream.cpp similarity index 100% rename from source/lib/PlaYUVerStream.cpp rename to lib/PlaYUVerStream.cpp diff --git a/source/lib/PlaYUVerStream.h b/lib/PlaYUVerStream.h similarity index 100% rename from source/lib/PlaYUVerStream.h rename to lib/PlaYUVerStream.h diff --git a/source/lib/ffmpeg/LibAvContextHandle.cpp b/lib/ffmpeg/LibAvContextHandle.cpp similarity index 100% rename from source/lib/ffmpeg/LibAvContextHandle.cpp rename to lib/ffmpeg/LibAvContextHandle.cpp diff --git a/source/lib/ffmpeg/LibAvContextHandle.h b/lib/ffmpeg/LibAvContextHandle.h similarity index 100% rename from source/lib/ffmpeg/LibAvContextHandle.h rename to lib/ffmpeg/LibAvContextHandle.h diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt new file mode 100644 index 0000000..67da484 --- /dev/null +++ b/modules/CMakeLists.txt @@ -0,0 +1,47 @@ +### +### CMakeLists for playuver modules component +### + +INCLUDE_DIRECTORIES( ${CMAKE_BINARY_DIR} ) + +# set(plaYUver_Mod_SRCS +# PlaYUVerModuleIf.cpp +# ) + + +# +# Init header +# +file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/ModulesListMacro.h "// This files defines the macro to \n" + "// define a list of modules\n" + "#ifndef __MODULESLISTMACRO_H__\n#define __MODULESLISTMACRO_H__\n" + "#define REGISTER_ALL_MODULES ") + +file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "// This files add the header files of each module\n" + + "#ifndef __MODULESLISTHEADER_H__\n#define __MODULESLISTHEADER_H__\n" ) + + +# +# Modules List +# +ADD_MODULE( FilterComponentLuma "FilterComponent" ) +ADD_MODULE( FilterComponentChromaU "FilterComponent" ) +ADD_MODULE( FilterComponentChromaV "FilterComponent" ) +ADD_MODULE( FrameDifference "FrameDifference" ) +ADD_MODULE( MeasurePSNR "MeasurePSNR" ) +# IF( USE_OPENCV ) +# ADD_MODULE( DisparityStereoVar "DisparityStereoVar" ) +# ENDIF() + + +# +# Finish header +# +file( APPEND ${CMAKE_CURRENT_BINARY_DIR}/ModulesListMacro.h "\n#endif // __MODULESLISTMACRO_H__\n" ) +file( APPEND ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "#endif // __MODULESLISTHEADER_H__\n" ) + +ADD_LIBRARY( PlaYUVerModules ${plaYUver_Mod_SRCS} ) + + +status("Modules List:" "${MODULES_LIST}" ) \ No newline at end of file diff --git a/source/modules/DisparityStereoVar.cpp b/modules/DisparityStereoVar.cpp similarity index 85% rename from source/modules/DisparityStereoVar.cpp rename to modules/DisparityStereoVar.cpp index afbefd5..ca5c5ff 100644 --- a/source/modules/DisparityStereoVar.cpp +++ b/modules/DisparityStereoVar.cpp @@ -43,6 +43,14 @@ static PlaYUVerModuleDefinition DisparityStereoVarDef = DisparityStereoVar::DisparityStereoVar() { + m_iModuleType = FRAME_PROCESSING_MODULE; + m_pchModuleCategory = "Disparity"; + m_pchModuleName = "StereoVar"; + m_pchModuleTooltip = "Measure the disparity between two images using the Stereo Var method (OpenCV)"; + m_uiNumberOfFrames = MODULE_REQUIRES_TWO_FRAMES; + m_uiModuleRequirements = MODULE_REQUIRES_NEW_WINDOW; + m_bApplyWhilePlaying = !APPLY_WHILE_PLAYING; + setModuleDefinition( DisparityStereoVarDef ); m_pcDisparityFrame = NULL; m_cStereoVar.levels = 3; // ignored with USE_AUTO_PARAMS @@ -68,15 +76,15 @@ Void DisparityStereoVar::create( PlaYUVerFrame* InputFrame ) PlaYUVerFrame* DisparityStereoVar::process( PlaYUVerFrame* InputLeft, PlaYUVerFrame* InputRight ) { cv::Mat* leftImage; - InputLeft->getCvMat( &leftImage ); + InputLeft->getCvMat( (Void**)&leftImage ); cv::Mat* rightImage; - InputRight->getCvMat( &rightImage ); + InputRight->getCvMat( (Void**)&rightImage ); cv::Mat disparityImage, disparityImage8; m_cStereoVar(*leftImage,*rightImage,disparityImage); disparityImage.convertTo(disparityImage8,CV_8U); - m_pcDisparityFrame->copyFrom(&disparityImage8); + m_pcDisparityFrame->fromCvMat( (Void*)&disparityImage8); return m_pcDisparityFrame; } diff --git a/source/modules/DisparityStereoVar.h b/modules/DisparityStereoVar.h similarity index 98% rename from source/modules/DisparityStereoVar.h rename to modules/DisparityStereoVar.h index 89e903b..b9e829c 100644 --- a/source/modules/DisparityStereoVar.h +++ b/modules/DisparityStereoVar.h @@ -25,7 +25,6 @@ #ifndef __DISPARITYSTEREOVAR_H__ #define __DISPARITYSTEREOVAR_H__ -#include "config.h" #include "PlaYUVerDefs.h" #include #include diff --git a/source/modules/FilterComponent.cpp b/modules/FilterComponent.cpp similarity index 100% rename from source/modules/FilterComponent.cpp rename to modules/FilterComponent.cpp diff --git a/source/modules/FilterComponent.h b/modules/FilterComponent.h similarity index 99% rename from source/modules/FilterComponent.h rename to modules/FilterComponent.h index d2698a5..55ce151 100644 --- a/source/modules/FilterComponent.h +++ b/modules/FilterComponent.h @@ -25,7 +25,6 @@ #ifndef __FILTERCOMPONENT_H__ #define __FILTERCOMPONENT_H__ -#include "config.h" #include "PlaYUVerDefs.h" #include #include diff --git a/source/modules/FrameDifference.cpp b/modules/FrameDifference.cpp similarity index 100% rename from source/modules/FrameDifference.cpp rename to modules/FrameDifference.cpp diff --git a/source/modules/FrameDifference.h b/modules/FrameDifference.h similarity index 98% rename from source/modules/FrameDifference.h rename to modules/FrameDifference.h index 61a10a5..2060eed 100644 --- a/source/modules/FrameDifference.h +++ b/modules/FrameDifference.h @@ -25,7 +25,6 @@ #ifndef __FRAMEDIFFERENCE_H__ #define __FRAMEDIFFERENCE_H__ -#include "config.h" #include "PlaYUVerDefs.h" #include #include diff --git a/source/modules/MeasurePSNR.cpp b/modules/MeasurePSNR.cpp similarity index 100% rename from source/modules/MeasurePSNR.cpp rename to modules/MeasurePSNR.cpp diff --git a/source/modules/MeasurePSNR.h b/modules/MeasurePSNR.h similarity index 98% rename from source/modules/MeasurePSNR.h rename to modules/MeasurePSNR.h index 9224a87..b8c594b 100644 --- a/source/modules/MeasurePSNR.h +++ b/modules/MeasurePSNR.h @@ -25,7 +25,6 @@ #ifndef __MEASUREPSNR_H__ #define __MEASUREPSNR_H__ -#include "config.h" #include "PlaYUVerDefs.h" #include #include diff --git a/source/app/PlaYUVerModuleIf.h b/modules/PlaYUVerModuleIf.h similarity index 74% rename from source/app/PlaYUVerModuleIf.h rename to modules/PlaYUVerModuleIf.h index 1a0025f..137681a 100644 --- a/source/app/PlaYUVerModuleIf.h +++ b/modules/PlaYUVerModuleIf.h @@ -25,19 +25,21 @@ #ifndef __PLAYUVERMODULESIF_H__ #define __PLAYUVERMODULESIF_H__ -#include "config.h" #include "PlaYUVerDefs.h" #include #include #include "PlaYUVerFrame.h" #include "PlaYUVerStream.h" -#include "ModuleHandleDock.h" - -class QAction; namespace plaYUVer { +#define REGISTER_MODULE(X) \ + { \ + X *pMod = new X(); \ + appendModule( pMod ); \ + } + enum // Module type { FRAME_PROCESSING_MODULE, @@ -62,15 +64,6 @@ enum // Requirements MODULES_REQUIREMENTS_TOTAL, }; -#define REGISTER_MODULE(X) \ - { \ - if( USE_##X ) \ - { \ - X *pMod = new X(); \ - appendModule( pMod ); \ - } \ - } - typedef struct { Int m_iModuleType; @@ -82,49 +75,23 @@ typedef struct Bool m_bApplyWhilePlaying; } PlaYUVerModuleDefinition; -class SubWindowHandle; - class PlaYUVerModuleIf -#ifdef PLAYUVER_THREADED_MODULES - : public QThread -#else - : public QObject -#endif { - friend class ModulesHandle; - -private: - QAction* m_pcAction; - SubWindowHandle* m_pcSubWindow[MAX_NUMBER_FRAMES]; - - SubWindowHandle* m_pcDisplaySubWindow; - - QDockWidget* m_pcDockWidget; - ModuleHandleDock* m_pcModuleDock; - - PlaYUVerStream* m_pcModuleStream; - PlaYUVerFrame* m_pcProcessedFrame; - Double m_dMeasurementResult; - - Void postProgress( Bool success ); public: - class EventData: public QEvent - { - public: - EventData( bool success = false, PlaYUVerModuleIf* module = NULL ) : - QEvent( QEvent::User ) - { - m_bSuccess = success; - m_pcModule = module; - } - Bool m_bSuccess; - PlaYUVerModuleIf* m_pcModule; - }; - PlaYUVerModuleIf(); + Int m_iModuleType; + const Char* m_pchModuleCategory; + const Char* m_pchModuleName; + const Char* m_pchModuleTooltip; + UInt m_uiNumberOfFrames; + UInt m_uiModuleRequirements; + Bool m_bApplyWhilePlaying; + + PlaYUVerModuleDefinition m_cModuleDef; + + PlaYUVerModuleIf() {} virtual ~PlaYUVerModuleIf() {} - virtual Void create() {} virtual Void create( PlaYUVerFrame* ) {} @@ -141,9 +108,6 @@ public: Void setModuleDefinition( PlaYUVerModuleDefinition def ) { m_cModuleDef = def; } PlaYUVerModuleDefinition getModuleDefinition() { return m_cModuleDef; } -protected: - PlaYUVerModuleDefinition m_cModuleDef; - virtual void run(); }; } // NAMESPACE diff --git a/resources/releaseNotes.html b/resources/releaseNotes.html deleted file mode 100644 index 3be1fde..0000000 --- a/resources/releaseNotes.html +++ /dev/null @@ -1,308 +0,0 @@ - - - - - - - - - - - Sample Release Notes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

Bugfix:

-
-

Various Bugfixes.

-
-

Feature:

-
-

New features maybe be introduced in this branch.

-
-

Other:

-
-

Note that you are following the development branch! Faster access to features and higher chance of bugs.

-
- - - -