Commit graph

18904 commits

Author SHA1 Message Date
Ognyan Tonchev
adb044c9ed rtspsrc: Fix segfault with illegal free
set_get_param_q is not a pointer so it is illegal to call g_queue_free_full().
Freeing the requests by popping them from the queue instead.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/669>
2020-07-15 13:19:38 +00:00
Raul Tambre
b471f75ea0 QtGLVideoItem: Use QSharedPointer::data() for better compatibility
Older Qt versions didn't have QSharedPointer::get(), which is just a modern alias for QSharedPointer::data().

FAILED: ext/qt/libgstqmlgl.so.p/qtitem.cc.o
c++ -Iext/qt/libgstqmlgl.so.p -Iext/qt -I../ext/qt -I. -I.. -I../gst-libs -I/usr/include/glib-2.0 -I/usr/lib/aarch64-linux-gnu/glib-2.0/include -I/usr/include/gstreamer-1.0 -I/usr/include/orc-0.4 -I/usr/lib/aarch64-linux-gnu/gstreamer-1.0/include -I/usr/include/aarch64-linux-gnu/qt5/QtCore -I/usr/include/aarch64-linux-gnu/qt5 -I/usr/include/aarch64-linux-gnu/qt5/QtGui -I/usr/include/aarch64-linux-gnu/qt5/QtQml -I/usr/include/aarch64-linux-gnu/qt5/QtNetwork -I/usr/include/aarch64-linux-gnu/qt5/QtQuick -I/usr/include/aarch64-linux-gnu/qt5/QtX11Extras -I/usr/include/libdrm -flto -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -std=c++11 -Wmissing-declarations -Wredundant-decls -Wwrite-strings -Winit-self -Wmissing-include-dirs -Wno-multichar -Wvla -Wpointer-arith -g -fdebug-prefix-map=/opt/good/src=. -Wformat -Werror=format-security -O3 -march=native -Wno-error -Wdate-time -fPIC -pthread -DHAVE_CONFIG_H -DHAVE_QT_X11 -DHAVE_QT_EGLFS -MD -MQ ext/qt/libgstqmlgl.so.p/qtitem.cc.o -MF ext/qt/libgstqmlgl.so.p/qtitem.cc.o.d -o ext/qt/libgstqmlgl.so.p/qtitem.cc.o -c ../ext/qt/qtitem.cc
In file included from /usr/include/gstreamer-1.0/gst/gst.h:55:0,
                 from /usr/include/gstreamer-1.0/gst/video/video.h:23,
                 from ../ext/qt/qtitem.cc:27:
../ext/qt/qtitem.cc: In destructor ‘virtual QtGLVideoItem::~QtGLVideoItem()’:
../ext/qt/qtitem.cc:138:86: error: ‘class QSharedPointer<QtGLVideoItemInterface>’ has no member named ‘get’
   GST_INFO ("%p Destroying QtGLVideoItem and invalidating the proxy %p", this, proxy.get());
                                                                                      ^
/usr/include/gstreamer-1.0/gst/gstinfo.h:682:31: note: in definition of macro ‘GST_CAT_LEVEL_LOG’
         (GObject *) (object), __VA_ARGS__);    \
                               ^~~~~~~~~~~
../ext/qt/qtitem.cc:138:3: note: in expansion of macro ‘GST_INFO’
   GST_INFO ("%p Destroying QtGLVideoItem and invalidating the proxy %p", this, proxy.get());
   ^

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/673>
2020-07-15 12:38:50 +00:00
Justin Chadwell
738f32d5d0 qtdemux: fix allocation explosion with stsd entries
Previously, the user input for stsd entries is trusted completely, and
so a maliciously crafted file could choose the length of the stsd
entries arbitrarily and cause qtdemux to try to allocate up to 2GB of
memory (half of a 32 bit max int).

This patch fixes this by sanity checking the stsd input against the
size of the entire stsd atom.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/670>
2020-07-15 12:10:45 +00:00
Justin Chadwell
e6f66f4681 qtdemux: fix crashes when input stream contained no stsd entries
During trak parsing, we need to check for the existence of stsd_entries,
otherwise, we end up with a NULL pointer to them. It is entirely
possible for the stsd to exist, but for it to have no entries, which the
previous checks did not take into account.

This patch adds a simply check to ensure that all files that do not
contain a stsd entry are deemed corrupt, and adds a test case to prevent
a regression.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/670>
2020-07-15 12:10:45 +00:00
Tim-Philipp Müller
d3cbd4077e docs: update for new pixel formats
https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/753
https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/754

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/672>
2020-07-15 12:40:17 +01:00
Tim-Philipp Müller
5a7275220b rpicamsrc: fix build with older meson versions
assert() used to require two arguments.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/668>
2020-07-10 21:43:14 +01:00
Tim-Philipp Müller
3b0437e58d examples: hook up rpicamsrc examples
webrtc one should probably go into gst-examples.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/667>
2020-07-10 17:37:28 +01:00
Tim-Philipp Müller
c22b71e181 examples: fix indentation of rpicamsrc examples
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/667>
2020-07-10 17:37:28 +01:00
Tim-Philipp Müller
fbcc43d822 rpicamsrc: flesh out docs and add to plugin docs cache
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/667>
2020-07-10 17:37:28 +01:00
Tim-Philipp Müller
b7c07b1a95 rpicamsrc: enable video orientation/direction unconditionally
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/667>
2020-07-10 17:37:28 +01:00
Tim-Philipp Müller
b222ca1fc9 rpicamsrc: remove mkenums template files which are no longer needed
They were still being used by the autotools build, but that's gone.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/667>
2020-07-10 17:37:28 +01:00
Tim-Philipp Müller
8ceaefe101 rpicamsrc: fix indentation
Not touching the Raspi* files.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/667>
2020-07-10 17:37:28 +01:00
Tim-Philipp Müller
996d2389af rpicamsrc: fix and silence some compiler warnings
Some are in system headers, and in Raspi files we want
to keep modifications to a minimum.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/667>
2020-07-10 17:37:28 +01:00
Tim-Philipp Müller
4a4de61c23 rpicamsrc: hook up to build
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/667>
2020-07-10 17:37:28 +01:00
Tim-Philipp Müller
84dbf94313 Merge branch 'plugin-move-rpicamsrc'
Move rpicamsrc from https://github.com/thaytan/gst-rpicamsrc/

It's a useful little element and works well, so might as well
make sure it's widely available so people can stop piping
raspivid output into fdsrc.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/667>
2020-07-10 17:36:14 +01:00
Tim-Philipp Müller
e5593a4c9c rpicamsrc: sync autotools with glib-mkenum usage in meson build 2020-07-10 16:47:12 +01:00
Tim-Philipp Müller
1c25fe131d rpicamsrc: meson: use gnome.glib_mkenums_simple() and fix build as Meson subproject
While at it also fix up the type defines, e.g.
GST_RPI_CAM_TYPE_RPI_CAM_SRC_EXPOSURE_MODE -> GST_RPI_CAM_SRC_TYPE_EXPOSURE_MODE
2020-07-10 16:47:10 +01:00
Tim-Philipp Müller
912ea0dceb rpicamsrc: meson: drop map file and fix plugin symbol export with newer gstreamer versions
Use -fvisibility instead of a map file for symbol export, so that
the right symbols get exported with newer gstreamer versions. Older
GStreamer versions also still work of course.

Fixes blacklisting/plugin-loading issues with GStreamer >= 1.14

Fixes https://github.com/thaytan/gst-rpicamsrc/issues/984,
closes https://github.com/thaytan/gst-rpicamsrc/issues/94
and https://github.com/thaytan/gst-rpicamsrc/issues/67
2020-07-10 16:46:35 +01:00
Jan Schmidt
3c5327ae64 rpicamsrc: Attempt to workaround MMAL timeout bug
mmal_queue_timedwait() might spuriously return immediately
if called at exactly the wrong instant due to an internal
off-by-one bug. Attempt to work around that and just retry.
2020-07-10 16:46:33 +01:00
Jan Schmidt
c907deb15f rpicamsrc: Improve timeout error
Propagate timeout errors so they're not reported
generically
2020-07-10 16:46:31 +01:00
Jan Schmidt
41f41f1fdd rpicamsrc: webrtc example: Add a STUN server to the configuration
To let the webrtc example work through NAT firewalls
2020-07-10 16:46:30 +01:00
Jan Schmidt
b333e32e18 rpicamsrc: webrtc example: Modify HTML to support other ports than 57778 2020-07-10 16:46:28 +01:00
Jan Schmidt
d9115ef1eb rpicamsrc: webrtc example: Remove external fmtp insertion
GStreamer 1.14.2 should contain the backport of gst-plugins-bad
commit 5c450c5 adding FEC and RTX support, and incidentally
the fmtp field in the SDP
2020-07-10 16:46:26 +01:00
Jan Schmidt
fa840da606 rpicamsrc: webrtc example: Set the locale
Make the date format in the overlay respect the current
locale
2020-07-10 16:46:24 +01:00
Jan Schmidt
09d9ac2d2e rpicamsrc: Don't destroy the camera component on startup error
Just disable the camera component when it fails to start. The
most common reason is that the camera device is already in use,
and if we just disable the mmal component correct cleanup
will happen later
2020-07-10 16:46:23 +01:00
Jan Schmidt
39a026760d rpicamsrc: Add webrtc streaming example
Add an example for testing webrtc streaming from the rpi
camera, based on the code from
https://bugzilla.gnome.org/show_bug.cgi?id=795404

Requires GStreamer 1.14.1 or git master
2020-07-10 16:46:21 +01:00
Jan Schmidt
d5cd0c0301 rpicamsrc: Expose constrained-baseline profile
constrained-baseline is a useful profile for streaming to iOS
devices, and seems to work in the firmware, so let's publish it
2020-07-10 16:46:19 +01:00
Jan Schmidt
93bd8c34ed rpicamsrc: Add define and increase reported maximum FPS from 90 to 1000 2020-07-10 16:46:18 +01:00
Jan Schmidt
cab6585378 rpicamsrc: Expand frame timeout from 100ms to 500ms
rpicamsrc on a normal rpi camera doesn't start up fast enough,
and always fails the new 100ms timeout. A better solution
might be to have a longer timeout for the first frame, but
shorter once frames are running - but this quick fix will at
least make rpicamsrc work again.
2020-07-10 16:46:17 +01:00
Georgii Staroselskii
b45e239128 rpicamsrc: RaspiCapture: use mmal_queue_timedwait() for buffer queueing
If an external camera was disconnected, there were no feedback in an
application. It seems reasonable to wait on mmal_queue no longer than
100ms. If it's stuck we just return a FLOW_ERROR and let the application
decide what to do later.
2020-07-10 16:46:15 +01:00
Georgii Staroselskii
149fdee7fb rpicamsrc: RaspiCapture: handle MMAL_EVENT_ERROR 2020-07-10 16:46:13 +01:00
Jan Schmidt
ed893592ea rpicamsrc: Implement use-stc property to disable STC timestamps
If use-stc=false, then rpicamsrc won't apply
the camera timestamping to outgoing buffers, instead
relying on real-time timestamping by the
GStreamer clock. It means slightly less accuracy
and more jitter in timestamps, but might help on some
CSI inputs with broken timestamping.
2020-07-10 16:46:12 +01:00
Jan Schmidt
f093e3f5fb rpicamsrc: Fix the descriptions of text annotation colour properties
The text annotation colour properties take an integer value
corresponding to a VUY colour, not a text string like
the copy-pasted description from raspivid suggests.

Fixes https://github.com/thaytan/gst-rpicamsrc/issues/59
2020-07-10 16:46:03 +01:00
Jan Schmidt
2c458819f5 rpicamsrc: Implement dynamic bitrate update
Use mmal_port_set_parameter_uint32 to update the encoder
bitrate.

Fixes https://github.com/thaytan/gst-rpicamsrc/issues/60
2020-07-10 16:45:54 +01:00
Jan Schmidt
1670712500 rpicamsrc: Set outgoing buffer durations based on negotiated framerate.
make sure outgoing buffers have at least some duration set,
otherwise it leads to strange situations, like qtmux writing
out a file that doesn't include the final frame inside the
playable segment, because no-duration = 0 duration there.
2020-07-10 16:45:53 +01:00
Jan Schmidt
dd9d7341b0 rpicamsrc: Destroy mmal pool on shutdown always.
Avoid hangs on the next run because we didn't clean up the mmal pool
last time we shutdown.
2020-07-10 16:45:52 +01:00
Jan Schmidt
f42afec471 rpicamsrc: Switch back to MJPEG codec for image/jpeg
The JPEG codec hangs, not sure why yet. The MJPEG
codec doesn't provide a quality setting, and sometimes
freezes on shutdown, but otherwise seems more
reliable
2020-07-10 16:45:50 +01:00
Jan Schmidt
38ef8c2411 rpicamsrc: Don't try and set H264 params with JPEG codec 2020-07-10 16:45:49 +01:00
Jan Schmidt
da86cec40e rpicamsrc: First attempt at implementing MJPEG and raw video support 2020-07-10 16:45:47 +01:00
Tim-Philipp Müller
0a38642214 rpicamsrc: Add experimental build using the Meson build system
Builds in about 10 seconds vs. 77 seconds with autotools.
2020-07-10 16:45:46 +01:00
Xabier Rodriguez Calvar
39afecac32 rpicamsrc: Implement GstVideoDirection interface
Instead of implementing a custom property, we implement that interface.
2020-07-10 16:45:45 +01:00
Jan Schmidt
2496d0e859 rpicamsrc: MMAL gives buffers with nal alignment, not AU
Fix the output caps, our buffers are not AU aligned, since
the SPS / PPS are given in separate packets at the start.
2020-07-10 16:45:43 +01:00
Xabier Rodriguez Calvar
c785d4f5db rpicamsrc: Create orientation property
Its behavior and choices are analog to the ones present in [gl]videoflip
for the method property.
2020-07-10 16:45:39 +01:00
Jan Schmidt
8e8ac0504c rpicamsrc: basesrc event handlers should not unref
Don't unref the passed event when handling events via
the GstBaseSrc src pad event handler - basesrc does
the unref. That breaks handling of upstream
force-key-unit events by unreffing twice.

Fixes https://github.com/thaytan/gst-rpicamsrc/issues/43
2020-07-10 16:45:29 +01:00
Jan Schmidt
8fa4acacc0 rpicamsrc: Add property getters for preview window position.
Add the lines in get_property() for the preview-x/y/w/h properties
so the values can be retrieved without causing critical warnings.

Fixes https://github.com/thaytan/gst-rpicamsrc/issues/42
2020-07-10 16:45:21 +01:00
Jan Schmidt
48b3c2bc8e rpicamsrc: Add preview-x/y/w/h properties
Expose properties for setting the position of the preview
window on the screen
2020-07-10 16:45:19 +01:00
Jan Schmidt
63f60f7e7e rpicamsrc: Add properties for configuring annotation text size and colour.
Map the raspivid setting for annotation text size and colours
to properties.
2020-07-10 16:45:18 +01:00
ibauer
a3de294cb5 rpicamsrc: Changed awb-gain-blue use the correct enum PROP_AWB_GAIN_BLUE and not PROP_AWB_GAIN_RED 2020-07-10 16:45:16 +01:00
Jan Schmidt
e97b50af51 rpicamsrc: Fix buffer PTS calculation
Timestamps from MMAL are in microseconds,
so make sure to convert to nanoseconds before
using them to adjust the GStreamer buffer time
2020-07-10 16:45:15 +01:00
Philippe Normand
cda483cb3c rpicamsrc: Basic orientation interface support
The (h,v)flip attributes are now supported through this interface.
It should also be possible to support (h,v)center attributes using the
ROI properties.
2020-07-10 16:45:13 +01:00