omxvideodec: Make core/component-name and in/outport index configurable

This commit is contained in:
Sebastian Dröge 2011-07-12 10:55:57 +02:00
parent 940febae88
commit 113d18caea
3 changed files with 47 additions and 12 deletions

View file

@ -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);

View file

@ -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 =

View file

@ -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