diff --git a/src/Gui/GcCrashDialog.cpp b/src/Gui/GcCrashDialog.cpp index 1774d789b..16965a481 100644 --- a/src/Gui/GcCrashDialog.cpp +++ b/src/Gui/GcCrashDialog.cpp @@ -37,10 +37,10 @@ #define COMPILER_VERSION QString("%1").arg(_MSC_VER) #endif -#ifndef Q_OS_MAC -#include "VideoWindow.h" -#else +#if defined(GC_VIDEO_AV) || defined(GC_VIDEO_QUICKTIME) #include "QtMacVideoWindow.h" +#else +#include "VideoWindow.h" #endif #ifdef GC_HAVE_ICAL diff --git a/src/Gui/GcWindowRegistry.cpp b/src/Gui/GcWindowRegistry.cpp index a2ac6518d..23d24aea2 100644 --- a/src/Gui/GcWindowRegistry.cpp +++ b/src/Gui/GcWindowRegistry.cpp @@ -29,7 +29,7 @@ #endif #include "HistogramWindow.h" #include "LTMWindow.h" -#ifdef Q_OS_MAC +#if defined(GC_VIDEO_AV) || defined(GC_VIDEO_QUICKTIME) #include "QtMacVideoWindow.h" #else #include "VideoWindow.h" diff --git a/src/Train/Library.cpp b/src/Train/Library.cpp index f9db6f0be..e3e994f06 100644 --- a/src/Train/Library.cpp +++ b/src/Train/Library.cpp @@ -31,7 +31,7 @@ #include // helpers -#ifdef Q_OS_MAC +#if defined(GC_VIDEO_AV) || defined(GC_VIDEO_QUICKTIME) #include "QtMacVideoWindow.h" #else #include "VideoWindow.h" diff --git a/src/Train/TrainSidebar.cpp b/src/Train/TrainSidebar.cpp index e126bb952..819e478fb 100644 --- a/src/Train/TrainSidebar.cpp +++ b/src/Train/TrainSidebar.cpp @@ -60,17 +60,16 @@ #endif // Media selection helper -#ifndef Q_OS_MAC +#if defined(GC_VIDEO_AV) || defined(GC_VIDEO_QUICKTIME) +#include "QtMacVideoWindow.h" +#else #include "VideoWindow.h" #endif - #ifdef Q_OS_MAC -#include "QtMacVideoWindow.h" #include #include #include #import - #endif #ifdef WIN32 diff --git a/src/Train/VideoWindow.cpp b/src/Train/VideoWindow.cpp index ab35a9f95..619bce082 100644 --- a/src/Train/VideoWindow.cpp +++ b/src/Train/VideoWindow.cpp @@ -99,6 +99,12 @@ VideoWindow::VideoWindow(Context *context) : libvlc_media_player_set_xwindow (mp, x11Container->winId()); #endif +#ifdef Q_OS_MAC + container = new QWidget(this); + layout->addWidget(container); + libvlc_media_player_set_nsobject (mp, (void*)(container->winId())); +#endif + #ifdef WIN32 container = new QWidget(this); layout->addWidget(container); diff --git a/src/Train/VideoWindow.h b/src/Train/VideoWindow.h index 13a3bd47c..e31fba6ca 100644 --- a/src/Train/VideoWindow.h +++ b/src/Train/VideoWindow.h @@ -44,9 +44,9 @@ #define GC_VIDEO_QUICKTIME #endif -// but qt5 and vlc are not valid options ! +// but qt5 and vlc are not experimental options ! #if defined GC_VIDEO_VLC -#error "VLC is not a support on Mac OS X builds of GoldenCheetah" +#warning "VLC is supported experimentally on Mac OS X builds of GoldenCheetah" #endif // but qt5 *is* supported, but use at your own risk! @@ -217,7 +217,7 @@ class VideoWindow : public GcChartWindow #endif #endif -#ifdef WIN32 +#if defined(WIN32) || defined (Q_OS_MAC) QWidget *container; #endif diff --git a/src/gcconfig.pri.in b/src/gcconfig.pri.in index cfa4d2dcb..367f1fa3b 100644 --- a/src/gcconfig.pri.in +++ b/src/gcconfig.pri.in @@ -190,11 +190,11 @@ # Set path to the root of the VLC installation # If the are installed in /usr/local/vlc then set # VLC_INSTALL = /usr/local/vlc -# This will automatically set (Windows and Unix): +# This will automatically set (Windows, Unix and macOS): # VLC_INCLUDE = $${VLC_INSTALL}/include # For Windows # VLC_LIBS = $${VLC_INSTALL}/lib/libvlc.dll.a -# For Unix +# For Unix and macOS # VLC_LIBS = -lvlc # You may override the INCLUDE and LIB files if you like. # You *must* define VLC_INSTALL to use this feature. @@ -202,12 +202,6 @@ #VLC_INCLUDE = #VLC_LIBS = -# *** Mac users NOTE *** -# On MAC you don't need libvlc since we use the -# native QTKit (OSX framework) for video playback -# using Quicktime and on 10.6 or higher Quicktime X -# - # if you want to resample with high fidelity we can use the # libsamplerate libraries, this is used in RideFile::resample() # if you don't resample (e.g. export or merge with new recording @@ -278,10 +272,10 @@ macx { # What video playback do you want? DEFINES += GC_VIDEO_NONE # dont add any video playback support -#DEFINES += GC_VIDEO_QUICKTIME # mac only and the default -#DEFINES += GC_VIDEO_QT5 # use QT5 qvideowidget if QT > 5.2.1 -#DEFINES += GC_VIDEO_VLC # use VideoLan library needs VLC_INSTALL defined above -#DEFINES += GC_VIDEO_AV # use AV Foundation on Mac now QTKit is deprecated +#DEFINES += GC_VIDEO_QUICKTIME # mac only and the default +#DEFINES += GC_VIDEO_QT5 # use QT5 qvideowidget if QT > 5.2.1 +#DEFINES += GC_VIDEO_VLC # use VideoLan library needs VLC_INSTALL defined above +#DEFINES += GC_VIDEO_AV # use AV Foundation on Mac now QTKit is deprecated # Using the GoldenCheetah/CloudDB feature (with a private CloudDB instance) diff --git a/src/src.pro b/src/src.pro index 029889c29..3502801ba 100644 --- a/src/src.pro +++ b/src/src.pro @@ -173,10 +173,11 @@ macx { } else { - contains(DEFINES, "GC_VIDEO_NONE")|contains(DEFINES, "GC_VIDEO_QT5") { + !contains(DEFINES, "GC_VIDEO_QUICKTIME") { - # GC_VIDEO_QT5 will enable Qt5 video support, otherwise - # we have a blank videowindow, it will do nothing + # GC_VIDEO_QT5 will enable Qt5 video support, + # GC_VIDEO_VLC will enable VLC video support, + # otherwise we have a blank videowindow, it will do nothing HEADERS += Train/VideoWindow.h SOURCES += Train/VideoWindow.cpp @@ -500,22 +501,18 @@ contains(DEFINES, "GC_WANT_R") { ###============================================================= -### OPTIONAL => VLC [Windows and Unix. OSX uses QuickTime Video] +### OPTIONAL => VLC [Windows, Unix and OSX] ###============================================================= !isEmpty(VLC_INSTALL) { - # not on a mac as they use quicktime video - !macx { + # we will work out the rest if you tell use where it is installed + isEmpty(VLC_INCLUDE) { VLC_INCLUDE = $${VLC_INSTALL}/include } + isEmpty(VLC_LIBS) { VLC_LIBS = -L$${VLC_INSTALL}/lib -lvlc } - # we will work out the rest if you tell use where it is installed - isEmpty(VLC_INCLUDE) { VLC_INCLUDE = $${VLC_INSTALL}/include } - isEmpty(VLC_LIBS) { VLC_LIBS = -L$${VLC_INSTALL}/lib -lvlc } - - DEFINES += GC_HAVE_VLC - INCLUDEPATH += $${VLC_INCLUDE} - LIBS += $${VLC_LIBS} - } + DEFINES += GC_HAVE_VLC + INCLUDEPATH += $${VLC_INCLUDE} + LIBS += $${VLC_LIBS} }