-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merged in filnet/librepilot/LP-109_video_gadget (pull request #454)
LP-109 video gadget Approved-by: Philippe Renon <[email protected]> Approved-by: Lalanne Laurent <[email protected]> Approved-by: Jan NIJS <[email protected]> Approved-by: Brian Webb <[email protected]>
- Loading branch information
Showing
108 changed files
with
7,221 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
win32:gstreamer { | ||
|
||
GST_BIN_DIR = $$system(pkg-config --variable=exec_prefix gstreamer-1.0)/bin | ||
GST_PLUGINS_DIR = $$system(pkg-config --variable=pluginsdir gstreamer-1.0) | ||
|
||
# gstreamer libraries | ||
GST_LIBS = \ | ||
libgstreamer-1.0-0.dll | ||
|
||
gstreamer_utilities:GST_LIBS += \ | ||
gst-inspect-1.0.exe \ | ||
gst-launch-1.0.exe | ||
|
||
for(lib, GST_LIBS) { | ||
addCopyFileTarget($${lib},$${GST_BIN_DIR},$${GCS_APP_PATH}) | ||
addCopyDependenciesTarget($${lib},$${GST_BIN_DIR},$${GCS_APP_PATH}) | ||
} | ||
|
||
# gstreamer core | ||
GST_PLUGINS = \ | ||
libgstcoreelements.dll | ||
|
||
# gst-plugins-base | ||
GST_PLUGINS += \ | ||
libgstapp.dll \ | ||
libgstaudiotestsrc.dll \ | ||
libgstpango.dll \ | ||
libgstplayback.dll \ | ||
libgsttcp.dll \ | ||
libgsttypefindfunctions.dll \ | ||
libgstvideoconvert.dll \ | ||
libgstvideorate.dll \ | ||
libgstvideoscale.dll \ | ||
libgstvideotestsrc.dll | ||
|
||
# gst-plugins-good | ||
GST_PLUGINS += \ | ||
libgstautodetect.dll \ | ||
libgstavi.dll \ | ||
libgstdeinterlace.dll \ | ||
libgstdirectsoundsink.dll \ | ||
libgstimagefreeze.dll \ | ||
libgstjpeg.dll \ | ||
libgstrawparse.dll \ | ||
libgstrtp.dll \ | ||
libgstrtpmanager.dll \ | ||
libgstrtsp.dll \ | ||
libgstudp.dll \ | ||
libgstvideomixer.dll | ||
|
||
# gst-plugins-bad | ||
GST_PLUGINS += \ | ||
libgstaudiovisualizers.dll \ | ||
libgstautoconvert.dll \ | ||
libgstcompositor.dll \ | ||
libgstd3dvideosink.dll \ | ||
libgstdebugutilsbad.dll \ | ||
libgstdirectsoundsrc.dll \ | ||
libgstopengl.dll \ | ||
libgstinter.dll \ | ||
libgstmpegpsdemux.dll \ | ||
libgstmpegpsmux.dll \ | ||
libgstmpegtsdemux.dll \ | ||
libgstmpegtsmux.dll \ | ||
libgstvideoparsersbad.dll \ | ||
libgstwinks.dll \ | ||
libgstwinscreencap.dll | ||
|
||
# gst-plugins-ugly | ||
GST_PLUGINS += \ | ||
libgstmpeg2dec.dll \ | ||
libgstx264.dll | ||
|
||
# gst-libav | ||
GST_PLUGINS += \ | ||
libgstlibav.dll | ||
|
||
for(lib, GST_PLUGINS) { | ||
addCopyFileTarget($${lib},$${GST_PLUGINS_DIR},$${GCS_LIBRARY_PATH}/gstreamer-1.0) | ||
addCopyDependenciesTarget($${lib},$${GST_PLUGINS_DIR},$${GCS_APP_PATH}) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
/** | ||
****************************************************************************** | ||
* | ||
* @file devicemonitor.cpp | ||
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2017. | ||
* @brief | ||
* @see The GNU Public License (GPL) Version 3 | ||
* @defgroup | ||
* @{ | ||
* | ||
*****************************************************************************/ | ||
/* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, but | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along | ||
* with this program; if not, write to the Free Software Foundation, Inc., | ||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
*/ | ||
#include "devicemonitor.h" | ||
|
||
#include "gst_util.h" | ||
|
||
#include <gst/gst.h> | ||
|
||
#include <QDebug> | ||
|
||
static GstBusSyncReply my_bus_sync_func(GstBus *bus, GstMessage *message, gpointer user_data) | ||
{ | ||
Q_UNUSED(bus) | ||
|
||
DeviceMonitor * dm; | ||
GstDevice *device; | ||
gchar *name; | ||
|
||
switch (GST_MESSAGE_TYPE(message)) { | ||
case GST_MESSAGE_DEVICE_ADDED: | ||
gst_message_parse_device_added(message, &device); | ||
name = gst_device_get_display_name(device); | ||
|
||
dm = (DeviceMonitor *)user_data; | ||
QMetaObject::invokeMethod(dm, "device_added", Qt::QueuedConnection, | ||
Q_ARG(QString, QString(name))); | ||
|
||
g_free(name); | ||
break; | ||
case GST_MESSAGE_DEVICE_REMOVED: | ||
gst_message_parse_device_removed(message, &device); | ||
name = gst_device_get_display_name(device); | ||
|
||
dm = (DeviceMonitor *)user_data; | ||
QMetaObject::invokeMethod(dm, "device_removed", Qt::QueuedConnection, | ||
Q_ARG(QString, QString(name))); | ||
|
||
g_free(name); | ||
break; | ||
default: | ||
break; | ||
} | ||
|
||
// no need to pass it to the async queue, there is none... | ||
return GST_BUS_DROP; | ||
} | ||
|
||
DeviceMonitor::DeviceMonitor(QObject *parent) : QObject(parent) | ||
{ | ||
// initialize gstreamer | ||
gst::init(NULL, NULL); | ||
|
||
monitor = gst_device_monitor_new(); | ||
|
||
GstBus *bus = gst_device_monitor_get_bus(monitor); | ||
gst_bus_set_sync_handler(bus, (GstBusSyncHandler)my_bus_sync_func, this, NULL); | ||
gst_object_unref(bus); | ||
|
||
GstCaps *caps = NULL; // gst_caps_new_empty_simple("video/x-raw"); | ||
const gchar *classes = "Video/Source"; | ||
gst_device_monitor_add_filter(monitor, classes, caps); | ||
if (caps) { | ||
gst_caps_unref(caps); | ||
} | ||
|
||
if (!gst_device_monitor_start(monitor)) { | ||
qWarning() << "Failed to start device monitor"; | ||
} | ||
} | ||
|
||
DeviceMonitor::~DeviceMonitor() | ||
{ | ||
gst_device_monitor_stop(monitor); | ||
gst_object_unref(monitor); | ||
} | ||
|
||
QList<Device> DeviceMonitor::devices() const | ||
{ | ||
QList<Device> devices; | ||
|
||
GList *list = gst_device_monitor_get_devices(monitor); | ||
while (list != NULL) { | ||
gchar *name; | ||
gchar *device_class; | ||
|
||
GstDevice *device = (GstDevice *)list->data; | ||
name = gst_device_get_display_name(device); | ||
device_class = gst_device_get_device_class(device); | ||
|
||
devices << Device(name, device_class); | ||
|
||
g_free(name); | ||
g_free(device_class); | ||
|
||
gst_object_unref(device); | ||
list = g_list_remove_link(list, list); | ||
} | ||
|
||
return devices; | ||
} | ||
|
||
void DeviceMonitor::device_added(QString name) | ||
{ | ||
// qDebug() << "**** ADDED:" << name; | ||
emit deviceAdded(name); | ||
} | ||
|
||
void DeviceMonitor::device_removed(QString name) | ||
{ | ||
// qDebug() << "**** REMOVED:" << name; | ||
emit deviceRemoved(name); | ||
} |
Oops, something went wrong.