Commit graph

80 commits

Author SHA1 Message Date
Nicolas Dufresne
bba92f64ca omx: Add helper to enable/disable/read subframe mode 2019-12-22 05:43:40 +00:00
George Kiagiadakis
fbe0d07068 gstomx: remove gst_omx_buffer_set_omx_buf/get_omx_buf
They are no longer used anywhere
2019-04-25 09:09:42 +05:30
Guillaume Desmottes
9dc359d0c1 omxbufferpool: fix race when releasing input buffers
If buffers were released from the pool while
gst_omx_video_enc_handle_frame() was waiting for new buffers,
gst_omx_port_acquire_buffer() was never awaken as the buffers weren't
released through OMX's messaging system.

GQueue isn't thread safe so also protect it with the lock mutex.
2019-01-08 16:04:31 +01:00
Guillaume Desmottes
7be54ad091 omxvideoenc: implement dmabuf export on input buffers
Propose pool upstream so input buffers can be allocated by the port and
exported as dmabuf.

The actual OMX buffers are allocated when the pool is activated, so we
don't end up doing useless allocations if the pool isn't used.

https://bugzilla.gnome.org/show_bug.cgi?id=796918
2018-08-30 10:59:30 +02:00
Guillaume Desmottes
34bc02e397 omx: allow gst_omx_port_acquire_buffer() to not wait for buffers
Will be needed to implement GST_BUFFER_POOL_ACQUIRE_FLAG_DONTWAIT.

https://bugzilla.gnome.org/show_bug.cgi?id=796918
2018-08-30 10:59:30 +02:00
Guillaume Desmottes
8efa0951ff turn GstOMXComponent to a GstMiniObject
Will use it for refcounting.

https://bugzilla.gnome.org/show_bug.cgi?id=796918
2018-08-30 10:59:30 +02:00
Guillaume Desmottes
457e1b9a5e omx: factor out gst_omx_buffer_get/set_omx_buf()
Move the qdata code to helper functions as I'm going to need them in
omxvideoenc to implement dmabuf export.

https://bugzilla.gnome.org/show_bug.cgi?id=796918
2018-08-30 10:59:30 +02:00
Guillaume Desmottes
f0964dfbdb omx: factor out gst_omx_port_set_dmabuf()
No semantic change. I also made the debug message a bit clearer.

https://bugzilla.gnome.org/show_bug.cgi?id=796918
2018-08-30 10:59:30 +02:00
Guillaume Desmottes
c8969b0dbe omxvideoenc: implement decide_allocation
Increase the number of output buffers by the number of buffers requested
downstream.
Prevent buffers starvation if downstream is going to use dynamic buffer
mode on its input.

https://bugzilla.gnome.org/show_bug.cgi?id=795746
2018-06-08 09:53:01 +02:00
Guillaume Desmottes
9a8e863862 omxvideodec/enc: add hack updating nBufferCountActual before allocating
The OMX specs states that the nBufferCountActual of a port has to default
to its nBufferCountMin. If we don't change nBufferCountActual we purely rely
on this default. But in some cases, OMX may change nBufferCountMin before we
allocate buffers. Like for example when configuring the input ports with the
actual format, it may decrease the number of minimal buffers required.
This method checks this and update nBufferCountActual if needed so we'll use
less buffers than the worst case in such scenarios.

SetParameter() needs to be called when the port is either disabled or
the component in the Loaded state.

Don't do this for the decoder output as
gst_omx_video_dec_allocate_output_buffers() already check
nBufferCountMin when computing the number of output buffers.

On some platform, like rpi, the default nBufferCountActual is much
higher than nBufferCountMin so only enable this using a specific gst-omx
hack.

https://bugzilla.gnome.org/show_bug.cgi?id=791211
2018-06-08 09:44:49 +02:00
Guillaume Desmottes
72cb1943da omxvideoenc: restore OMX default target-bitrate if requested by user
0xffffffff is the magic number in gst-omx meaning 'the default value
defined in OMX'. This works fine with OMX parameters which are only set
once when starting the component but not with configs which can be
changed while PLAYING.
Save the actual OMX default bitrate so we can restore it later if user
sets back 0xffffffff on the property.

Added GST_OMX_PROP_OMX_DEFAULT so we stop hardcoding magic numbers
everywhere.

https://bugzilla.gnome.org/show_bug.cgi?id=794998
2018-04-23 10:41:10 +02:00
Guillaume Desmottes
ab181a4335 include all OMX extension headers if present
The OMX specs defines 8 headers that implementations can use to define
their custom extensions. We were checking and including 3 and ignoring
the other ones.

https://bugzilla.gnome.org/show_bug.cgi?id=792043
2018-01-30 11:54:37 +00:00
Guillaume Desmottes
2ca3cf5cfa omxvideodec: add hack to pass color format from caps to OMX decoder
This hack tries to pass as much information as possible from caps to the
decoder before it receives any buffer. These information can be used by
the OMX decoder to, for example, pre-allocate its internal buffers
before starting to decode and so reduce its initial latency.

This mechanism is currently supported by the zynqultrascaleplus decoder.

https://bugzilla.gnome.org/show_bug.cgi?id=792040
2018-01-30 09:23:59 +00:00
Guillaume Desmottes
9f87b987ef omxvideoenc: implement dmabuf import on zynqultrascaleplus
The Zynq UltraScale+ encoder implements a custom OMX extension to
directly import dmabuf saving the need of mapping input buffers.

This can be use with either 'v4l2src io-mode=dmabuf' or an OMX video
decoder upstream.

https://bugzilla.gnome.org/show_bug.cgi?id=792361
2018-01-29 15:21:02 +00:00
Guillaume Desmottes
da07a647b8 omx: add API to implement dynamic buffers support
OMX 1.2.0 introduced a third way to manage buffers by allowing
components to only allocate buffers header during their initialization
and change their pBuffer pointer at runtime.
This new feature can save us a copy between GStreamer and OMX for each
input buffer.

This patch adds API to allocate and use such buffers.

https://bugzilla.gnome.org/show_bug.cgi?id=787093
2017-12-14 09:00:02 +00:00
Guillaume Desmottes
3a0e4bc35d add gst_omx_buffer_flags_to_string()
Make debug logs more readable so users don't have to manually figure out
the meaning of flags.

https://bugzilla.gnome.org/show_bug.cgi?id=788767
2017-10-11 13:49:30 -04:00
Guillaume Desmottes
4488ab97af build: include OMX_IndexExt and OMX_ComponentExt if present
These files may be used by OMX implementation to define custom extensions.
Include them if present as we are already doing with OMX_VideoExt.h

https://bugzilla.gnome.org/show_bug.cgi?id=784847
2017-07-13 14:41:58 +01:00
Guillaume Desmottes
0aa4c9db4e h264dec: add hack to pass profile and level to OMX
This information can be useful to zynqultrascaleplus decoders. They may
use this information to reduce startup latency by configuring itself
before receiving the first frames.

We also have a custom OMX extension allowing the decoder to report the
latency. The profile/level information helps it reporting a more
accurate latency earlier.

https://bugzilla.gnome.org/show_bug.cgi?id=783114
2017-07-11 11:57:50 -04:00
Gurkirpal Singh
fc1a8229b0 omx: guard some omx enums with IL version
Some enums that existed in 1.1.2 just do not exit in 1.2.0
See https://www.khronos.org/registry/OpenMAX-IL/specs/OpenMAX_IL_1_2_0_Specification_redline.pdf

https://bugzilla.gnome.org/show_bug.cgi?id=782800
2017-07-05 17:27:27 -04:00
Jan Schmidt
413f05269c omxvideoenc: Add GST_OMX_HACK_HEIGHT_MULTIPLE_16 for Rpi
The Raspberry Pi encoder produces corrupt output unless
the input height is a multiple of 16. Add a hack that adds
zero padding when needed.
2017-03-14 03:00:49 +11:00
George Kiagiadakis
05b137a256 Add a signals-premature-eos hack for egl_render
egl_render seems to have a bug and signals EOS before it has finished
pushing out all data; this hack simply makes acquire_buffer() wait
a bit more before signalling EOS, in case egl_render decides to spit
out some more data.

https://bugzilla.gnome.org/show_bug.cgi?id=741856
2016-12-13 11:38:26 +02:00
Sebastian Dröge
a78756c63f omx: #define OMX_SKIP64BIT on the RPi as required by their API
Also add generic support for OMX_SKIP64BIT to gst-omx, in case other
implementations also #define that for whatever reason.

https://bugzilla.gnome.org/show_bug.cgi?id=766475
2016-06-17 12:06:48 +03:00
Sebastian Dröge
b9238195dd omx: Only include OMX_VideoExt.h conditionally
It does not exist on the RPi for example.
2014-06-24 14:52:43 +02:00
Sebastian Dröge
4e20116bc6 omx: Add a hack for not disabling the output port after set_format until the output format is known
Needed on some OMX implementations, e.g. the one from Atmel. It does
not send the settings-changed event on the output port if it is
disabled.
2014-05-15 10:59:35 +02:00
Christian König
8a860bd024 omxvideo: fix debug category initialisation
https://bugzilla.gnome.org/show_bug.cgi?id=726024
2014-03-15 12:42:03 +01:00
Christian König
de5f940186 omx: simplify tunnel functions
Specifying the component is error prone and unnecessary.

https://bugzilla.gnome.org/show_bug.cgi?id=726021
2014-03-12 08:48:46 +01:00
jitendra
715b44ea66 omx: Add pads based on element type
This allows to later add sources and sink that only have a srcpad
or sinkpad.

https://bugzilla.gnome.org/show_bug.cgi?id=699754
2013-05-06 16:20:20 +02:00
Sebastian Dröge
8a1bb1b4a3 omxvideodec: Add support for egl_render on RPi 2013-03-26 14:00:03 +01:00
Tim-Philipp Müller
d7862b927c omx: log commands as strings
Makes logs easier to read.
2013-03-15 09:29:56 +00:00
Tim-Philipp Müller
07e6ae99f1 omx: log states as strings 2013-03-15 09:29:55 +00:00
Tim-Philipp Müller
118345eef5 omx: log component name in debug messages
Useful when we have more different components
active at the same time.
2013-03-15 09:29:55 +00:00
Sebastian Dröge
22dce51dd4 omx: Handle the OMX_EventBufferFlag to detect EOS too 2013-03-14 12:51:54 +01:00
Sebastian Dröge
acf15e84a9 omx: Mark OpenMAX buffers as EGLImage if they contain one
Needs special handling in some places, e.g. because nFilledLen
will always be 0.
2013-03-13 13:10:28 +01:00
Sebastian Dröge
7a1eaec3b9 omx: Add timeout to the flush operation and move buffer populating to a separate function 2013-03-07 13:57:00 +01:00
Sebastian Dröge
001b7f0ed9 omx: Remove min buffer count hack for RPi again
It's not necessary anymore
2013-03-07 13:56:50 +01:00
Sebastian Dröge
60861f3990 omx: Do number of buffers configuration explicitely 2013-03-07 13:56:44 +01:00
Sebastian Dröge
0bb816e32c omx: Handle errors more gracefully 2013-03-01 11:18:38 +01:00
Sebastian Dröge
aeec430261 omx: Return the OMX_ERRORTYPE from gst_omx_port_update_port_definition 2013-02-28 15:49:14 +01:00
Sebastian Dröge
1dd6214f44 omx: Add hack for RPi for the minimum number of buffers required for a port
The value in the port definition is invalid and the initial actual
buffer count should be used.
2013-02-28 13:57:43 +01:00
Sebastian Dröge
1a906da409 omx: Add API for allocating a specific number of buffers and using EGLImages or buffers allocated elsewhere 2013-02-28 11:20:52 +01:00
Sebastian Dröge
b12610efd7 omx: Clean up port settings change handling 2013-02-27 15:50:20 +01:00
Sebastian Dröge
70368c31cd omx: Refactor waiting for buffers to be released by the component to a separate function 2013-02-25 10:41:12 +01:00
Sebastian Dröge
f79bbc302b omx: Add methods to set up and close a tunnel between components 2013-02-25 09:47:37 +01:00
Sebastian Dröge
219a93bbaf omx: Some minor refactoring and cleanup 2013-02-12 11:49:21 +01:00
Sebastian Dröge
c3bcc43db7 omx: Split enabling/disabling of port into sending the command and waiting for it
This allows to do anything necessary after sending the command to actually let it finish
2013-02-12 11:41:43 +01:00
Sebastian Dröge
4044aaecbe omx: Fix includes to properly work with the 1.0 releases 2013-01-17 18:08:15 +01:00
Sebastian Dröge
2d913c6773 omx: Atomic ops are not required anymore for the reconfiguration 2013-01-14 10:37:06 +01:00
Sebastian Dröge
a42f27547d omx: Implement new approach for locking that should solve all deadlocks on RPi
No mutex is locked while calling any OpenMAX functions anymore
and everything from the OpenMAX callbacks is inserted into a message
queue and handled from outside the callbacks.

Also there's only a single mutex and condition variable per component
now for handling anything from OpenMAX callbacks and a single mutex
for keeping our component/port state sane.
2013-01-14 10:36:32 +01:00
Sebastian Dröge
a70a71b9a5 omx: Also initialize nStep field of the OMX structures 2012-12-19 13:05:28 +01:00
Sebastian Dröge
73dc5bb199 omx: Initialize struct version with the OMX version we compiled with 2012-12-19 13:03:37 +01:00