Commit graph

2040 commits

Author SHA1 Message Date
Nicolas Dufresne
1094e2548e v4l2src: Add source resolution change support
This patch adds support for source resolution change detection.
Resolution change is signaled by drivers when a change in the detected
signal have been detected. This is notably seen on HDMI receivers.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/870>
2021-02-19 16:02:02 -05:00
Nicolas Dufresne
bb1d9b398e v4l2bufferpool: Handle resolution change event
This patch adds the detection, dequeuing and reporting of the SOURCE_CHANGE
event when the CH_RESOLUTION flag is set. The acquire function will now return
a new custom success called GST_V4L2_FLOW_RESOLUTION_CHANGE. In order to use
this new feature, elements must enable it by calling:

  gst_v4l2_buffer_pool_enable_resolution_change (pool);

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/870>
2021-02-19 16:02:02 -05:00
Nicolas Dufresne
4be9bf4085 v4l2object: Add event helpers
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/870>
2021-02-19 16:02:02 -05:00
Nicolas Dufresne
954e38a6b9 v4l2bufferpool: use FLOW_LAST_BUFFER
This uses the GST_V4L2_FLOW_LAST_BUFFER alias instead of
GST_FLOW_CUSTOM_SUCCESS to make the code more readable.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/870>
2021-02-19 15:22:47 -05:00
Lucas Stach
1b1ad32b90 v4l2object: prefer NV12 over I420
Considering NV12 an 'odd' format is a historical artifact. This format
is now quite common, and usually preferable to I420 due to more memory
friendly access patterns.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/857>
2021-02-19 13:12:54 -05:00
Kevin Song
c63ff9c06c Apply 1 suggestion(s) to 1 file(s)
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/868>
2021-02-05 00:55:49 +00:00
Kevin Song
fd6c296021 Apply 1 suggestion(s) to 1 file(s)
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/868>
2021-02-05 00:55:49 +00:00
Bing Song
025b43e512 v4l2videoenc: support resolution change stream encode.
Resolution change stream transcoding will drain before send new video
frame buffer. Need encode video frame after process EOS.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/868>
2021-02-05 00:55:49 +00:00
Bing Song
5f00810ee0 v4l2h265codec: fix HEVC profile string issue.
Keep HEVC profile compatible with other module.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/850>
2021-01-27 01:22:41 +00:00
Bing Song
b87db31fbe v4l2object: Need keep same transfer as input caps.
GST_VIDEO_TRANSFER_BT2020_12 and GST_VIDEO_TRANSFER_BT2020_10 will
be mapped to V4L2_XFER_FUNC_709. Need check input caps when map
V4L2_XFER_FUNC_709 back to GST_VIDEO_TRANSFER_BT2020_12 and
GST_VIDEO_TRANSFER_BT2020_10

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/816
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/841>
2021-01-18 04:26:04 +00:00
Hou Qi
386b785e48 v4l2object: Map correct video format for RGBA
Map V4L2_PIX_FMT_RGBA32 pixel format to GST_VIDEO_FORMAT_RGBA instead of
GST_VIDEO_FORMAT_RGB video format to support RGBA.

Fixes #823

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/848>
2021-01-11 09:05:05 +08:00
Hou Qi
ff1dd307f2 v4l2object: Use active resolution during fallback colorspace probe
For legacy drivers that don't implement ENUM_FRAMESIZE, use active
resolution to probe colorspace. This can improve the accuracy of the
result when the colorspace depends on the resolution. This fixes a
wrong colorspace issue on board with vendor bsp at resolution 2560x1440.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/830>
2020-12-14 09:15:18 +08:00
Jose Quaresma
2a5d7b18a0 rpicamsrc: add vchostif library as it is required to build successful
fix: undefined reference to `vc_gencmd'
/usr/src/debug/gstreamer1.0-plugins-good/1.18.1-r0/build/../gst-plugins-good-1.18.1/sys/rpicamsrc/RaspiCamControl.c:1440: undefined reference to `vc_gencmd'

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/818>
2020-12-01 18:24:58 +00:00
Tim Schneider
2c76f03fe2 rpicamsrc: Added "src->started = FALSE;" to gst_rpi_cam_src_stop
Makes the element reusable multiple times after a state change back to READY.
Fixes #105

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/823>
2020-11-20 02:15:15 +11:00
Bing Song
8a0a7d932a v4l2: caps negotiate wrong as interlace feature
gst_caps_simplify() will move interlace format before normal video
format. It will cause caps negotiate prefer interlaced caps which
isn't expected. Seperate normal caps and interlaced caps and then
merge it will keep prefer progress video format.
Add ARGB/BGRA for interlaced caps.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/802

Part-of <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/813>

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/813>
2020-11-16 15:12:28 +00:00
Sebastian Dröge
d885cc0f1a v4l2codec: Garbage collect old frames if they accumulate because of codec bugs
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/778>
2020-10-19 22:04:55 +03:00
Sebastian Dröge
bcb3428ed0 v4l2codec: Pass system frame number as timestamp and use it to retrieve back frames reliably
System frame numbers are supposed to be unique and correct drivers are
passing through timestamps without modification from the output/sink to the
capture/src side.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/778>
2020-10-19 18:33:58 +03:00
Havard Graff
ed01e165b5 v4l2object: plug memory-leak
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/718>
2020-09-10 01:29:53 +00:00
Nicolas Dufresne
6b76be620b v4l2h264codec: Map newly defined profile/levels
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/697>
2020-08-11 17:24:11 -04:00
Nicolas Dufresne
742d435511 v4l2: Sync headers with kernel 5.9
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/697>
2020-08-11 17:24:03 -04:00
Víctor Manuel Jáquez Leal
078560e70a v4l2: use GstV4l2Error in gst_v4l2_open()
gst_v4l2_open() is called by gst_v4l2_device_provider_probe_device(),
where the GstV4l2Object is created without an associated GstElement.

If gst_v4l2_open() fails, it raises a bus message, but without an
element, a precondition check fails on
gst_element_message_full_with_details() generating a crash if running
with fatal-warnings debug mode.

GstV4l2Error is a helper to raise error bus messages when it is
appropiated. This patch changes the direct bus messages to this
helper, and the elements will actually send the error message.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/694>
2020-08-11 01:44:17 +00:00
Tim-Philipp Müller
435c2acdc5 rpicamsrc: hypothetical fix for data pointer calculation
mmal buffer header docs say data is valid for length bytes
from offset. In practice offset always seems to be 0 so
far though.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/682>
2020-07-24 17:13:04 +01:00
Tim-Philipp Müller
987a332076 rpicamsrc: mark buffers as header and keyframe/delta-unit
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/682>
2020-07-24 17:09:45 +01:00
Tim-Philipp Müller
9588108d6e rpicamsrc: fix nal alignment of output buffers
We claim output buffers are nal-aligned, but that wasn't
actually true: We would push out a partial nal in case
the nal doesn't fit into the max encoder-selected output
buffer size, and then the next buffer would not start
with a sync marker. That's not right and makes h264parse
unhappy.

Instead accumulate buffers until we have a full frame
(we can't rely on the NAL_END flag, it's always set).

Fixes #768

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/682>
2020-07-24 17:09:45 +01:00
Tim-Philipp Müller
477eba2dd7 rpicamsrc: fix "Could not find component vc.ril.camera" on recent raspios
Make extra sure all the required mmal libs such as libmmal_vc_client.so
actually get linked and stay linked. Otherwise the above error happens
it seems.

buster (10.4) with meson 0.55 and pi ref 2020-05-27
pi-gen, 825107f04027269db77426046f5085475b1ea22f, stage5

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/682>
2020-07-23 19:11:30 +01:00
Tim-Philipp Müller
428c545e06 rpicamsrc: deviceprovider: hook up i18n properly
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/682>
2020-07-23 19:09:56 +01:00
Tim-Philipp Müller
7861f17bd7 rpicamsrc: deviceprovider: advertise (M)JPEG as well
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/682>
2020-07-23 19:09:56 +01:00
Tim-Philipp Müller
d67e21d454 rpicamsrc: deviceprovider: also advertise constrained-baseline profile
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/682>
2020-07-23 19:09:56 +01:00
Haihua Hu
0a453cc4a4 v4l2: enhance v4l2 control interface to support string type CID
add string type cid support for v4l2 implementation

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/676>
2020-07-22 14:21:42 +08: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
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
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
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