summaryrefslogtreecommitdiff
path: root/omx/gstomx.h
diff options
context:
space:
mode:
Diffstat (limited to 'omx/gstomx.h')
-rw-r--r--omx/gstomx.h198
1 files changed, 120 insertions, 78 deletions
diff --git a/omx/gstomx.h b/omx/gstomx.h
index 8af81b8..76f6622 100644
--- a/omx/gstomx.h
+++ b/omx/gstomx.h
@@ -3,6 +3,7 @@
* Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>, Collabora Ltd.
* Copyright (C) 2013, Collabora Ltd.
* Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
+ * Copyright (c) 2012-2014, NVIDIA CORPORATION. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -48,6 +49,10 @@
#include <OMX_Core.h>
#include <OMX_Component.h>
+#ifdef USE_OMX_TARGET_TEGRA
+#include "NVOMX_IndexExtensions.h"
+#endif
+
#ifdef USE_OMX_TARGET_RPI
#include <OMX_Broadcom.h>
#endif
@@ -57,7 +62,6 @@
#endif
G_BEGIN_DECLS
-
#define GST_OMX_INIT_STRUCT(st) G_STMT_START { \
memset ((st), 0, sizeof (*(st))); \
(st)->nSize = sizeof (*(st)); \
@@ -66,7 +70,6 @@ G_BEGIN_DECLS
(st)->nVersion.s.nRevision = OMX_VERSION_REVISION; \
(st)->nVersion.s.nStep = OMX_VERSION_STEP; \
} G_STMT_END
-
/* Different hacks that are required to work around
* bugs in different OpenMAX implementations
*/
@@ -91,22 +94,18 @@ G_BEGIN_DECLS
* Happens with Qualcomm's OpenMAX implementation.
*/
#define GST_OMX_HACK_NO_COMPONENT_RECONFIGURE G_GUINT64_CONSTANT (0x0000000000000010)
-
/* If the component does not accept empty EOS buffers.
* Happens with Qualcomm's OpenMAX implementation.
*/
#define GST_OMX_HACK_NO_EMPTY_EOS_BUFFER G_GUINT64_CONSTANT (0x0000000000000020)
-
/* If the component might not acknowledge a drain.
* Happens with TI's Ducati OpenMAX implementation.
*/
#define GST_OMX_HACK_DRAIN_MAY_NOT_RETURN G_GUINT64_CONSTANT (0x0000000000000040)
-
/* If the component doesn't allow any component role to be set.
* Happens with Broadcom's OpenMAX implementation.
*/
#define GST_OMX_HACK_NO_COMPONENT_ROLE G_GUINT64_CONSTANT (0x0000000000000080)
-
typedef struct _GstOMXCore GstOMXCore;
typedef struct _GstOMXPort GstOMXPort;
typedef enum _GstOMXPortDirection GstOMXPortDirection;
@@ -115,7 +114,8 @@ typedef struct _GstOMXBuffer GstOMXBuffer;
typedef struct _GstOMXClassData GstOMXClassData;
typedef struct _GstOMXMessage GstOMXMessage;
-typedef enum {
+typedef enum
+{
/* Everything good and the buffer is valid */
GST_OMX_ACQUIRE_BUFFER_OK = 0,
/* The port is flushing, exit ASAP */
@@ -128,25 +128,28 @@ typedef enum {
GST_OMX_ACQUIRE_BUFFER_ERROR
} GstOMXAcquireBufferReturn;
-struct _GstOMXCore {
+struct _GstOMXCore
+{
/* Handle to the OpenMAX IL core shared library */
GModule *module;
/* Current number of users, transitions from/to 0
* call init/deinit */
GMutex lock;
- gint user_count; /* LOCK */
+ gint user_count; /* LOCK */
/* OpenMAX core library functions, protected with LOCK */
- OMX_ERRORTYPE (*init) (void);
- OMX_ERRORTYPE (*deinit) (void);
- OMX_ERRORTYPE (*get_handle) (OMX_HANDLETYPE * handle,
+ OMX_ERRORTYPE (*init) (void);
+ OMX_ERRORTYPE (*deinit) (void);
+ OMX_ERRORTYPE (*get_handle) (OMX_HANDLETYPE * handle,
OMX_STRING name, OMX_PTR data, OMX_CALLBACKTYPE * callbacks);
- OMX_ERRORTYPE (*free_handle) (OMX_HANDLETYPE handle);
- OMX_ERRORTYPE (*setup_tunnel) (OMX_HANDLETYPE output, OMX_U32 outport, OMX_HANDLETYPE input, OMX_U32 inport);
+ OMX_ERRORTYPE (*free_handle) (OMX_HANDLETYPE handle);
+ OMX_ERRORTYPE (*setup_tunnel) (OMX_HANDLETYPE output, OMX_U32 outport,
+ OMX_HANDLETYPE input, OMX_U32 inport);
};
-typedef enum {
+typedef enum
+{
GST_OMX_MESSAGE_STATE_SET,
GST_OMX_MESSAGE_FLUSH,
GST_OMX_MESSAGE_ERROR,
@@ -156,37 +159,47 @@ typedef enum {
GST_OMX_MESSAGE_BUFFER_DONE,
} GstOMXMessageType;
-typedef enum {
+typedef enum
+{
GST_OMX_COMPONENT_TYPE_SINK,
GST_OMX_COMPONENT_TYPE_SOURCE,
GST_OMX_COMPONENT_TYPE_FILTER
} GstOmxComponentType;
-struct _GstOMXMessage {
+struct _GstOMXMessage
+{
GstOMXMessageType type;
- union {
- struct {
+ union
+ {
+ struct
+ {
OMX_STATETYPE state;
} state_set;
- struct {
+ struct
+ {
OMX_U32 port;
} flush;
- struct {
+ struct
+ {
OMX_ERRORTYPE error;
} error;
- struct {
+ struct
+ {
OMX_U32 port;
OMX_BOOL enable;
} port_enable;
- struct {
+ struct
+ {
OMX_U32 port;
} port_settings_changed;
- struct {
+ struct
+ {
OMX_U32 port;
OMX_U32 flags;
} buffer_flag;
- struct {
+ struct
+ {
OMX_HANDLETYPE component;
OMX_PTR app_data;
OMX_BUFFERHEADERTYPE *buffer;
@@ -195,20 +208,22 @@ struct _GstOMXMessage {
} content;
};
-struct _GstOMXPort {
+struct _GstOMXPort
+{
GstOMXComponent *comp;
guint32 index;
gboolean tunneled;
OMX_PARAM_PORTDEFINITIONTYPE port_def;
- GPtrArray *buffers; /* Contains GstOMXBuffer* */
- GQueue pending_buffers; /* Contains GstOMXBuffer* */
+ GPtrArray *buffers; /* Contains GstOMXBuffer* */
+ GQueue pending_buffers; /* Contains GstOMXBuffer* */
gboolean flushing;
- gboolean flushed; /* TRUE after OMX_CommandFlush was done */
- gboolean enabled_pending; /* TRUE after OMX_Command{En,Dis}able */
- gboolean disabled_pending; /* was done until it took effect */
- gboolean eos; /* TRUE after a buffer with EOS flag was received */
+ gboolean flushed; /* TRUE after OMX_CommandFlush was done */
+ gboolean enabled_pending; /* TRUE after OMX_Command{En,Dis}able */
+ gboolean disabled_pending; /* was done until it took effect */
+ gboolean eos; /* TRUE after a buffer with EOS flag was received */
+ gboolean reconfigure; /* TRUE incase port needs to be reconfigured */
/* Increased whenever the settings of these port change.
* If settings_cookie != configured_settings_cookie
@@ -218,18 +233,19 @@ struct _GstOMXPort {
gint configured_settings_cookie;
};
-struct _GstOMXComponent {
+struct _GstOMXComponent
+{
GstObject *parent;
- gchar *name; /* for debugging mostly */
+ gchar *name; /* for debugging mostly */
OMX_HANDLETYPE handle;
GstOMXCore *core;
- guint64 hacks; /* Flags, GST_OMX_HACK_* */
+ guint64 hacks; /* Flags, GST_OMX_HACK_* */
/* Added once, never changed. No locks necessary */
- GPtrArray *ports; /* Contains GstOMXPort* */
+ GPtrArray *ports; /* Contains GstOMXPort* */
gint n_in_ports, n_out_ports;
/* Locking order: lock -> messages_lock
@@ -238,7 +254,7 @@ struct _GstOMXComponent {
* Always check that messages is empty before waiting */
GMutex lock;
- GQueue messages; /* Queue of GstOMXMessages */
+ GQueue messages; /* Queue of GstOMXMessages */
GMutex messages_lock;
GCond messages_cond;
@@ -251,9 +267,11 @@ struct _GstOMXComponent {
GList *pending_reconfigure_outports;
};
-struct _GstOMXBuffer {
+struct _GstOMXBuffer
+{
GstOMXPort *port;
OMX_BUFFERHEADERTYPE *omx_buf;
+ GstBuffer *gst_buf;
/* TRUE if the buffer is used by the port, i.e.
* between {Empty,Fill}ThisBuffer and the callback
@@ -267,7 +285,8 @@ struct _GstOMXBuffer {
gboolean eglimage;
};
-struct _GstOMXClassData {
+struct _GstOMXClassData
+{
const gchar *core_name;
const gchar *component_name;
const gchar *component_role;
@@ -282,65 +301,88 @@ struct _GstOMXClassData {
GstOmxComponentType type;
};
-GKeyFile * gst_omx_get_configuration (void);
+GKeyFile *gst_omx_get_configuration (void);
-const gchar * gst_omx_error_to_string (OMX_ERRORTYPE err);
-const gchar * gst_omx_state_to_string (OMX_STATETYPE state);
-const gchar * gst_omx_command_to_string (OMX_COMMANDTYPE cmd);
+const gchar *gst_omx_error_to_string (OMX_ERRORTYPE err);
+const gchar *gst_omx_state_to_string (OMX_STATETYPE state);
+const gchar *gst_omx_command_to_string (OMX_COMMANDTYPE cmd);
-guint64 gst_omx_parse_hacks (gchar ** hacks);
+guint64 gst_omx_parse_hacks (gchar ** hacks);
-GstOMXCore * gst_omx_core_acquire (const gchar * filename);
-void gst_omx_core_release (GstOMXCore * core);
+GstOMXCore *gst_omx_core_acquire (const gchar * filename);
+void gst_omx_core_release (GstOMXCore * core);
-GstOMXComponent * gst_omx_component_new (GstObject * parent, const gchar *core_name, const gchar *component_name, const gchar * component_role, guint64 hacks);
-void gst_omx_component_free (GstOMXComponent * comp);
+GstOMXComponent *gst_omx_component_new (GstObject * parent,
+ const gchar * core_name, const gchar * component_name,
+ const gchar * component_role, guint64 hacks);
+void gst_omx_component_free (GstOMXComponent * comp);
-OMX_ERRORTYPE gst_omx_component_set_state (GstOMXComponent * comp, OMX_STATETYPE state);
-OMX_STATETYPE gst_omx_component_get_state (GstOMXComponent * comp, GstClockTime timeout);
+OMX_ERRORTYPE gst_omx_component_set_state (GstOMXComponent * comp,
+ OMX_STATETYPE state);
+OMX_STATETYPE gst_omx_component_get_state (GstOMXComponent * comp,
+ GstClockTime timeout);
-OMX_ERRORTYPE gst_omx_component_get_last_error (GstOMXComponent * comp);
-const gchar * gst_omx_component_get_last_error_string (GstOMXComponent * comp);
+OMX_ERRORTYPE gst_omx_component_get_last_error (GstOMXComponent * comp);
+const gchar *gst_omx_component_get_last_error_string (GstOMXComponent * comp);
-GstOMXPort * gst_omx_component_add_port (GstOMXComponent * comp, guint32 index);
-GstOMXPort * gst_omx_component_get_port (GstOMXComponent * comp, guint32 index);
+GstOMXPort *gst_omx_component_add_port (GstOMXComponent * comp, guint32 index);
+GstOMXPort *gst_omx_component_get_port (GstOMXComponent * comp, guint32 index);
-OMX_ERRORTYPE gst_omx_component_get_parameter (GstOMXComponent * comp, OMX_INDEXTYPE index, gpointer param);
-OMX_ERRORTYPE gst_omx_component_set_parameter (GstOMXComponent * comp, OMX_INDEXTYPE index, gpointer param);
+OMX_ERRORTYPE gst_omx_component_get_parameter (GstOMXComponent * comp,
+ OMX_INDEXTYPE index, gpointer param);
+OMX_ERRORTYPE gst_omx_component_set_parameter (GstOMXComponent * comp,
+ OMX_INDEXTYPE index, gpointer param);
-OMX_ERRORTYPE gst_omx_component_get_config (GstOMXComponent * comp, OMX_INDEXTYPE index, gpointer config);
-OMX_ERRORTYPE gst_omx_component_set_config (GstOMXComponent * comp, OMX_INDEXTYPE index, gpointer config);
-OMX_ERRORTYPE gst_omx_component_setup_tunnel (GstOMXComponent * comp1, GstOMXPort * port1, GstOMXComponent * comp2, GstOMXPort * port2);
-OMX_ERRORTYPE gst_omx_component_close_tunnel (GstOMXComponent * comp1, GstOMXPort * port1, GstOMXComponent * comp2, GstOMXPort * port2);
+OMX_ERRORTYPE gst_omx_component_get_config (GstOMXComponent * comp,
+ OMX_INDEXTYPE index, gpointer config);
+OMX_ERRORTYPE gst_omx_component_set_config (GstOMXComponent * comp,
+ OMX_INDEXTYPE index, gpointer config);
+OMX_ERRORTYPE gst_omx_component_setup_tunnel (GstOMXComponent * comp1,
+ GstOMXPort * port1, GstOMXComponent * comp2, GstOMXPort * port2);
+OMX_ERRORTYPE gst_omx_component_close_tunnel (GstOMXComponent * comp1,
+ GstOMXPort * port1, GstOMXComponent * comp2, GstOMXPort * port2);
-OMX_ERRORTYPE gst_omx_port_get_port_definition (GstOMXPort * port, OMX_PARAM_PORTDEFINITIONTYPE * port_def);
-OMX_ERRORTYPE gst_omx_port_update_port_definition (GstOMXPort *port, OMX_PARAM_PORTDEFINITIONTYPE *port_definition);
+OMX_ERRORTYPE gst_omx_port_get_port_definition (GstOMXPort * port,
+ OMX_PARAM_PORTDEFINITIONTYPE * port_def);
+OMX_ERRORTYPE gst_omx_port_update_port_definition (GstOMXPort * port,
+ OMX_PARAM_PORTDEFINITIONTYPE * port_definition);
-GstOMXAcquireBufferReturn gst_omx_port_acquire_buffer (GstOMXPort *port, GstOMXBuffer **buf);
-OMX_ERRORTYPE gst_omx_port_release_buffer (GstOMXPort *port, GstOMXBuffer *buf);
+GstOMXAcquireBufferReturn gst_omx_port_acquire_buffer (GstOMXPort * port,
+ GstOMXBuffer ** buf);
+OMX_ERRORTYPE gst_omx_port_release_buffer (GstOMXPort * port,
+ GstOMXBuffer * buf);
-OMX_ERRORTYPE gst_omx_port_set_flushing (GstOMXPort *port, GstClockTime timeout, gboolean flush);
-gboolean gst_omx_port_is_flushing (GstOMXPort *port);
+OMX_ERRORTYPE gst_omx_port_set_flushing (GstOMXPort * port,
+ GstClockTime timeout, gboolean flush);
+gboolean gst_omx_port_is_flushing (GstOMXPort * port);
-OMX_ERRORTYPE gst_omx_port_allocate_buffers (GstOMXPort *port);
-OMX_ERRORTYPE gst_omx_port_use_buffers (GstOMXPort *port, const GList *buffers);
-OMX_ERRORTYPE gst_omx_port_use_eglimages (GstOMXPort *port, const GList *images);
-OMX_ERRORTYPE gst_omx_port_deallocate_buffers (GstOMXPort *port);
-OMX_ERRORTYPE gst_omx_port_populate (GstOMXPort *port);
-OMX_ERRORTYPE gst_omx_port_wait_buffers_released (GstOMXPort * port, GstClockTime timeout);
+OMX_ERRORTYPE gst_omx_port_allocate_buffers (GstOMXPort * port);
+OMX_ERRORTYPE gst_omx_port_use_buffers (GstOMXPort * port,
+ const GList * buffers);
+OMX_ERRORTYPE gst_omx_port_use_eglimages (GstOMXPort * port,
+ const GList * images);
+OMX_ERRORTYPE gst_omx_port_deallocate_buffers (GstOMXPort * port);
+OMX_ERRORTYPE gst_omx_port_populate (GstOMXPort * port);
+OMX_ERRORTYPE gst_omx_port_wait_buffers_released (GstOMXPort * port,
+ GstClockTime timeout);
-OMX_ERRORTYPE gst_omx_port_mark_reconfigured (GstOMXPort * port);
+OMX_ERRORTYPE gst_omx_port_mark_reconfigured (GstOMXPort * port);
-OMX_ERRORTYPE gst_omx_port_set_enabled (GstOMXPort * port, gboolean enabled);
-OMX_ERRORTYPE gst_omx_port_wait_enabled (GstOMXPort * port, GstClockTime timeout);
-gboolean gst_omx_port_is_enabled (GstOMXPort * port);
+OMX_ERRORTYPE gst_omx_port_set_enabled (GstOMXPort * port, gboolean enabled);
+OMX_ERRORTYPE gst_omx_port_wait_enabled (GstOMXPort * port,
+ GstClockTime timeout);
+gboolean gst_omx_port_is_enabled (GstOMXPort * port);
-void gst_omx_set_default_role (GstOMXClassData *class_data, const gchar *default_role);
+void gst_omx_set_default_role (GstOMXClassData * class_data,
+ const gchar * default_role);
+OMX_ERRORTYPE gst_omx_component_get_index (GstOMXComponent * comp, gpointer str,
+ OMX_INDEXTYPE * index);
-G_END_DECLS
+void gst_omx_handle_messages (GstOMXComponent * comp);
+G_END_DECLS
#endif /* __GST_OMX_H__ */