You can subscribe to this list here.
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(2) |
Sep
|
Oct
(1) |
Nov
|
Dec
(8) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2008 |
Jan
(5) |
Feb
(3) |
Mar
|
Apr
(2) |
May
(4) |
Jun
(1) |
Jul
(11) |
Aug
(31) |
Sep
(2) |
Oct
(21) |
Nov
(16) |
Dec
(56) |
| 2009 |
Jan
(12) |
Feb
(5) |
Mar
(34) |
Apr
(9) |
May
(5) |
Jun
(7) |
Jul
(18) |
Aug
(5) |
Sep
(2) |
Oct
(6) |
Nov
(50) |
Dec
|
| 2010 |
Jan
(3) |
Feb
(67) |
Mar
(135) |
Apr
(30) |
May
(2) |
Jun
(11) |
Jul
|
Aug
(18) |
Sep
(12) |
Oct
(4) |
Nov
(17) |
Dec
(11) |
| 2011 |
Jan
(14) |
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Stefan K. <en...@ho...> - 2010-03-04 08:36:03
|
Felipe Contreras wrote:
> As suggested by Rob Clark.
>
> Signed-off-by: Felipe Contreras <fel...@no...>
> ---
> omx/gstomx_base_filter.c | 12 ++----------
> omx/gstomx_base_sink.c | 12 ++----------
> omx/gstomx_base_src.c | 12 ++----------
> 3 files changed, 6 insertions(+), 30 deletions(-)
>
> diff --git a/omx/gstomx_base_filter.c b/omx/gstomx_base_filter.c
> index 01ca10a..da41b4d 100644
> --- a/omx/gstomx_base_filter.c
> +++ b/omx/gstomx_base_filter.c
> @@ -201,14 +201,6 @@ set_property (GObject *obj,
>
> switch (prop_id)
> {
> - case ARG_COMPONENT_NAME:
> - g_free (self->gomx->component_name);
> - self->gomx->component_name = g_value_dup_string (value);
> - break;
> - case ARG_LIBRARY_NAME:
> - g_free (self->gomx->library_name);
> - self->gomx->library_name = g_value_dup_string (value);
> - break;
> case ARG_USE_TIMESTAMPS:
> self->use_timestamps = g_value_get_boolean (value);
> break;
> @@ -268,12 +260,12 @@ type_class_init (gpointer g_class,
> g_object_class_install_property (gobject_class, ARG_COMPONENT_NAME,
> g_param_spec_string ("component-name", "Component name",
> "Name of the OpenMAX IL component to use",
> - NULL, G_PARAM_READWRITE));
> + NULL, G_PARAM_READABLE));
>
> g_object_class_install_property (gobject_class, ARG_LIBRARY_NAME,
> g_param_spec_string ("library-name", "Library name",
> "Name of the OpenMAX IL implementation library to use",
> - NULL, G_PARAM_READWRITE));
> + NULL, G_PARAM_READABLE));
>
> g_object_class_install_property (gobject_class, ARG_USE_TIMESTAMPS,
> g_param_spec_boolean ("use-timestamps", "Use timestamps",
> diff --git a/omx/gstomx_base_sink.c b/omx/gstomx_base_sink.c
> index ac32799..b042f33 100644
> --- a/omx/gstomx_base_sink.c
> +++ b/omx/gstomx_base_sink.c
> @@ -295,14 +295,6 @@ set_property (GObject *obj,
>
> switch (prop_id)
> {
> - case ARG_COMPONENT_NAME:
> - g_free (self->gomx->component_name);
> - self->gomx->component_name = g_value_dup_string (value);
> - break;
> - case ARG_LIBRARY_NAME:
> - g_free (self->gomx->library_name);
> - self->gomx->library_name = g_value_dup_string (value);
> - break;
> default:
> G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
> break;
> @@ -363,12 +355,12 @@ type_class_init (gpointer g_class,
> g_object_class_install_property (gobject_class, ARG_COMPONENT_NAME,
> g_param_spec_string ("component-name", "Component name",
> "Name of the OpenMAX IL component to use",
> - NULL, G_PARAM_READWRITE));
> + NULL, G_PARAM_READABLE));
>
> g_object_class_install_property (gobject_class, ARG_LIBRARY_NAME,
> g_param_spec_string ("library-name", "Library name",
> "Name of the OpenMAX IL implementation library to use",
> - NULL, G_PARAM_READWRITE));
> + NULL, G_PARAM_READABLE));
> }
> }
>
> diff --git a/omx/gstomx_base_src.c b/omx/gstomx_base_src.c
> index 51aa189..bd25c6d 100644
> --- a/omx/gstomx_base_src.c
> +++ b/omx/gstomx_base_src.c
> @@ -359,14 +359,6 @@ set_property (GObject *obj,
>
> switch (prop_id)
> {
> - case ARG_COMPONENT_NAME:
> - g_free (self->gomx->component_name);
> - self->gomx->component_name = g_value_dup_string (value);
> - break;
> - case ARG_LIBRARY_NAME:
> - g_free (self->gomx->library_name);
> - self->gomx->library_name = g_value_dup_string (value);
> - break;
> default:
> G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
> break;
> @@ -424,12 +416,12 @@ type_class_init (gpointer g_class,
> g_object_class_install_property (gobject_class, ARG_COMPONENT_NAME,
> g_param_spec_string ("component-name", "Component name",
> "Name of the OpenMAX IL component to use",
> - NULL, G_PARAM_READWRITE));
> + NULL, G_PARAM_READABLE));
>
> g_object_class_install_property (gobject_class, ARG_LIBRARY_NAME,
> g_param_spec_string ("library-name", "Library name",
> "Name of the OpenMAX IL implementation library to use",
> - NULL, G_PARAM_READWRITE));
> + NULL, G_PARAM_READABLE));
> }
> }
>
>
As a minor optimization I'd suggest to use G_PARAM_STATIC_STRINGS in
addition. This avoids copying the ("library-name", "Library name", "Name
of the OpenMAX IL implementation library to use") stings. There is a
flag for each string, if only some are static.
Stefan
|
|
From: Clark, R. <ro...@ti...> - 2010-03-04 00:00:39
|
On Mar 3, 2010, at 5:07 PM, Felipe Contreras wrote: > On Tue, Mar 2, 2010 at 7:29 PM, Clark, Rob <ro...@ti...> wrote: >> >> On Mar 1, 2010, at 9:43 AM, Felipe Contreras wrote: >> >>> On Sat, Feb 27, 2010 at 8:24 PM, Rob Clark <ro...@ti...> wrote: >>>> btw, I'm thinking about this one again.. >>>> >>>> how about, in case of setting all params: >>>> >>>> OMX_AUDIO_PARAM_PCMMODETYPE param; >>>> >>>> G_OMX_INIT_PARAM (param); >>> >>> I think it should be: >>> >>> G_OMX_INIT_PARAM (OMX_AUDIO_PARAM_PCMMODETYPE, param); >>> >>>> ... set params ... >>>> >>>> G_OMX_PORT_SET_PARAM (port, OMX_IndexParamAudioPcm, ¶m); >>> >>> I don't see a big difference to: >>> >>> param.nPortIndex = 1; >>> OMX_SetParameter(omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); >>> >>>> or in case where you just want to set a few params: >>>> >>>> OMX_AUDIO_PARAM_PCMMODETYPE param; >>> >>> You forgot the init I guess. >> >> >> oh, btw, maybe it wasn't obvious, but current version of the patch combines the GET macro and INIT.. > > Oh, well I don't like that approach. > >> which is fine if you always follow GET/modify/SET pattern.. which seems like a reasonably good pattern to encourage. In normal cases you aren't setting all parameters in one place. Exceptions might be some param/config structs which only have one or two fields. > > I'm not a fan of patronizing users. And as you said; some structs have > one or two fields, and it's perfectly fine not to call Get in those > cases. I was leaning towards the approach of providing an INIT and a GET+INIT macro. But I could go either way with this.. I'm ok w/ separate INIT, GET, and SET APIs. I'm more interested in having port versions which sets nPortIndex automatically.. but as you mention below, due to the silly way the OMX structs are defined (with copy/paste rather than inheritance), we can't really safely[1] do it without a macro :-( that said, it is a pretty simple macro. Especially if we remove the INIT part of the macro. BR, -R --- [1] I did have a look thru all the standard config/param structs.. they *do* all have the same layout, so in theory we could implement as a function, and just cast the param/config void ptr to a OMX_PARAM_PORTDEFINITIONTYPE ptr and initialize nPortIndex.. but that isn't really an approach that helps me sleep well at night. All it takes is for someone to define a custom config/param struct which doesn't follow the standard layout, and you get silent badness. Whereas with the macro, you would catch the problem at compile time. > >> But it could be reasonable to to have an INIT function/macro as alternative to GET for those cases where GET/modify/SET really doesn't make sense. > > I don't like the idea of hiding things under the carpet. If the code > is doing: init ->get -> set, then that's what the code should look > like. > >> I still like the idea of making it conceptually a method of the GOmxPort object (ie. G_OMX_PORT_SET_PARAM(out_port, ...)) for port related params, since I think it makes it easier to read the code of the different gst-openmax element classes. > > I'm ok with a function that does this, but not with a macro, and I > don't think there's a way to do that. > > Cheers. > > -- > Felipe Contreras |
|
From: Clark, R. <ro...@ti...> - 2010-03-03 23:38:05
|
On Mar 3, 2010, at 4:51 PM, Felipe Contreras wrote:
> @@ -234,10 +231,10 @@ get_property (GObject *obj,
> switch (prop_id)
> {
> case ARG_COMPONENT_NAME:
> - g_value_set_string (value, self->omx_component);
> + g_value_set_string (value, self->gomx->component_name);
> break;
> case ARG_LIBRARY_NAME:
> - g_value_set_string (value, self->omx_library);
> + g_value_set_string (value, self->gomx->library_name);
> break;
one thought as I look at the patch (and something that I didn't think of either when I made my original patch)..
but the get_property() for component-name and library-name (and when I send a later patch, component-role) are basically identical..
what about adding a g_omx_core_get_property_helper() which could be shared by all the base classes? This way, when I send the patch to add component-role, it just changes GOmxCore and not the base classes ;-)
I can send the updated patch if you like the idea
BR,
-R
|
|
From: Felipe C. <fel...@gm...> - 2010-03-03 23:07:58
|
On Tue, Mar 2, 2010 at 7:29 PM, Clark, Rob <ro...@ti...> wrote: > > On Mar 1, 2010, at 9:43 AM, Felipe Contreras wrote: > >> On Sat, Feb 27, 2010 at 8:24 PM, Rob Clark <ro...@ti...> wrote: >>> btw, I'm thinking about this one again.. >>> >>> how about, in case of setting all params: >>> >>> OMX_AUDIO_PARAM_PCMMODETYPE param; >>> >>> G_OMX_INIT_PARAM (param); >> >> I think it should be: >> >> G_OMX_INIT_PARAM (OMX_AUDIO_PARAM_PCMMODETYPE, param); >> >>> ... set params ... >>> >>> G_OMX_PORT_SET_PARAM (port, OMX_IndexParamAudioPcm, ¶m); >> >> I don't see a big difference to: >> >> param.nPortIndex = 1; >> OMX_SetParameter(omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); >> >>> or in case where you just want to set a few params: >>> >>> OMX_AUDIO_PARAM_PCMMODETYPE param; >> >> You forgot the init I guess. > > > oh, btw, maybe it wasn't obvious, but current version of the patch combines the GET macro and INIT.. Oh, well I don't like that approach. > which is fine if you always follow GET/modify/SET pattern.. which seems like a reasonably good pattern to encourage. In normal cases you aren't setting all parameters in one place. Exceptions might be some param/config structs which only have one or two fields. I'm not a fan of patronizing users. And as you said; some structs have one or two fields, and it's perfectly fine not to call Get in those cases. > But it could be reasonable to to have an INIT function/macro as alternative to GET for those cases where GET/modify/SET really doesn't make sense. I don't like the idea of hiding things under the carpet. If the code is doing: init ->get -> set, then that's what the code should look like. > I still like the idea of making it conceptually a method of the GOmxPort object (ie. G_OMX_PORT_SET_PARAM(out_port, ...)) for port related params, since I think it makes it easier to read the code of the different gst-openmax element classes. I'm ok with a function that does this, but not with a macro, and I don't think there's a way to do that. Cheers. -- Felipe Contreras |
|
From: Clark, R. <ro...@ti...> - 2010-03-03 23:04:30
|
not a comment on current patch (which looks fine to me, btw), but a note about what I'm thinking for future evolution of config file..
since we are using a GstStructure as the the config file syntax, it would be really simple to start adding element specific fields. For example, anything that subclasses GstOmxBaseVideoDec could have an optional output-formats list. Like:
----
omx_h264dec,
type=GstOmxH264Dec,
library-name=libomxil-bellagio.so.0,
component-name=OMX.st.video_decoder.avc,
srcpad-formats=(fourcc){I420, YUY2, NV12},
rank=256;
----
or audio decoder could have fields for supported # of channels or rates, etc, etc.
It should be really easy to add an API to take an element and field name as parameter, and return a GValue which could be dropped into the caps.
At that point, it might make sense to move the library and component name strings out of the element.. I'm not sure. But that can come as a later patch.
(Oh, and I want to make those library-name and component-name properties as read-only too.. but also another patch)
Thoughts?
BR,
-R
On Mar 3, 2010, at 4:43 PM, Felipe Contreras wrote:
> From: Rob Clark <ro...@ti...>
>
> Configurable mapping between gst-openmax elements and OMX library-name
> and component-name via config file. The config file may even create
> multiple different elements with unique names using the same gst-openmax
> class but different OMX library-name and/or component-name.
>
> In the simple case, of one OMX component per gst-openmax class, specify
> the gst-openmax class as the 'type', and the 'library-name' and
> 'compnent-name' of the OMX component, and optionally the 'rank'
> (defaults to 0 or GST_RANK_NONE):
>
> ----
> omx_h264dec,
> type=GstOmxH264Dec,
> library-name=libomxil-bellagio.so.0,
> component-name=OMX.st.video_decoder.avc,
> rank=256;
> ----
>
> Or in the advanced case of multiple OMX components per gst-openmax
> class, specify the gst-openmax class as the 'parent-type' and a
> dynamically created sub-class for the 'type':
>
> ----
> omx_mp3dec_ti,
> parent-type=GstOmxMp3Dec,
> type=GstOmxMp3DecTi
> library-name=libOMX_Core.so.0,
> component-name=OMX.TI.AUDIO.DECODE,
> component-role=audio_decode.dsp.mp3,
> rank=256;
>
> omx_mp3dec_nokia,
> parent-type=GstOmxMp3Dec,
> type=GstOmxMp3DecNokia
> library-name=libomxil_bellagio.so.0,
> component-name=OMX.nokia.audio_decode.mp3,
> rank=128;
> ----
>
> By default, the config file is stored in $HOME/.config/gst-openmax.conf,
> although if none is found a default config will be created.
>
> Modified by Felipe Contreras to keep using the library and component
> names through qdata. Plus a bunch of cleanups and reorganization.
>
> Signed-off-by: Felipe Contreras <fel...@no...>
> ---
> omx/gstomx.c | 264 ++++++++++++++++++++++++++++++++++++++++++++++------------
> 1 files changed, 211 insertions(+), 53 deletions(-)
>
> diff --git a/omx/gstomx.c b/omx/gstomx.c
> index 6756f54..8b082a2 100644
> --- a/omx/gstomx.c
> +++ b/omx/gstomx.c
> @@ -21,6 +21,10 @@
>
> #include "config.h"
>
> +#include <string.h>
> +
> +#include <gst/gststructure.h>
> +
> #include "gstomx.h"
> #include "gstomx_dummy.h"
> #include "gstomx_mpeg4dec.h"
> @@ -59,85 +63,239 @@
>
> GST_DEBUG_CATEGORY (gstomx_debug);
>
> -typedef struct TableItem
> -{
> - const gchar *name;
> - const gchar *library_name;
> - const gchar *component_name;
> - guint rank;
> - GType (*get_type) (void);
> -} TableItem;
> -
> -static TableItem element_table[] =
> -{
> - { "omx_dummy", "libomxil-bellagio.so.0", "OMX.st.dummy", GST_RANK_NONE, gst_omx_dummy_get_type },
> - { "omx_mpeg4dec", "libomxil-bellagio.so.0", "OMX.st.video_decoder.mpeg4", GST_RANK_PRIMARY, gst_omx_mpeg4dec_get_type },
> - { "omx_h264dec", "libomxil-bellagio.so.0", "OMX.st.video_decoder.avc", GST_RANK_PRIMARY, gst_omx_h264dec_get_type },
> - { "omx_h263dec", "libomxil-bellagio.so.0", "OMX.st.video_decoder.h263", GST_RANK_PRIMARY, gst_omx_h263dec_get_type },
> - { "omx_wmvdec", "libomxil-bellagio.so.0", "OMX.st.video_decoder.wmv", GST_RANK_PRIMARY, gst_omx_wmvdec_get_type },
> - { "omx_mpeg4enc", "libomxil-bellagio.so.0", "OMX.st.video_encoder.mpeg4", GST_RANK_PRIMARY, gst_omx_mpeg4enc_get_type },
> - { "omx_h264enc", "libomxil-bellagio.so.0", "OMX.st.video_encoder.avc", GST_RANK_PRIMARY, gst_omx_h264enc_get_type },
> - { "omx_h263enc", "libomxil-bellagio.so.0", "OMX.st.video_encoder.h263", GST_RANK_PRIMARY, gst_omx_h263enc_get_type },
> - { "omx_vorbisdec", "libomxil-bellagio.so.0", "OMX.st.audio_decoder.ogg.single", GST_RANK_SECONDARY, gst_omx_vorbisdec_get_type },
> - { "omx_mp3dec", "libomxil-bellagio.so.0", "OMX.st.audio_decoder.mp3.mad", GST_RANK_PRIMARY, gst_omx_mp3dec_get_type },
> +static GstStructure *element_table = NULL;
> +static GQuark element_name_quark;
> +
> +const gchar *default_config = NULL;
> +
> +static GType (*get_type[]) (void) = {
> + gst_omx_dummy_get_type,
> + gst_omx_mpeg4dec_get_type,
> + gst_omx_h264dec_get_type,
> + gst_omx_h263dec_get_type,
> + gst_omx_wmvdec_get_type,
> + gst_omx_mpeg4enc_get_type,
> + gst_omx_h264enc_get_type,
> + gst_omx_h263enc_get_type,
> + gst_omx_vorbisdec_get_type,
> + gst_omx_mp3dec_get_type,
> #ifdef EXPERIMENTAL
> - { "omx_mp2dec", "libomxil-bellagio.so.0", "OMX.st.audio_decoder.mp3.mad", GST_RANK_PRIMARY, gst_omx_mp2dec_get_type },
> - { "omx_amrnbdec", "libomxil-bellagio.so.0", "OMX.st.audio_decoder.amrnb", GST_RANK_PRIMARY, gst_omx_amrnbdec_get_type },
> - { "omx_amrnbenc", "libomxil-bellagio.so.0", "OMX.st.audio_encoder.amrnb", GST_RANK_PRIMARY, gst_omx_amrnbenc_get_type },
> - { "omx_amrwbdec", "libomxil-bellagio.so.0", "OMX.st.audio_decoder.amrwb", GST_RANK_PRIMARY, gst_omx_amrwbdec_get_type },
> - { "omx_amrwbenc", "libomxil-bellagio.so.0", "OMX.st.audio_encoder.amrwb", GST_RANK_PRIMARY, gst_omx_amrwbenc_get_type },
> - { "omx_aacdec", "libomxil-bellagio.so.0", "OMX.st.audio_decoder.aac", GST_RANK_PRIMARY, gst_omx_aacdec_get_type },
> - { "omx_aacenc", "libomxil-bellagio.so.0", "OMX.st.audio_encoder.aac", GST_RANK_PRIMARY, gst_omx_aacenc_get_type },
> - { "omx_adpcmdec", "libomxil-bellagio.so.0", "OMX.st.audio_decoder.adpcm", GST_RANK_PRIMARY, gst_omx_adpcmdec_get_type },
> - { "omx_adpcmenc", "libomxil-bellagio.so.0", "OMX.st.audio_encoder.adpcm", GST_RANK_PRIMARY, gst_omx_adpcmenc_get_type },
> - { "omx_g711dec", "libomxil-bellagio.so.0", "OMX.st.audio_decoder.g711", GST_RANK_PRIMARY, gst_omx_g711dec_get_type },
> - { "omx_g711enc", "libomxil-bellagio.so.0", "OMX.st.audio_encoder.g711", GST_RANK_PRIMARY, gst_omx_g711enc_get_type },
> - { "omx_g729dec", "libomxil-bellagio.so.0", "OMX.st.audio_decoder.g729", GST_RANK_PRIMARY, gst_omx_g729dec_get_type },
> - { "omx_g729enc", "libomxil-bellagio.so.0", "OMX.st.audio_encoder.g729", GST_RANK_PRIMARY, gst_omx_g729enc_get_type },
> - { "omx_ilbcdec", "libomxil-bellagio.so.0", "OMX.st.audio_decoder.ilbc", GST_RANK_PRIMARY, gst_omx_ilbcdec_get_type },
> - { "omx_ilbcenc", "libomxil-bellagio.so.0", "OMX.st.audio_encoder.ilbc", GST_RANK_PRIMARY, gst_omx_ilbcenc_get_type },
> - { "omx_jpegenc", "libomxil-bellagio.so.0", "OMX.st.image_encoder.jpeg", GST_RANK_PRIMARY, gst_omx_jpegenc_get_type },
> + gst_omx_mp2dec_get_type,
> + gst_omx_amrnbdec_get_type,
> + gst_omx_amrnbenc_get_type,
> + gst_omx_amrwbdec_get_type,
> + gst_omx_amrwbenc_get_type,
> + gst_omx_aacdec_get_type,
> + gst_omx_aacenc_get_type,
> + gst_omx_adpcmdec_get_type,
> + gst_omx_adpcmenc_get_type,
> + gst_omx_g711dec_get_type,
> + gst_omx_g711enc_get_type,
> + gst_omx_g729dec_get_type,
> + gst_omx_g729enc_get_type,
> + gst_omx_ilbcdec_get_type,
> + gst_omx_ilbcenc_get_type,
> + gst_omx_jpegenc_get_type,
> #endif /* EXPERIMENTAL */
> - { "omx_audiosink", "libomxil-bellagio.so.0", "OMX.st.alsa.alsasink", GST_RANK_NONE, gst_omx_audiosink_get_type },
> + gst_omx_audiosink_get_type,
> #ifdef EXPERIMENTAL
> - { "omx_videosink", "libomxil-bellagio.so.0", "OMX.st.videosink", GST_RANK_NONE, gst_omx_videosink_get_type },
> - { "omx_filereadersrc", "libomxil-bellagio.so.0", "OMX.st.audio_filereader", GST_RANK_NONE, gst_omx_filereadersrc_get_type },
> + gst_omx_videosink_get_type,
> + gst_omx_filereadersrc_get_type,
> #endif /* EXPERIMENTAL */
> - { "omx_volume", "libomxil-bellagio.so.0", "OMX.st.volume.component", GST_RANK_NONE, gst_omx_volume_get_type },
> - { NULL, NULL, NULL, 0, NULL },
> + gst_omx_volume_get_type,
> };
>
> +/**
> + * @todo find a way to call plugin_init() when the config file changes
> + * @todo support a system-wide config file
> + * @todo provide a recommended system-wide config file
> + */
> +
> +/* TODO: we can cache table w/ gst_plugin_{get,set}_cache_data..
> + */
> +static GstStructure *
> +get_element_table (void)
> +{
> + static volatile gsize gonce_data = 0;
> + if (g_once_init_enter (&gonce_data))
> + {
> + gchar *path;
> + gchar *config, *s;
> + GstStructure *element;
> +
> + path = g_strdup (g_getenv ("OMX_REGISTRY"));
> + if (!path)
> + {
> + path = g_build_filename (g_get_user_config_dir (),
> + "gst-openmax.conf", NULL);
> + }
> +
> + if (!g_file_get_contents (path, &config, NULL, NULL))
> + {
> + g_warning ("could not find config file '%s'.. using defaults!", path);
> + config = (gchar *) default_config;
> + }
> +
> + g_free (path);
> +
> + GST_DEBUG ("parsing config:\n%s", config);
> +
> + element_table = gst_structure_empty_new ("element_table");
> +
> + s = config;
> +
> + while ((element = gst_structure_from_string (s, &s)))
> + {
> + const gchar *element_name = gst_structure_get_name (element);
> + gst_structure_set (element_table,
> + element_name, GST_TYPE_STRUCTURE, element, NULL);
> + }
> +
> + if (config != default_config)
> + g_free (config);
> +
> + GST_DEBUG ("element_table=%" GST_PTR_FORMAT, element_table);
> +
> + g_once_init_leave (&gonce_data, 1);
> + }
> +
> + return element_table;
> +}
> +
> +static GstStructure *
> +get_element_entry (const gchar *element_name)
> +{
> + GstStructure *element_table = get_element_table ();
> + GstStructure *element;
> +
> + if (!gst_structure_get (element_table, element_name,
> + GST_TYPE_STRUCTURE, &element, NULL))
> + {
> + element = NULL;
> + }
> +
> + /* This assert should never fail, because plugin elements are registered
> + * based on the entries in this table. Someone would have to manually
> + * override the type qdata for this to fail.
> + */
> + g_assert (element);
> +
> + return element;
> +}
> +
> +/* register a new dynamic sub-class with the name 'type_name'.. this gives us
> + * a way to use the same (for example) GstOmxMp3Dec element mapping to
> + * multiple different element names with different OMX library implementations
> + * and/or component names
> + */
> +static GType
> +create_subtype (GType parent_type, const gchar *type_name)
> +{
> + GTypeQuery q;
> + GTypeInfo i = {0};
> +
> + if (!type_name)
> + return 0;
> +
> + g_type_query (parent_type, &q);
> +
> + i.class_size = q.class_size;
> + i.instance_size = q.instance_size;
> +
> + return g_type_register_static (parent_type, type_name, &i, 0);
> +}
> +
> static gboolean
> plugin_init (GstPlugin *plugin)
> {
> GQuark library_name_quark;
> GQuark component_name_quark;
> + gint i, cnt;
> + GstStructure *element_table;
> +
> GST_DEBUG_CATEGORY_INIT (gstomx_debug, "omx", 0, "gst-openmax");
> GST_DEBUG_CATEGORY_INIT (gstomx_util_debug, "omx_util", 0, "gst-openmax utility");
>
> library_name_quark = g_quark_from_static_string ("library-name");
> component_name_quark = g_quark_from_static_string ("component-name");
> + element_name_quark = g_quark_from_static_string ("element-name");
> +
> + /*
> + * First, call all the _get_type() functions to ensure the types are
> + * registered.
> + */
> + for (i = 0; i < G_N_ELEMENTS (get_type); i++)
> + get_type[i] ();
> +
> + element_table = get_element_table ();
>
> g_omx_init ();
>
> + cnt = gst_structure_n_fields (element_table);
> + for (i = 0; i < cnt; i++)
> {
> - guint i;
> - for (i = 0; element_table[i].name; i++)
> - {
> - TableItem *element;
> - GType type;
> + const gchar *element_name = gst_structure_nth_field_name (element_table, i);
> + GstStructure *element = get_element_entry (element_name);
> + const gchar *type_name, *parent_type_name;
> + const gchar *component_name, *library_name;
> + GType type;
> + gint rank;
>
> - element = &element_table[i];
> - type = element->get_type ();
> - g_type_set_qdata (type, library_name_quark, (gpointer) element->library_name);
> - g_type_set_qdata (type, component_name_quark, (gpointer) element->component_name);
> + GST_DEBUG ("element_name=%s, element=%" GST_PTR_FORMAT, element_name, element);
>
> - if (!gst_element_register (plugin, element->name, element->rank, type))
> + parent_type_name = gst_structure_get_string (element, "parent-type");
> + type_name = gst_structure_get_string (element, "type");
> + component_name = gst_structure_get_string (element, "component-name");
> + library_name = gst_structure_get_string (element, "library-name");
> +
> + if (!type_name || !component_name || !library_name)
> + {
> + g_warning ("malformed config file: missing required fields for %s",
> + element_name);
> + return FALSE;
> + }
> +
> + if (parent_type_name)
> + {
> + type = g_type_from_name (parent_type_name);
> + if (type)
> + {
> + type = create_subtype (type, type_name);
> + }
> + else
> {
> - g_warning ("failed registering '%s'", element->name);
> + g_warning ("malformed config file: invalid parent-type '%s' for %s",
> + parent_type_name, element_name);
> return FALSE;
> }
> }
> + else
> + {
> + type = g_type_from_name (type_name);
> + }
> +
> + if (!type)
> + {
> + g_warning ("malformed config file: invalid type '%s' for %s",
> + type_name, element_name);
> + return FALSE;
> + }
> +
> + g_type_set_qdata (type, library_name_quark, (gpointer) library_name);
> + g_type_set_qdata (type, component_name_quark, (gpointer) component_name);
> + g_type_set_qdata (type, element_name_quark, (gpointer) element_name);
> +
> + if (!gst_structure_get_int (element, "rank", &rank))
> + {
> + /* use default rank: */
> + rank = GST_RANK_NONE;
> + }
> +
> + if (!gst_element_register (plugin, element_name, rank, type))
> + {
> + g_warning ("failed registering '%s'", element_name);
> + return FALSE;
> + }
> }
>
> return TRUE;
> --
> 1.7.0.1
>
|
|
From: Felipe C. <fel...@no...> - 2010-03-03 22:52:27
|
As suggested by Rob Clark.
Signed-off-by: Felipe Contreras <fel...@no...>
---
omx/gstomx_base_filter.c | 12 ++----------
omx/gstomx_base_sink.c | 12 ++----------
omx/gstomx_base_src.c | 12 ++----------
3 files changed, 6 insertions(+), 30 deletions(-)
diff --git a/omx/gstomx_base_filter.c b/omx/gstomx_base_filter.c
index 01ca10a..da41b4d 100644
--- a/omx/gstomx_base_filter.c
+++ b/omx/gstomx_base_filter.c
@@ -201,14 +201,6 @@ set_property (GObject *obj,
switch (prop_id)
{
- case ARG_COMPONENT_NAME:
- g_free (self->gomx->component_name);
- self->gomx->component_name = g_value_dup_string (value);
- break;
- case ARG_LIBRARY_NAME:
- g_free (self->gomx->library_name);
- self->gomx->library_name = g_value_dup_string (value);
- break;
case ARG_USE_TIMESTAMPS:
self->use_timestamps = g_value_get_boolean (value);
break;
@@ -268,12 +260,12 @@ type_class_init (gpointer g_class,
g_object_class_install_property (gobject_class, ARG_COMPONENT_NAME,
g_param_spec_string ("component-name", "Component name",
"Name of the OpenMAX IL component to use",
- NULL, G_PARAM_READWRITE));
+ NULL, G_PARAM_READABLE));
g_object_class_install_property (gobject_class, ARG_LIBRARY_NAME,
g_param_spec_string ("library-name", "Library name",
"Name of the OpenMAX IL implementation library to use",
- NULL, G_PARAM_READWRITE));
+ NULL, G_PARAM_READABLE));
g_object_class_install_property (gobject_class, ARG_USE_TIMESTAMPS,
g_param_spec_boolean ("use-timestamps", "Use timestamps",
diff --git a/omx/gstomx_base_sink.c b/omx/gstomx_base_sink.c
index ac32799..b042f33 100644
--- a/omx/gstomx_base_sink.c
+++ b/omx/gstomx_base_sink.c
@@ -295,14 +295,6 @@ set_property (GObject *obj,
switch (prop_id)
{
- case ARG_COMPONENT_NAME:
- g_free (self->gomx->component_name);
- self->gomx->component_name = g_value_dup_string (value);
- break;
- case ARG_LIBRARY_NAME:
- g_free (self->gomx->library_name);
- self->gomx->library_name = g_value_dup_string (value);
- break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
break;
@@ -363,12 +355,12 @@ type_class_init (gpointer g_class,
g_object_class_install_property (gobject_class, ARG_COMPONENT_NAME,
g_param_spec_string ("component-name", "Component name",
"Name of the OpenMAX IL component to use",
- NULL, G_PARAM_READWRITE));
+ NULL, G_PARAM_READABLE));
g_object_class_install_property (gobject_class, ARG_LIBRARY_NAME,
g_param_spec_string ("library-name", "Library name",
"Name of the OpenMAX IL implementation library to use",
- NULL, G_PARAM_READWRITE));
+ NULL, G_PARAM_READABLE));
}
}
diff --git a/omx/gstomx_base_src.c b/omx/gstomx_base_src.c
index 51aa189..bd25c6d 100644
--- a/omx/gstomx_base_src.c
+++ b/omx/gstomx_base_src.c
@@ -359,14 +359,6 @@ set_property (GObject *obj,
switch (prop_id)
{
- case ARG_COMPONENT_NAME:
- g_free (self->gomx->component_name);
- self->gomx->component_name = g_value_dup_string (value);
- break;
- case ARG_LIBRARY_NAME:
- g_free (self->gomx->library_name);
- self->gomx->library_name = g_value_dup_string (value);
- break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
break;
@@ -424,12 +416,12 @@ type_class_init (gpointer g_class,
g_object_class_install_property (gobject_class, ARG_COMPONENT_NAME,
g_param_spec_string ("component-name", "Component name",
"Name of the OpenMAX IL component to use",
- NULL, G_PARAM_READWRITE));
+ NULL, G_PARAM_READABLE));
g_object_class_install_property (gobject_class, ARG_LIBRARY_NAME,
g_param_spec_string ("library-name", "Library name",
"Name of the OpenMAX IL implementation library to use",
- NULL, G_PARAM_READWRITE));
+ NULL, G_PARAM_READABLE));
}
}
--
1.7.0.1
|
|
From: Felipe C. <fel...@gm...> - 2010-03-03 22:51:40
|
On Wed, Mar 3, 2010 at 3:57 PM, Rob Clark <ro...@ti...> wrote: > --- > tests/Makefile.am | 3 ++- > tests/check_gstomx.c | 2 -- > tests/gst-openmax.conf | 6 ++++++ > 3 files changed, 8 insertions(+), 3 deletions(-) > create mode 100644 tests/gst-openmax.conf Great! ACK'ed. -- Felipe Contreras |
|
From: Felipe C. <fel...@no...> - 2010-03-03 22:51:36
|
No more writeable properties.
Signed-off-by: Felipe Contreras <fel...@no...>
---
omx/gstomx_base_sink.c | 19 -------------------
omx/gstomx_base_src.c | 19 -------------------
2 files changed, 0 insertions(+), 38 deletions(-)
diff --git a/omx/gstomx_base_sink.c b/omx/gstomx_base_sink.c
index b042f33..68c7ea7 100644
--- a/omx/gstomx_base_sink.c
+++ b/omx/gstomx_base_sink.c
@@ -284,24 +284,6 @@ handle_event (GstBaseSink *gst_base,
}
static void
-set_property (GObject *obj,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- GstOmxBaseSink *self;
-
- self = GST_OMX_BASE_SINK (obj);
-
- switch (prop_id)
- {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
- break;
- }
-}
-
-static void
get_property (GObject *obj,
guint prop_id,
GValue *value,
@@ -349,7 +331,6 @@ type_class_init (gpointer g_class,
/* Properties stuff */
{
- gobject_class->set_property = set_property;
gobject_class->get_property = get_property;
g_object_class_install_property (gobject_class, ARG_COMPONENT_NAME,
diff --git a/omx/gstomx_base_src.c b/omx/gstomx_base_src.c
index bd25c6d..bae9f55 100644
--- a/omx/gstomx_base_src.c
+++ b/omx/gstomx_base_src.c
@@ -348,24 +348,6 @@ handle_event (GstBaseSrc *gst_base,
}
static void
-set_property (GObject *obj,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- GstOmxBaseSrc *self;
-
- self = GST_OMX_BASE_SRC (obj);
-
- switch (prop_id)
- {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
- break;
- }
-}
-
-static void
get_property (GObject *obj,
guint prop_id,
GValue *value,
@@ -410,7 +392,6 @@ type_class_init (gpointer g_class,
/* Properties stuff */
{
- gobject_class->set_property = set_property;
gobject_class->get_property = get_property;
g_object_class_install_property (gobject_class, ARG_COMPONENT_NAME,
--
1.7.0.1
|
|
From: Felipe C. <fel...@no...> - 2010-03-03 22:51:35
|
No need to duplicate these, and also will be helpful for upcoming
commits.
Signed-off-by: Felipe Contreras <fel...@no...>
---
omx/gstomx_base_filter.c | 21 +++++++++------------
omx/gstomx_base_filter.h | 2 --
omx/gstomx_base_sink.c | 21 +++++++++------------
omx/gstomx_base_sink.h | 3 ---
omx/gstomx_base_src.c | 28 +++++++++-------------------
omx/gstomx_base_src.h | 2 --
omx/gstomx_util.c | 11 ++++++-----
omx/gstomx_util.h | 5 ++++-
8 files changed, 37 insertions(+), 56 deletions(-)
diff --git a/omx/gstomx_base_filter.c b/omx/gstomx_base_filter.c
index b0353cb..fd3f071 100644
--- a/omx/gstomx_base_filter.c
+++ b/omx/gstomx_base_filter.c
@@ -115,7 +115,7 @@ change_state (GstElement *element,
switch (transition)
{
case GST_STATE_CHANGE_NULL_TO_READY:
- g_omx_core_init (core, self->omx_library, self->omx_component);
+ g_omx_core_init (core);
if (core->omx_state != OMX_StateLoaded)
{
ret = GST_STATE_CHANGE_FAILURE;
@@ -184,9 +184,6 @@ finalize (GObject *obj)
g_omx_core_free (self->gomx);
- g_free (self->omx_component);
- g_free (self->omx_library);
-
g_mutex_free (self->ready_lock);
G_OBJECT_CLASS (parent_class)->finalize (obj);
@@ -205,12 +202,12 @@ set_property (GObject *obj,
switch (prop_id)
{
case ARG_COMPONENT_NAME:
- g_free (self->omx_component);
- self->omx_component = g_value_dup_string (value);
+ g_free (self->gomx->component_name);
+ self->gomx->component_name = g_value_dup_string (value);
break;
case ARG_LIBRARY_NAME:
- g_free (self->omx_library);
- self->omx_library = g_value_dup_string (value);
+ g_free (self->gomx->library_name);
+ self->gomx->library_name = g_value_dup_string (value);
break;
case ARG_USE_TIMESTAMPS:
self->use_timestamps = g_value_get_boolean (value);
@@ -234,10 +231,10 @@ get_property (GObject *obj,
switch (prop_id)
{
case ARG_COMPONENT_NAME:
- g_value_set_string (value, self->omx_component);
+ g_value_set_string (value, self->gomx->component_name);
break;
case ARG_LIBRARY_NAME:
- g_value_set_string (value, self->omx_library);
+ g_value_set_string (value, self->gomx->library_name);
break;
case ARG_USE_TIMESTAMPS:
g_value_set_boolean (value, self->use_timestamps);
@@ -926,10 +923,10 @@ type_instance_init (GTypeInstance *instance,
const char *tmp;
tmp = g_type_get_qdata (G_OBJECT_CLASS_TYPE (g_class),
g_quark_from_static_string ("library-name"));
- self->omx_library = g_strdup (tmp);
+ self->gomx->library_name = g_strdup (tmp);
tmp = g_type_get_qdata (G_OBJECT_CLASS_TYPE (g_class),
g_quark_from_static_string ("component-name"));
- self->omx_component = g_strdup (tmp);
+ self->gomx->component_name = g_strdup (tmp);
}
GST_LOG_OBJECT (self, "end");
diff --git a/omx/gstomx_base_filter.h b/omx/gstomx_base_filter.h
index 4baf181..99b5d72 100644
--- a/omx/gstomx_base_filter.h
+++ b/omx/gstomx_base_filter.h
@@ -48,8 +48,6 @@ struct GstOmxBaseFilter
GOmxPort *in_port;
GOmxPort *out_port;
- char *omx_component;
- char *omx_library;
gboolean use_timestamps; /** @todo remove; timestamps should always be used */
gboolean ready;
GMutex *ready_lock;
diff --git a/omx/gstomx_base_sink.c b/omx/gstomx_base_sink.c
index c1a2076..5afb11d 100644
--- a/omx/gstomx_base_sink.c
+++ b/omx/gstomx_base_sink.c
@@ -141,9 +141,6 @@ finalize (GObject *obj)
g_omx_core_free (self->gomx);
- g_free (self->omx_component);
- g_free (self->omx_library);
-
G_OBJECT_CLASS (parent_class)->finalize (obj);
}
@@ -299,12 +296,12 @@ set_property (GObject *obj,
switch (prop_id)
{
case ARG_COMPONENT_NAME:
- g_free (self->omx_component);
- self->omx_component = g_value_dup_string (value);
+ g_free (self->gomx->component_name);
+ self->gomx->component_name = g_value_dup_string (value);
break;
case ARG_LIBRARY_NAME:
- g_free (self->omx_library);
- self->omx_library = g_value_dup_string (value);
+ g_free (self->gomx->library_name);
+ self->gomx->library_name = g_value_dup_string (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
@@ -325,10 +322,10 @@ get_property (GObject *obj,
switch (prop_id)
{
case ARG_COMPONENT_NAME:
- g_value_set_string (value, self->omx_component);
+ g_value_set_string (value, self->gomx->component_name);
break;
case ARG_LIBRARY_NAME:
- g_value_set_string (value, self->omx_library);
+ g_value_set_string (value, self->gomx->library_name);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
@@ -420,7 +417,7 @@ activate_push (GstPad *pad,
static inline gboolean
omx_init (GstOmxBaseSink *self)
{
- g_omx_core_init (self->gomx, self->omx_library, self->omx_component);
+ g_omx_core_init (self->gomx);
if (self->gomx->omx_error)
return FALSE;
@@ -471,10 +468,10 @@ type_instance_init (GTypeInstance *instance,
const char *tmp;
tmp = g_type_get_qdata (G_OBJECT_CLASS_TYPE (g_class),
g_quark_from_static_string ("library-name"));
- self->omx_library = g_strdup (tmp);
+ self->gomx->library_name = g_strdup (tmp);
tmp = g_type_get_qdata (G_OBJECT_CLASS_TYPE (g_class),
g_quark_from_static_string ("component-name"));
- self->omx_component = g_strdup (tmp);
+ self->gomx->component_name = g_strdup (tmp);
}
{
diff --git a/omx/gstomx_base_sink.h b/omx/gstomx_base_sink.h
index 681e939..589c441 100644
--- a/omx/gstomx_base_sink.h
+++ b/omx/gstomx_base_sink.h
@@ -46,9 +46,6 @@ struct GstOmxBaseSink
GOmxCore *gomx;
GOmxPort *in_port;
- char *omx_component;
- char *omx_library;
-
gboolean ready;
GstPadActivateModeFunction base_activatepush;
gboolean initialized;
diff --git a/omx/gstomx_base_src.c b/omx/gstomx_base_src.c
index 9b02b22..4e67a71 100644
--- a/omx/gstomx_base_src.c
+++ b/omx/gstomx_base_src.c
@@ -67,7 +67,7 @@ start (GstBaseSrc *gst_base)
GST_LOG_OBJECT (self, "begin");
- g_omx_core_init (self->gomx, self->omx_library, self->omx_component);
+ g_omx_core_init (self->gomx);
if (self->gomx->omx_error)
return GST_STATE_CHANGE_FAILURE;
@@ -106,9 +106,6 @@ finalize (GObject *obj)
g_omx_core_free (self->gomx);
- g_free (self->omx_component);
- g_free (self->omx_library);
-
G_OBJECT_CLASS (parent_class)->finalize (obj);
}
@@ -363,18 +360,12 @@ set_property (GObject *obj,
switch (prop_id)
{
case ARG_COMPONENT_NAME:
- if (self->omx_component)
- {
- g_free (self->omx_component);
- }
- self->omx_component = g_value_dup_string (value);
+ g_free (self->gomx->component_name);
+ self->gomx->component_name = g_value_dup_string (value);
break;
case ARG_LIBRARY_NAME:
- if (self->omx_library)
- {
- g_free (self->omx_library);
- }
- self->omx_library = g_value_dup_string (value);
+ g_free (self->gomx->library_name);
+ self->gomx->library_name = g_value_dup_string (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
@@ -395,10 +386,10 @@ get_property (GObject *obj,
switch (prop_id)
{
case ARG_COMPONENT_NAME:
- g_value_set_string (value, self->omx_component);
+ g_value_set_string (value, self->gomx->component_name);
break;
case ARG_LIBRARY_NAME:
- g_value_set_string (value, self->omx_library);
+ g_value_set_string (value, self->gomx->library_name);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
@@ -463,13 +454,12 @@ type_instance_init (GTypeInstance *instance,
const char *tmp;
tmp = g_type_get_qdata (G_OBJECT_CLASS_TYPE (g_class),
g_quark_from_static_string ("library-name"));
- self->omx_library = g_strdup (tmp);
+ self->gomx->library_name = g_strdup (tmp);
tmp = g_type_get_qdata (G_OBJECT_CLASS_TYPE (g_class),
g_quark_from_static_string ("component-name"));
- self->omx_component = g_strdup (tmp);
+ self->gomx->component_name = g_strdup (tmp);
}
-
GST_LOG_OBJECT (self, "end");
}
diff --git a/omx/gstomx_base_src.h b/omx/gstomx_base_src.h
index 85e4c13..adab894 100644
--- a/omx/gstomx_base_src.h
+++ b/omx/gstomx_base_src.h
@@ -44,8 +44,6 @@ struct GstOmxBaseSrc
GOmxCore *gomx;
GOmxPort *out_port;
- char *omx_component;
- char *omx_library;
GstOmxBaseSrcCb setup_ports;
};
diff --git a/omx/gstomx_util.c b/omx/gstomx_util.c
index 39d900b..c61f849 100644
--- a/omx/gstomx_util.c
+++ b/omx/gstomx_util.c
@@ -301,17 +301,15 @@ g_omx_core_free (GOmxCore *core)
}
void
-g_omx_core_init (GOmxCore *core,
- const gchar *library_name,
- const gchar *component_name)
+g_omx_core_init (GOmxCore *core)
{
- core->imp = request_imp (library_name);
+ core->imp = request_imp (core->library_name);
if (!core->imp)
return;
core->omx_error = core->imp->sym_table.get_handle (&core->omx_handle,
- (char *) component_name,
+ (char *) core->component_name,
core,
&callbacks);
if (!core->omx_error)
@@ -331,6 +329,9 @@ g_omx_core_deinit (GOmxCore *core)
core->omx_error = core->imp->sym_table.free_handle (core->omx_handle);
}
+ g_free (core->library_name);
+ g_free (core->component_name);
+
release_imp (core->imp);
core->imp = NULL;
}
diff --git a/omx/gstomx_util.h b/omx/gstomx_util.h
index f0cf045..a4dc47b 100644
--- a/omx/gstomx_util.h
+++ b/omx/gstomx_util.h
@@ -91,6 +91,9 @@ struct GOmxCore
GOmxImp *imp;
gboolean done;
+
+ gchar *library_name;
+ gchar *component_name;
};
struct GOmxPort
@@ -116,7 +119,7 @@ void g_omx_deinit (void);
GOmxCore *g_omx_core_new (void);
void g_omx_core_free (GOmxCore *core);
-void g_omx_core_init (GOmxCore *core, const gchar *library_name, const gchar *component_name);
+void g_omx_core_init (GOmxCore *core);
void g_omx_core_deinit (GOmxCore *core);
void g_omx_core_prepare (GOmxCore *core);
void g_omx_core_start (GOmxCore *core);
--
1.7.0.1
|
|
From: Felipe C. <fel...@no...> - 2010-03-03 22:51:35
|
Based on a patch by Rob Clark.
Signed-off-by: Felipe Contreras <fel...@no...>
---
omx/gstomx.c | 30 ++++++++++++++++++++++++------
omx/gstomx.h | 3 +++
omx/gstomx_base_filter.c | 11 +----------
omx/gstomx_base_sink.c | 11 +----------
omx/gstomx_base_src.c | 11 +----------
5 files changed, 30 insertions(+), 36 deletions(-)
diff --git a/omx/gstomx.c b/omx/gstomx.c
index 89c9db5..f3c6470 100644
--- a/omx/gstomx.c
+++ b/omx/gstomx.c
@@ -208,16 +208,12 @@ create_subtype (GType parent_type, const gchar *type_name)
static gboolean
plugin_init (GstPlugin *plugin)
{
- GQuark library_name_quark;
- GQuark component_name_quark;
gint i, cnt;
GstStructure *element_table;
GST_DEBUG_CATEGORY_INIT (gstomx_debug, "omx", 0, "gst-openmax");
GST_DEBUG_CATEGORY_INIT (gstomx_util_debug, "omx_util", 0, "gst-openmax utility");
- library_name_quark = g_quark_from_static_string ("library-name");
- component_name_quark = g_quark_from_static_string ("component-name");
element_name_quark = g_quark_from_static_string ("element-name");
/*
@@ -281,8 +277,6 @@ plugin_init (GstPlugin *plugin)
return FALSE;
}
- g_type_set_qdata (type, library_name_quark, (gpointer) library_name);
- g_type_set_qdata (type, component_name_quark, (gpointer) component_name);
g_type_set_qdata (type, element_name_quark, (gpointer) element_name);
if (!gst_structure_get_int (element, "rank", &rank))
@@ -301,6 +295,30 @@ plugin_init (GstPlugin *plugin)
return TRUE;
}
+gboolean
+gstomx_get_component_info (void *core,
+ GType type)
+{
+ GOmxCore *rcore = core;
+ const gchar *element_name;
+ GstStructure *element;
+ const gchar *str;
+
+ element_name = g_type_get_qdata (type, element_name_quark);
+ element = get_element_entry (element_name);
+
+ if (!element)
+ return FALSE;
+
+ str = gst_structure_get_string (element, "library-name");
+ rcore->library_name = g_strdup (str);
+
+ str = gst_structure_get_string (element, "component-name");
+ rcore->component_name = g_strdup (str);
+
+ return TRUE;
+}
+
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"omx",
diff --git a/omx/gstomx.h b/omx/gstomx.h
index 7d5fa04..b62773c 100644
--- a/omx/gstomx.h
+++ b/omx/gstomx.h
@@ -30,6 +30,9 @@ GST_DEBUG_CATEGORY_EXTERN (gstomx_debug);
GST_DEBUG_CATEGORY_EXTERN (gstomx_util_debug);
#define GST_CAT_DEFAULT gstomx_debug
+gboolean gstomx_get_component_info (void *core,
+ GType type);
+
G_END_DECLS
#endif /* GSTOMX_H */
diff --git a/omx/gstomx_base_filter.c b/omx/gstomx_base_filter.c
index 626f979..01ca10a 100644
--- a/omx/gstomx_base_filter.c
+++ b/omx/gstomx_base_filter.c
@@ -898,6 +898,7 @@ type_instance_init (GTypeInstance *instance,
{
GOmxCore *gomx;
self->gomx = gomx = g_omx_core_new (self);
+ gstomx_get_component_info (gomx, G_TYPE_FROM_CLASS (g_class));
}
self->ready_lock = g_mutex_new ();
@@ -918,16 +919,6 @@ type_instance_init (GTypeInstance *instance,
gst_element_add_pad (GST_ELEMENT (self), self->sinkpad);
gst_element_add_pad (GST_ELEMENT (self), self->srcpad);
- {
- const char *tmp;
- tmp = g_type_get_qdata (G_OBJECT_CLASS_TYPE (g_class),
- g_quark_from_static_string ("library-name"));
- self->gomx->library_name = g_strdup (tmp);
- tmp = g_type_get_qdata (G_OBJECT_CLASS_TYPE (g_class),
- g_quark_from_static_string ("component-name"));
- self->gomx->component_name = g_strdup (tmp);
- }
-
GST_LOG_OBJECT (self, "end");
}
diff --git a/omx/gstomx_base_sink.c b/omx/gstomx_base_sink.c
index aec2b68..ac32799 100644
--- a/omx/gstomx_base_sink.c
+++ b/omx/gstomx_base_sink.c
@@ -461,16 +461,7 @@ type_instance_init (GTypeInstance *instance,
{
GOmxCore *gomx;
self->gomx = gomx = g_omx_core_new (self);
- }
-
- {
- const char *tmp;
- tmp = g_type_get_qdata (G_OBJECT_CLASS_TYPE (g_class),
- g_quark_from_static_string ("library-name"));
- self->gomx->library_name = g_strdup (tmp);
- tmp = g_type_get_qdata (G_OBJECT_CLASS_TYPE (g_class),
- g_quark_from_static_string ("component-name"));
- self->gomx->component_name = g_strdup (tmp);
+ gstomx_get_component_info (gomx, G_TYPE_FROM_CLASS (g_class));
}
{
diff --git a/omx/gstomx_base_src.c b/omx/gstomx_base_src.c
index 9439455..51aa189 100644
--- a/omx/gstomx_base_src.c
+++ b/omx/gstomx_base_src.c
@@ -447,16 +447,7 @@ type_instance_init (GTypeInstance *instance,
{
GOmxCore *gomx;
self->gomx = gomx = g_omx_core_new (self);
- }
-
- {
- const char *tmp;
- tmp = g_type_get_qdata (G_OBJECT_CLASS_TYPE (g_class),
- g_quark_from_static_string ("library-name"));
- self->gomx->library_name = g_strdup (tmp);
- tmp = g_type_get_qdata (G_OBJECT_CLASS_TYPE (g_class),
- g_quark_from_static_string ("component-name"));
- self->gomx->component_name = g_strdup (tmp);
+ gstomx_get_component_info (gomx, G_TYPE_FROM_CLASS (g_class));
}
GST_LOG_OBJECT (self, "end");
--
1.7.0.1
|
|
From: Felipe C. <fel...@no...> - 2010-03-03 22:51:35
|
So that it receives the 'object' which is kind of mandatory.
Signed-off-by: Felipe Contreras <fel...@no...>
---
omx/gstomx_base_filter.c | 3 +--
omx/gstomx_base_sink.c | 3 +--
omx/gstomx_base_src.c | 3 +--
omx/gstomx_util.c | 3 ++-
omx/gstomx_util.h | 2 +-
5 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/omx/gstomx_base_filter.c b/omx/gstomx_base_filter.c
index fd3f071..626f979 100644
--- a/omx/gstomx_base_filter.c
+++ b/omx/gstomx_base_filter.c
@@ -897,8 +897,7 @@ type_instance_init (GTypeInstance *instance,
/* GOmx */
{
GOmxCore *gomx;
- self->gomx = gomx = g_omx_core_new ();
- gomx->object = self;
+ self->gomx = gomx = g_omx_core_new (self);
}
self->ready_lock = g_mutex_new ();
diff --git a/omx/gstomx_base_sink.c b/omx/gstomx_base_sink.c
index 5afb11d..aec2b68 100644
--- a/omx/gstomx_base_sink.c
+++ b/omx/gstomx_base_sink.c
@@ -460,8 +460,7 @@ type_instance_init (GTypeInstance *instance,
/* GOmx */
{
GOmxCore *gomx;
- self->gomx = gomx = g_omx_core_new ();
- gomx->object = self;
+ self->gomx = gomx = g_omx_core_new (self);
}
{
diff --git a/omx/gstomx_base_src.c b/omx/gstomx_base_src.c
index 4e67a71..9439455 100644
--- a/omx/gstomx_base_src.c
+++ b/omx/gstomx_base_src.c
@@ -446,8 +446,7 @@ type_instance_init (GTypeInstance *instance,
/* GOmx */
{
GOmxCore *gomx;
- self->gomx = gomx = g_omx_core_new ();
- gomx->object = self;
+ self->gomx = gomx = g_omx_core_new (self);
}
{
diff --git a/omx/gstomx_util.c b/omx/gstomx_util.c
index c61f849..b2a96c8 100644
--- a/omx/gstomx_util.c
+++ b/omx/gstomx_util.c
@@ -265,12 +265,13 @@ g_omx_deinit (void)
*/
GOmxCore *
-g_omx_core_new (void)
+g_omx_core_new (void *object)
{
GOmxCore *core;
core = g_new0 (GOmxCore, 1);
+ core->object = object;
core->ports = g_ptr_array_new ();
core->omx_state_condition = g_cond_new ();
diff --git a/omx/gstomx_util.h b/omx/gstomx_util.h
index a4dc47b..ce0156c 100644
--- a/omx/gstomx_util.h
+++ b/omx/gstomx_util.h
@@ -117,7 +117,7 @@ struct GOmxPort
void g_omx_init (void);
void g_omx_deinit (void);
-GOmxCore *g_omx_core_new (void);
+GOmxCore *g_omx_core_new (void *object);
void g_omx_core_free (GOmxCore *core);
void g_omx_core_init (GOmxCore *core);
void g_omx_core_deinit (GOmxCore *core);
--
1.7.0.1
|
|
From: Felipe C. <fel...@no...> - 2010-03-03 22:51:30
|
Hi,
As Rob suggested the component-name and library-name properties should be
read-only.
His original config patch tackled this, but I decided to do it in a different
way.
Felipe Contreras (5):
Move component and library name fields to 'util'
Reorganize core_new()
Reorganize {library,component}-name assigns
Make {component,library}-name read-only
base: remove unused set_property()
omx/gstomx.c | 30 ++++++++++++++++++----
omx/gstomx.h | 3 ++
omx/gstomx_base_filter.c | 35 +++++---------------------
omx/gstomx_base_filter.h | 2 -
omx/gstomx_base_sink.c | 54 +++++-----------------------------------
omx/gstomx_base_sink.h | 3 --
omx/gstomx_base_src.c | 61 +++++----------------------------------------
omx/gstomx_base_src.h | 2 -
omx/gstomx_util.c | 14 ++++++----
omx/gstomx_util.h | 7 ++++-
10 files changed, 61 insertions(+), 150 deletions(-)
|
|
From: Felipe C. <fel...@no...> - 2010-03-03 22:43:46
|
From: Rob Clark <ro...@ti...>
Configurable mapping between gst-openmax elements and OMX library-name
and component-name via config file. The config file may even create
multiple different elements with unique names using the same gst-openmax
class but different OMX library-name and/or component-name.
In the simple case, of one OMX component per gst-openmax class, specify
the gst-openmax class as the 'type', and the 'library-name' and
'compnent-name' of the OMX component, and optionally the 'rank'
(defaults to 0 or GST_RANK_NONE):
----
omx_h264dec,
type=GstOmxH264Dec,
library-name=libomxil-bellagio.so.0,
component-name=OMX.st.video_decoder.avc,
rank=256;
----
Or in the advanced case of multiple OMX components per gst-openmax
class, specify the gst-openmax class as the 'parent-type' and a
dynamically created sub-class for the 'type':
----
omx_mp3dec_ti,
parent-type=GstOmxMp3Dec,
type=GstOmxMp3DecTi
library-name=libOMX_Core.so.0,
component-name=OMX.TI.AUDIO.DECODE,
component-role=audio_decode.dsp.mp3,
rank=256;
omx_mp3dec_nokia,
parent-type=GstOmxMp3Dec,
type=GstOmxMp3DecNokia
library-name=libomxil_bellagio.so.0,
component-name=OMX.nokia.audio_decode.mp3,
rank=128;
----
By default, the config file is stored in $HOME/.config/gst-openmax.conf,
although if none is found a default config will be created.
Modified by Felipe Contreras to keep using the library and component
names through qdata. Plus a bunch of cleanups and reorganization.
Signed-off-by: Felipe Contreras <fel...@no...>
---
omx/gstomx.c | 264 ++++++++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 211 insertions(+), 53 deletions(-)
diff --git a/omx/gstomx.c b/omx/gstomx.c
index 6756f54..8b082a2 100644
--- a/omx/gstomx.c
+++ b/omx/gstomx.c
@@ -21,6 +21,10 @@
#include "config.h"
+#include <string.h>
+
+#include <gst/gststructure.h>
+
#include "gstomx.h"
#include "gstomx_dummy.h"
#include "gstomx_mpeg4dec.h"
@@ -59,85 +63,239 @@
GST_DEBUG_CATEGORY (gstomx_debug);
-typedef struct TableItem
-{
- const gchar *name;
- const gchar *library_name;
- const gchar *component_name;
- guint rank;
- GType (*get_type) (void);
-} TableItem;
-
-static TableItem element_table[] =
-{
- { "omx_dummy", "libomxil-bellagio.so.0", "OMX.st.dummy", GST_RANK_NONE, gst_omx_dummy_get_type },
- { "omx_mpeg4dec", "libomxil-bellagio.so.0", "OMX.st.video_decoder.mpeg4", GST_RANK_PRIMARY, gst_omx_mpeg4dec_get_type },
- { "omx_h264dec", "libomxil-bellagio.so.0", "OMX.st.video_decoder.avc", GST_RANK_PRIMARY, gst_omx_h264dec_get_type },
- { "omx_h263dec", "libomxil-bellagio.so.0", "OMX.st.video_decoder.h263", GST_RANK_PRIMARY, gst_omx_h263dec_get_type },
- { "omx_wmvdec", "libomxil-bellagio.so.0", "OMX.st.video_decoder.wmv", GST_RANK_PRIMARY, gst_omx_wmvdec_get_type },
- { "omx_mpeg4enc", "libomxil-bellagio.so.0", "OMX.st.video_encoder.mpeg4", GST_RANK_PRIMARY, gst_omx_mpeg4enc_get_type },
- { "omx_h264enc", "libomxil-bellagio.so.0", "OMX.st.video_encoder.avc", GST_RANK_PRIMARY, gst_omx_h264enc_get_type },
- { "omx_h263enc", "libomxil-bellagio.so.0", "OMX.st.video_encoder.h263", GST_RANK_PRIMARY, gst_omx_h263enc_get_type },
- { "omx_vorbisdec", "libomxil-bellagio.so.0", "OMX.st.audio_decoder.ogg.single", GST_RANK_SECONDARY, gst_omx_vorbisdec_get_type },
- { "omx_mp3dec", "libomxil-bellagio.so.0", "OMX.st.audio_decoder.mp3.mad", GST_RANK_PRIMARY, gst_omx_mp3dec_get_type },
+static GstStructure *element_table = NULL;
+static GQuark element_name_quark;
+
+const gchar *default_config = NULL;
+
+static GType (*get_type[]) (void) = {
+ gst_omx_dummy_get_type,
+ gst_omx_mpeg4dec_get_type,
+ gst_omx_h264dec_get_type,
+ gst_omx_h263dec_get_type,
+ gst_omx_wmvdec_get_type,
+ gst_omx_mpeg4enc_get_type,
+ gst_omx_h264enc_get_type,
+ gst_omx_h263enc_get_type,
+ gst_omx_vorbisdec_get_type,
+ gst_omx_mp3dec_get_type,
#ifdef EXPERIMENTAL
- { "omx_mp2dec", "libomxil-bellagio.so.0", "OMX.st.audio_decoder.mp3.mad", GST_RANK_PRIMARY, gst_omx_mp2dec_get_type },
- { "omx_amrnbdec", "libomxil-bellagio.so.0", "OMX.st.audio_decoder.amrnb", GST_RANK_PRIMARY, gst_omx_amrnbdec_get_type },
- { "omx_amrnbenc", "libomxil-bellagio.so.0", "OMX.st.audio_encoder.amrnb", GST_RANK_PRIMARY, gst_omx_amrnbenc_get_type },
- { "omx_amrwbdec", "libomxil-bellagio.so.0", "OMX.st.audio_decoder.amrwb", GST_RANK_PRIMARY, gst_omx_amrwbdec_get_type },
- { "omx_amrwbenc", "libomxil-bellagio.so.0", "OMX.st.audio_encoder.amrwb", GST_RANK_PRIMARY, gst_omx_amrwbenc_get_type },
- { "omx_aacdec", "libomxil-bellagio.so.0", "OMX.st.audio_decoder.aac", GST_RANK_PRIMARY, gst_omx_aacdec_get_type },
- { "omx_aacenc", "libomxil-bellagio.so.0", "OMX.st.audio_encoder.aac", GST_RANK_PRIMARY, gst_omx_aacenc_get_type },
- { "omx_adpcmdec", "libomxil-bellagio.so.0", "OMX.st.audio_decoder.adpcm", GST_RANK_PRIMARY, gst_omx_adpcmdec_get_type },
- { "omx_adpcmenc", "libomxil-bellagio.so.0", "OMX.st.audio_encoder.adpcm", GST_RANK_PRIMARY, gst_omx_adpcmenc_get_type },
- { "omx_g711dec", "libomxil-bellagio.so.0", "OMX.st.audio_decoder.g711", GST_RANK_PRIMARY, gst_omx_g711dec_get_type },
- { "omx_g711enc", "libomxil-bellagio.so.0", "OMX.st.audio_encoder.g711", GST_RANK_PRIMARY, gst_omx_g711enc_get_type },
- { "omx_g729dec", "libomxil-bellagio.so.0", "OMX.st.audio_decoder.g729", GST_RANK_PRIMARY, gst_omx_g729dec_get_type },
- { "omx_g729enc", "libomxil-bellagio.so.0", "OMX.st.audio_encoder.g729", GST_RANK_PRIMARY, gst_omx_g729enc_get_type },
- { "omx_ilbcdec", "libomxil-bellagio.so.0", "OMX.st.audio_decoder.ilbc", GST_RANK_PRIMARY, gst_omx_ilbcdec_get_type },
- { "omx_ilbcenc", "libomxil-bellagio.so.0", "OMX.st.audio_encoder.ilbc", GST_RANK_PRIMARY, gst_omx_ilbcenc_get_type },
- { "omx_jpegenc", "libomxil-bellagio.so.0", "OMX.st.image_encoder.jpeg", GST_RANK_PRIMARY, gst_omx_jpegenc_get_type },
+ gst_omx_mp2dec_get_type,
+ gst_omx_amrnbdec_get_type,
+ gst_omx_amrnbenc_get_type,
+ gst_omx_amrwbdec_get_type,
+ gst_omx_amrwbenc_get_type,
+ gst_omx_aacdec_get_type,
+ gst_omx_aacenc_get_type,
+ gst_omx_adpcmdec_get_type,
+ gst_omx_adpcmenc_get_type,
+ gst_omx_g711dec_get_type,
+ gst_omx_g711enc_get_type,
+ gst_omx_g729dec_get_type,
+ gst_omx_g729enc_get_type,
+ gst_omx_ilbcdec_get_type,
+ gst_omx_ilbcenc_get_type,
+ gst_omx_jpegenc_get_type,
#endif /* EXPERIMENTAL */
- { "omx_audiosink", "libomxil-bellagio.so.0", "OMX.st.alsa.alsasink", GST_RANK_NONE, gst_omx_audiosink_get_type },
+ gst_omx_audiosink_get_type,
#ifdef EXPERIMENTAL
- { "omx_videosink", "libomxil-bellagio.so.0", "OMX.st.videosink", GST_RANK_NONE, gst_omx_videosink_get_type },
- { "omx_filereadersrc", "libomxil-bellagio.so.0", "OMX.st.audio_filereader", GST_RANK_NONE, gst_omx_filereadersrc_get_type },
+ gst_omx_videosink_get_type,
+ gst_omx_filereadersrc_get_type,
#endif /* EXPERIMENTAL */
- { "omx_volume", "libomxil-bellagio.so.0", "OMX.st.volume.component", GST_RANK_NONE, gst_omx_volume_get_type },
- { NULL, NULL, NULL, 0, NULL },
+ gst_omx_volume_get_type,
};
+/**
+ * @todo find a way to call plugin_init() when the config file changes
+ * @todo support a system-wide config file
+ * @todo provide a recommended system-wide config file
+ */
+
+/* TODO: we can cache table w/ gst_plugin_{get,set}_cache_data..
+ */
+static GstStructure *
+get_element_table (void)
+{
+ static volatile gsize gonce_data = 0;
+ if (g_once_init_enter (&gonce_data))
+ {
+ gchar *path;
+ gchar *config, *s;
+ GstStructure *element;
+
+ path = g_strdup (g_getenv ("OMX_REGISTRY"));
+ if (!path)
+ {
+ path = g_build_filename (g_get_user_config_dir (),
+ "gst-openmax.conf", NULL);
+ }
+
+ if (!g_file_get_contents (path, &config, NULL, NULL))
+ {
+ g_warning ("could not find config file '%s'.. using defaults!", path);
+ config = (gchar *) default_config;
+ }
+
+ g_free (path);
+
+ GST_DEBUG ("parsing config:\n%s", config);
+
+ element_table = gst_structure_empty_new ("element_table");
+
+ s = config;
+
+ while ((element = gst_structure_from_string (s, &s)))
+ {
+ const gchar *element_name = gst_structure_get_name (element);
+ gst_structure_set (element_table,
+ element_name, GST_TYPE_STRUCTURE, element, NULL);
+ }
+
+ if (config != default_config)
+ g_free (config);
+
+ GST_DEBUG ("element_table=%" GST_PTR_FORMAT, element_table);
+
+ g_once_init_leave (&gonce_data, 1);
+ }
+
+ return element_table;
+}
+
+static GstStructure *
+get_element_entry (const gchar *element_name)
+{
+ GstStructure *element_table = get_element_table ();
+ GstStructure *element;
+
+ if (!gst_structure_get (element_table, element_name,
+ GST_TYPE_STRUCTURE, &element, NULL))
+ {
+ element = NULL;
+ }
+
+ /* This assert should never fail, because plugin elements are registered
+ * based on the entries in this table. Someone would have to manually
+ * override the type qdata for this to fail.
+ */
+ g_assert (element);
+
+ return element;
+}
+
+/* register a new dynamic sub-class with the name 'type_name'.. this gives us
+ * a way to use the same (for example) GstOmxMp3Dec element mapping to
+ * multiple different element names with different OMX library implementations
+ * and/or component names
+ */
+static GType
+create_subtype (GType parent_type, const gchar *type_name)
+{
+ GTypeQuery q;
+ GTypeInfo i = {0};
+
+ if (!type_name)
+ return 0;
+
+ g_type_query (parent_type, &q);
+
+ i.class_size = q.class_size;
+ i.instance_size = q.instance_size;
+
+ return g_type_register_static (parent_type, type_name, &i, 0);
+}
+
static gboolean
plugin_init (GstPlugin *plugin)
{
GQuark library_name_quark;
GQuark component_name_quark;
+ gint i, cnt;
+ GstStructure *element_table;
+
GST_DEBUG_CATEGORY_INIT (gstomx_debug, "omx", 0, "gst-openmax");
GST_DEBUG_CATEGORY_INIT (gstomx_util_debug, "omx_util", 0, "gst-openmax utility");
library_name_quark = g_quark_from_static_string ("library-name");
component_name_quark = g_quark_from_static_string ("component-name");
+ element_name_quark = g_quark_from_static_string ("element-name");
+
+ /*
+ * First, call all the _get_type() functions to ensure the types are
+ * registered.
+ */
+ for (i = 0; i < G_N_ELEMENTS (get_type); i++)
+ get_type[i] ();
+
+ element_table = get_element_table ();
g_omx_init ();
+ cnt = gst_structure_n_fields (element_table);
+ for (i = 0; i < cnt; i++)
{
- guint i;
- for (i = 0; element_table[i].name; i++)
- {
- TableItem *element;
- GType type;
+ const gchar *element_name = gst_structure_nth_field_name (element_table, i);
+ GstStructure *element = get_element_entry (element_name);
+ const gchar *type_name, *parent_type_name;
+ const gchar *component_name, *library_name;
+ GType type;
+ gint rank;
- element = &element_table[i];
- type = element->get_type ();
- g_type_set_qdata (type, library_name_quark, (gpointer) element->library_name);
- g_type_set_qdata (type, component_name_quark, (gpointer) element->component_name);
+ GST_DEBUG ("element_name=%s, element=%" GST_PTR_FORMAT, element_name, element);
- if (!gst_element_register (plugin, element->name, element->rank, type))
+ parent_type_name = gst_structure_get_string (element, "parent-type");
+ type_name = gst_structure_get_string (element, "type");
+ component_name = gst_structure_get_string (element, "component-name");
+ library_name = gst_structure_get_string (element, "library-name");
+
+ if (!type_name || !component_name || !library_name)
+ {
+ g_warning ("malformed config file: missing required fields for %s",
+ element_name);
+ return FALSE;
+ }
+
+ if (parent_type_name)
+ {
+ type = g_type_from_name (parent_type_name);
+ if (type)
+ {
+ type = create_subtype (type, type_name);
+ }
+ else
{
- g_warning ("failed registering '%s'", element->name);
+ g_warning ("malformed config file: invalid parent-type '%s' for %s",
+ parent_type_name, element_name);
return FALSE;
}
}
+ else
+ {
+ type = g_type_from_name (type_name);
+ }
+
+ if (!type)
+ {
+ g_warning ("malformed config file: invalid type '%s' for %s",
+ type_name, element_name);
+ return FALSE;
+ }
+
+ g_type_set_qdata (type, library_name_quark, (gpointer) library_name);
+ g_type_set_qdata (type, component_name_quark, (gpointer) component_name);
+ g_type_set_qdata (type, element_name_quark, (gpointer) element_name);
+
+ if (!gst_structure_get_int (element, "rank", &rank))
+ {
+ /* use default rank: */
+ rank = GST_RANK_NONE;
+ }
+
+ if (!gst_element_register (plugin, element_name, rank, type))
+ {
+ g_warning ("failed registering '%s'", element_name);
+ return FALSE;
+ }
}
return TRUE;
--
1.7.0.1
|
|
From: Felipe C. <fel...@no...> - 2010-03-03 22:43:44
|
From: Rob Clark <ro...@ti...>
Signed-off-by: Felipe Contreras <fel...@no...>
---
tests/Makefile.am | 3 ++-
tests/check_gstomx.c | 2 --
tests/gst-openmax.conf | 5 +++++
3 files changed, 7 insertions(+), 3 deletions(-)
create mode 100644 tests/gst-openmax.conf
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 41057c6..f43098a 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -8,7 +8,8 @@ CHECK_REGISTRY = $(top_builddir)/tests/test-registry.reg
TESTS_ENVIRONMENT = GST_REGISTRY=$(CHECK_REGISTRY) \
LD_LIBRARY_PATH=$(builddir)/standalone \
- GST_PLUGIN_PATH=$(top_builddir)/omx
+ GST_PLUGIN_PATH=$(top_builddir)/omx \
+ OMX_REGISTRY=gst-openmax.conf
check_PROGRAMS =
diff --git a/tests/check_gstomx.c b/tests/check_gstomx.c
index aea8cc9..5db576f 100644
--- a/tests/check_gstomx.c
+++ b/tests/check_gstomx.c
@@ -114,8 +114,6 @@ helper (gboolean flush)
eos_cond = g_cond_new ();
eos_arrived = FALSE;
- g_object_set (G_OBJECT (filter), "library-name", "libomxil-foo.so", NULL);
-
/* start */
fail_unless_equals_int (gst_element_set_state (filter, GST_STATE_PLAYING),
diff --git a/tests/gst-openmax.conf b/tests/gst-openmax.conf
new file mode 100644
index 0000000..f7b3140
--- /dev/null
+++ b/tests/gst-openmax.conf
@@ -0,0 +1,5 @@
+omx_dummy,
+ type=GstOmxDummy,
+ library-name=libomxil-foo.so,
+ component-name=OMX.bellagio.dummy,
+ rank=0;
--
1.7.0.1
|
|
From: Felipe C. <fel...@no...> - 2010-03-03 22:43:42
|
From: Rob Clark <ro...@ti...>
A little bit hacky, but works just fine.
Signed-off-by: Felipe Contreras <fel...@no...>
---
omx/Makefile.am | 8 ++-
omx/gstomx.c | 2 +-
omx/gstomx.conf | 203 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 211 insertions(+), 2 deletions(-)
create mode 100644 omx/gstomx.conf
diff --git a/omx/Makefile.am b/omx/Makefile.am
index 4a3fbf9..80e7d9a 100644
--- a/omx/Makefile.am
+++ b/omx/Makefile.am
@@ -18,7 +18,8 @@ libgstomx_la_SOURCES = gstomx.c gstomx.h \
gstomx_vorbisdec.c gstomx_vorbisdec.h \
gstomx_mp3dec.c gstomx_mp3dec.h \
gstomx_base_sink.c gstomx_base_sink.h \
- gstomx_audiosink.c gstomx_audiosink.h
+ gstomx_audiosink.c gstomx_audiosink.h \
+ gstomx_conf.c
if EXPERIMENTAL
libgstomx_la_SOURCES += gstomx_amrnbdec.c gstomx_amrnbdec.h \
@@ -47,3 +48,8 @@ libgstomx_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS) $(top_builddir)/util/libutil.
libgstomx_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
EXTRA_DIST = headers
+
+gstomx_conf.c: gstomx.conf
+ echo "const char *default_config =" > $@
+ cat $^ | $(CPP) $(CFLAGS) $(libgstomx_la_CFLAGS) $(DEFAULT_INCLUDES) $(INCLUDES) - | grep -v "^#" | sed 's/^.*/\"&\\\n"/' >> $@
+ echo ";" >> $@
diff --git a/omx/gstomx.c b/omx/gstomx.c
index 8b082a2..89c9db5 100644
--- a/omx/gstomx.c
+++ b/omx/gstomx.c
@@ -66,7 +66,7 @@ GST_DEBUG_CATEGORY (gstomx_debug);
static GstStructure *element_table = NULL;
static GQuark element_name_quark;
-const gchar *default_config = NULL;
+extern const gchar *default_config;
static GType (*get_type[]) (void) = {
gst_omx_dummy_get_type,
diff --git a/omx/gstomx.conf b/omx/gstomx.conf
new file mode 100644
index 0000000..c22c6d6
--- /dev/null
+++ b/omx/gstomx.conf
@@ -0,0 +1,203 @@
+#include "config.h"
+
+/* in case of multiple OMX components mapping to a single gst-openmax element
+ * class, a dynamic subclass can be created by specifying the gst-openmax
+ * type as the 'parent-type' and specifying a new unique type name as the
+ * 'type' parameter:
+ */
+omx_dummy,
+ parent-type=GstOmxDummy,
+ type=GstOmxDummyOne,
+ library-name=libomxil-bellagio.so.0,
+ component-name=OMX.bellagio.dummy,
+ rank=0;
+
+/* for testing: */
+omx_dummy_2,
+ parent-type=GstOmxDummy,
+ type=GstOmxDummyTwo,
+ library-name=libomxil-bellagio.so.0,
+ component-name=OMX.st.dummy2,
+ rank=256;
+
+omx_mpeg4dec,
+ type=GstOmxMpeg4Dec,
+ library-name=libomxil-bellagio.so.0,
+ component-name=OMX.st.video_decoder.mpeg4,
+ rank=256;
+
+omx_h264dec,
+ type=GstOmxH264Dec,
+ library-name=libomxil-bellagio.so.0,
+ component-name=OMX.st.video_decoder.avc,
+ rank=256;
+
+omx_h263dec,
+ type=GstOmxH263Dec,
+ library-name=libomxil-bellagio.so.0,
+ component-name=OMX.st.video_decoder.h263,
+ rank=256;
+
+omx_wmvdec,
+ type=GstOmxWmvDec,
+ library-name=libomxil-bellagio.so.0,
+ component-name=OMX.st.video_decoder.wmv,
+ rank=256;
+
+omx_mpeg4enc,
+ type=GstOmxMpeg4Enc,
+ library-name=libomxil-bellagio.so.0,
+ component-name=OMX.st.video_encoder.mpeg4,
+ rank=256;
+
+omx_h264enc,
+ type=GstOmxH264Enc,
+ library-name=libomxil-bellagio.so.0,
+ component-name=OMX.st.video_encoder.avc,
+ rank=256;
+
+omx_h263enc,
+ type=GstOmxH263Enc,
+ library-name=libomxil-bellagio.so.0,
+ component-name=OMX.st.video_encoder.h263,
+ rank=256;
+
+omx_vorbisdec,
+ type=GstOmxVorbisDec,
+ library-name=libomxil-bellagio.so.0,
+ component-name=OMX.st.audio_decoder.ogg.single,
+ rank=128;
+
+omx_mp3dec,
+ type=GstOmxMp3Dec,
+ library-name=libomxil-bellagio.so.0,
+ component-name=OMX.st.audio_decoder.mp3.mad,
+ rank=256;
+
+#ifdef EXPERIMENTAL
+
+omx_mp2dec,
+ type=GstOmxMp2Dec,
+ library-name=libomxil-bellagio.so.0,
+ component-name=OMX.st.audio_decoder.mp3.mad,
+ rank=256;
+
+omx_amrnbdec,
+ type=GstOmxAmrNbDec,
+ library-name=libomxil-bellagio.so.0,
+ component-name=OMX.st.audio_decoder.amrnb,
+ rank=256;
+
+omx_amrnbenc,
+ type=GstOmxAmrNbEnc,
+ library-name=libomxil-bellagio.so.0,
+ component-name=OMX.st.audio_encoder.amrnb,
+ rank=256;
+
+omx_amrwbdec,
+ type=GstOmxAmrWbDec,
+ library-name=libomxil-bellagio.so.0,
+ component-name=OMX.st.audio_decoder.amrwb,
+ rank=256;
+
+omx_amrwbenc,
+ type=GstOmxAmrWbEnc,
+ library-name=libomxil-bellagio.so.0,
+ component-name=OMX.st.audio_encoder.amrwb,
+ rank=256;
+
+omx_aacdec,
+ type=GstOmxAacDec,
+ library-name=libomxil-bellagio.so.0,
+ component-name=OMX.st.audio_decoder.aac,
+ rank=256;
+
+omx_aacenc,
+ type=GstOmxAacEnc,
+ library-name=libomxil-bellagio.so.0,
+ component-name=OMX.st.audio_encoder.aac,
+ rank=256;
+
+omx_adpcmdec,
+ type=GstOmxAdpcmDec,
+ library-name=libomxil-bellagio.so.0,
+ component-name=OMX.st.audio_decoder.adpcm,
+ rank=256;
+
+omx_adpcmenc,
+ type=GstOmxAdpcmEnc,
+ library-name=libomxil-bellagio.so.0,
+ component-name=OMX.st.audio_encoder.adpcm,
+ rank=256;
+
+omx_g711dec,
+ type=GstOmxG711Dec,
+ library-name=libomxil-bellagio.so.0,
+ component-name=OMX.st.audio_decoder.g711,
+ rank=256;
+
+omx_g711enc,
+ type=GstOmxG711Enc,
+ library-name=libomxil-bellagio.so.0,
+ component-name=OMX.st.audio_encoder.g711,
+ rank=256;
+
+omx_g729dec,
+ type=GstOmxG729Dec,
+ library-name=libomxil-bellagio.so.0,
+ component-name=OMX.st.audio_decoder.g729,
+ rank=256;
+
+omx_g729enc,
+ type=GstOmxG729Enc,
+ library-name=libomxil-bellagio.so.0,
+ component-name=OMX.st.audio_encoder.g729,
+ rank=256;
+
+omx_ilbcdec,
+ type=GstOmxIlbcDec,
+ library-name=libomxil-bellagio.so.0,
+ component-name=OMX.st.audio_decoder.ilbc,
+ rank=256;
+
+omx_ilbcenc,
+ type=GstOmxIlbcEnc,
+ library-name=libomxil-bellagio.so.0,
+ component-name=OMX.st.audio_encoder.ilbc,
+ rank=256;
+
+omx_jpegenc,
+ type=GstOmxJpegEnc,
+ library-name=libomxil-bellagio.so.0,
+ component-name=OMX.st.image_encoder.jpeg,
+ rank=256;
+
+#endif /* EXPERIMENTAL */
+
+omx_audiosink,
+ type=GstOmxAudioSink,
+ library-name=libomxil-bellagio.so.0,
+ component-name=OMX.st.alsa.alsasink,
+ rank=0;
+
+#ifdef EXPERIMENTAL
+
+omx_videosink,
+ type=GstOmxVideoSink,
+ library-name=libomxil-bellagio.so.0,
+ component-name=OMX.st.videosink,
+ rank=0;
+
+omx_filereadersrc,
+ type=GstOmxFilereaderSrc,
+ library-name=libomxil-bellagio.so.0,
+ component-name=OMX.st.audio_filereader,
+ rank=0;
+
+#endif /* EXPERIMENTAL */
+
+omx_volume,
+ type=GstOmxVolume,
+ library-name=libomxil-bellagio.so.0,
+ component-name=OMX.st.volume.component,
+ rank=0;
--
1.7.0.1
|
|
From: Felipe C. <fel...@no...> - 2010-03-03 22:43:42
|
Hi, I've modified the patches from Rob again, and now should be closer to the original ones, the configuration format is the same, and 'make check' shouldn't be broken at any point. I'm pretty happy with these, so if there are no more comments I'll commit them. ACK at will though :) Some work is still pending, but that can be done later: * find a way to call plugin_init() when the config file changes * support a system-wide config file * provide a recommended system-wide config file Cheers. Rob Clark (3): Initial support for configuration file Add default configuration tests: update to use config file omx/Makefile.am | 8 ++- omx/gstomx.c | 264 ++++++++++++++++++++++++++++++++++++++---------- omx/gstomx.conf | 203 +++++++++++++++++++++++++++++++++++++ tests/Makefile.am | 3 +- tests/check_gstomx.c | 2 - tests/gst-openmax.conf | 5 + 6 files changed, 428 insertions(+), 57 deletions(-) create mode 100644 omx/gstomx.conf create mode 100644 tests/gst-openmax.conf |
|
From: Rob C. <ro...@ti...> - 2010-03-03 13:56:51
|
---
tests/Makefile.am | 3 ++-
tests/check_gstomx.c | 2 --
tests/gst-openmax.conf | 6 ++++++
3 files changed, 8 insertions(+), 3 deletions(-)
create mode 100644 tests/gst-openmax.conf
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 41057c6..f43098a 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -8,7 +8,8 @@ CHECK_REGISTRY = $(top_builddir)/tests/test-registry.reg
TESTS_ENVIRONMENT = GST_REGISTRY=$(CHECK_REGISTRY) \
LD_LIBRARY_PATH=$(builddir)/standalone \
- GST_PLUGIN_PATH=$(top_builddir)/omx
+ GST_PLUGIN_PATH=$(top_builddir)/omx \
+ OMX_REGISTRY=gst-openmax.conf
check_PROGRAMS =
diff --git a/tests/check_gstomx.c b/tests/check_gstomx.c
index 366396c..ba1c111 100644
--- a/tests/check_gstomx.c
+++ b/tests/check_gstomx.c
@@ -114,8 +114,6 @@ helper (gboolean flush)
eos_cond = g_cond_new ();
eos_arrived = FALSE;
- g_object_set (G_OBJECT (filter), "library-name", "libomxil-foo.so", NULL);
-
/* start */
fail_unless_equals_int (gst_element_set_state (filter, GST_STATE_PLAYING),
diff --git a/tests/gst-openmax.conf b/tests/gst-openmax.conf
new file mode 100644
index 0000000..d8c574f
--- /dev/null
+++ b/tests/gst-openmax.conf
@@ -0,0 +1,6 @@
+omx_dummy,
+ type=GstOmxDummy,
+ library-name=libomxil-foo.so,
+ component-name=OMX.bellagio.dummy,
+ rank=0;
+
--
1.6.3.2
|
|
From: Felipe C. <fel...@no...> - 2010-03-03 09:59:42
|
On Wed, Mar 03, 2010 at 03:06:24AM +0100, Rob Clark wrote: > On Mar 2, 2010, at 6:35 PM, Felipe Contreras wrote: > > Note that here I'm not creating a file with the default_config. > > > > I think it's a bad idea; the conf file wouldn't be human readable, and > > in case gst-omx is updated with a new default_config it will not be > > used because the old one is already stored. > > re: human-readable: as long as you aren't using > gst_structure_to_string(), it should be readable.. Well, when I took a look at the file (which I scratched my head for quite some time trying to figure out how it got there) everything was on one line. So that's not readable to me. > re: writing default config: I was debating back and forth on this.. > it would be nice to make it easier for someone to take the current > config, and make a few tweaks. Maybe the better approach would be to > write out gst-openmax.conf-example which the user could modify and > rename if desired.. Yeah, in some kind of documentation, but we shouldn't polute the user's config directory. Most people wouldn't care about this, and if every project out there does this, it would be chaos. I don't recall any project doing something like this. The other option is to provide a system-wide config file instead, so the user can copy it to ~/.config, and then modify it. But in that case I'm against having an internal 'default_config'. In fact, now that I think again... most systems would rather have a system-wide config file. Cheers. -- Felipe Contreras |
|
From: Clark, R. <ro...@ti...> - 2010-03-03 02:18:37
|
On Mar 2, 2010, at 6:35 PM, Felipe Contreras wrote:
> On Wed, Mar 3, 2010 at 2:15 AM, Felipe Contreras
> <fel...@no...> wrote:
>> diff --git a/omx/gstomx.c b/omx/gstomx.c
>
> [...]
>
>> +static GstStructure *element_table = NULL;
>> +
>> +const gchar *default_config = NULL;
>
> Note that the default_config is NULL, but will be updated by a
> subsequent patch to use the extern one.
>
> [...]
>
>> +/* TODO: we can cache table w/ gst_plugin_{get,set}_cache_data..
>> + */
>> +static GstStructure *
>> +get_element_table (void)
>> +{
>> + static volatile gsize gonce_data = 0;
>> + if (g_once_init_enter (&gonce_data))
>> + {
>> + gchar *path;
>> + gchar *config, *s;
>> + GstStructure *element;
>> +
>> + path = g_strdup (g_getenv ("OMX_REGISTRY"));
>> + if (!path)
>> + {
>> + path = g_build_filename (g_get_user_config_dir (),
>> + "gst-openmax.conf", NULL);
>> + }
>> +
>> + if (!g_file_get_contents (path, &config, NULL, NULL))
>> + {
>> + g_warning ("could not find config file '%s'.. using defaults!", path);
>> + config = (gchar *) default_config;
>
> Note that here I'm not creating a file with the default_config.
>
> I think it's a bad idea; the conf file wouldn't be human readable, and
> in case gst-omx is updated with a new default_config it will not be
> used because the old one is already stored.
re: human-readable: as long as you aren't using gst_structure_to_string(), it should be readable..
re: writing default config: I was debating back and forth on this.. it would be nice to make it easier for someone to take the current config, and make a few tweaks. Maybe the better approach would be to write out gst-openmax.conf-example which the user could modify and rename if desired..
(other note.. current patch I sent was not handling case where .config directory does not exist yet)
BR,
-R
>
> [...]
>
> Cheers.
>
> --
> Felipe Contreras
>
> ------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Gstreamer-openmax mailing list
> Gst...@li...
> https://lists.sourceforge.net/lists/listinfo/gstreamer-openmax
|
|
From: Felipe C. <fel...@gm...> - 2010-03-03 00:35:50
|
On Wed, Mar 3, 2010 at 2:15 AM, Felipe Contreras
<fel...@no...> wrote:
> diff --git a/omx/gstomx.c b/omx/gstomx.c
[...]
> +static GstStructure *element_table = NULL;
> +
> +const gchar *default_config = NULL;
Note that the default_config is NULL, but will be updated by a
subsequent patch to use the extern one.
[...]
> +/* TODO: we can cache table w/ gst_plugin_{get,set}_cache_data..
> + */
> +static GstStructure *
> +get_element_table (void)
> +{
> + static volatile gsize gonce_data = 0;
> + if (g_once_init_enter (&gonce_data))
> + {
> + gchar *path;
> + gchar *config, *s;
> + GstStructure *element;
> +
> + path = g_strdup (g_getenv ("OMX_REGISTRY"));
> + if (!path)
> + {
> + path = g_build_filename (g_get_user_config_dir (),
> + "gst-openmax.conf", NULL);
> + }
> +
> + if (!g_file_get_contents (path, &config, NULL, NULL))
> + {
> + g_warning ("could not find config file '%s'.. using defaults!", path);
> + config = (gchar *) default_config;
Note that here I'm not creating a file with the default_config.
I think it's a bad idea; the conf file wouldn't be human readable, and
in case gst-omx is updated with a new default_config it will not be
used because the old one is already stored.
[...]
Cheers.
--
Felipe Contreras
|
|
From: Felipe C. <fel...@no...> - 2010-03-03 00:20:36
|
On Wed, Mar 03, 2010 at 01:15:24AM +0100, To gst-openmax wrote: > From: Rob Clark <ro...@ti...> > > Modified by Felipe Contreras to use element 'type' instead of 'name' as > primary field, and keep using the library and component names through > qdata. Plus a bunch of cleanups and reorganization. > > Signed-off-by: Felipe Contreras <fel...@no...> Damn it, I forgot to include your commit message. Anyway, this is more like RFC. Cheers. -- Felipe Contreras |
|
From: Felipe C. <fel...@no...> - 2010-03-03 00:15:55
|
From: Rob Clark <ro...@ti...>
Modified by Felipe Contreras to use element 'type' instead of 'name' as
primary field, and keep using the library and component names through
qdata. Plus a bunch of cleanups and reorganization.
Signed-off-by: Felipe Contreras <fel...@no...>
---
omx/gstomx.c | 254 ++++++++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 201 insertions(+), 53 deletions(-)
diff --git a/omx/gstomx.c b/omx/gstomx.c
index 6756f54..6d50f68 100644
--- a/omx/gstomx.c
+++ b/omx/gstomx.c
@@ -21,6 +21,10 @@
#include "config.h"
+#include <string.h>
+
+#include <gst/gststructure.h>
+
#include "gstomx.h"
#include "gstomx_dummy.h"
#include "gstomx_mpeg4dec.h"
@@ -59,85 +63,229 @@
GST_DEBUG_CATEGORY (gstomx_debug);
-typedef struct TableItem
-{
- const gchar *name;
- const gchar *library_name;
- const gchar *component_name;
- guint rank;
- GType (*get_type) (void);
-} TableItem;
-
-static TableItem element_table[] =
-{
- { "omx_dummy", "libomxil-bellagio.so.0", "OMX.st.dummy", GST_RANK_NONE, gst_omx_dummy_get_type },
- { "omx_mpeg4dec", "libomxil-bellagio.so.0", "OMX.st.video_decoder.mpeg4", GST_RANK_PRIMARY, gst_omx_mpeg4dec_get_type },
- { "omx_h264dec", "libomxil-bellagio.so.0", "OMX.st.video_decoder.avc", GST_RANK_PRIMARY, gst_omx_h264dec_get_type },
- { "omx_h263dec", "libomxil-bellagio.so.0", "OMX.st.video_decoder.h263", GST_RANK_PRIMARY, gst_omx_h263dec_get_type },
- { "omx_wmvdec", "libomxil-bellagio.so.0", "OMX.st.video_decoder.wmv", GST_RANK_PRIMARY, gst_omx_wmvdec_get_type },
- { "omx_mpeg4enc", "libomxil-bellagio.so.0", "OMX.st.video_encoder.mpeg4", GST_RANK_PRIMARY, gst_omx_mpeg4enc_get_type },
- { "omx_h264enc", "libomxil-bellagio.so.0", "OMX.st.video_encoder.avc", GST_RANK_PRIMARY, gst_omx_h264enc_get_type },
- { "omx_h263enc", "libomxil-bellagio.so.0", "OMX.st.video_encoder.h263", GST_RANK_PRIMARY, gst_omx_h263enc_get_type },
- { "omx_vorbisdec", "libomxil-bellagio.so.0", "OMX.st.audio_decoder.ogg.single", GST_RANK_SECONDARY, gst_omx_vorbisdec_get_type },
- { "omx_mp3dec", "libomxil-bellagio.so.0", "OMX.st.audio_decoder.mp3.mad", GST_RANK_PRIMARY, gst_omx_mp3dec_get_type },
+static GstStructure *element_table = NULL;
+
+const gchar *default_config = NULL;
+
+static GType (*get_type[]) (void) = {
+ gst_omx_dummy_get_type,
+ gst_omx_mpeg4dec_get_type,
+ gst_omx_h264dec_get_type,
+ gst_omx_h263dec_get_type,
+ gst_omx_wmvdec_get_type,
+ gst_omx_mpeg4enc_get_type,
+ gst_omx_h264enc_get_type,
+ gst_omx_h263enc_get_type,
+ gst_omx_vorbisdec_get_type,
+ gst_omx_mp3dec_get_type,
#ifdef EXPERIMENTAL
- { "omx_mp2dec", "libomxil-bellagio.so.0", "OMX.st.audio_decoder.mp3.mad", GST_RANK_PRIMARY, gst_omx_mp2dec_get_type },
- { "omx_amrnbdec", "libomxil-bellagio.so.0", "OMX.st.audio_decoder.amrnb", GST_RANK_PRIMARY, gst_omx_amrnbdec_get_type },
- { "omx_amrnbenc", "libomxil-bellagio.so.0", "OMX.st.audio_encoder.amrnb", GST_RANK_PRIMARY, gst_omx_amrnbenc_get_type },
- { "omx_amrwbdec", "libomxil-bellagio.so.0", "OMX.st.audio_decoder.amrwb", GST_RANK_PRIMARY, gst_omx_amrwbdec_get_type },
- { "omx_amrwbenc", "libomxil-bellagio.so.0", "OMX.st.audio_encoder.amrwb", GST_RANK_PRIMARY, gst_omx_amrwbenc_get_type },
- { "omx_aacdec", "libomxil-bellagio.so.0", "OMX.st.audio_decoder.aac", GST_RANK_PRIMARY, gst_omx_aacdec_get_type },
- { "omx_aacenc", "libomxil-bellagio.so.0", "OMX.st.audio_encoder.aac", GST_RANK_PRIMARY, gst_omx_aacenc_get_type },
- { "omx_adpcmdec", "libomxil-bellagio.so.0", "OMX.st.audio_decoder.adpcm", GST_RANK_PRIMARY, gst_omx_adpcmdec_get_type },
- { "omx_adpcmenc", "libomxil-bellagio.so.0", "OMX.st.audio_encoder.adpcm", GST_RANK_PRIMARY, gst_omx_adpcmenc_get_type },
- { "omx_g711dec", "libomxil-bellagio.so.0", "OMX.st.audio_decoder.g711", GST_RANK_PRIMARY, gst_omx_g711dec_get_type },
- { "omx_g711enc", "libomxil-bellagio.so.0", "OMX.st.audio_encoder.g711", GST_RANK_PRIMARY, gst_omx_g711enc_get_type },
- { "omx_g729dec", "libomxil-bellagio.so.0", "OMX.st.audio_decoder.g729", GST_RANK_PRIMARY, gst_omx_g729dec_get_type },
- { "omx_g729enc", "libomxil-bellagio.so.0", "OMX.st.audio_encoder.g729", GST_RANK_PRIMARY, gst_omx_g729enc_get_type },
- { "omx_ilbcdec", "libomxil-bellagio.so.0", "OMX.st.audio_decoder.ilbc", GST_RANK_PRIMARY, gst_omx_ilbcdec_get_type },
- { "omx_ilbcenc", "libomxil-bellagio.so.0", "OMX.st.audio_encoder.ilbc", GST_RANK_PRIMARY, gst_omx_ilbcenc_get_type },
- { "omx_jpegenc", "libomxil-bellagio.so.0", "OMX.st.image_encoder.jpeg", GST_RANK_PRIMARY, gst_omx_jpegenc_get_type },
+ gst_omx_mp2dec_get_type,
+ gst_omx_amrnbdec_get_type,
+ gst_omx_amrnbenc_get_type,
+ gst_omx_amrwbdec_get_type,
+ gst_omx_amrwbenc_get_type,
+ gst_omx_aacdec_get_type,
+ gst_omx_aacenc_get_type,
+ gst_omx_adpcmdec_get_type,
+ gst_omx_adpcmenc_get_type,
+ gst_omx_g711dec_get_type,
+ gst_omx_g711enc_get_type,
+ gst_omx_g729dec_get_type,
+ gst_omx_g729enc_get_type,
+ gst_omx_ilbcdec_get_type,
+ gst_omx_ilbcenc_get_type,
+ gst_omx_jpegenc_get_type,
#endif /* EXPERIMENTAL */
- { "omx_audiosink", "libomxil-bellagio.so.0", "OMX.st.alsa.alsasink", GST_RANK_NONE, gst_omx_audiosink_get_type },
+ gst_omx_audiosink_get_type,
#ifdef EXPERIMENTAL
- { "omx_videosink", "libomxil-bellagio.so.0", "OMX.st.videosink", GST_RANK_NONE, gst_omx_videosink_get_type },
- { "omx_filereadersrc", "libomxil-bellagio.so.0", "OMX.st.audio_filereader", GST_RANK_NONE, gst_omx_filereadersrc_get_type },
+ gst_omx_videosink_get_type,
+ gst_omx_filereadersrc_get_type,
#endif /* EXPERIMENTAL */
- { "omx_volume", "libomxil-bellagio.so.0", "OMX.st.volume.component", GST_RANK_NONE, gst_omx_volume_get_type },
- { NULL, NULL, NULL, 0, NULL },
+ gst_omx_volume_get_type,
};
+/* TODO: we can cache table w/ gst_plugin_{get,set}_cache_data..
+ */
+static GstStructure *
+get_element_table (void)
+{
+ static volatile gsize gonce_data = 0;
+ if (g_once_init_enter (&gonce_data))
+ {
+ gchar *path;
+ gchar *config, *s;
+ GstStructure *element;
+
+ path = g_strdup (g_getenv ("OMX_REGISTRY"));
+ if (!path)
+ {
+ path = g_build_filename (g_get_user_config_dir (),
+ "gst-openmax.conf", NULL);
+ }
+
+ if (!g_file_get_contents (path, &config, NULL, NULL))
+ {
+ g_warning ("could not find config file '%s'.. using defaults!", path);
+ config = (gchar *) default_config;
+ }
+
+ g_free (path);
+
+ GST_DEBUG ("parsing config:\n%s", config);
+
+ element_table = gst_structure_empty_new ("element_table");
+
+ s = config;
+
+ while ((element = gst_structure_from_string (s, &s)))
+ {
+ const gchar *element_type = gst_structure_get_name (element);
+ gst_structure_set (element_table,
+ element_type, GST_TYPE_STRUCTURE, element, NULL);
+ }
+
+ if (config != default_config)
+ g_free (config);
+
+ GST_DEBUG ("element_table=%" GST_PTR_FORMAT, element_table);
+
+ g_once_init_leave (&gonce_data, 1);
+ }
+
+ return element_table;
+}
+
+static GstStructure *
+get_element_entry (const gchar *element_type)
+{
+ GstStructure *element_table = get_element_table ();
+ GstStructure *element;
+
+ if (!gst_structure_get (element_table, element_type,
+ GST_TYPE_STRUCTURE, &element, NULL))
+ {
+ element = NULL;
+ }
+
+ /* This assert should never fail, because plugin elements are registered
+ * based on the entries in this table. Someone would have to manually
+ * override the type qdata for this to fail.
+ */
+ g_assert (element);
+
+ return element;
+}
+
+/* register a new dynamic sub-class with the name 'type_name'.. this gives us
+ * a way to use the same (for example) GstOmxMp3Dec element mapping to
+ * multiple different element names with different OMX library implementations
+ * and/or component names
+ */
+static GType
+create_subtype (GType parent_type, const gchar *type_name)
+{
+ GTypeQuery q;
+ GTypeInfo i = {0};
+
+ if (!type_name)
+ return 0;
+
+ g_type_query (parent_type, &q);
+
+ i.class_size = q.class_size;
+ i.instance_size = q.instance_size;
+
+ return g_type_register_static (parent_type, type_name, &i, 0);
+}
+
static gboolean
plugin_init (GstPlugin *plugin)
{
GQuark library_name_quark;
GQuark component_name_quark;
+ gint i, cnt;
+ GstStructure *element_table;
+
GST_DEBUG_CATEGORY_INIT (gstomx_debug, "omx", 0, "gst-openmax");
GST_DEBUG_CATEGORY_INIT (gstomx_util_debug, "omx_util", 0, "gst-openmax utility");
library_name_quark = g_quark_from_static_string ("library-name");
component_name_quark = g_quark_from_static_string ("component-name");
+ /*
+ * First, call all the _get_type() functions to ensure the types are
+ * registered.
+ */
+ for (i = 0; i < G_N_ELEMENTS (get_type); i++)
+ get_type[i] ();
+
+ element_table = get_element_table ();
+
g_omx_init ();
+ cnt = gst_structure_n_fields (element_table);
+ for (i = 0; i < cnt; i++)
{
- guint i;
- for (i = 0; element_table[i].name; i++)
- {
- TableItem *element;
- GType type;
+ const gchar *element_type = gst_structure_nth_field_name (element_table, i);
+ GstStructure *element = get_element_entry (element_type);
+ const gchar *name, *parent_type_name;
+ const gchar *component_name, *library_name;
+ GType type;
+ gint rank;
+
+ GST_DEBUG ("element_type=%s, element=%" GST_PTR_FORMAT, element_type, element);
+
+ name = gst_structure_get_string (element, "name");
+ component_name = gst_structure_get_string (element, "component-name");
+ library_name = gst_structure_get_string (element, "library-name");
- element = &element_table[i];
- type = element->get_type ();
- g_type_set_qdata (type, library_name_quark, (gpointer) element->library_name);
- g_type_set_qdata (type, component_name_quark, (gpointer) element->component_name);
+ parent_type_name = gst_structure_get_string (element, "parent-type");
- if (!gst_element_register (plugin, element->name, element->rank, type))
+ if (!name || !component_name || !library_name)
+ {
+ g_warning ("malformed config file: missing required fields for %s",
+ element_type);
+ return FALSE;
+ }
+
+ if (parent_type_name)
+ {
+ type = g_type_from_name (parent_type_name);
+ if (type)
{
- g_warning ("failed registering '%s'", element->name);
+ type = create_subtype (type, element_type);
+ }
+ else
+ {
+ g_warning ("malformed config file: invalid parent-type '%s' for %s",
+ parent_type_name, element_type);
return FALSE;
}
}
+ else
+ type = g_type_from_name (element_type);
+
+ if (!type)
+ {
+ g_warning ("malformed config file: invalid type '%s'",
+ element_type);
+ return FALSE;
+ }
+
+ g_type_set_qdata (type, library_name_quark, (gpointer) library_name);
+ g_type_set_qdata (type, component_name_quark, (gpointer) component_name);
+
+ if (!gst_structure_get_int (element, "rank", &rank))
+ {
+ /* use default rank: */
+ rank = GST_RANK_NONE;
+ }
+
+ if (!gst_element_register (plugin, name, rank, type))
+ {
+ g_warning ("failed registering '%s'", name);
+ return FALSE;
+ }
}
return TRUE;
--
1.7.0.1
|
|
From: Felipe C. <fel...@no...> - 2010-03-03 00:07:26
|
On Mon, Mar 01, 2010 at 12:36:13AM +0100, Rob Clark wrote: > Configurable mapping between gst-openmax elements and OMX library-name > and component-name via config file. The config file may even create > multiple different elements with unique names using the same > gst-openmax class but different OMX library-name and/or > component-name. > > In the simple case, of one OMX component per gst-openmax class, > specify the gst-openmax class as the 'type', and the 'library-name' > and 'compnent-name' of the OMX component, and optionally the 'rank' > (defaults to 0 or GST_RANK_NONE): > > ---- > omx_h264dec, > type=GstOmxH264Dec, > library-name=libomxil-bellagio.so.0, > component-name=OMX.st.video_decoder.avc, > rank=256; > ---- > > Or in the advanced case of multiple OMX components per gst-openmax > class, specify the gst-openmax class as the 'parent-type' and a > dynamically created sub-class for the 'type': > > ---- > omx_mp3dec_ti, > parent-type=GstOmxMp3Dec, > type=GstOmxMp3DecTi > library-name=libOMX_Core.so.0, > component-name=OMX.TI.AUDIO.DECODE, > component-role=audio_decode.dsp.mp3, > rank=256; > > omx_mp3dec_nokia, > parent-type=GstOmxMp3Dec, > type=GstOmxMp3DecNokia > library-name=libomxil_bellagio.so.0, > component-name=OMX.nokia.audio_decode.mp3, > rank=128; > ---- > > by default, the config file is stored in > $HOME/.config/gst-openmax.conf, although if none is found a default > config will be created. > --- > Latest (and hopefully final) version of patch fixes small memory leak I was about to commit this when I recalled to run 'make check', which is broken by this commit. One modification lead to another and I ended up making huge modifications. Please see the following patch (I'll call it v2 because the previous ones were not versioned). First, it's not necessary to make read-only the 'library-name' and 'component-name' properties. I acomplished this by moving both fienls from the bases clases to GOmxCore, and then, in g_omx_core_init(), only update them if they haven't been set before. This fixes 'make check'. I have the patch if you are interested. It might be possible to update 'make check' to use a temporary configuration file instead, but I didn't want to go that way yet. The problem with this approach is that the fields will not be updated from the config file until g_omx_core_init() is called, so they'll not show in gst-launch. I solved this by calling g_omx_get_component_info() when the instance is created and using the type of the class instead of the element name. For some reason get_element_name() was returning NULL. I think it might be possible to keep using the element name as the primary field, by using the "element-name" qdata of the GType but I only though of it just now. The resulting patch is much simpler. This is the format of the config: (I'm not entirely happy with it) --- GstOmxMpeg4Dec, name=omx_mpeg4dec, library-name=libOMX_Core, component-name=OMX.TI.Video.Decoder, rank=256; --- Cheers. -- Felipe Contreras |
|
From: Clark, R. <ro...@ti...> - 2010-03-02 17:49:39
|
On Mar 1, 2010, at 9:43 AM, Felipe Contreras wrote: > On Sat, Feb 27, 2010 at 8:24 PM, Rob Clark <ro...@ti...> wrote: >> btw, I'm thinking about this one again.. >> >> how about, in case of setting all params: >> >> OMX_AUDIO_PARAM_PCMMODETYPE param; >> >> G_OMX_INIT_PARAM (param); > > I think it should be: > > G_OMX_INIT_PARAM (OMX_AUDIO_PARAM_PCMMODETYPE, param); > >> ... set params ... >> >> G_OMX_PORT_SET_PARAM (port, OMX_IndexParamAudioPcm, ¶m); > > I don't see a big difference to: > > param.nPortIndex = 1; > OMX_SetParameter(omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); > >> or in case where you just want to set a few params: >> >> OMX_AUDIO_PARAM_PCMMODETYPE param; > > You forgot the init I guess. oh, btw, maybe it wasn't obvious, but current version of the patch combines the GET macro and INIT.. which is fine if you always follow GET/modify/SET pattern.. which seems like a reasonably good pattern to encourage. In normal cases you aren't setting all parameters in one place. Exceptions might be some param/config structs which only have one or two fields. But it could be reasonable to to have an INIT function/macro as alternative to GET for those cases where GET/modify/SET really doesn't make sense. I still like the idea of making it conceptually a method of the GOmxPort object (ie. G_OMX_PORT_SET_PARAM(out_port, ...)) for port related params, since I think it makes it easier to read the code of the different gst-openmax element classes. BR, -R > >> G_OMX_PORT_GET_PARAM (port, OMX_IndexParamAudioPcm, ¶m); >> >> ... set params ... >> >> G_OMX_PORT_SET_PARAM (port, OMX_IndexParamAudioPcm, ¶m); > > Again, I don't see a big difference to: > > param.nPortIndex = 1; > OMX_GetParameter(omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); > > ... set params ... > > OMX_SetParameter(omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); > > Cheers. > > -- > Felipe Contreras |
|
From: Tejas <te...@pi...> - 2010-03-02 09:16:21
|
Hi, I have installed totem latest version which is 2.28.5 and tried to play VGA and HD video content. But still I am getting same kind of errors. I can tell about my steps. 1. My boot args are as followed. "setenv bootargs 'console=ttyS2,115200n8 root=/dev/mmcblk0p2 rw rootwait omapfb.mode=dvi:1280x720MR-32@60 vram=16M omapfb.vram=0:8M,1:8M' " 2. Boot system and open totem movie player, maximize it and try to play 640 x 480 VGA video content. It is playing properly. Now when I restore down the totem window while my playback is going on only blue screen is running and following error message is coming on my HyperTerminal window. "omapdss MANAGER error: dispc_setup_plane failed for ovl 1" 3. The same thing happens for HD content having 1280x720. In this case something different behavior. I open totem movie player, start 1280x720 HD video content, only blue screen is running. Now when I do full screen actual video is playing. And when I do leave full screen again blue video play back is going on. And same error message is coming. Can anyone tell where I am lacking ? Is there any settings which I forgot to make? Please guide me and correct me if I am wrong. -Tejas. -----Original Message----- From: Clark, Rob [mailto:ro...@ti...] Sent: Tuesday, February 23, 2010 8:30 PM To: Tejas Cc: Felipe Contreras; Stefan Kost; gst...@li... Subject: Re: [Gstreamer-openmax] AV Sync with Gst-OpenMax pluggin could you patch totem to use playbin2? For most part, you just have to replace "playbin" with "playbin2". the native-video and native-audio flags on playbin2 result in a more embedded friendly pipeline.. that alone is worth the switch BR, -R On Feb 22, 2010, at 11:10 PM, Tejas wrote: > Hi Felipe, > With help of playbin2 also I am able to run all HD video content by following commands. > > $ gst-launch-0.10 playbin2 uri=file:///648x480.mp4 > > $ gst-launch-0.10 playbin2 uri=file:///1280x720.mp4 > > I have taken debug log of totem playback, it is creating bin as playbin only. > > totem --gst-debug=GST_ELEMENT_*:3 --play /media/mmcblk0p1/Movie.mp4 > > It is using playbin only. And the kernel image which I am using is having DSS2. > > I have added "omapfb.vram=0:2M,1:4M" argument to my boot argument. Still I am getting "omapdss MANAGER error: dispc_setup_plane failed for ovl 1" error > > > -Tejas. > > -----Original Message----- > From: Felipe Contreras [mailto:fel...@gm...] > Sent: Monday, February 22, 2010 5:39 PM > To: Tejas > Cc: Stefan Kost; gst...@li... > Subject: Re: [Gstreamer-openmax] AV Sync with Gst-OpenMax pluggin > > On Mon, Feb 22, 2010 at 2:00 PM, Tejas <te...@pi...> wrote: >> Hello Felipe, >> As I was not able to play any video content with the help of omapfbsink plugin. Later I found that memory from frame buffer 1 was not mapped , because memory for fb1 has not been allocated. After my system of beagle board boots I am running following commands to allocate memory. >> >> My boot args is as followed. >> >> "setenv bootargs 'console=ttyS2,115200n8 root=/dev/mmcblk0p2 rw rootwait omapfb.mode=dvi:1280x720MR-32@60 vram=12M'" > > I add "omapfb.vram=0:2M,1:4M". I'm not sure if you need that in recent DSS2. > >> $echo 8000000 > /sys/class/graphics/fb1/size >> $fbset -fb /dev/fb1 -nonstd 1 >> $echo "1" > /sys/devices/platform/omapdss/overlay1/enabled >> $echo "$1,$2" > /sys/devices/platform/omapdss/overlay1/output_size >> $echo "0,0" > /sys/devices/platform/omapdss/overlay1/position >> $fbset -fb /dev/fb0 -xres $1 -yres $2 >> $echo "0,0" > /sys/devices/platform/omapdss/overlay0/position >> $echo "0" > /sys/devices/platform/omapdss/display0/enabled >> $echo "" > /sys/devices/platform/omapdss/manager0/display >> $echo "0" > /sys/devices/platform/omapdss/overlay1/enabled >> $ >> $echo "1" > /sys/devices/platform/omapdss/overlay1/enabled >> $echo "dvi" > /sys/devices/platform/omapdss/manager0/display >> $echo "1" > /sys/devices/platform/omapdss/display0/enabled >> >> I put all these command into one disp.sh file and run it as ./disp.sh 640 480, then 640x480 display comes and rest comes as black. Now I can run following command smoothly. >> >> $gst-launch-0.10 playbin uri=file:///648x480.mp4 > > AFAIK omapfbsink would do most of those sysctl commands. However maybe > you are using and old version of gst-omapfb. > >> After that when I run following command, that display doesn't come properly. That video content is of resolution 1280 x 720. >> >> $gst-launch-0.10 playbin uri=file:///1280x720.mp4 >> >> After that I run ./disp.sh 1280 720 and then run above command I can play video properly. >> >> But when I run 1280 x 720 video file into totem movie player nothing is coming and only blue screen throught entire video play back. After getting log file it gives following error. >> "omapdss MANAGER error: dispc_setup_plane failed for ovl 1" >> >> Can any one guide me to come out this error. > > That's really strange. Totem shouldn't be doing anything different... > well, I't using playbin2 instead of playbin. Can you try that? > > Anyway, I would add debugging in gst-omapfb to find out what > parameters are being used to setup the plane that make it fail. > > Cheers. > > -- > Felipe Contreras > > > ---------------------------------------------------------------------------- -- > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Gstreamer-openmax mailing list > Gst...@li... > https://lists.sourceforge.net/lists/listinfo/gstreamer-openmax |