Commit graph

599 commits

Author SHA1 Message Date
Julien Isorce
1c8f069e42 omx: allow 0 feature
Previously the omx plugin was blacklisted if GST_OMX_CONFIG_DIR
points to an invalid path or if the gstomx.conf contains 0 valid
component.
Problem is that once the plugin is blacklisted, a rescan is not
triggered upon changes of the env var or the gstomx.conf file
despite being setup with gst_plugin_add_dependency.

This also makes it more consistent with other plugins that auto
generate features. For example gst-{ffmeg,libav}, gstreamer-vaapi,
v4l2 video dec.

To clarify the diff, the plugin_init func will return TRUE even if
g_key_file_get_groups returns 0 element and even if
g_key_file_load_from_dirs fails.

https://bugzilla.gnome.org/show_bug.cgi?id=782867
2017-05-21 15:40:11 +01:00
Sejun Park
d980af213b omxvideodec: Removed unreachable code
https://bugzilla.gnome.org/show_bug.cgi?id=782416
2017-05-10 11:54:44 +01:00
Guillaume Desmottes
e8590db808 meson: add dep on GModule
libgstomx uses the GModule API and so needs it in its dependencies list.

https://bugzilla.gnome.org/show_bug.cgi?id=782387
2017-05-09 16:31:03 +02:00
Guillaume Desmottes
623d2df5a3 videoenc: use GST_ROUND_UP_N() macro
Makes the code much easier to read and understand.

https://bugzilla.gnome.org/show_bug.cgi?id=781409
2017-04-26 15:37:41 +01:00
Sebastian Dröge
812e24b06f omxvideoenc: Fix compiler warning
gstomxvideoenc.c: In function ‘gst_omx_video_enc_fill_buffer’:
  CC       libgstomx_la-gstomxaacdec.lo
gstomxvideoenc.c:1316:27: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 8 has type ‘OMX_U32 {aka long unsigned int}’ [-Wformat=]
     GST_LOG_OBJECT (self, "Matched strides - direct copy %u bytes",
                           ^
         outbuf->omx_buf->nFilledLen);
         ~~~~~~~~~~~~~~~~~~
2017-04-07 14:27:23 +03:00
Jan Schmidt
75d9ec634c omxvideoenc: Add an unimplemented mapping for RGBA formats
Add some pixel formats mappings for 2 RGBA formats. Not yet
implemented in the buffer input code though, so no effect for now.
2017-03-14 03:02:06 +11: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
Jan Schmidt
f3a7bce442 omxvideoenc: Add a mapping for OMX_COLOR_FormatYUV420PackedSemiPlanar
The RaspberryPi
2017-03-14 02:42:15 +11:00
Jan Schmidt
c3078dd20c omxvideoenc: Filter out unimplemented formats
Don't announce pixel formats in the caps if they've not been
implemented.
2017-03-14 02:40:24 +11:00
Jan Schmidt
7c829886ca omxvideodec: demote ERROR message
There's no need to warn about failing to negotiate EGL output
 - that can be perfectly normal.
2017-03-14 02:34:36 +11:00
Vincent Penquerc'h
4e01a6f7b1 omxaacenc: let encoder know about incoming rate/channels
https://bugzilla.gnome.org/show_bug.cgi?id=777223
2017-01-20 13:37:46 -05:00
Matthew Waters
ed5f63c9ef build: add meson build definition
Currently only been tested on the RPi within gst-build.
2017-01-18 15:23:42 +11:00
Vincent Penquerc'h
a02f1e5c9b omxaudioenc: set base class format instead of just source pad caps 2017-01-11 11:38:05 +00:00
Graham Leggett
a1e613dd89 omx*dec: Flush before we stop the srcpad loop
Flushing could otherwise hang if output port queue of pending buffers was empty

https://bugzilla.gnome.org/show_bug.cgi?id=774654
2016-12-19 10:52:16 +02:00
Reynaldo H. Verdejo Pinochet
7925355d72 Fix broken build due to syntax error
Problem was introduced by 8716c23e2b
2016-12-14 13:32:16 -08:00
Graham Leggett
8716c23e2b Prevent early EOS by resetting eos flag once GST_OMX_ACQUIRE_BUFFER_EOS is triggered
https://bugzilla.gnome.org/show_bug.cgi?id=774600
2016-12-13 11:38:38 +02:00
Graham Leggett
5d5fbcd8f6 Add clear debug logging on all the paths out of gst_omx_port_acquire_buffer()
https://bugzilla.gnome.org/show_bug.cgi?id=774600
2016-12-13 11:38:36 +02: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
Graham Leggett
8b01b06af6 Add support for OMX_COLOR_FormatYUV420PackedSemiPlanar and OMX_COLOR_Format24bitBGR888
https://bugzilla.gnome.org/show_bug.cgi?id=775959
2016-12-13 11:18:43 +02:00
Sebastian Dröge
53d8d353f0 omx: Fix compiler warning with latest clang
gstomx.c:1376:42: error: implicit conversion from enumeration type 'GstOMXAcquireBufferReturn' to different enumeration type 'OMX_ERRORTYPE'
      (aka 'enum OMX_ERRORTYPE') [-Werror,-Wenum-conversion]
  g_return_val_if_fail (!port->tunneled, GST_OMX_ACQUIRE_BUFFER_ERROR);
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

https://bugzilla.gnome.org/show_bug.cgi?id=775112
2016-11-26 00:07:13 +02:00
Matthew Waters
baaf404f2b videodecoder: remove use of EGLImage orientation
New code should use GstVideoTransformationMeta

(The defaults do the right thing here though).
2016-11-17 19:56:35 +11:00
Sebastian Dröge
cb9078627c omx: Also search for gstomx.conf in the autoconf --sysconfdir
https://bugzilla.gnome.org/show_bug.cgi?id=770743
2016-09-14 11:28:36 +02:00
Kazunori Kobayashi
766cd65fa4 omxvideodec: Use GST_VIDEO_FRAME_PLANE_STRIDE() to get output buffer's stride
GST_VIDEO_FRAME_PLANE_STRIDE() should be used to get the actual buffer stride,
as reported in the buffers's GstVideoMeta, when copying data to that buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=768173
2016-06-29 18:44:20 +10:00
Aurélien Zanelli
d07aa49943 omxaudioenc: implement GstPreset interface
To allow user to use GstPreset to quickly save and load a set of
parameters.

https://bugzilla.gnome.org/show_bug.cgi?id=767907
2016-06-21 15:02:02 +03:00
Aurélien Zanelli
0c265c1e0e omxvideoenc: implement GstPreset interface
To allow user to use GstPreset to quickly save and load a set of
parameters.

https://bugzilla.gnome.org/show_bug.cgi?id=767907
2016-06-21 15:02:02 +03: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
198e31355f omxvideodec: Implement ::drain() virtual method
https://bugzilla.gnome.org/show_bug.cgi?id=767641
2016-06-17 10:59:45 +03:00
Gwang Yoon Hwang
27d2cdd45d omxvideodec : Use gstglmemoryegl for the RPi
Modified to use gstglmemoryegl to avoid texture creation/copy operations
at the glupload.

[Matthew Waters]: gst-indent the sources and port testegl to GstGLMemoryEGL

https://bugzilla.gnome.org/show_bug.cgi?id=760918
2016-05-04 13:42:23 +10:00
Enrique Ocaña González
271093d633 Remember the last_error after a failed set state call to avoid blocking the next get state call
gst_omx_video_dec_flush() blocks forever in
http://cgit.freedesktop.org/gstreamer/gst-omx/tree/omx/gstomxvideodec.c?id=9adf0ff82903cad5331e40975ae91ed5d11bc102#n2110
when the previous call to gst_omx_component_set_state() fails in
http://cgit.freedesktop.org/gstreamer/gst-omx/tree/omx/gstomx.c?id=9adf0ff82903cad5331e40975ae91ed5d11bc102#n827.
To mitigate that, I set "last_error" to true, so the code in
http://cgit.freedesktop.org/gstreamer/gst-omx/tree/omx/gstomx.c?id=9adf0ff82903cad5331e40975ae91ed5d11bc102#n862
exits early and doesn't block.

https://bugzilla.gnome.org/show_bug.cgi?id=758274
2015-11-18 15:18:02 +02:00
Enrique Ocaña González
d1a79d7c59 Properly handle drain requests while flushing
Without this commit the decoder streaming thread stops without ever attending
the drain request, leaving the decoder input thread waiting forever.

https://bugzilla.gnome.org/show_bug.cgi?id=758274
2015-11-18 15:18:02 +02:00
Nicolas Huet
9adf0ff829 omx: fix hacks leak on class init 2015-11-18 12:02:44 +00:00
Thiago Santos
03fc454457 omxaacdec: Do not accept unknown layouts
It was defaulting to RAW when an unknown layout was received but
the caps template would actually forbid that on the caps query
or accept-caps anyway.
2015-09-01 16:13:00 -03:00
Thiago Santos
1f3bf04fe7 omxaudiodec: use default pad accept-caps handling
Instead of the audiodecoder one. The OMX audioo decoders have their
valid input in the template pad, so just check against that to
avoid doing a query downstream.
2015-09-01 09:01:45 -03:00
Thiago Santos
c038df6671 omxvideodec: use default pad accept-caps handling
Instead of the videodecoder one. The OMX video decoders have their
valid input in the template pad, so just check against that to
avoid doing a query downstream.
2015-08-28 12:57:33 -03:00
Graham Leggett
703bab6885 omxvideoenc: Add keyframe support for the Rpi, using OMX_IndexConfigBrcmVideoRequestIFrame
https://bugzilla.gnome.org/show_bug.cgi?id=753085
2015-08-27 11:15:29 +03:00
Philippe Normand
e0327521f6 omxh264dec: implement is_format_change
The omxvideodecoder class only checks some of the caps parameters but if
other fields change such as h264 profile and/or level it wouldn't trigger a
reconfiguration.

https://bugzilla.gnome.org/show_bug.cgi?id=752376
2015-08-16 15:48:16 +02:00
Aurélien Zanelli
d2df0fb032 omxvideodec: unref allocator after getting it from allocation query
Otherwise a reference will be leaked for each allocator. It only happens
when target platform is Raspberry Pi and when we have GL support.

https://bugzilla.gnome.org/show_bug.cgi?id=751867
2015-07-06 11:54:28 +03:00
Sebastian Dröge
3f46a12aab omxaudiodec: Add an output adapter for chunking the output into codec frames
Otherwise the base class will be confused.
See https://bugzilla.gnome.org/show_bug.cgi?id=685730
2015-05-19 19:14:42 +03:00
Tim-Philipp Müller
afab78e52e Remove obsolete Android build cruft
This is not needed any longer.
2015-04-26 18:24:26 +01:00
Luis de Bethencourt
24c0197e46 omxaudiodec: add comment explaining duplicate code path 2015-03-06 12:12:49 +00:00
Luis de Bethencourt
e8d76fb1ef Revert "omxaudiodec: remove duplicate code path"
This reverts commit a8d26ff27a.
2015-03-06 12:09:06 +00:00
Luis de Bethencourt
70c48cf85f omx: handle both errors in the two steps of update_port_definition
Also consider potential errors in the _get_parameter() in the return of the
update_port_definition function.

CID #1287052
2015-03-06 12:06:22 +00:00
Luis de Bethencourt
3aa008adb7 omxaudioenc: impossible if statement
ret is set to GST_STATE_CHANGE_SUCCESS and never touched, so it is impossible
for it to be anything else at the if check. Remove the if check.

CID #1287053
2015-03-06 10:57:53 +00:00
Luis de Bethencourt
964cb549bb omxaudiodec: impossible if statement
ret is set to GST_STATE_CHANGE_SUCCESS and never touched, so it is impossible
for it to be anything else at the if check. Remove it.

CID #1287054
2015-03-06 10:54:46 +00:00
Luis de Bethencourt
a8d26ff27a omxaudiodec: remove duplicate code path 2015-03-06 10:50:30 +00:00
George Kiagiadakis
0ef1e90b34 omx: call handle_messages() only once in acquire_buffer() to avoid potential deadlock
There is one rare case where calling handle_messages() more than once can cause a deadlock
in the video decoder element:

- sink pad thread starts the src pad task (gst_omx_video_dec_loop())
- _video_dec_loop() calls gst_omx_port_acquire_buffer() on dec_out_port
- blocks in gst_omx_component_wait_message() releasing comp->lock and comp->messages_lock
  (initially, there are no buffers configured on that port, so it waits for OMX_EventPortSettingsChanged)
- the sink pad thread pushes a buffer to the decoder with gst_omx_port_release_buffer()
- _release_buffer() grabs comp->lock and sends the buffer to OMX, which consumes it immediately
- EmptyBufferDone gets called at this point, which signals _wait_message() to unblock
- the message from EmptyBufferDone is processed in gst_omx_component_handle_messages()
  called from gst_omx_port_release_buffer()
- gst_omx_port_release_buffer releases comp->lock
- the src pad thread now gets to run, grabbing comp->lock while it exits from _wait_message()
- _acquire_buffer() calls the _handle_messages() on the next line after _wait_message(),
  which does nothing (no pending messages)
- then it goes to "retry:" and calls _handle_messages() again, which also does nothing
  (still no pending messages)
- scheduler switches to a videocore thread that calls EventHandler, informing us about the
  OMX_EventPortSettingsChanged event that just arrived
- EventHandler graps comp->messages_lock, but not comp->lock, so it can run in parallel at
  this point just fine.
- scheduler switches back to the src pad thread (which is in the middle of _acquire_buffer())
- the next _handle_messages() which is right before if (g_queue_is_empty (&port->pending_buffers))
  processes the OMX_EventPortSettingsChanged
- the buffer queue is still empty, so that thread blocks again in _wait_message()
- the sink pad thread tries to acquire the next input port buffer
- _acquire_buffer() also blocks this thread in:
   if (comp->pending_reconfigure_outports) { ... _wait_message() ... }
- DEADLOCK. gstreamer is waiting for omx to do something, omx waits for gstreamer to do something.

By removing those extra _handle_messages() calls, we can ensure that all the checks of
_acquire_buffer() will re-run. In the above case, after the scheduler switches back to
the middle of _acquire_buffer(), the code will enter _wait_message(), which will see that
there are pending messages and will return immediately, going back to "retry:" and
re-doing all the checks properly.

https://bugzilla.gnome.org/show_bug.cgi?id=741854
2015-03-04 09:51:03 +01:00
Wonchul Lee
df58d8baac omx: cleanup code a bit to remove else statement
https://bugzilla.gnome.org/show_bug.cgi?id=745191
2015-02-26 11:15:37 +02:00
Jun Ji
8936f6634c omx: Add omxamrdec
https://bugzilla.gnome.org/show_bug.cgi?id=739333
2014-11-13 13:32:16 +01:00
Sebastian Dröge
40ab1b0a45 omxaudiodec: Clean up code a bit to get rid of useless NULL checks 2014-09-30 10:47:20 +03:00
junji
eba9e3f29d omxaudiodec: Unmap input buffers after usage
https://bugzilla.gnome.org/show_bug.cgi?id=736314
2014-09-30 10:44:38 +03:00