diff --git a/omx/gstomxh264dec.c b/omx/gstomxh264dec.c index 91a656fa98..3ec2166e52 100644 --- a/omx/gstomxh264dec.c +++ b/omx/gstomxh264dec.c @@ -91,12 +91,6 @@ gst_omx_h264_dec_class_init (GstOMXH264DecClass * klass) gobject_class->finalize = gst_omx_h264_dec_finalize; - /* TODO: Make this configurable */ - videodec_class->core_name = "/usr/local/lib/libomxil-bellagio.so.0"; - videodec_class->component_name = "OMX.st.video_decoder.avc"; - videodec_class->in_port_index = 0; - videodec_class->out_port_index = 1; - videodec_class->is_format_change = GST_DEBUG_FUNCPTR (gst_omx_h264_dec_is_format_change); videodec_class->set_format = GST_DEBUG_FUNCPTR (gst_omx_h264_dec_set_format); diff --git a/omx/gstomxmpeg4videodec.c b/omx/gstomxmpeg4videodec.c index b70ff9f944..c956a8bc1b 100644 --- a/omx/gstomxmpeg4videodec.c +++ b/omx/gstomxmpeg4videodec.c @@ -93,12 +93,6 @@ gst_omx_mpeg4_video_dec_class_init (GstOMXMPEG4VideoDecClass * klass) gobject_class->finalize = gst_omx_mpeg4_video_dec_finalize; - /* TODO: Make this configurable */ - videodec_class->core_name = "/usr/local/lib/libomxil-bellagio.so.0"; - videodec_class->component_name = "OMX.st.video_decoder.mpeg4"; - videodec_class->in_port_index = 0; - videodec_class->out_port_index = 1; - videodec_class->is_format_change = GST_DEBUG_FUNCPTR (gst_omx_mpeg4_video_dec_is_format_change); videodec_class->set_format = diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c index b9445fdbe5..0130608034 100644 --- a/omx/gstomxvideodec.c +++ b/omx/gstomxvideodec.c @@ -77,6 +77,53 @@ GST_BOILERPLATE_FULL (GstOMXVideoDec, gst_omx_video_dec, GstBaseVideoDecoder, static void gst_omx_video_dec_base_init (gpointer g_class) { + GstOMXVideoDecClass *videodec_class = GST_OMX_VIDEO_DEC_CLASS (g_class); + GKeyFile *config; + const gchar *element_name; + GError *err; + gchar *core_name, *component_name; + gint in_port_index, out_port_index; + + element_name = + g_type_get_qdata (G_TYPE_FROM_CLASS (g_class), + gst_omx_element_name_quark); + /* This happens for the base class and abstract subclasses */ + if (!element_name) + return; + + config = gst_omx_get_configuration (); + + /* This will always succeed, see check in plugin_init */ + core_name = g_key_file_get_string (config, element_name, "core-name", NULL); + g_assert (core_name != NULL); + videodec_class->core_name = core_name; + component_name = + g_key_file_get_string (config, element_name, "component-name", NULL); + g_assert (component_name != NULL); + videodec_class->component_name = component_name; + + /* Now set the inport/outport indizes and assume sane defaults */ + err = NULL; + in_port_index = + g_key_file_get_integer (config, element_name, "in-port-index", &err); + if (err != NULL) { + GST_DEBUG ("No 'in-port-index' set for element '%s', assuming 0: %s", + element_name, err->message); + in_port_index = 0; + g_error_free (err); + } + videodec_class->in_port_index = in_port_index; + + err = NULL; + out_port_index = + g_key_file_get_integer (config, element_name, "out-port-index", &err); + if (err != NULL) { + GST_DEBUG ("No 'out-port-index' set for element '%s', assuming 1: %s", + element_name, err->message); + out_port_index = 1; + g_error_free (err); + } + videodec_class->out_port_index = out_port_index; } static void