Commit graph

142 commits

Author SHA1 Message Date
Sebastian Dröge
5d6d6ec2df omx: Add FIXME for the future 2013-02-12 11:55:39 +01:00
Sebastian Dröge
219a93bbaf omx: Some minor refactoring and cleanup 2013-02-12 11:49:21 +01:00
Sebastian Dröge
4399c0b96b omx: Don't access the port's buffers array if it wasn't allocated yet 2013-02-12 11:49:07 +01:00
Sebastian Dröge
dd3ad9e6d5 omx: Mark an array as const 2013-02-12 11:44:40 +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
58a093bc0c omx: Flushing is also allowed in Paused state 2013-02-12 11:37:38 +01:00
Julian Scheel
3d7a50944d omx: add mpeg2 video decoder
This adds a decoder class for mpeg2, as well as an extended
configuration for raspberry pi.

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

Signed-off-by: Julian Scheel <julian@jusst.de>
2013-01-24 22:46:52 +00:00
Sebastian Dröge
5c4799ccf1 omx: Minimize the time when the messages lock is held
Fixes a deadlock if any OMX functions are called when the
messages are handled.

Thanks to Nicolas Dufresne for noticing.
2013-01-18 16:47:52 +01:00
Tim-Philipp Müller
453d81886d omx: improve debug message when we can't find the config file
Mention where we looked for the config file.
2013-01-18 15:28:20 +00:00
Sebastian Dröge
e5bf204a1d omx: Update port definition when changing some port setting 2013-01-15 14:37:37 +01:00
Sebastian Dröge
449017b50b omx: Rename from libgstopenmax.so to ligstomx.so for consistency 2013-01-15 14:37:37 +01:00
Nicolas Dufresne
8c3bd103ff omx: Add a method to send message 2013-01-14 10:37:13 +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
e026926951 omx: Fix another race condition in the recursive mutex
Between lock() and begin_recursion() it was possible for another thread to
try to do a recursive_lock(). This would block because the mutex was already
locked(), but not ready for recursive locking yet. unlock() would never
happen in the original thread because it was waiting for the other thread
to finish first.

Happened on the Raspberry Pi.
2012-12-20 17:46:36 +01:00
Sebastian Dröge
b93d86abbe omx: Use has_suffix() instead of has_prefix() for the Broadcom hack 2012-12-19 12:19:12 +01:00
Sebastian Dröge
5105daba1a omx: Add hack to load and initialize libbcm_host.so
Needed on the Raspberry Pi. Patch based on a patch by
George Kiagiadakis <george.kiagiadakis@collabora.com>
2012-12-19 11:31:51 +01:00
Sebastian Dröge
2481ceb8c4 omx: Update to new GLib thread API 2012-11-12 11:29:48 +01:00
George Kiagiadakis
f93feb2644 omx: fix debug statement 2012-09-03 12:37:02 +03:00
George Kiagiadakis
8a669ee308 omx: use recursive_lock inside set_last_error(), since this function may be called from an event handler 2012-09-03 12:36:53 +03:00
Tim-Philipp Müller
3f963f87fb omx: fix plugin name for new GST_PLUGIN_DEFINE API 2012-08-03 19:32:13 +01:00
George Kiagiadakis
7b3dac67af omx: Fix spelling mistake found by lintian: s/Seperate/Separate/ 2012-05-08 16:16:00 +03:00
George Kiagiadakis
158775f497 Implement a new custom recursive mutex type and fix locking in callbacks so that in-context calls are allowed.
According to the OMX specification, implementations are allowed to call
callbacks in the context of their function calls. However, our callbacks
take locks and this causes deadlocks if the unerlying OMX implementation
uses this kind of in-context calls.

A solution to the problem would be a recursive mutex. However, a normal
recursive mutex does not fix the problem because it is not guaranteed
that the callbacks are called from the same thread. What we see in Broadcom's
implementation for example is:

- OMX_Foo is called
- OMX_Foo waits on a condition
- A callback is executed in a different thread
- When the callback returns, its calling function
  signals the condition that OMX_Foo waits on
- OMX_Foo wakes up and returns

The solution I came up with here is to take a second lock inside the callback,
but only if recursion is expected to happen. Therefore, all calls to OMX
functions are guarded by calls to gst_omx_rec_mutex_begin_recursion() / _end_recursion(),
which effectively tells the mutex that at this point we want to allow calls
to _recursive_lock() to succeed, although we are still holding the master lock.
2012-05-07 17:01:16 +03:00
George Kiagiadakis
5c15caef8e omx: Add hack to disable setting roles to components.
Conflicts:

	omx/gstomx.c
2012-05-03 13:21:18 +02:00
Arun Raghavan
34a83c184e omx: Fix trivial debug print bug 2012-04-26 09:42:54 +05:30
Arun Raghavan
9e4cddee7e omxvideodec: Add hack for Ducati components not returning from drain
This happens on the Galaxy Nexus, and causes the pipeline to hang waiting
endlessly for a drain. The hack replaces the wait with a wait + 500ms timeout.
2012-04-26 09:42:52 +05:30
Arun Raghavan
036cd16756 omx: Fix deadlock between ending a flush and the event handler
gst_omx_port_set_flushing() calls OMX_FillThisBuffer at the end of a flush
without releasing the port lock, and this can cause a deadlock with the
EventHandler. This patches fixes this by dropping the lock for the duration of
the fill buffer call.
2012-04-26 09:42:50 +05:30
Olivier Crête
ff2603a727 Port to Gst 0.11 2012-04-13 12:16:34 -04:00
Sebastian Dröge
9e6665e8f8 omx: Add hack for encoder components that don't allow empty EOS buffers 2011-12-09 12:24:01 +01:00
Sebastian Dröge
0cb32a4ebd omx: Improve debugging of buffer handling 2011-12-05 13:18:09 +01:00
Sebastian Dröge
47d66cadfa omx: Only disabling of a port is like flushing, enabling is like unflushing 2011-11-17 14:38:54 -08:00
Sebastian Dröge
c144ebd054 omx: Enabling/disabling a port is also like flushing
The component returns all buffers to us and shouldn't get any
new buffers passed anymore.
2011-11-17 14:11:51 -08:00
Sebastian Dröge
70b735da82 omx: Fix debug level for flushing in wrong state from ERROR to DEBUG
It's not really an error and doesn't matter at all if flush is called
when the component is not running.
2011-11-15 09:47:55 -08:00
Sebastian Dröge
6736a39671 omx: Add XXX to the nOffset reset hack comment for QCOM 2011-11-14 09:13:06 -08:00
Sebastian Dröge
b66fd610d6 omx: Always reset buffer flags for output ports, even in flushing/error state 2011-11-09 15:41:02 +01:00
Sebastian Dröge
1d071c05dc omx: Also properly release buffers when in error state 2011-11-08 08:24:49 +01:00
Jonas Larsson
0682012181 omx: Properly release buffers during flushing
We can't pass them back to OMX_FillThisBuffer() or OMX_EmptyThisBuffer()
but instead of doing nothing we have to put them back into our queue.
Otherwise the buffer is leaked and we will have too few buffers in
the future.
2011-11-08 08:24:49 +01:00
Sebastian Dröge
fa6881c1cc omx: Reset buffer flags to 0 after it was consumed by the component or the element
Some implementations don't reset the flags and the standard is not
really clear on the expected behaviour. Let's just always reset the
flags as they're not valid at this point anymore.
2011-11-04 09:04:16 +01:00
Sebastian Dröge
72fa93956b omx: Remove QCOM hack to reset nOffset in EmptyBufferDone
This is now done in a generic way that does not require any
hacks because it will work without any side effects on any
OMX implementation.
2011-10-14 10:27:47 +02:00
Sebastian Dröge
2750a8869b omx: Reset nOffset to 0 in EmptyBufferDone if nFilledLen is 0
Some OMX implementations don't reset nOffset when the complete
buffer is emptied but instead only reset nFilledLen. We reset
nOffset to 0 if nFilledLen == 0, which is safe to do because
the offset *must* be 0 if the buffer is not filled at all.

Seen in QCOM's OMX implementation.
2011-10-14 10:26:21 +02:00
Sebastian Dröge
792cdb7d1f omxvideodec: New hack for QCOM to recreate the component instead of reconfiguring it on caps changes 2011-09-28 10:35:31 +02:00
Sebastian Dröge
a7f77e22a4 omx: Change a g_assert() into a GST_WARNING_OBJECT() 2011-09-27 12:28:22 +02:00
Sebastian Dröge
837fc4ca66 omx: Add hack for Qualcomm's OMX implementation to manually reset nOffset in EmptyBufferDone 2011-09-26 13:05:23 +02:00
Sebastian Dröge
f0fe1148b7 omx: Wait until the Executing state is reached before calling OMX_FillThisBuffer()
This correctly works around the QCOM race condition that happens when calling
FTB after setting the new state and before reaching it.
2011-09-14 10:16:41 +02:00
Sebastian Dröge
422ca1796b omxaacenc: Add initial version of OpenMAX AAC encoder element 2011-08-16 10:49:21 +02:00
Sebastian Dröge
9dcaf5c2bb omx: Don't hold any locks while calling OMX_SendCommand()
It might call into one of the callbacks and lead to deadlocks, e.g.
with the Qualcomm OMX implementation.
2011-08-10 09:49:57 +02:00
Sebastian Dröge
0bb345a16d omx: Move some code 2011-08-10 09:32:01 +02:00
Sebastian Dröge
e413b8403c omx: Reset pending reconfigure output ports when changing the state from Executing to any lower state 2011-08-10 09:23:10 +02:00
Sebastian Dröge
25fd0594f5 omx: Fix crash when setting last error after the ports were freed 2011-08-10 09:08:00 +02:00
Sebastian Dröge
9678efdf88 omx: Free component structure 2011-08-10 09:03:52 +02:00
Sebastian Dröge
52a422f637 omx: Make component destruction safer 2011-08-10 09:02:52 +02:00
Sebastian Dröge
8fd4eaae69 omx: Set pAppPrivate of buffers to NULL when deallocating buffers
This prevents usage of freed memory later if the OMX component
has weird behaviour.
2011-08-10 08:55:18 +02:00
Sebastian Dröge
cb001aa85f omx: Add some assertions to check if the buffer pAppPrivate is still correct 2011-08-10 08:51:54 +02:00
Sebastian Dröge
825d435d7d omx: Only prevent setting a higher state if the component is in an error state 2011-08-08 12:12:58 +02:00
Sebastian Dröge
2c4dcf418a omx: Improve debugging in param/config getter/setter wrappers 2011-08-03 15:35:01 +02:00
Sebastian Dröge
aced7478ab omx: Add a hacks flag for the Qualcomm 7x30 OMX_FillThisBuffer() race and make it optional 2011-08-01 13:22:05 +02:00
Sebastian Dröge
cba41896a6 omx: Add workaround for QCOM 7x30 race condition 2011-07-29 13:56:59 +02:00
Sebastian Dröge
b085e11c37 omxh263enc: Add H.263 encoder element 2011-07-29 12:06:21 +02:00
Sebastian Dröge
f2b456e2e6 omx: Add wrapper functions for OMX_[GS]et{Config,Parameter} 2011-07-28 12:16:43 +02:00
Sebastian Dröge
35850e7233 omx: Add macro to initialize OpenMAX structures 2011-07-28 12:16:43 +02:00
Sebastian Dröge
1fa3b2662e omx: Ensure that the pAppPrivate pointer in OMX buffers is set correctly 2011-07-25 15:05:08 +02:00
Sebastian Dröge
8977906f4b omxwmvdec: Add WMV video decoder element 2011-07-25 12:01:05 +02:00
Sebastian Dröge
4a110e129c omxh263dec: Add H.263 decoder element 2011-07-25 11:44:56 +02:00
Sebastian Dröge
e01eb8c35c omxh264enc: Add H.264 encoder element 2011-07-25 11:32:51 +02:00
Sebastian Dröge
9e1cfa300b omx: Deallocate port buffers before freeing the component
They should be deallocated by the caller before reaching the
Loaded state but to be on the safe side we will make sure
they're really deallocated here.
2011-07-25 10:46:49 +02:00
Sebastian Dröge
a86debaf36 omx: Failure to set the component role is fatal 2011-07-21 10:36:19 +02:00
Sebastian Dröge
e8b2ffe6f4 omx: Use libgstopenmax.so for the plugin filename and openmax for the plugin name
Resolves conflicts with gst-openmax.
2011-07-20 11:09:54 +02:00
Sebastian Dröge
2343decb3c omxvideoenc: Add video encoder base class and MPEG4 video encoder
Unfortunately requires lots of hacks again to work properly with
Bellagio.
2011-07-20 11:08:18 +02:00
Sebastian Dröge
71d176f71a omx: Improve debug output a bit 2011-07-19 12:29:51 +02:00
Sebastian Dröge
b6558570bf omx: Rework port reconfiguration again and only use the Bellagio specific hacks with Bellagio
We only reconfigure ports that need to be reconfigured now instead of
always all ports.
2011-07-19 10:33:54 +02:00
Sebastian Dröge
4616d804ac omx: Add infrastructure to enable special hacks for broken OpenMAX implementations 2011-07-19 10:33:15 +02:00
Sebastian Dröge
f3f3bd1dff omx: When acquiring a buffer from an input port always wait until all output ports are reconfigured 2011-07-18 13:10:49 +02:00
Sebastian Dröge
51dbc82ef4 omx: Provide all buffers to output ports after enabling them 2011-07-14 10:34:09 +02:00
Sebastian Dröge
f0cbbad0f1 omx: Add support for setting the component-role 2011-07-13 20:37:02 +02:00
Sebastian Dröge
0a9fe2f146 omx: Improve error reporting by formatting the error codes better and also providing their string representation 2011-07-13 20:22:51 +02:00
Sebastian Dröge
9ab5f79784 build: Only require GStreamer >= 0.10.29 and GLib >= 2.16 2011-07-13 14:35:51 +02:00
Sebastian Dröge
2023754bcf omx: Allow to set a preferred configuration directory with the GST_OMX_CONFIG_DIR environment variable 2011-07-12 11:13:50 +02:00
Sebastian Dröge
940febae88 omx: Add initial version of configuration system
This now only registers elements that are specified in the
configuration file.

The configuration file is a keyfile in the first XDG configuration
directory with the name gstomx.conf.
2011-07-12 11:04:11 +02:00
Sebastian Dröge
6bd84629ed omxh264dec: Rename from omxh264videodec to omxh264dec 2011-07-12 08:54:22 +02:00
Sebastian Dröge
079098c3d6 omxh264videodec: Add h.264 video decoder 2011-07-12 08:34:44 +02:00
Sebastian Dröge
db08890edd omx: Rework port reconfiguration
We always reconfigure all ports now if the settings of one
port changes to prevent lots of race conditions, dropped
frames and similar issues.
2011-07-09 11:06:06 +02:00
Sebastian Dröge
c8c1c7f10f omx: Add more checks to acquire_buffer() and return the current state additional to the buffer
Also refactor the code flow in the video decoder for this. This makes
the usage of acquire_buffer() easier and more atomic.
2011-07-09 11:06:06 +02:00
Sebastian Dröge
28688414b8 omx: Don't broadcast port->port_cond after allocating buffers successfully
Allocating buffers must happen while no thread is waiting for the
cond and especially must happen from the thread that would acquire
buffers from the port.
2011-07-09 11:06:06 +02:00
Sebastian Dröge
d9e2391448 omx: Always check if the component is in an error state before waiting for a condition variable to be signalled
Otherwise we might wait forever because nothing is going to signal
the condition variable anymore.
2011-07-09 11:06:06 +02:00
Sebastian Dröge
46fe757270 omx: Always hold port->port_lock before signalling port->port_cond when notifying about errors
Otherwise a port might be in the critical section, has checked the error state
already but waits after port->port_cond is signalled, which will lead
to a deadlock.
2011-07-09 11:06:05 +02:00
Sebastian Dröge
b53c001bf2 omx: Improve debug output a bit 2011-07-09 11:06:05 +02:00
Sebastian Dröge
7739049df5 omx: Always try to deallocate buffers, even if there's a component error 2011-07-09 11:06:05 +02:00
Sebastian Dröge
0b9c0ac78d omx: Use G_USEC_PER_SEC for clarity instead of 1000000 2011-07-09 11:06:05 +02:00
Sebastian Dröge
5d4f7890c2 omx: Don't use port_def.bEnabled to check if the Enable/Disable command is finished
bEnabled should be set immediately after sending the command, it's only
Bellagio that waits until the command is finished before setting it.
2011-07-09 11:06:05 +02:00
Sebastian Dröge
3d50c1f99c omx: Improve error handling and reporting 2011-07-09 11:06:05 +02:00
Sebastian Dröge
bc1e73e8c8 omx: Add initial version of OpenMAX framework, video decoder base class and MPEG4 video decoder
This currently hardcodes a lot of stuff but works at least.

Also adds a generic framework for handling OpenMAX cores, components
and ports.
2011-07-09 11:06:05 +02:00
Sebastian Dröge
d2463b017f Initial commit with build system 2011-06-21 10:52:13 +02:00