VideoStreaming.pri 7.53 KB
Newer Older
Gus Grubba's avatar
Gus Grubba committed
1
################################################################################
Gus Grubba's avatar
Gus Grubba committed
2
#
Gus Grubba's avatar
Gus Grubba committed
3
# (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
Gus Grubba's avatar
Gus Grubba committed
4
#
Gus Grubba's avatar
Gus Grubba committed
5 6 7 8
# QGroundControl is licensed according to the terms in the file
# COPYING.md in the root of the source code directory.
#
################################################################################
Gus Grubba's avatar
Gus Grubba committed
9 10 11 12 13 14 15 16

#
#-- Depends on gstreamer, which can be found at: http://gstreamer.freedesktop.org/download/
#

LinuxBuild {
    CONFIG += link_pkgconfig
    packagesExist(gstreamer-1.0) {
Gus Grubba's avatar
Gus Grubba committed
17
        PKGCONFIG   += gstreamer-1.0  gstreamer-video-1.0
Gus Grubba's avatar
Gus Grubba committed
18 19 20 21 22 23 24 25 26 27
        CONFIG      += VideoEnabled
    }
} else:MacBuild {
    #- gstreamer framework installed by the gstreamer devel installer
    GST_ROOT = /Library/Frameworks/GStreamer.framework
    exists($$GST_ROOT) {
        CONFIG      += VideoEnabled
        INCLUDEPATH += $$GST_ROOT/Headers
        LIBS        += -F/Library/Frameworks -framework GStreamer
    }
dogmaphobic's avatar
dogmaphobic committed
28 29 30 31 32 33
} else:iOSBuild {
    #- gstreamer framework installed by the gstreamer iOS SDK installer (default to home directory)
    GST_ROOT = $$(HOME)/Library/Developer/GStreamer/iPhone.sdk/GStreamer.framework
    exists($$GST_ROOT) {
        CONFIG      += VideoEnabled
        INCLUDEPATH += $$GST_ROOT/Headers
34
        LIBS        += -F$$(HOME)/Library/Developer/GStreamer/iPhone.sdk -framework GStreamer -liconv -lresolv
dogmaphobic's avatar
dogmaphobic committed
35
    }
36 37
} else:WindowsBuild {
    #- gstreamer installed by default under c:/gstreamer
DonLakeFlyer's avatar
DonLakeFlyer committed
38
    GST_ROOT = c:/gstreamer/1.0/x86_64
Gus Grubba's avatar
Gus Grubba committed
39 40
    exists($$GST_ROOT) {
        CONFIG      += VideoEnabled
Don Gagne's avatar
Don Gagne committed
41 42 43 44

        LIBS        += -L$$GST_ROOT/lib -lgstreamer-1.0 -lgstvideo-1.0 -lgstbase-1.0
        LIBS        += -lglib-2.0 -lintl -lgobject-2.0

Gus Grubba's avatar
Gus Grubba committed
45 46 47
        INCLUDEPATH += \
            $$GST_ROOT/include/gstreamer-1.0 \
            $$GST_ROOT/include/glib-2.0 \
48
            $$GST_ROOT/lib/gstreamer-1.0/include \
Don Gagne's avatar
Don Gagne committed
49 50
            $$GST_ROOT/lib/glib-2.0/include

Don Gagne's avatar
Don Gagne committed
51
        DESTDIR_WIN = $$replace(DESTDIR, "/", "\\")
Don Gagne's avatar
Don Gagne committed
52 53 54 55 56 57 58
        GST_ROOT_WIN = $$replace(GST_ROOT, "/", "\\")

        # Copy main GStreamer runtime files
        QMAKE_POST_LINK += $$escape_expand(\\n) xcopy \"$$GST_ROOT_WIN\\bin\*.dll\" \"$$DESTDIR_WIN\" /S/Y $$escape_expand(\\n)
        QMAKE_POST_LINK += xcopy \"$$GST_ROOT_WIN\\bin\*.\" \"$$DESTDIR_WIN\" /S/Y $$escape_expand(\\n)

        # Copy GStreamer plugins
Don Gagne's avatar
Don Gagne committed
59 60
        QMAKE_POST_LINK += $$escape_expand(\\n) xcopy \"$$GST_ROOT_WIN\\lib\\gstreamer-1.0\\*.dll\" \"$$DESTDIR_WIN\\gstreamer-plugins\\\" /Y $$escape_expand(\\n)
        QMAKE_POST_LINK += $$escape_expand(\\n) xcopy \"$$GST_ROOT_WIN\\lib\\gstreamer-1.0\\validate\\*.dll\" \"$$DESTDIR_WIN\\gstreamer-plugins\\validate\\\" /Y $$escape_expand(\\n)
61 62
    }
} else:AndroidBuild {
Don Gagne's avatar
Don Gagne committed
63 64
    #- gstreamer assumed to be installed in $$PWD/../../gstreamer-1.0-android-universal-1.14.4/***
    contains(QT_ARCH, arm) {
65
        GST_ROOT = $$PWD/../../gstreamer-1.0-android-universal-1.14.4/armv7
Don Gagne's avatar
Don Gagne committed
66 67 68 69
    } else:contains(QT_ARCH, arm64) {
        GST_ROOT = $$PWD/../../gstreamer-1.0-android-universal-1.14.4/arm64
    } else {
        GST_ROOT = $$PWD/../../gstreamer-1.0-android-universal-1.14.4/x86
70
    }
71 72 73
    exists($$GST_ROOT) {
        QMAKE_CXXFLAGS  += -pthread
        CONFIG          += VideoEnabled
74 75

        # We want to link these plugins statically
76
        LIBS += -L$$GST_ROOT/lib/gstreamer-1.0 \
77
            -lgstvideo-1.0 \
78 79 80
            -lgstcoreelements \
            -lgstudp \
            -lgstrtp \
81
            -lgstrtsp \
82 83
            -lgstx264 \
            -lgstlibav \
84 85 86
            -lgstsdpelem \
            -lgstvideoparsersbad \
            -lgstrtpmanager \
87 88
            -lgstisomp4 \
            -lgstmatroska \
89
            -lgstandroidmedia
90 91 92

        # Rest of GStreamer dependencies
        LIBS += -L$$GST_ROOT/lib \
93 94
            -lgstfft-1.0 -lm  \
            -lgstnet-1.0 -lgio-2.0 \
95
            -lgstphotography-1.0 -lgstgl-1.0 -lEGL \
96
            -lgstaudio-1.0 -lgstcodecparsers-1.0 -lgstbase-1.0 \
97
            -lgstreamer-1.0 -lgstrtp-1.0 -lgstpbutils-1.0 -lgstrtsp-1.0 -lgsttag-1.0 \
98
            -lgstvideo-1.0 -lavformat -lavcodec -lavutil -lx264 -lavfilter -lswresample \
99 100 101
            -lgstriff-1.0 -lgstcontroller-1.0 -lgstapp-1.0 \
            -lgstsdp-1.0 -lbz2 -lgobject-2.0 \
            -Wl,--export-dynamic -lgmodule-2.0 -pthread -lglib-2.0 -lorc-0.4 -liconv -lffi -lintl \
102 103 104 105 106

        INCLUDEPATH += \
            $$GST_ROOT/include/gstreamer-1.0 \
            $$GST_ROOT/lib/gstreamer-1.0/include \
            $$GST_ROOT/include/glib-2.0 \
Gus Grubba's avatar
Gus Grubba committed
107
            $$GST_ROOT/lib/glib-2.0/include
108
    }
Gus Grubba's avatar
Gus Grubba committed
109 110 111 112
}

VideoEnabled {

113 114
    message("Including support for video streaming")

Gus Grubba's avatar
Gus Grubba committed
115
    DEFINES += \
dogmaphobic's avatar
dogmaphobic committed
116
        QGC_GST_STREAMING \
Gus Grubba's avatar
Gus Grubba committed
117 118
        GST_PLUGIN_BUILD_STATIC \
        QTGLVIDEOSINK_NAME=qt5glvideosink \
119
        QGC_VIDEOSINK_PLUGIN=qt5videosink
Gus Grubba's avatar
Gus Grubba committed
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148

    INCLUDEPATH += \
        $$PWD/gstqtvideosink \
        $$PWD/gstqtvideosink/delegates \
        $$PWD/gstqtvideosink/painters \
        $$PWD/gstqtvideosink/utils \

    #-- QtGstreamer (gutted to our needs)

    HEADERS += \
        $$PWD/gstqtvideosink/delegates/basedelegate.h \
        $$PWD/gstqtvideosink/delegates/qtquick2videosinkdelegate.h \
        $$PWD/gstqtvideosink/delegates/qtvideosinkdelegate.h \
        $$PWD/gstqtvideosink/delegates/qwidgetvideosinkdelegate.h \
        $$PWD/gstqtvideosink/gstqtglvideosink.h \
        $$PWD/gstqtvideosink/gstqtglvideosinkbase.h \
        $$PWD/gstqtvideosink/gstqtquick2videosink.h \
        $$PWD/gstqtvideosink/gstqtvideosink.h \
        $$PWD/gstqtvideosink/gstqtvideosinkbase.h \
        $$PWD/gstqtvideosink/gstqtvideosinkmarshal.h \
        $$PWD/gstqtvideosink/gstqtvideosinkplugin.h \
        $$PWD/gstqtvideosink/gstqwidgetvideosink.h \
        $$PWD/gstqtvideosink/painters/abstractsurfacepainter.h \
        $$PWD/gstqtvideosink/painters/genericsurfacepainter.h \
        $$PWD/gstqtvideosink/painters/openglsurfacepainter.h \
        $$PWD/gstqtvideosink/painters/videomaterial.h \
        $$PWD/gstqtvideosink/painters/videonode.h \
        $$PWD/gstqtvideosink/utils/bufferformat.h \
        $$PWD/gstqtvideosink/utils/utils.h \
dogmaphobic's avatar
dogmaphobic committed
149
        $$PWD/gstqtvideosink/utils/glutils.h \
Gus Grubba's avatar
Gus Grubba committed
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170

    SOURCES += \
        $$PWD/gstqtvideosink/delegates/basedelegate.cpp \
        $$PWD/gstqtvideosink/delegates/qtquick2videosinkdelegate.cpp \
        $$PWD/gstqtvideosink/delegates/qtvideosinkdelegate.cpp \
        $$PWD/gstqtvideosink/delegates/qwidgetvideosinkdelegate.cpp \
        $$PWD/gstqtvideosink/gstqtglvideosink.cpp \
        $$PWD/gstqtvideosink/gstqtglvideosinkbase.cpp \
        $$PWD/gstqtvideosink/gstqtvideosinkmarshal.c \
        $$PWD/gstqtvideosink/gstqtquick2videosink.cpp \
        $$PWD/gstqtvideosink/gstqtvideosink.cpp \
        $$PWD/gstqtvideosink/gstqtvideosinkbase.cpp \
        $$PWD/gstqtvideosink/gstqtvideosinkplugin.cpp \
        $$PWD/gstqtvideosink/gstqwidgetvideosink.cpp \
        $$PWD/gstqtvideosink/painters/genericsurfacepainter.cpp \
        $$PWD/gstqtvideosink/painters/openglsurfacepainter.cpp \
        $$PWD/gstqtvideosink/painters/videomaterial.cpp \
        $$PWD/gstqtvideosink/painters/videonode.cpp \
        $$PWD/gstqtvideosink/utils/bufferformat.cpp \
        $$PWD/gstqtvideosink/utils/utils.cpp \

171 172 173 174 175 176 177
    iOSBuild {
        OBJECTIVE_SOURCES += \
            $$PWD/ios/gst_ios_init.m
        INCLUDEPATH += \
            $$PWD/ios
    }

Gus Grubba's avatar
Gus Grubba committed
178
} else {
179
    LinuxBuild|MacBuild|iOSBuild|WindowsBuild|AndroidBuild {
180
        message("Skipping support for video streaming (GStreamer libraries not installed)")
181
        message("Installation instructions here: https://github.com/mavlink/qgroundcontrol/blob/master/src/VideoStreaming/README.md")
182 183 184
    } else {
        message("Skipping support for video streaming (Unsupported platform)")
    }
Gus Grubba's avatar
Gus Grubba committed
185 186
}