Make ffmpeg optional for frontend
authorunc0rr
Tue, 28 Aug 2012 22:33:17 +0400
changeset 7617 0ac281e1b58b
parent 7616 dcda1c2b77e4
child 7618 4d3a32d91028
Make ffmpeg optional for frontend
QTfrontend/CMakeLists.txt
QTfrontend/hwform.cpp
QTfrontend/ui/page/pagemain.cpp
QTfrontend/util/libav_iteraction.cpp
cmake_modules/FindFFMPEG.cmake
--- a/QTfrontend/CMakeLists.txt	Tue Aug 28 22:32:19 2012 +0400
+++ b/QTfrontend/CMakeLists.txt	Tue Aug 28 22:33:17 2012 +0400
@@ -28,7 +28,7 @@
 # Configure for SDL
 find_package(SDL REQUIRED)
 find_package(SDL_mixer REQUIRED)
-find_package(FFMPEG REQUIRED)
+find_package(FFMPEG)
 
 include_directories(.)
 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/model)
@@ -73,6 +73,10 @@
 file(GLOB_RECURSE UIcpp ui/*.cpp)
 file(GLOB UtilCpp util/*.cpp)
 
+if((NOT NO_VIDEOREC) AND ${FFMPEG_FOUND})
+    add_definitions(-DVIDEOREC)
+endif()
+
 set(hwfr_src
     ${ModelCpp}
     ${NetCpp}
--- a/QTfrontend/hwform.cpp	Tue Aug 28 22:32:19 2012 +0400
+++ b/QTfrontend/hwform.cpp	Tue Aug 28 22:33:17 2012 +0400
@@ -202,8 +202,10 @@
     connect(ui.pageNetGame, SIGNAL(DLCClicked()), pageSwitchMapper, SLOT(map()));
     pageSwitchMapper->setMapping(ui.pageNetGame, ID_PAGE_DATADOWNLOAD);
 
+#ifdef VIDEOREC
     connect(ui.pageMain->BtnVideos, SIGNAL(clicked()), pageSwitchMapper, SLOT(map()));
     pageSwitchMapper->setMapping(ui.pageMain->BtnVideos, ID_PAGE_VIDEOS);
+#endif
 
     //connect(ui.pageMain->BtnExit, SIGNAL(pressed()), this, SLOT(btnExitPressed()));
     //connect(ui.pageMain->BtnExit, SIGNAL(clicked()), this, SLOT(btnExitClicked()));
--- a/QTfrontend/ui/page/pagemain.cpp	Tue Aug 28 22:32:19 2012 +0400
+++ b/QTfrontend/ui/page/pagemain.cpp	Tue Aug 28 22:33:17 2012 +0400
@@ -86,8 +86,10 @@
 
     btnBack->setWhatsThis(tr("Exit game"));
 
+#ifdef VIDEOREC
     BtnVideos = addButton(":/res/Record.png", bottomLayout, 1, true);
-    BtnVideos->setWhatsThis(tr("Manage videos recorded from game"));
+    BtnVideos->setWhatsThis(tr("Manage videos recorded from game"));    
+#endif
 
     BtnSetup = addButton(":/res/Settings.png", bottomLayout, 2, true);
     BtnSetup->setWhatsThis(tr("Edit game preferences"));
--- a/QTfrontend/util/libav_iteraction.cpp	Tue Aug 28 22:32:19 2012 +0400
+++ b/QTfrontend/util/libav_iteraction.cpp	Tue Aug 28 22:33:17 2012 +0400
@@ -16,17 +16,20 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  */
 
+#include "libav_iteraction.h"
+
+#if VIDEOREC
 #define __STDC_CONSTANT_MACROS
 extern "C"
 {
 #include "libavformat/avformat.h"
 }
+
 #include <QVector>
 #include <QList>
 #include <QMessageBox>
 #include <QComboBox>
 
-#include "libav_iteraction.h"
 #include "HWApplication.h"
 
 struct Codec
@@ -50,12 +53,6 @@
 QList<Codec> codecs;
 QMap<QString,Format> formats;
 
-LibavIteraction & LibavIteraction::instance()
-{
-    static LibavIteraction instance;
-    return instance;
-}
-
 // test if given format supports given codec
 bool FormatQueryCodec(AVOutputFormat *ofmt, enum CodecID codec_id)
 {  
@@ -325,3 +322,42 @@
 #endif
     return desc;
 }
+
+#else
+LibavIteraction::LibavIteraction()
+{
+
+}
+
+void LibavIteraction::fillFormats(QComboBox * pFormats)
+{
+    Q_UNUSED(pFormats);
+}
+
+void LibavIteraction::fillCodecs(const QString & format, QComboBox * pVCodecs, QComboBox * pACodecs)
+{
+    Q_UNUSED(format);
+    Q_UNUSED(pVCodecs);
+    Q_UNUSED(pACodecs);
+}
+
+QString LibavIteraction::getExtension(const QString & format)
+{
+    Q_UNUSED(format);
+
+    return QString();
+}
+
+QString LibavIteraction::getFileInfo(const QString & filepath)
+{
+    Q_UNUSED(filepath);
+
+    return QString();
+}
+#endif
+
+LibavIteraction & LibavIteraction::instance()
+{
+    static LibavIteraction instance;
+    return instance;
+}
--- a/cmake_modules/FindFFMPEG.cmake	Tue Aug 28 22:32:19 2012 +0400
+++ b/cmake_modules/FindFFMPEG.cmake	Tue Aug 28 22:33:17 2012 +0400
@@ -55,7 +55,7 @@
   endif()
 
   if (FFMPEG_FOUND)
-    set(FFMPEG_INCLUDE_DIR ${FFMPEG_AVCODEC_INCLUDE_DIR}/..)
+    set(FFMPEG_INCLUDE_DIR ${FFMPEG_AVCODEC_INCLUDE_DIR})
 
     set(FFMPEG_LIBRARIES
       ${FFMPEG_LIBAVCODEC}