Merge branch 'master' of https://github.com/pixlra/playuver
This commit is contained in:
+14
-7
@@ -2,18 +2,19 @@
|
||||
### CMakeLists for playuver
|
||||
###
|
||||
|
||||
cmake_minimum_required( VERSION 2.8.9 )
|
||||
|
||||
######################################################################################
|
||||
# Project Definition
|
||||
######################################################################################
|
||||
|
||||
cmake_minimum_required( VERSION 2.8.9 )
|
||||
SET( PROJECT_NAME playuver )
|
||||
SET( PLAYUVER_VERSION_MAJOR "0" )
|
||||
SET( PLAYUVER_VERSION_MINOR "1" )
|
||||
SET( PLAYUVER_VERSION_PATH "0" )
|
||||
PROJECT( ${PROJECT_NAME} )
|
||||
|
||||
INCLUDE( cmake/CMakeMacros.cmake )
|
||||
|
||||
PROJECT( playuver )
|
||||
|
||||
SET( PROJECT_NAME playuver )
|
||||
|
||||
# Project directories
|
||||
SET( SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/source )
|
||||
SET( LIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/source/lib )
|
||||
@@ -39,6 +40,8 @@ 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 "" )
|
||||
|
||||
######################################################################################
|
||||
# Variables
|
||||
######################################################################################
|
||||
@@ -87,11 +90,14 @@ ENDIF()
|
||||
|
||||
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall" )
|
||||
SET( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g" )
|
||||
SET( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3" )
|
||||
SET( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3" )
|
||||
|
||||
IF( USE_WERROR )
|
||||
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror" )
|
||||
ENDIF()
|
||||
|
||||
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" )
|
||||
|
||||
ADD_EXECUTABLE( ${PROJECT_NAME} ${SOURCES_FILES} ${HEADERS_MOC_FILES} ${FORMS_HEADERS_FILES} ${RESOURCES_RCC_FILES} )
|
||||
|
||||
TARGET_LINK_LIBRARIES( ${PROJECT_NAME} ${PLAYUVER_LIBS} ${MODULES_LIBS} ${LINKER_LIBS} )
|
||||
@@ -107,6 +113,7 @@ INCLUDE(cmake/Install.cmake)
|
||||
######################################################################################
|
||||
status("Configuration:")
|
||||
status(" Build type:" ${CMAKE_BUILD_TYPE} )
|
||||
status(" Build flags:" "${CMAKE_CXX_FLAGS}" )
|
||||
status(" Warnings as errors:" USE_WERROR THEN YES ELSE NO)
|
||||
status("Dependencies:")
|
||||
status(" QT:" USE_QT4 THEN "QT4" ELSE "QT5" )
|
||||
|
||||
+10
-11
@@ -7,21 +7,20 @@ 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 )
|
||||
|
||||
# # try to set up the menu system
|
||||
# find_program(XDG-MIME_EXECUTABLE xdg-mime)
|
||||
# # find_program(XDG-DESKTOP-MENU_EXECUTABLE xdg-desktop-menu)
|
||||
# INSTALL(CODE "execute_process(COMMAND ${XDG-MIME_EXECUTABLE} install --novendor resources/)" )
|
||||
|
||||
######################################################################################
|
||||
# Create deb package
|
||||
######################################################################################
|
||||
SET(CPACK_GENERATOR "DEB")
|
||||
SET(CPACK_PACKAGE_VERSION_MAJOR "0")
|
||||
SET(CPACK_PACKAGE_VERSION_MINOR "1")
|
||||
SET(CPACK_PACKAGE_VERSION_PATCH "0")
|
||||
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libqt4-core,libqt4-gui,libavformat53,libcodec53,libavutil51")
|
||||
SET(CPACK_PACKAGE_VERSION_MAJOR ${PLAYUVER_VERSION_MAJOR})
|
||||
SET(CPACK_PACKAGE_VERSION_MINOR ${PLAYUVER_VERSION_MINOR})
|
||||
SET(CPACK_PACKAGE_VERSION_PATCH ${PLAYUVER_VERSION_PATH})
|
||||
IF( USE_QT4 )
|
||||
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS} libqtcore4,libqtgui4 ")
|
||||
ENDIF()
|
||||
IF( USE_FFMPEG )
|
||||
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS} libavformat53,libcodec53,libavutil51")
|
||||
ENDIF()
|
||||
SET(CPACK_PACKAGE_DESCRIPTION "plaYUVer is an open-source QT based raw video player")
|
||||
SET(CPACK_PACKAGE_CONTACT "Joao Carreira (jfmcarreira@gmail.com)")
|
||||
SET(CPACK_PACKAGE_CONTACT "Joao Carreira (jfmcarreira@gmail.com), Luis Lucas (luisfrlucas@gmail.com)")
|
||||
# set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/Debian/postinst")
|
||||
|
||||
INCLUDE(CPack)
|
||||
+1
-1
@@ -32,7 +32,7 @@ IF( NOT USE_QT4 )
|
||||
QT5_ADD_RESOURCES( RESOURCES_RCC_FILES ${RESOURCES_FILES} )
|
||||
|
||||
# Add compiler flags for building executables (-fPIE)
|
||||
SET( CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS} )
|
||||
LIST(APPEND CMAKE_CXX_FLAGS ${Qt5Core_EXECUTABLE_COMPILE_FLAGS} )
|
||||
|
||||
LIST(APPEND LINKER_LIBS ${Qt5Core_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Widgets_LIBRARIES} )
|
||||
SET( CURR_QT_MODULES Core Gui Widgets )
|
||||
|
||||
@@ -298,7 +298,7 @@ Void InputStream::getDuration( Int* duration_array )
|
||||
else
|
||||
#endif
|
||||
{
|
||||
secs = m_uiTotalFrameNum * m_uiFrameRate;
|
||||
secs = m_uiTotalFrameNum / m_uiFrameRate;
|
||||
}
|
||||
mins = secs / 60;
|
||||
secs %= 60;
|
||||
|
||||
+52
-14
@@ -322,26 +322,35 @@ void plaYUVerApp::pause()
|
||||
{
|
||||
m_pcCurrentSubWindow->pause();
|
||||
}
|
||||
m_pcFrameSlider->setValue( m_pcCurrentSubWindow->getInputStream()->getCurrFrameNum() );
|
||||
updateCurrFrameNum();
|
||||
}
|
||||
setTimerStatus();
|
||||
}
|
||||
|
||||
void plaYUVerApp::stop()
|
||||
{
|
||||
if( m_acPlayingSubWindows.size() > 0 )
|
||||
{
|
||||
for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
||||
{
|
||||
m_acPlayingSubWindows.at( i )->stop();
|
||||
}
|
||||
m_acPlayingSubWindows.clear();
|
||||
setTimerStatus();
|
||||
m_pcFrameSlider->setValue( m_pcCurrentSubWindow->getInputStream()->getCurrFrameNum() );
|
||||
|
||||
updateCurrFrameNum();
|
||||
if( m_uiAveragePlayInterval )
|
||||
qDebug( ) << "Real display time: "
|
||||
<< QString::number( 1000 / m_uiAveragePlayInterval )
|
||||
<< " fps";
|
||||
m_uiAveragePlayInterval = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( m_pcCurrentSubWindow )
|
||||
{
|
||||
seekSliderEvent( 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void plaYUVerApp::playEvent()
|
||||
@@ -354,13 +363,13 @@ void plaYUVerApp::playEvent()
|
||||
{
|
||||
case -1:
|
||||
stop();
|
||||
m_pcFrameSlider->setValue( m_pcCurrentSubWindow ? m_pcCurrentSubWindow->getInputStream()->getCurrFrameNum() : 0 );
|
||||
updateCurrFrameNum();
|
||||
break;
|
||||
case -2:
|
||||
if( !actionVideoLoop->isChecked() )
|
||||
{
|
||||
stop();
|
||||
m_pcFrameSlider->setValue( m_pcCurrentSubWindow ? m_pcCurrentSubWindow->getInputStream()->getCurrFrameNum() : 0 );
|
||||
updateCurrFrameNum();
|
||||
return;
|
||||
}
|
||||
break;
|
||||
@@ -374,12 +383,29 @@ void plaYUVerApp::playEvent()
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( m_pcCurrentSubWindow )
|
||||
m_pcFrameSlider->setValue( m_pcCurrentSubWindow->getInputStream()->getCurrFrameNum() );
|
||||
|
||||
updateCurrFrameNum();
|
||||
m_uiAveragePlayInterval = ( m_uiAveragePlayInterval + time ) / 2;
|
||||
}
|
||||
|
||||
Void plaYUVerApp::updateCurrFrameNum()
|
||||
{
|
||||
if( m_pcCurrentSubWindow )
|
||||
{
|
||||
Int frame_num = m_pcCurrentSubWindow->getInputStream()->getCurrFrameNum();
|
||||
m_pcFrameSlider->setValue( frame_num );
|
||||
m_pcCurrFrameNumLabel->setText( QString( tr( "%1" ) ).arg( frame_num ) );
|
||||
}
|
||||
}
|
||||
Void plaYUVerApp::updateTotalFrameNum( UInt total_frame_num )
|
||||
{
|
||||
if( m_pcCurrentSubWindow && total_frame_num == 0 )
|
||||
{
|
||||
total_frame_num = m_pcCurrentSubWindow->getInputStream()->getFrameNum();
|
||||
}
|
||||
m_pcFrameSlider->setMaximum( total_frame_num - 1 );
|
||||
m_pcTotalFrameNumLabel->setText( QString( tr( "%1" ) ).arg( total_frame_num ) );
|
||||
}
|
||||
|
||||
void plaYUVerApp::seekEvent( int direction )
|
||||
{
|
||||
if( m_pcCurrentSubWindow )
|
||||
@@ -394,8 +420,9 @@ void plaYUVerApp::seekEvent( int direction )
|
||||
else
|
||||
{
|
||||
m_pcCurrentSubWindow->seekRelativeEvent( direction > 0 ? true : false );
|
||||
m_pcFrameSlider->setValue( m_pcCurrentSubWindow->getInputStream()->getCurrFrameNum() );
|
||||
|
||||
}
|
||||
updateCurrFrameNum();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -413,8 +440,8 @@ void plaYUVerApp::seekSliderEvent( int new_frame_num )
|
||||
else
|
||||
{
|
||||
m_pcCurrentSubWindow->seekAbsoluteEvent( ( UInt )new_frame_num );
|
||||
m_pcFrameSlider->setValue( m_pcCurrentSubWindow->getInputStream()->getCurrFrameNum() );
|
||||
}
|
||||
updateCurrFrameNum();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -476,9 +503,10 @@ void plaYUVerApp::chageSubWindowSelection()
|
||||
// {
|
||||
// playingTimer->stop();
|
||||
// }
|
||||
m_pcFrameSlider->setMaximum( activeSubWindow()->getInputStream()->getFrameNum() - 1 );
|
||||
m_pcFrameSlider->setValue( activeSubWindow()->getInputStream()->getCurrFrameNum() );
|
||||
m_pcCurrentSubWindow = activeSubWindow();
|
||||
updateCurrFrameNum();
|
||||
updateTotalFrameNum();
|
||||
m_pcCurrFrameNumLabel->setText( QString( tr( "%1" ) ).arg( m_pcCurrentSubWindow->getInputStream()->getCurrFrameNum() ) );
|
||||
updateProperties();
|
||||
}
|
||||
else
|
||||
@@ -615,8 +643,9 @@ Void plaYUVerApp::updateMenus()
|
||||
if( !hasSubWindow )
|
||||
{
|
||||
m_pcFrameSlider->setValue( 0 );
|
||||
m_pcCurrFrameNumLabel->setText("-");
|
||||
m_pcTotalFrameNumLabel->setText("-");
|
||||
}
|
||||
|
||||
actionNavigationTool->setEnabled( hasSubWindow );
|
||||
actionSelectionTool->setEnabled( hasSubWindow );
|
||||
|
||||
@@ -920,7 +949,16 @@ Void plaYUVerApp::createToolBars()
|
||||
toolbarVideo->addAction( actionVideoCenter );
|
||||
*/
|
||||
toolbarVideo->addWidget( m_pcFrameSlider );
|
||||
|
||||
toolbarVideo->addWidget( new QLabel );
|
||||
m_pcCurrFrameNumLabel = new QLabel;
|
||||
m_pcCurrFrameNumLabel->setText("-");
|
||||
toolbarVideo->addWidget( m_pcCurrFrameNumLabel );
|
||||
QLabel *forwardslash = new QLabel;
|
||||
forwardslash->setText("/");
|
||||
toolbarVideo->addWidget( forwardslash );
|
||||
m_pcTotalFrameNumLabel = new QLabel;
|
||||
m_pcTotalFrameNumLabel->setText("-");
|
||||
toolbarVideo->addWidget( m_pcTotalFrameNumLabel );
|
||||
}
|
||||
|
||||
Void plaYUVerApp::createDockWidgets()
|
||||
|
||||
@@ -116,6 +116,8 @@ private:
|
||||
Void loadFile( QString fileName );
|
||||
//! Playing functions
|
||||
Void setTimerStatus();
|
||||
Void updateCurrFrameNum();
|
||||
Void updateTotalFrameNum( UInt total_frame_num = 0 );
|
||||
|
||||
Void updateMenus();
|
||||
Void updateProperties();
|
||||
@@ -135,6 +137,8 @@ private:
|
||||
Bool m_bIsPlaying;
|
||||
QVector<SubWindowHandle*> m_acPlayingSubWindows;
|
||||
QSlider *m_pcFrameSlider;
|
||||
QLabel *m_pcCurrFrameNumLabel;
|
||||
QLabel *m_pcTotalFrameNumLabel;
|
||||
|
||||
|
||||
QSignalMapper *mapperZoom;
|
||||
|
||||
Reference in New Issue
Block a user