VideoReceiver.pri 5.68 KB
Newer Older
1
################################################################################
Gus Grubba's avatar
Gus Grubba committed
2
#
3
# (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
Gus Grubba's avatar
Gus Grubba committed
4
#
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

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

LinuxBuild {
15
    QT += x11extras waylandclient
Gus Grubba's avatar
Gus Grubba committed
16 17
    CONFIG += link_pkgconfig
    packagesExist(gstreamer-1.0) {
18
        PKGCONFIG   += gstreamer-1.0  gstreamer-video-1.0 gstreamer-gl-1.0 egl
Gus Grubba's avatar
Gus Grubba committed
19 20 21 22 23 24 25 26 27 28
        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
29 30 31 32 33 34
} 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
35
        LIBS        += -F$$(HOME)/Library/Developer/GStreamer/iPhone.sdk -framework GStreamer -framework AVFoundation -framework CoreMedia -framework CoreVideo -framework VideoToolbox -liconv -lresolv
dogmaphobic's avatar
dogmaphobic committed
36
    }
37 38
} else:WindowsBuild {
    #- gstreamer installed by default under c:/gstreamer
39
    GST_ROOT = c:/gstreamer/1.0/x86_64
Gus Grubba's avatar
Gus Grubba committed
40 41
    exists($$GST_ROOT) {
        CONFIG      += VideoEnabled
Don Gagne's avatar
Don Gagne committed
42

43
        LIBS        += -L$$GST_ROOT/lib -lgstreamer-1.0 -lgstgl-1.0 -lgstvideo-1.0 -lgstbase-1.0
Don Gagne's avatar
Don Gagne committed
44 45
        LIBS        += -lglib-2.0 -lintl -lgobject-2.0

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

Don Gagne's avatar
Don Gagne committed
53
        DESTDIR_WIN = $$replace(DESTDIR, "/", "\\")
Don Gagne's avatar
Don Gagne committed
54 55 56 57 58 59 60
        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
61 62
        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)
63 64
    }
} else:AndroidBuild {
65 66
    #- gstreamer assumed to be installed in $$PWD/../../gstreamer-1.0-android-universal-1.14.4/***
    contains(QT_ARCH, arm) {
67
        GST_ROOT = $$PWD/../../gstreamer-1.0-android-universal-1.14.4/armv7
68 69 70 71
    } 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
72
    }
73 74 75
    exists($$GST_ROOT) {
        QMAKE_CXXFLAGS  += -pthread
        CONFIG          += VideoEnabled
76 77

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

        # Rest of GStreamer dependencies
        LIBS += -L$$GST_ROOT/lib \
99
            -lgraphene-1.0 -ljpeg -lpng16 \
100 101
            -lgstfft-1.0 -lm  \
            -lgstnet-1.0 -lgio-2.0 \
102
            -lgstphotography-1.0 -lgstgl-1.0 -lEGL \
103
            -lgstaudio-1.0 -lgstcodecparsers-1.0 -lgstbase-1.0 \
104
            -lgstreamer-1.0 -lgstrtp-1.0 -lgstpbutils-1.0 -lgstrtsp-1.0 -lgsttag-1.0 \
105
            -lgstvideo-1.0 -lavformat -lavcodec -lavutil -lx264 -lavfilter -lswresample \
106
            -lgstriff-1.0 -lgstcontroller-1.0 -lgstapp-1.0 \
107
            -lgstsdp-1.0 -lbz2 -lgobject-2.0 -lgstmpegts-1.0 \
108
            -Wl,--export-dynamic -lgmodule-2.0 -pthread -lglib-2.0 -lorc-0.4 -liconv -lffi -lintl \
109 110 111 112 113

        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
114
            $$GST_ROOT/lib/glib-2.0/include
115
    }
Gus Grubba's avatar
Gus Grubba committed
116 117 118 119
}

VideoEnabled {

120 121
    message("Including support for video streaming")

Gus Grubba's avatar
Gus Grubba committed
122
    DEFINES += \
123
        QGC_GST_STREAMING
Gus Grubba's avatar
Gus Grubba committed
124 125

    INCLUDEPATH += \
126
        $$PWD
Gus Grubba's avatar
Gus Grubba committed
127

128 129 130 131
    iOSBuild {
        OBJECTIVE_SOURCES += \
            $$PWD/gst_ios_init.m
    }
Gus Grubba's avatar
Gus Grubba committed
132 133

    HEADERS += \
134 135 136
        $$PWD/GStreamer.h \
        $$PWD/GstVideoReceiver.h \
        $$PWD/VideoReceiver.h
Gus Grubba's avatar
Gus Grubba committed
137 138

    SOURCES += \
139 140 141 142
        $$PWD/gstqgcvideosinkbin.c \
        $$PWD/gstqgc.c \
        $$PWD/GStreamer.cc \
        $$PWD/GstVideoReceiver.cc
143

144
    include($$PWD/../../qmlglsink.pri)
Gus Grubba's avatar
Gus Grubba committed
145
} else {
146
    LinuxBuild|MacBuild|iOSBuild|WindowsBuild|AndroidBuild {
147
        message("Skipping support for video streaming (GStreamer libraries not installed)")
148
        message("Installation instructions here: https://github.com/mavlink/qgroundcontrol/blob/master/src/VideoReceiver/README.md")
149 150 151
    } else {
        message("Skipping support for video streaming (Unsupported platform)")
    }
Gus Grubba's avatar
Gus Grubba committed
152
}