platform/upstream/gst-omx.git
6 years agoadd OMX_PERFORMANCE debug category
Guillaume Desmottes [Mon, 30 Oct 2017 10:59:19 +0000 (11:59 +0100)]
add OMX_PERFORMANCE debug category

Can be used to log buffers exchange between OMX and gst-omx to profile
performances of the OMX component.
Ideally this should be done using tracer hooks but it's currently not
possible to define custom hooks outside of core.

Use GST_DEBUG="OMX_PERFORMANCE:8" to enable it.
See also
https://github.com/gdesmott/gst-log-parser/blob/master/src/bin/omx-perf.rs
as a simple program consuming those logs to generate gnuplot files and
stats.

https://bugzilla.gnome.org/show_bug.cgi?id=791093

6 years agoomxvideoenc: implement dmabuf import on zynqultrascaleplus
Guillaume Desmottes [Thu, 27 Jul 2017 09:21:59 +0000 (11:21 +0200)]
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

6 years agoomxvideoenc: drop late input frames if QoS is enabled
Guillaume Desmottes [Fri, 22 Sep 2017 14:02:40 +0000 (16:02 +0200)]
omxvideoenc: drop late input frames if QoS is enabled

Make use of the new GstVideoEncoder QoS API to drop late input frames. This may
help a live pipeline to catch up if it's being late and all frames end up
being dropped at the sink.

https://bugzilla.gnome.org/show_bug.cgi?id=792783

6 years agoTestEgl: Removed redundant/unused code
Ashish Kumar [Fri, 19 Jan 2018 09:48:23 +0000 (15:18 +0530)]
TestEgl: Removed redundant/unused code

https://bugzilla.gnome.org/show_bug.cgi?id=788550

6 years agoomxvideoenc: early return in fill_buffer() if something goes wrong
Guillaume Desmottes [Wed, 3 Jan 2018 15:07:18 +0000 (16:07 +0100)]
omxvideoenc: early return in fill_buffer() if something goes wrong

If something goes wrong while trying to manually copy the input buffer,
the 'break' was moving us out of the 'for' loop but not out of the switch block.
So we ended up calling gst_video_frame_unmap() a second time (raising
assertions) and returning TRUE rather than FALSE.

Reproduced with a WIP zynqultrascaleplus OMX branch reporting wrong
buffer sizes and so triggering this bug.

https://bugzilla.gnome.org/show_bug.cgi?id=792167

6 years agomeson: gl: the winsys and platform list in the .pc file is space-separated
Tim-Philipp Müller [Tue, 19 Dec 2017 16:09:41 +0000 (16:09 +0000)]
meson: gl: the winsys and platform list in the .pc file is space-separated

6 years agomeson: fix subproject fallback for gstreamer-gl-1.0
Tim-Philipp Müller [Tue, 19 Dec 2017 16:08:58 +0000 (16:08 +0000)]
meson: fix subproject fallback for gstreamer-gl-1.0

It's now in -base.

6 years agoomxvideodec: ignore very little variations of the framerate
Julien Isorce [Tue, 12 Dec 2017 17:30:27 +0000 (17:30 +0000)]
omxvideodec: ignore very little variations of the framerate

If less than 1%.

The dynamic format change should not happen when the
resolution does not change and when only the framerate
changes but very slightly, i.e. from 50000/1677=29.81
to 89/3=29.66 so a "percentage change" of less than 1%
(i.e. 100*(29.81-29.66)/29.66 = 0.50 < 1 ). In that case
just ignore it to avoid unnecessary renegotiation.

https://bugzilla.gnome.org/show_bug.cgi?id=759043

6 years agoomxvideodec: use dynamic buffer mode on input if possible
Guillaume Desmottes [Wed, 9 Aug 2017 16:07:33 +0000 (12:07 -0400)]
omxvideodec: use dynamic buffer mode on input if possible

Prevent from copying the input buffers between GStreamer and OMX.

Tested on zynqultrascaleplus and rpi (without dynamic buffers).

https://bugzilla.gnome.org/show_bug.cgi?id=787093

6 years agoomxvideoenc: use dynamic buffer mode on input if possible
Guillaume Desmottes [Thu, 20 Jul 2017 14:35:31 +0000 (16:35 +0200)]
omxvideoenc: use dynamic buffer mode on input if possible

If the OMX component supports dynamic buffer mode and the input buffers
are properly aligned avoid copying each input frame between OMX and
GStreamer.

Tested on zynqultrascaleplus and rpi (without dynamic buffers).

https://bugzilla.gnome.org/show_bug.cgi?id=787093

6 years agoomxvideoenc/dec: factor out input buffer allocation
Guillaume Desmottes [Thu, 20 Jul 2017 10:56:37 +0000 (12:56 +0200)]
omxvideoenc/dec: factor out input buffer allocation

No semantic change so far. I'm going to add an alternate way to allocate
input buffers.

https://bugzilla.gnome.org/show_bug.cgi?id=787093

6 years agoomx: add API to implement dynamic buffers support
Guillaume Desmottes [Thu, 20 Jul 2017 14:31:54 +0000 (16:31 +0200)]
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

6 years agoAutomatic update of common submodule
Matthew Waters [Thu, 14 Dec 2017 03:53:17 +0000 (14:53 +1100)]
Automatic update of common submodule

From e8c7a71 to 3fa2c9e

6 years agoomxvideodec: consolidate the decision to try UseBuffer
Julien Isorce [Wed, 13 Dec 2017 12:06:40 +0000 (12:06 +0000)]
omxvideodec: consolidate the decision to try UseBuffer

The tee element can call gst_query_add_allocation_pool with pool as NULL.
Checking nth > 0 is not enough so we need to verify if there is a pool.

https://bugzilla.gnome.org/show_bug.cgi?id=730758
https://bugzilla.gnome.org/show_bug.cgi?id=784069

6 years agogstomxvideodec: fix framerate overflow
Julien Isorce [Tue, 12 Dec 2017 14:45:30 +0000 (14:45 +0000)]
gstomxvideodec: fix framerate overflow

Some live streams can set the framerate to 50000/1677 (=29.81).

GstVideoInfo.fps_n << 16 is wrong if the fps_n is 50000
(i.e. greater than 32767).

https://bugzilla.gnome.org/show_bug.cgi?id=759043

6 years agoexample: port testegl.c to desktop
Julien Isorce [Tue, 22 Aug 2017 12:48:26 +0000 (13:48 +0100)]
example: port testegl.c to desktop

Will be easier to maintain.

Also uniformize autotool build with meson build which is
already retrieving the gl libs.

https://bugzilla.gnome.org/show_bug.cgi?id=781606

6 years agomeson: move omx features check after target selection
Julien Isorce [Mon, 11 Dec 2017 15:55:44 +0000 (15:55 +0000)]
meson: move omx features check after target selection

And uses gst_omx_args instead of add_global_arguments.

Similar to c69232852120d064c689caef07b3c68ad8fe6288
which was only for configure.ac

Useful to get omxvp8dec with meson too:
  meson . buildtmp -D with_omx_target=tizonia

https://bugzilla.gnome.org/show_bug.cgi?id=782800

6 years agoconfig: add OMX.Aratelia.audio_decoder.aac to Tizonia config
Julien Isorce [Mon, 4 Dec 2017 17:11:04 +0000 (17:11 +0000)]
config: add OMX.Aratelia.audio_decoder.aac to Tizonia config

Useful mostly for testing/debugging purpose as this is a software
based decoder (libfaad) for which GStreamer provides a direct
wrapper.

https://bugzilla.gnome.org/show_bug.cgi?id=791482

6 years agoomxvideodec: retrieve OMX_IndexParamVideoPortFormat before setting it
Guillaume Desmottes [Wed, 29 Nov 2017 13:18:41 +0000 (14:18 +0100)]
omxvideodec: retrieve OMX_IndexParamVideoPortFormat before setting it

The usual pattern when setting OMX params is to first get the struct
param, override the values we want to set and then set the updated
param.
We were not doing this with OMX_IndexParamVideoPortFormat and so were
resetting some fields such as OMX_VIDEO_PARAM_PORTFORMATTYPE.xFramerate

https://bugzilla.gnome.org/show_bug.cgi?id=790979

6 years agoomxaacenc: also set 'profile' if mpegversion is 4
Julien Isorce [Sun, 21 May 2017 16:34:51 +0000 (17:34 +0100)]
omxaacenc: also set 'profile' if mpegversion is 4

Like done by gst_codec_utils_aac_caps_set_level_and_profile
which is called by avenc_aac, ffaac and voaacenc.

https://bugzilla.gnome.org/show_bug.cgi?id=735208

6 years agoomx: wait for flush complete and buffers being released when flushing
Guillaume Desmottes [Tue, 24 Oct 2017 10:19:50 +0000 (12:19 +0200)]
omx: wait for flush complete and buffers being released when flushing

As stated in the existing comment, when flusing we should wait for OMX
to send the flush command complete event AND all ports being released.
We were stopping as soon as one of those condition was met.

Fix a race between FillThisBufferDone/EmptyBufferDone and the flush
EventCmdComplete messages. The OMX implementation is supposed to release
its buffers before posting the EventCmdComplete event but the ordering
isn't guaranteed as the FillThisBufferDone/EmptyBufferDone and
EventHandler callbacks can be called from different threads (cf 2.7
'Thread Safety' in the spec).

https://bugzilla.gnome.org/show_bug.cgi?id=789475

6 years agogst_omx_port_set_flushing: simplify waiting loop
Guillaume Desmottes [Tue, 24 Oct 2017 09:45:20 +0000 (11:45 +0200)]
gst_omx_port_set_flushing: simplify waiting loop

No semantic change so far, I just made the 'while' end condition easier
to understand as a first step before changing it.
- move error/time out checks inside the loop to make it clearer on what
we are actually waiting for.
- group port->buffers checks together with parenthesis as they are part
of the same conceptual check: waiting for all buffers to be released.

https://bugzilla.gnome.org/show_bug.cgi?id=789475

6 years agoAutomatic update of common submodule
Matthew Waters [Mon, 27 Nov 2017 09:17:17 +0000 (20:17 +1100)]
Automatic update of common submodule

From 3f4aa96 to e8c7a71

6 years agozynqultrascaleplus: add support for extra AVC levels
Guillaume Desmottes [Thu, 23 Nov 2017 14:03:48 +0000 (15:03 +0100)]
zynqultrascaleplus: add support for extra AVC levels

The Zynqultrascaleplus has support for extra AVC levels not defined in
the OMX spec as a customer extension.

https://bugzilla.gnome.org/show_bug.cgi?id=790758

6 years agoadd test support
Guillaume Desmottes [Mon, 16 Oct 2017 12:47:07 +0000 (14:47 +0200)]
add test support

Most of the boilerplate and the states test has been copied from
gst-plugins-good.

https://bugzilla.gnome.org/show_bug.cgi?id=789094

6 years agomeson: add tools support
Guillaume Desmottes [Tue, 17 Oct 2017 11:07:05 +0000 (13:07 +0200)]
meson: add tools support

Looks like the tools directory was left out during the initial port to
meson.

https://bugzilla.gnome.org/show_bug.cgi?id=789090

6 years agoomx: fix build on rpi
Guillaume Desmottes [Mon, 16 Oct 2017 12:24:50 +0000 (14:24 +0200)]
omx: fix build on rpi

The nTimeStamp field is a OMX_TICKS struct on the rpi so use the proper
macro to set it.
Fix build on the build which has been broken by
b3173144b7c1b12c9e1b7571f78659be45d813f6

https://bugzilla.gnome.org/show_bug.cgi?id=789052

6 years agocheck if Allegro headers are present when building zynqultrascaleplus
Guillaume Desmottes [Tue, 17 Oct 2017 10:11:04 +0000 (12:11 +0200)]
check if Allegro headers are present when building zynqultrascaleplus

The Zynq UltraScale+ uses a custom version of OMX implementing several
3rd party extensions. Make sure those are present when building this
target.

https://bugzilla.gnome.org/show_bug.cgi?id=788064

6 years agoomxvideodec: remove redundant debug message
Guillaume Desmottes [Mon, 16 Oct 2017 10:42:44 +0000 (12:42 +0200)]
omxvideodec: remove redundant debug message

We have already a debug message right after.

https://bugzilla.gnome.org/show_bug.cgi?id=789058

6 years agoomxh265: fix enum casting when using Allegro HEVC extensions
Guillaume Desmottes [Mon, 16 Oct 2017 11:26:38 +0000 (13:26 +0200)]
omxh265: fix enum casting when using Allegro HEVC extensions

Allegro's HEVC implementation defines a superset of the profiles and
enums from the Android implementation.
Properly cast to fix -Wenum-conversion warnings from clang.

https://bugzilla.gnome.org/show_bug.cgi?id=789057

6 years agoproperly cast extension enums
Guillaume Desmottes [Mon, 16 Oct 2017 11:08:12 +0000 (13:08 +0200)]
properly cast extension enums

OMX's allow 3rds party to define extensions using their own enums
(like OMX_VIDEO_CODINGEXTTYPE) and to be used as the general
ones (like OMX_VIDEO_CODINGTYPE).
Properly cast those to fix -Wenum-conversion warnings from some
compilers such as clang.

https://bugzilla.gnome.org/show_bug.cgi?id=789057

6 years agoomx: also reset nTimeStamp when re-using buffers
Guillaume Desmottes [Mon, 9 Oct 2017 11:12:35 +0000 (13:12 +0200)]
omx: also reset nTimeStamp when re-using buffers

Some OMX implementations may check if the timestamp of the output buffers
they receive is actually not set.

https://bugzilla.gnome.org/show_bug.cgi?id=788711

6 years agoomx: factor out gst_omx_buffer_reset()
Guillaume Desmottes [Wed, 4 Oct 2017 15:11:55 +0000 (17:11 +0200)]
omx: factor out gst_omx_buffer_reset()

https://bugzilla.gnome.org/show_bug.cgi?id=788711

6 years agoadd gst_omx_buffer_flags_to_string()
Guillaume Desmottes [Mon, 9 Oct 2017 15:27:22 +0000 (17:27 +0200)]
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

6 years agoh263enc: fix caps leak in error code path
Ponnam Srinivas [Wed, 27 Sep 2017 14:17:29 +0000 (19:47 +0530)]
h263enc: fix caps leak in error code path

https://bugzilla.gnome.org/show_bug.cgi?id=788245

6 years agoomxh264enc: fix caps leak
Ponnam Srinivas [Thu, 21 Sep 2017 09:51:36 +0000 (15:21 +0530)]
omxh264enc: fix caps leak

https://bugzilla.gnome.org/show_bug.cgi?id=787711

6 years agoomxh265enc: fix caps leak
Ponnam Srinivas [Thu, 21 Sep 2017 06:06:46 +0000 (11:36 +0530)]
omxh265enc: fix caps leak

https://bugzilla.gnome.org/show_bug.cgi?id=787714

6 years agoomxvideodec: log info about frame before releasing it
Guillaume Desmottes [Wed, 13 Sep 2017 13:32:51 +0000 (15:32 +0200)]
omxvideodec: log info about frame before releasing it

gst_video_decoder_release_frame() takes ownership of the frame and will
destroy it. So we should no longer use it after calling it.

https://bugzilla.gnome.org/show_bug.cgi?id=787628

6 years agoconfigure: Show tizonia target in help
Gurkirpal Singh [Sun, 20 Aug 2017 14:49:33 +0000 (20:19 +0530)]
configure: Show tizonia target in help

https://bugzilla.gnome.org/show_bug.cgi?id=786544

6 years agoomxh265dec: add H265 decoder
Guillaume Desmottes [Wed, 12 Jul 2017 12:35:10 +0000 (14:35 +0200)]
omxh265dec: add H265 decoder

Add HEVC decoder for the zynqultrascaleplus platform.

I used the H264 decoder code as a template.

https://bugzilla.gnome.org/show_bug.cgi?id=785434

6 years agoomxh265enc: add H265 encoder
Guillaume Desmottes [Wed, 12 Jul 2017 09:01:15 +0000 (11:01 +0200)]
omxh265enc: add H265 encoder

The OMX spec doesn't support HEVC but the OMX stack of the
zynqultrascaleplus adds it as a custom extension.
It uses the same API as the one of Android's OMX stack.

I used the H264 encoder code as a template.

https://bugzilla.gnome.org/show_bug.cgi?id=785434

6 years agoomxvideoenc: use caps from query in propose_allocation
Guillaume Desmottes [Mon, 28 Aug 2017 11:56:22 +0000 (13:56 +0200)]
omxvideoenc: use caps from query in propose_allocation

Prevent crash by not deferencing a NULL pointer if self->input_state
isn't defined when propose_allocation() is called.

https://bugzilla.gnome.org/show_bug.cgi?id=786442

6 years agoomx: display states as string if changing failed
Guillaume Desmottes [Mon, 4 Sep 2017 07:34:03 +0000 (09:34 +0200)]
omx: display states as string if changing failed

Improve the error message by displaying the states in their string
representation rather than their numerical value.

https://bugzilla.gnome.org/show_bug.cgi?id=787235

6 years agoomxvideodec: EGLDisplay is not indirectly defined by gstgl headers inclusion
Julien Isorce [Tue, 22 Aug 2017 09:22:45 +0000 (10:22 +0100)]
omxvideodec: EGLDisplay is not indirectly defined by gstgl headers inclusion

Just use gpointer as done in GstGL to not include
EGL/egl.h just for EGLDisplay.

https://bugzilla.gnome.org/show_bug.cgi?id=784779

6 years agoconfig: expose OMX.mesa h264 decoder and encoder in Tizonia config
Gurkirpal Singh [Fri, 14 Jul 2017 11:04:04 +0000 (16:34 +0530)]
config: expose OMX.mesa h264 decoder and encoder in Tizonia config

https://bugzilla.gnome.org/show_bug.cgi?id=783976

6 years agoomxvideodec: remove wrong SettingsChanged ack
Julien Isorce [Fri, 11 Aug 2017 14:48:37 +0000 (07:48 -0700)]
omxvideodec: remove wrong SettingsChanged ack

Partially revert 1b7d0b8:
  omxvideodec: handle IL 1.2 behavior for OMX_SetParameter

It turned out it was a problem in the decoder which was
not updating some local variables upon SetParameter.

https://bugzilla.gnome.org/show_bug.cgi?id=783976

6 years agoomx{audio,video}{dec,enc}: sequentially disable ports because buffers are not shared
Julien Isorce [Thu, 20 Jul 2017 08:43:19 +0000 (09:43 +0100)]
omx{audio,video}{dec,enc}: sequentially disable ports because buffers are not shared

For the history, the parallel disable port has been introduced by:
"00be69f omxvideodec: Disable output port when setting a new format"
and then replicated to videoenc, audiodec and audioenc.

This is only required to do 'parallel' if buffers are shared between ports.
But for decoders and encoders the input and output buffer are of different
nature by definition (bitstream vs images). So they cannot be shared.

Also starting from IL 1.2.0 it is written in the spec that the parallel
disable is not allowed and will return an error. Except when buffers are
shared.

Again here we know in advance that they are not shared so let's always
do a sequential disable.

Tested on Desktop, rpi and zynqultrascaleplus.

https://bugzilla.gnome.org/show_bug.cgi?id=786348

6 years agoAutomatic update of common submodule
Tim-Philipp Müller [Thu, 17 Aug 2017 11:26:05 +0000 (12:26 +0100)]
Automatic update of common submodule

From 48a5d85 to 3f4aa96

6 years agoomxvideodec: use the decoder API to set latency
Guillaume Desmottes [Thu, 10 Aug 2017 16:16:53 +0000 (12:16 -0400)]
omxvideodec: use the decoder API to set latency

https://bugzilla.gnome.org/show_bug.cgi?id=785125

6 years agoomxvideoenc/dec: declare latency on zynqultrascaleplus
Guillaume Desmottes [Thu, 6 Jul 2017 12:19:19 +0000 (14:19 +0200)]
omxvideoenc/dec: declare latency on zynqultrascaleplus

The OMX specification doesn't provide any API to expose the latency
introduced by encoders and decoders. We implemented this as a custom
extension as declaring the latency is needed for live pipelines like
video conferencing.

https://bugzilla.gnome.org/show_bug.cgi?id=785125

6 years agoomxvideoenc: adjust stride and slice height from input
Guillaume Desmottes [Mon, 7 Aug 2017 17:16:01 +0000 (13:16 -0400)]
omxvideoenc: adjust stride and slice height from input

Use the stride and slice height information from the first buffer meta
data to adjust the settings of the input port.
This will ensure that the OMX input buffers match the GStreamer ones
and so will save us from having to copy line-by-line each one.

This is also the first step to allow the OMX encoder to receive dmabuf.

Tested on rpi and zynqultrascaleplus.

https://bugzilla.gnome.org/show_bug.cgi?id=785967

6 years agoomxvideoenc: delay buffer configuration until component is enabled
Guillaume Desmottes [Mon, 7 Aug 2017 15:45:29 +0000 (11:45 -0400)]
omxvideoenc: delay buffer configuration until component is enabled

No significant change for now. Just delay the input port configuration
of the buffer size related fields (stride, slice height, buffer size)
until the component is activated.
This will allow us to use the actual stride/height of the first input
and so avoid the buffer copying code path in most cases.

Tested on rpi and zynqultrascaleplus.

https://bugzilla.gnome.org/show_bug.cgi?id=785967

6 years agoomxvideodec/enc: delay allocation after the allocation query
Guillaume Desmottes [Mon, 24 Jul 2017 11:52:35 +0000 (13:52 +0200)]
omxvideodec/enc: delay allocation after the allocation query

Allocating OMX components buffers in set_format() is too early.
Doing it when receiving the first buffers will allow the element to use
the information from the allocation query and/or the first incoming
buffer to pick to best allocation mode.

Tested on raspberry pi with dynamic resolution changes on decoder and
encoder input.

https://bugzilla.gnome.org/show_bug.cgi?id=785967

6 years agoomxvideoenc: start src thread in handle_frame()
Guillaume Desmottes [Tue, 25 Jul 2017 12:27:45 +0000 (14:27 +0200)]
omxvideoenc: start src thread in handle_frame()

Makes the code simpler as we no longer need to restart the thread in
gst_omx_video_enc_flush() and It's more symetric which the omxvideodec
implementation.

I'm also going to move the enabling of the OMX component in
handle_frame() and the src pad thread needs to be started after it.

https://bugzilla.gnome.org/show_bug.cgi?id=785967

6 years agoomxvideodec: earlier return if downstream_flow_ret is not OK
Guillaume Desmottes [Tue, 25 Jul 2017 12:07:30 +0000 (14:07 +0200)]
omxvideodec: earlier return if downstream_flow_ret is not OK

There is no point to (re)start the src thread if, for example, we are
flushing.

https://bugzilla.gnome.org/show_bug.cgi?id=785967

6 years agoomxvideodec: factor out enable and disable code
Guillaume Desmottes [Mon, 24 Jul 2017 10:31:37 +0000 (12:31 +0200)]
omxvideodec: factor out enable and disable code

No semantic change, just factor out the code enabling and disabling the
component to their own functions.

Makes the code easier to read as the set_format() method was already
pretty big. Will also allow us to easily change the enabling logic.

https://bugzilla.gnome.org/show_bug.cgi?id=785967

6 years agoomxvideoenc: factor out enable and disable code
Guillaume Desmottes [Mon, 24 Jul 2017 10:31:37 +0000 (12:31 +0200)]
omxvideoenc: factor out enable and disable code

No semantic change, just factor out the code enabling and disabling the
component to their own functions.

Makes the code easier to read as the set_format() method was already
pretty big. Will also allow us to easily change the enabling logic.

https://bugzilla.gnome.org/show_bug.cgi?id=785967

6 years agoomx: also reset nFilledLen before calling OMX_FillThisBuffer()
Guillaume Desmottes [Thu, 27 Jul 2017 10:12:01 +0000 (12:12 +0200)]
omx: also reset nFilledLen before calling OMX_FillThisBuffer()

The spec states that the buffer passed to OMX_FillThisBuffer() needs to be
empty. Some implementation may check it actually is by checking its
nFilledLen field, so best to reset it as well.

https://bugzilla.gnome.org/show_bug.cgi?id=785623

6 years agoomxvideodec: make generic the OMX_UseEGLImage code path
Julien Isorce [Mon, 17 Jul 2017 20:06:47 +0000 (21:06 +0100)]
omxvideodec: make generic the OMX_UseEGLImage code path

Will be easier to maintain and to make enhancements.

Tested with Tizonia on Desktop.
Also tested with Bellagio to make sure it does not crash when
calling OMX_UseEGLImage and indeed it returns NotImplemented.
Then gst-omx fallback to OMX_UseBuffer if it can and so on.

Also tested on rpi to make sure there is no regression.

https://bugzilla.gnome.org/show_bug.cgi?id=784365

7 years agoomxvideodec: Fix segment seek
Nicolas Dufresne [Fri, 21 Jul 2017 15:52:00 +0000 (11:52 -0400)]
omxvideodec: Fix segment seek

On segment seek, unlike EOS, we drain, but we cannot expect a flush
later to reset the decoder state. As a side effect, the decoder would
remain in EOS state and ignore any new incoming buffers.

To fix this, we call _flush() inside the _drain() function, and
_finish() becomes what _drain() was before. This way, for _finish() (the
    eos case) we only drain, for _drain() triggered by segment seek or new
caps, we also reset the decoder state so it's ready to accept buffers.

https://bugzilla.gnome.org/show_bug.cgi?id=785237

7 years agoomxvideoenc: ensure enough buffers are allocated in the pool
Guillaume Desmottes [Mon, 10 Jul 2017 13:00:58 +0000 (15:00 +0200)]
omxvideoenc: ensure enough buffers are allocated in the pool

Handle allocation query and ensure enough buffers are allocated in
the negotiated pool. This help preventing buffer starvation in the pipeline.

https://bugzilla.gnome.org/show_bug.cgi?id=785122

7 years agoomxvideodec: add dmabuf support for output
Guillaume Desmottes [Tue, 4 Jul 2017 10:16:39 +0000 (12:16 +0200)]
omxvideodec: add dmabuf support for output

The zynqultrascaleplus OMX implementation has a custom extension
allowing decoders to output dmabuf and so avoid buffers copy between OMX
and GStreamer.

Make use of this extension when built on the zynqultrascaleplus. The
buffer pool code should be re-usable for other platforms as well.

https://bugzilla.gnome.org/show_bug.cgi?id=784847

7 years agoconfig: add OMX.Aratelia.video_decoder.vp8 to Tizonia config
Julien Isorce [Mon, 19 Jun 2017 23:13:33 +0000 (00:13 +0100)]
config: add OMX.Aratelia.video_decoder.vp8 to Tizonia config

Useful mostly for testing/debugging purpose as this is a software
based encoder (libvpxdec) for which GStreamer provides a direct
wrapper.

https://bugzilla.gnome.org/show_bug.cgi?id=783976

7 years agoomxvideodec: handle IL 1.2 behavior for OMX_SetParameter
Julien Isorce [Mon, 19 Jun 2017 22:56:02 +0000 (23:56 +0100)]
omxvideodec: handle IL 1.2 behavior for OMX_SetParameter

It triggers SettingsChanged on the other port and it is up to
the client to decide if it should lead to a port reconfiguration.

Settings are propagated to the other port for fields they have
in common. But this event is only triggered on the other port
if it actually change a setting.

https://bugzilla.gnome.org/show_bug.cgi?id=783976

7 years agoconfig: set rank to 0 for Tizonia's mp3 decoder
Julien Isorce [Tue, 18 Jul 2017 22:41:17 +0000 (23:41 +0100)]
config: set rank to 0 for Tizonia's mp3 decoder

Should have been 0 from the initial commit
eed49b4231a063639f90279c8044404c2149902a

7 years agoomxvideodec: fix file permissions
Julien Isorce [Mon, 17 Jul 2017 20:03:55 +0000 (21:03 +0100)]
omxvideodec: fix file permissions

Introduced by ebc9b4903cbdac2793c24b05a1bb7acc3b67fae5

7 years agoomxvideodec: fix buffer leak when eglimage setup fails
Julien Isorce [Thu, 29 Jun 2017 22:17:26 +0000 (23:17 +0100)]
omxvideodec: fix buffer leak when eglimage setup fails

Can happen if gst_buffer_pool_acquire_buffer succeeds but
gst_buffer_n_memory (buffer) is not exactly 1.

In theory this should not happen because the decoder requests
EGLImage(RGBA) but better to fix any leak on corner cases.

https://bugzilla.gnome.org/show_bug.cgi?id=784365

7 years agoomx: Possible Memory leak in gst_caps_from_string
Satya Prakash Gupta [Mon, 17 Jul 2017 13:06:36 +0000 (18:36 +0530)]
omx: Possible Memory leak in gst_caps_from_string

https://bugzilla.gnome.org/show_bug.cgi?id=784978

7 years agoomxvideoenc: Fix deadlock in error case when draining
Satya Prakash Gupta [Mon, 17 Jul 2017 10:18:44 +0000 (15:48 +0530)]
omxvideoenc: Fix deadlock in error case when draining

https://bugzilla.gnome.org/show_bug.cgi?id=784972

7 years agoomxaudioenc: Fix deadlock in error case when draining
Satya Prakash Gupta [Mon, 17 Jul 2017 08:14:54 +0000 (13:44 +0530)]
omxaudioenc: Fix deadlock in error case when draining

https://bugzilla.gnome.org/show_bug.cgi?id=784967

7 years agobuild: include OMX_IndexExt and OMX_ComponentExt if present
Guillaume Desmottes [Fri, 2 Jun 2017 10:36:30 +0000 (12:36 +0200)]
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

7 years agoomxh264enc: Re-add periodicty-idr property for backward compat
Jan Schmidt [Thu, 13 Jul 2017 06:40:26 +0000 (16:40 +1000)]
omxh264enc: Re-add periodicty-idr property for backward compat

Retain backwards compatibility by adding a duplicate
property for periodicty-idr

https://bugzilla.gnome.org/show_bug.cgi?id=784370

7 years agoomxh264enc: fix typo in "periodicty-idr" property name
Guillaume Desmottes [Fri, 30 Jun 2017 13:15:06 +0000 (15:15 +0200)]
omxh264enc: fix typo in "periodicty-idr" property name

Also fix the 'nick' of the property.

https://bugzilla.gnome.org/show_bug.cgi?id=784370

7 years agoomxvideodec: use OMX_UseBuffer
Julien Isorce [Thu, 29 Jun 2017 21:48:47 +0000 (22:48 +0100)]
omxvideodec: use OMX_UseBuffer

For example this allows the omx decoder to directly fill the
pixmaps coming from the video sink.

It only avoids a buffer copy when the decoder uses a pool provided
by a downstream element. So let's restrict this usage to situations
where the decoder decides to use a downstream buffer pool.

Tested with Tizonia/OMX.Aratelia.video_decoder.vp8
and with Bellagio/OMX.mesa.video_decoder.avc.

If it fails to setup buffers with OMX_UseBuffer the decoders
fallbacks to usual OMX_AllocateBuffer.

Also it allows to test on desktop the GstOMXBufferPool->other_pool
management which was previously only used in the OMX_UseEGLImage
case, i.e. on Rpi.

https://bugzilla.gnome.org/show_bug.cgi?id=784069

7 years agoomx: do not always print an error if OMX_{UseBuffer,EGLImage} fails
Julien Isorce [Wed, 12 Jul 2017 09:29:16 +0000 (10:29 +0100)]
omx: do not always print an error if OMX_{UseBuffer,EGLImage} fails

Let the caller decide to print an error. Because it can be part of
a normal trial path.

https://bugzilla.gnome.org/show_bug.cgi?id=784069

7 years agomeson: add gstomxmp3enc
Guillaume Desmottes [Wed, 12 Jul 2017 14:00:53 +0000 (16:00 +0200)]
meson: add gstomxmp3enc

Commit 02d493e85921596f7cac7ef4af02fde500e9a5d8 didn't add
gstomxmp3enc.c to meson.

https://bugzilla.gnome.org/show_bug.cgi?id=784848

7 years agoconfig: add OMX.Aratelia.audio_encoder.mp3 to Tizonia config
Julien Isorce [Tue, 23 May 2017 09:32:58 +0000 (10:32 +0100)]
config: add OMX.Aratelia.audio_encoder.mp3 to Tizonia config

Useful mostly for testing/debugging purpose as this is a software
based encoder (libmp3lame) for which GStreamer provides a direct
wrapper.

https://bugzilla.gnome.org/show_bug.cgi?id=782988

7 years agoomx: add gstomxmp3enc
Julien Isorce [Tue, 23 May 2017 09:32:06 +0000 (10:32 +0100)]
omx: add gstomxmp3enc

Initial support and only tested with the software based
encoder OMX.Aratelia.audio_encoder.mp3 from Tizonia which
internally uses libmp3lame.

https://bugzilla.gnome.org/show_bug.cgi?id=782988

7 years agoh264dec: add hack to pass profile and level to OMX
Guillaume Desmottes [Tue, 28 Mar 2017 14:27:10 +0000 (16:27 +0200)]
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

7 years agoomxh264enc: move profile and level parsing functions to their own files
Guillaume Desmottes [Mon, 3 Jul 2017 11:17:11 +0000 (13:17 +0200)]
omxh264enc: move profile and level parsing functions to their own files

Will allow to re-use them in the decoder element.

https://bugzilla.gnome.org/show_bug.cgi?id=783114

7 years agomeson: Add tizonia option
Gurkirpal Singh [Mon, 3 Jul 2017 21:45:00 +0000 (03:15 +0530)]
meson: Add tizonia option

https://bugzilla.gnome.org/show_bug.cgi?id=782800

7 years agoconfig: add omxmp3dec config for tizonia
Gurkirpal Singh [Fri, 28 Apr 2017 21:26:59 +0000 (02:56 +0530)]
config: add omxmp3dec config for tizonia

GST_OMX_CONFIG_DIR=$HOME/gst/master/gst-omx/config/tizonia/ \
    gst-launch-1.0 filesrc location=mpthreetest.mp3 ! id3demux ! \
    mpegaudioparse ! omxmp3dec ! audioconvert ! pulsesink

v2: [Nicolas] Use template to create gstomx.conf using pkg-config

v3: [Nicolas] Ignore only config/tizonia/gstomx.conf

v4: [Nicolas] Add "/" for single occurence

https://bugzilla.gnome.org/show_bug.cgi?id=782800

7 years agoomx: always ignore OMX_ErrorPortUnpopulated
Gurkirpal Singh [Sun, 7 May 2017 14:39:54 +0000 (20:09 +0530)]
omx: always ignore OMX_ErrorPortUnpopulated

It is safe to ignore it always. Tizonia notifies this error to pass
some khronos conformance tests. Problem is that gst-omx saves this
error in comp->last_error and then gst_omx_port_set_enabled early
error out which fails the pipeline.

https://bugzilla.gnome.org/show_bug.cgi?id=782800

7 years agoomx: guard some omx enums with IL version
Gurkirpal Singh [Fri, 28 Apr 2017 21:23:26 +0000 (02:53 +0530)]
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

7 years agoconfigure.ac: add tizonia target for --with-omx-target flag.
Gurkirpal Singh [Fri, 28 Apr 2017 20:26:01 +0000 (01:56 +0530)]
configure.ac: add tizonia target for --with-omx-target flag.

This will check for tizilheaders.pc which adds path to omx-il
headers its cflags. Can be installed all together with the 1.2 headers
with package tizilheaders if not building from sources:
https://github.com/tizonia/tizonia-openmax-il

It is also adviced to remove libomxil-bellagio-dev package because
it installs headers /usr/include directly, ex: /usr/include/OMX_Video.h.

https://bugzilla.gnome.org/show_bug.cgi?id=782800

7 years agoomxaudioenc: update local port_def after reopening the component
Julien Isorce [Wed, 5 Jul 2017 09:47:41 +0000 (10:47 +0100)]
omxaudioenc: update local port_def after reopening the component

gst_omx_audio_enc_open will only update GstOMXAudioEnc->port->port_def.

Note that the component is reopen only if the flag
GST_OMX_HACK_NO_COMPONENT_RECONFIGURE is set.

https://bugzilla.gnome.org/show_bug.cgi?id=782418

7 years agoomxvideoenc: update local port_def after reopening the component
Julien Isorce [Wed, 5 Jul 2017 09:48:52 +0000 (10:48 +0100)]
omxvideoenc: update local port_def after reopening the component

gst_omx_video_enc_open will only update GstOMXVideoEnc->port->port_def.

Note that the component is reopen only if the flag
GST_OMX_HACK_NO_COMPONENT_RECONFIGURE is set.

https://bugzilla.gnome.org/show_bug.cgi?id=782418

7 years agoomxvideodec: update local port_def after reopening the component
Sejun Park [Wed, 10 May 2017 03:38:39 +0000 (12:38 +0900)]
omxvideodec: update local port_def after reopening the component

gst_omx_video_dec_open will only update GstOMXVideoDec->port->port_def.

Note that the component is reopen only if the flag
GST_OMX_HACK_NO_COMPONENT_RECONFIGURE is set.

https://bugzilla.gnome.org/show_bug.cgi?id=782418

7 years agoomxvideodec: increase the minimum number of allocated buffers
Guillaume Desmottes [Mon, 3 Jul 2017 14:33:06 +0000 (16:33 +0200)]
omxvideodec: increase the minimum number of allocated buffers

Ensure that enough buffers are allocated by adding up component's own
minimal plus the number of buffers requested by downstream.
This should prevent buffers starvation problem if downstream elements
are holding some of the buffers they required.

Also simplify the check on the maximum on buffers. What we actually care
about is to make sure the pool can hold the minimum of required buffers.

https://bugzilla.gnome.org/show_bug.cgi?id=784479

7 years agoomxh264enc: raise a warning if AVCIntraPeriod is not supported
Guillaume Desmottes [Mon, 3 Jul 2017 08:54:50 +0000 (10:54 +0200)]
omxh264enc: raise a warning if AVCIntraPeriod is not supported

Some platforms may not implement OMX_IndexConfigVideoAVCIntraPeriod and
use OMX_IndexParamVideoAvc instead to configure the GOP pattern.
So raise a warning instead of an error if this API is not implemented.

https://bugzilla.gnome.org/show_bug.cgi?id=784379

7 years agoomxh264enc: add 'b-frames' property
Guillaume Desmottes [Thu, 29 Jun 2017 12:16:19 +0000 (14:16 +0200)]
omxh264enc: add 'b-frames' property

Add a property to control the number of B-frames produced by the
encoder using the OMX_VIDEO_PARAM_AVCTYPE OMX API.

https://bugzilla.gnome.org/show_bug.cgi?id=784379

7 years agoomxh264enc: fix typo in 'set_avc_intra_period'
Guillaume Desmottes [Fri, 30 Jun 2017 12:18:35 +0000 (14:18 +0200)]
omxh264enc: fix typo in 'set_avc_intra_period'

https://bugzilla.gnome.org/show_bug.cgi?id=784379

7 years agoadd 'zynqultrascaleplus' as OMX target
Guillaume Desmottes [Mon, 22 May 2017 09:23:33 +0000 (11:23 +0200)]
add 'zynqultrascaleplus' as OMX target

Adding support for the 'Zynq UltraScale+' as a new OMX target.

See https://www.xilinx.com/products/silicon-devices/soc/zynq-ultrascale-mpsoc.html
for details about the platform.

https://bugzilla.gnome.org/show_bug.cgi?id=783097

7 years agoconfig: add OMX.mesa.video_decoder.{avc,mpeg2} for Bellagio config
Julien Isorce [Sun, 21 May 2017 14:23:09 +0000 (15:23 +0100)]
config: add OMX.mesa.video_decoder.{avc,mpeg2} for Bellagio config

Install libomxil-bellagio0 and make sure mesa has been built with
--enable-omx. Check there is /usr/lib/libomxil-bellagio0/libomx_mesa.so
then run omxregister-bellagio to regenerate $XDG_DATA_HOME/.omxregister

Then omxh264dec and omxmpeg2dec should load.

https://bugzilla.gnome.org/show_bug.cgi?id=782926

7 years agoconfigure.ac: move omx features check after target selection
Julien Isorce [Thu, 18 May 2017 12:50:56 +0000 (13:50 +0100)]
configure.ac: move omx features check after target selection

Does not change anything, except this will be useful for future commits.
Indeed some targets provide a .pc file where to look for the omx headers.

https://bugzilla.gnome.org/show_bug.cgi?id=782800

7 years agoomxh264dec: remove 'parsed=true' from sink pad
Guillaume Desmottes [Thu, 29 Jun 2017 14:48:07 +0000 (16:48 +0200)]
omxh264dec: remove 'parsed=true' from sink pad

The decoder only requires to receive one frame per buffer which is
already enforced with 'alignment=au'. There is no need to require to
have a parser upstream.

Allow to run "encode ! decode" pipeline without having a parser.

https://bugzilla.gnome.org/show_bug.cgi?id=784344

7 years agoomxh264enc: set profile/level using OMX_VIDEO_PARAM_AVCTYPE as well
Guillaume Desmottes [Fri, 16 Jun 2017 11:28:33 +0000 (13:28 +0200)]
omxh264enc: set profile/level using OMX_VIDEO_PARAM_AVCTYPE as well

The OMX specification defines two API to set the AVC profile and level:
using OMX_VIDEO_PARAM_PROFILELEVELTYPE and OMX_VIDEO_PARAM_AVCTYPE.

We were already supporting the former but not the latter. We are now
setting both so implementation don't have to rely on a specific one.

https://bugzilla.gnome.org/show_bug.cgi?id=783862

7 years agoomxh264enc: factor out update_param_profile_level()
Guillaume Desmottes [Fri, 16 Jun 2017 11:19:33 +0000 (13:19 +0200)]
omxh264enc: factor out update_param_profile_level()

https://bugzilla.gnome.org/show_bug.cgi?id=783862

7 years agoomxh264enc: factor out string to profile/level enum conversion
Guillaume Desmottes [Fri, 16 Jun 2017 10:53:15 +0000 (12:53 +0200)]
omxh264enc: factor out string to profile/level enum conversion

https://bugzilla.gnome.org/show_bug.cgi?id=783862

7 years agoomxh264enc: use OMX_IndexConfigBrcmVideoIntraPeriod on pi
Guillaume Desmottes [Wed, 28 Jun 2017 13:06:10 +0000 (15:06 +0200)]
omxh264enc: use OMX_IndexConfigBrcmVideoIntraPeriod on pi

The OMX_VIDEO_CONFIG_AVCINTRAPERIOD.nPFrames setting isn't of any use on
the raspbery pi. Instead it uses a custom extension to define the I
frame period.

https://bugzilla.gnome.org/show_bug.cgi?id=783829