summaryrefslogtreecommitdiff
path: root/omx/gstomx.c
diff options
context:
space:
mode:
authornvidia <nvidia@nvidia.com>2015-11-04 15:57:23 +0000
committerJavier Jardón <jjardon@gnome.org>2015-11-04 16:07:49 +0000
commit72cd0878cf111dd1ec4081ece6d188122a293d64 (patch)
tree41c772015ff05a956e794fb3f419e00348e339bf /omx/gstomx.c
parentf3f9330332050f6e18b8fbeabf3791604b862ab0 (diff)
downloadgst-omx-72cd0878cf111dd1ec4081ece6d188122a293d64.tar.gz
Add NVIDIA omx implementationbaserock/1.0.0.1/tegra
Diffstat (limited to 'omx/gstomx.c')
-rw-r--r--omx/gstomx.c74
1 files changed, 68 insertions, 6 deletions
diff --git a/omx/gstomx.c b/omx/gstomx.c
index 4a81de9..fc3379c 100644
--- a/omx/gstomx.c
+++ b/omx/gstomx.c
@@ -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) 2013-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
@@ -33,13 +34,23 @@
#include "gstomxmpeg4videodec.h"
#include "gstomxh264dec.h"
#include "gstomxh263dec.h"
-#include "gstomxvp8dec.h"
#include "gstomxtheoradec.h"
#include "gstomxwmvdec.h"
#include "gstomxmpeg4videoenc.h"
#include "gstomxh264enc.h"
#include "gstomxh263enc.h"
#include "gstomxaacenc.h"
+#include "gstnvoverlaysink.h"
+#include "gstnvhdmioverlaysink.h"
+#include "gstomxaacdec.h"
+#include "gstomxmpegaudiodec.h"
+#include "gstomxamrnbdec.h"
+#include "gstomxamrwbdec.h"
+
+#ifdef HAVE_VP8
+#include "gstomxvp8dec.h"
+#include "gstomxvp8enc.h"
+#endif
GST_DEBUG_CATEGORY (gstomx_debug);
#define GST_CAT_DEFAULT gstomx_debug
@@ -47,6 +58,8 @@ GST_DEBUG_CATEGORY (gstomx_debug);
G_LOCK_DEFINE_STATIC (core_handles);
static GHashTable *core_handles;
+extern const char *default_config;
+
GstOMXCore *
gst_omx_core_acquire (const gchar * filename)
{
@@ -359,6 +372,10 @@ gst_omx_component_handle_messages (GstOMXComponent * comp)
buf->omx_buf->nOffset = 0;
buf->omx_buf->nFilledLen = 0;
+ /*Unref buffer, so it can be used again */
+ if (buf->gst_buf)
+ gst_buffer_unref (buf->gst_buf);
+
/* Reset all flags, some implementations don't
* reset them themselves and the flags are not
* valid anymore after the buffer was consumed
@@ -396,6 +413,13 @@ gst_omx_component_handle_messages (GstOMXComponent * comp)
g_mutex_unlock (&comp->messages_lock);
}
+
+void
+gst_omx_handle_messages (GstOMXComponent * comp)
+{
+ gst_omx_component_handle_messages (comp);
+}
+
/* NOTE: comp->messages_lock will be used */
static void
gst_omx_component_send_message (GstOMXComponent * comp, GstOMXMessage * msg)
@@ -508,7 +532,10 @@ EventHandler (OMX_HANDLETYPE hComponent, OMX_PTR pAppData, OMX_EVENTTYPE eEvent,
GST_DEBUG_OBJECT (comp->parent, "%s settings changed (port index: %u)",
comp->name, (guint) msg->content.port_settings_changed.port);
- gst_omx_component_send_message (comp, msg);
+ /* ignore crop and scale events */
+ if (nData2 != OMX_IndexConfigCommonOutputCrop
+ && nData2 != OMX_IndexConfigCommonScale)
+ gst_omx_component_send_message (comp, msg);
break;
}
case OMX_EventBufferFlag:{
@@ -930,6 +957,7 @@ gst_omx_component_add_port (GstOMXComponent * comp, guint32 index)
port->enabled_pending = FALSE;
port->disabled_pending = FALSE;
port->eos = FALSE;
+ port->reconfigure = FALSE;
if (port->port_def.eDir == OMX_DirInput)
comp->n_in_ports++;
@@ -1060,6 +1088,23 @@ gst_omx_component_set_config (GstOMXComponent * comp, OMX_INDEXTYPE index,
}
OMX_ERRORTYPE
+gst_omx_component_get_index (GstOMXComponent * comp, gpointer str,
+ OMX_INDEXTYPE * index)
+{
+ OMX_ERRORTYPE err;
+ g_return_val_if_fail (comp != NULL, OMX_ErrorUndefined);
+ g_return_val_if_fail (index != NULL, OMX_ErrorUndefined);
+
+ GST_DEBUG_OBJECT (comp->parent, "Getting %s Extension index for %s",
+ comp->name, (char *) str);
+ err = OMX_GetExtensionIndex (comp->handle, str, index);
+ GST_DEBUG_OBJECT (comp->parent, "Got %s Extension index for %s: %s "
+ "(0x%08x)", comp->name, (char *) str, gst_omx_error_to_string (err), err);
+
+ return err;
+}
+
+OMX_ERRORTYPE
gst_omx_component_setup_tunnel (GstOMXComponent * comp1, GstOMXPort * port1,
GstOMXComponent * comp2, GstOMXPort * port2)
{
@@ -2317,9 +2362,12 @@ static const GGetTypeFunction types[] = {
gst_omx_h264_dec_get_type, gst_omx_h263_dec_get_type,
gst_omx_wmv_dec_get_type, gst_omx_mpeg4_video_enc_get_type,
gst_omx_h264_enc_get_type, gst_omx_h263_enc_get_type,
- gst_omx_aac_enc_get_type, gst_omx_mjpeg_dec_get_type
+ gst_omx_aac_enc_get_type, gst_omx_mjpeg_dec_get_type,
+ gst_nv_overlay_sink_get_type, gst_nv_hdmi_overlay_sink_get_type,
+ gst_omx_aac_dec_get_type, gst_omx_mpegaudio_dec_get_type,
+ gst_omx_amrnb_dec_get_type, gst_omx_amrwb_dec_get_type
#ifdef HAVE_VP8
- , gst_omx_vp8_dec_get_type
+ , gst_omx_vp8_dec_get_type, gst_omx_vp8_enc_get_type
#endif
#ifdef HAVE_THEORA
, gst_omx_theora_dec_get_type
@@ -2336,6 +2384,8 @@ static const struct TypeOffest base_types[] = {
{gst_omx_video_dec_get_type, G_STRUCT_OFFSET (GstOMXVideoDecClass, cdata)},
{gst_omx_video_enc_get_type, G_STRUCT_OFFSET (GstOMXVideoEncClass, cdata)},
{gst_omx_audio_enc_get_type, G_STRUCT_OFFSET (GstOMXAudioEncClass, cdata)},
+ {gst_omx_video_sink_get_type, G_STRUCT_OFFSET (GstOmxVideoSinkClass, cdata)},
+ {gst_omx_audio_dec_get_type, G_STRUCT_OFFSET (GstOMXAudioDecClass, cdata)},
};
static GKeyFile *config = NULL;
@@ -2728,13 +2778,25 @@ plugin_init (GstPlugin * plugin)
gchar *paths;
paths = g_strjoinv (":", config_dirs);
- GST_ERROR ("Failed to load configuration file: %s (searched in: %s as per "
+ GST_WARNING
+ ("Failed to load configuration file: %s (searched in: %s as per "
"GST_OMX_CONFIG_DIR environment variable, the xdg user config "
"directory (or XDG_CONFIG_HOME) and the system config directory "
"(or XDG_CONFIG_DIRS)", err->message, paths);
+
g_free (paths);
g_error_free (err);
- goto done;
+ err = NULL;
+ GST_INFO ("Using default configuration");
+ if (default_config == NULL || !g_key_file_load_from_data (config,
+ default_config, strlen (default_config), G_KEY_FILE_NONE, &err)) {
+ if (err) {
+ GST_ERROR ("Failed to use default configuration: %s", err->message);
+ g_error_free (err);
+ } else
+ GST_ERROR ("Failed to use default configuration: no config string");
+ goto done;
+ }
}
/* Initialize all types */