Commit graph

132 commits

Author SHA1 Message Date
Guillaume Desmottes
0603e442ce 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
2017-08-08 10:40:47 -04:00
Guillaume Desmottes
90da3c665e 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
2017-08-08 10:40:47 -04:00
Guillaume Desmottes
973c6e109a 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
2017-08-08 10:40:47 -04:00
Guillaume Desmottes
3f5d98a360 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
2017-07-19 09:37:37 -04:00
Satya Prakash Gupta
45eaf9cfc6 omxvideoenc: Fix deadlock in error case when draining
https://bugzilla.gnome.org/show_bug.cgi?id=784972
2017-07-17 15:39:02 +03:00
Julien Isorce
786a2617b2 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
2017-07-05 10:48:52 +01:00
Graham Leggett
463929af3e omxvideoenc: Improve debug output when setting codec state due to new codec_data fails
https://bugzilla.gnome.org/show_bug.cgi?id=783657
2017-06-12 09:56:20 +03: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
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
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
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
Michal Lazo
bfeab29a39 omxvideoenc: Setup aspect ratio on RPi
Needs firmware from yesterday or newer to work with all possible
aspect ratios. Before that it only supported a fixed list.

https://bugzilla.gnome.org/show_bug.cgi?id=732533
2014-09-01 12:18:58 +03:00
Peng Liu
d3d0a82ba4 omxvideoenc: Implement the hack flag GST_OMX_HACK_NO_COMPONENT_RECONFIGURE
Fix a video encoder stall problem on RPi when changing the aspect ratio.

https://bugzilla.gnome.org/show_bug.cgi?id=732533
2014-08-28 10:45:11 +03:00
Sebastian Dröge
d75334456d omx: Let base classes handle EOS
https://bugzilla.gnome.org//show_bug.cgi?id=734774
2014-08-14 17:36:11 +03:00
Sebastian Dröge
0a60770a28 omxvideoenc: Implement flush() instead of the deprecated reset() 2014-06-29 19:04:54 +02:00
Sebastian Dröge
34577a965d omxvideoenc: Don't forget to unref codec state
CID 1214603
2014-05-19 09:10:07 +02:00
Sebastian Dröge
40869afea7 omxvideoenc: Implement 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 13:21:07 +02:00
Sebastian Dröge
bc2990169a omxvideoenc: Set nTickCount to the whole duration of the buffer instead of a wrong calculation 2014-05-10 22:47:21 +02:00
Sebastian Dröge
a04ef276e5 omx: Rename function from _4_ to _for_ for clarity 2014-03-12 12:47:34 +01:00
Christian König
6bf4d9a498 omxvideo: start sharing more code between video decoder and encoder
Identical functionality spread of two different components.
We can't use a common base class because of different inheritance,
but let's try to share the code anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=726024
2014-03-12 12:47:09 +01:00
Christian König
20cfcda4db omxvideoenc: fix a memory leak in gst_omx_video_enc_getcaps
https://bugzilla.gnome.org/show_bug.cgi?id=725826
2014-03-06 20:37:02 +01:00
Christian König
85db124673 omxvideoenc: simplify _find_nearest_frame
Just the same as we did with the decoder. Also give the
function a gst_omx_video_enc prefix to distinct it from
the decoder function.

https://bugzilla.gnome.org/show_bug.cgi?id=724236
2014-03-03 20:12:58 +01:00
Christian König
4e4f093319 omxvideoenc: fix startup race condition
The reset function shouldn't start the src pad
loop if it wasn't started before.

Signed-off-by: Christian König <christian.koenig@amd.com>
2014-03-02 12:08:09 +01:00
Sebastian Dröge
1bf4edf721 omx: Don't handle FLUSHING and NOT_LINKED as errors
Also don't stop the task on NOT_LINKED. We're not a demuxer.
2014-01-25 17:44:57 +01:00
Roman Arutyunyan
5ba55b6c9a gstomxvideoenc: Set bitrate in setcaps
Otherwise it gets lost whenever we configure new caps

https://bugzilla.gnome.org/show_bug.cgi?id=698049
2013-07-01 15:48:47 +02:00
Josep Torra
f3f9330332 omx: Take lock on EOS to update the flow return value
Fixes "GThread-ERROR **: file gthread-posix.c: line 171
(g_mutex_free_posix_impl): error 'Device or resource busy' during
'pthread_mutex_destroy ((pthread_mutex_t *) mutex)'" in _finalize.
2013-05-20 12:06:34 +02: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
Tim-Philipp Müller
2cbbab3128 omx: more printf format fixes
Fix printf formats again, so that gst-omx compiles warning-
free on the Raspberry Pi as well. Unfortunately OMX_UINT32
maybe be typedefed to uint32_t or unsigned long, which
doesn't work well with our debugging printf format strings,
so just use %u for those and cast to guint.
2013-04-18 23:10:13 +01:00
jitendra
960590f92f omx: Disable output port before transition to idle state
https://bugzilla.gnome.org/show_bug.cgi?id=698109
2013-04-16 12:46:48 +02:00
Tim-Philipp Müller
0c08d375f4 omx: fix printf formats in debug messages
OMX_U32 is typedefed to an unsigned long,
OMX_TICKS to a 64-bit integer.
2013-04-08 17:02:32 +01:00
Josep Torra
a5778efe16 omx: Clarify that loop task is also paused in EOS 2013-03-16 10:00:24 +01:00
Josep Torra
e16207f3dd omxvideoenec: Don't forget propagate flow return value upstream 2013-03-16 09:59:01 +01:00
Sebastian Dröge
e1f94660f7 omx: Stop output port task after draining 2013-03-15 11:46:34 +01: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
b9af5f4f31 omxvideoenc: Properly check the nVersion field 2013-03-13 10:21:49 +01:00
Sebastian Dröge
68c8196912 omxvideoenc: RPi returns garbage for OMX_IndexParamVideoBitrate, work around that 2013-03-13 09:38:07 +01:00
Sebastian Dröge
3c13502b75 omxvideoenc: Always allocate output buffers from the loop function 2013-03-11 13:45:04 +01:00
Sebastian Dröge
79a1fed0e0 omxvideoenc: Wait until the Executing state is reached before passing buffers to the component 2013-03-11 11:52:57 +01:00
Sebastian Dröge
f518ce5ed9 omxvideoenc: Disable output port when setting a new format 2013-03-11 10:29:30 +01:00
Sebastian Dröge
65174bbd7f omx: Catch errors when releasing buffers to a port and handle them 2013-03-11 10:04:10 +01:00
Sebastian Dröge
eac2078056 omxvideoenc: Use the correct video codec state when filling an input buffer 2013-03-10 12:09:23 +01:00
Sebastian Dröge
98cf9f6fe2 omxvideoenc: Store correct input state 2013-03-10 12:05:50 +01:00
Sebastian Dröge
fb3b213b3e omxvideoenc: Allocate output buffers as early as possible 2013-03-10 11:31:55 +01:00
Josep Torra
bd071327da omx: Fix deadlock in encoders and add explainatory comments. 2013-03-09 14:14:40 +01:00