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: Felipe C. <fel...@gm...> - 2009-11-14 12:52:25
|
On Wed, Nov 4, 2009 at 4:27 AM, Rob Clark <ro...@ti...> wrote: > Not properly flushing output port buffers was causing a problem with seek. We would get a buffer from before the flush-start/flush-stop/newsegment sequence, which had an old timestamp, throwing off the AV sync logic in gst base sink classes. This would only happen if the omx component returns an output buffer *after* the gst flush has finished, which means the flush of the input port has finished too, which means there are no input buffers in the component queue. How can the component still generate output buffers if there's no input. I think I added that logic because bellagio was misbehaving (probably a race condition), but I realized that we actually wanted this in the general case, because we are not going to do anything with the flushed output buffers, just send them back to the component. In any case, if you want to do this properly, then you need to remove the check for input vs output, and just send OMX_CommandFlush all the time, and not touch the async queue. -- Felipe Contreras |
|
From: Felipe C. <fel...@gm...> - 2009-11-14 12:41:43
|
On Wed, Nov 4, 2009 at 4:26 AM, Rob Clark <ro...@ti...> wrote: > These work like the GST_BOILERPLATE macros, but following the naming conventions for init functions used in the gst-openmax code, to remove a lot of gobject related boilerplate code. This seems ok, but I don't like the GSTOMX_BOILERPLATE_FULL; it's only used on the base classes which by architecture are always going to be few, and might even change quite drastically in the future (in order to do tunneling properly). -- Felipe Contreras |
|
From: Felipe C. <fel...@gm...> - 2009-11-14 12:33:24
|
On Fri, Nov 6, 2009 at 4:58 AM, Rob Clark <ro...@ti...> wrote: > On Nov 5, 2009, at 10:56 AM, Felipe Contreras wrote: >> It's not required right now, is it? The component_name and >> library_name are only needed in the _init function. > > But the point of this patch was that _init() could be called upon demand the > first time the element needs to access the handle. So they might be needed > earlier than when _init() was traditionally called. I sent a reply to your personal mail explaining why this is a fundamental change, and we should probably wait until we have an omx registry implemented. > I'm not sure I quite catch your point.. the GOmxCore object represents on > instance of one OMX component.. and this requires both library name and > component name (and later in a later commit, when I add component-role, the > component role string as well) > > but this could be split out into an earlier patch in the series I'm saying GOmxCore is independent of the omx implementation when you call _new(), it's tied to it *only* when you call _init(). In theory you can call _deinit() and _init() again, and re-use it for a different implementation. I'm not saying this is good, or desirable, just the way it is, and that if you want to change that, that should be a different patch. >> g_return_if_fail is not fatal, it would just silently return. > > yeah, agree.. should be g_assert() > > (and if support to get these values from elsewhere, like a config file, were > added.. then we'd have to make sure the config file actually contained these > values at this point. So I don't think that really changes anything.) Unless the config file format makes that impossible. >> Perhaps, but I still don't see why another patch would *need* this. If >> anything, g_omx_core_init should be called in some other strategic >> place, not leaked in like this... it messes up the semantics of the >> API. > > with the addition of call to g_omx_core_deinit() in g_omx_core_deinit(), the > OMX component won't be leaked.. unless the GOmxCore itself was leaked, but > that would be a problem in any case I didn't mean "leak" as in memory leak. I meant as in silently tagged along to something completely different. If you need the _init() to happen sooner, then do a separate call to _init() sooner. >> So you want to change the point at which OpenMAX is really >> initialized? There's some patches ready pending merging that serialize >> omx to gst state changes, although I'm not sure if they would be >> useful to you; in my testing those would require dynamic port >> configuration to work, and it doesn't seem to in TI's omx video >> components. > > do you mind sending these patches to me? Even if they are only half-baked > and not ready to merge yet. I can have a look and see if I need to change > my patch to fit in better with these other patches > > (btw, I have some later patches that I'm still working on for dynamic port > enable/disable/reconfig. Although these aren't for use w/ the omap3 omx > components that you are familiar with. And really has nothing to do with > this patch.) Sure. I'm in the process of cleaning all the repos I've been working on for Maemo 5, among different machines and servers. I'm going to push my pending gst-openmax branches to github (personal repo) soon. > well, several of these early commits are laying groundwork for some later > commits.. so they aren't all completely independent. Although some of them > are, and different branches for the independent commits probably would have > simplified life.. but I'm learning new things about git every day ;-) Yeap, this is usually referred to as "feature branches", and it's not specific to git, but git makes to easy to work with them :) For example, in linux I have 'fc-cleanup', and 'fc-iommu-reorg' and these are completely independent, so I send the patch series for review independently too, and can be reviewed and merged in the same way. If 'fc-iommu-reorg' requires a try v5 that doesn't affect 'fc-cleanup' at all. Similarly, I start new branches based on the 'master' branch, so that they are independent of all the other patches I've done. I had a similar problem than you do when the 'maemo' branch in gst-openmax was huge, and it was not clear which patches should go into 'master', which into 'omap', which just dropped, and so on. But with a little bit of training on git commands such as chery-pick, rebase --interactive, and mergetool, it's even fun ;) Cheers. -- Felipe Contreras |
|
From: Felipe C. <fel...@gm...> - 2009-11-09 21:16:53
|
On Mon, Nov 9, 2009 at 5:11 PM, 温康维 <wen...@gm...> wrote: > Dear gstreamer-openmax, > > Is gst-openmax can support OpenMax IL version 1.1.2 ? > > Bellagio 0.9.2 has Upgraded to version 1.1.2. OpenMAX IL 1.1.2 implementations should be compatible with 1.1.1 clients, so gst-openmax should work. -- Felipe Contreras |
|
From: 温康维 <wen...@gm...> - 2009-11-09 15:11:20
|
Dear gstreamer-openmax, Is gst-openmax can support OpenMax IL version 1.1.2 ? Bellagio 0.9.2 has Upgraded to version 1.1.2. -- Best Regards WKW ---------------------------------------------------------------------- Skytone (China,Guangzhou) Tel: +86-020-38629186 Email: wen...@sk... | wen...@gm... |
|
From: Rob C. <ro...@ti...> - 2009-11-06 02:58:57
|
On Nov 5, 2009, at 10:56 AM, Felipe Contreras wrote:
> On Wed, Nov 4, 2009 at 5:17 PM, Rob Clark <ro...@ti...> wrote:
>> On Nov 4, 2009, at 8:31 AM, Felipe Contreras wrote:
>>> This doesn't fit with $subject, seems to be a logically independent
>>> trivial rename that's also changing code-style at the same time.
>>
>> [RC] not really.. if you look a bit further down
>> g_omx_core_get_port()
>> became a public (to the gstomx elements) API and most of the
>> functionality
>> was split out into an internal get_port helper function which is
>> called by
>> g_omx_core_get_port() and some other places.
>
> Ok, so it's a different function with essentially the same name.
>
> BTW. No need to prefix your replies with "[RC]". I'm not sure why TI
> people do that.
I guess just habit.. won't do that in future ;-)
>
>> Is your preference that additional parameters to a function go on
>> separate
>> lines? If so, my mistake.. I thought that was only for purposes of
>> line
>> wrapping long lines.
>
> Well, yeah, that's how that function is right now. It probably doesn't
> matter since the coding style will change, but it introduces noise in
> the patch.
>
>>> Again, that's a logically separate change.
>>
>> [RC] hmm, yeah, that should have been one of the later patches..
>> looks like
>> a couple small things slipped through in the process of trying to
>> re-organize the commits I had already made. When a lot of
>> different changes
>> touch the same file, grouping them into different commits isn't
>> straightforward. (Hmm, need a way to 'git add' parts of a file)
>
> git add --patch $file
>
>>> I'm not sure about passing a GObjectClass to the _new function. A
>>> separate function would make more sense.
>>
>> [RC] yeah... but it is required to completely initialize the GOmxCore
>> object. (Or could the klass be retrieved from the gobject?)
>
> It's not required right now, is it? The component_name and
> library_name are only needed in the _init function.
But the point of this patch was that _init() could be called upon
demand the first time the element needs to access the handle. So they
might be needed earlier than when _init() was traditionally called.
>
>> The GOmxCore object isn't really complete w/o knowing the library and
>> component name. And I was trying to keep things simpler for the
>> gstomx
>> element classes.
>
> Currently GOmxCore is independent of the actual OpenMAX
> implementation. If you want to change that I think that should be a
> different patch.
I'm not sure I quite catch your point.. the GOmxCore object represents
on instance of one OMX component.. and this requires both library name
and component name (and later in a later commit, when I add component-
role, the component role string as well)
but this could be split out into an earlier patch in the series
>
>>>> + g_return_if_fail (component_name);
>>>> + g_return_if_fail (library_name);
>>>
>>> If one component_name is there but not library_name there would be a
>>> memory leak, right?
>>
>> [RC] yup.. but you get a useful assert message about what was
>> screwed up so
>> you can fix it. Rather than just a segfault.
>
> g_return_if_fail is not fatal, it would just silently return.
yeah, agree.. should be g_assert()
(and if support to get these values from elsewhere, like a config
file, were added.. then we'd have to make sure the config file
actually contained these values at this point. So I don't think that
really changes anything.)
>
>> maybe those should be g_assert()'s, since it is pretty much a bad
>> situation
>> of you don't know the component or library name.
>
> Maybe, unless we alternatively obtain those values from somewhere else
> (not happening right now).
>
>>>> +/**
>>>> + * Accessor for OMX component handle. If the OMX component is not
>>>> constructed
>>>> + * yet, this will trigger it to be constructed
>>>> (OMX_GetHandle()). This
>>>> should
>>>> + * at least be used in places where g_omx_core_init() might not
>>>> have
>>>> been
>>>> + * called yet (such as setting/getting properties)
>>>> + */
>>>> +OMX_HANDLETYPE
>>>> +g_omx_core_get_handle (GOmxCore *core)
>>>> +{
>>>> + if (!core->omx_handle) g_omx_core_init (core);
>>>> + return core->omx_handle;
>>>> +}
>>>
>>> Why do we want to do this?
>>
>> [RC] this way, you can do things like GetConfig/GetParameter
>> earlier in
>> startup. This was needed by some of the later patches, and is
>> basically the
>> main purpose of the patch
>
> Perhaps, but I still don't see why another patch would *need* this. If
> anything, g_omx_core_init should be called in some other strategic
> place, not leaked in like this... it messes up the semantics of the
> API.
>
with the addition of call to g_omx_core_deinit() in
g_omx_core_deinit(), the OMX component won't be leaked.. unless the
GOmxCore itself was leaked, but that would be a problem in any case
>>> I'm not completely against this patch, but it's difficult to review
>>> with so many unrelated changes, and at the end of the day I still
>>> wonder; What's the point of this patch? I'm sure the purpose would
>>> be
>>> revealed in latter patches, but each individual patch must make
>>> sense
>>> on it's own: explain in detail on the commit message.
>>
>> [RC] yeah, sorry.. in process of making those changes I added a
>> bunch of
>> traces (which is most of the unrelated changes).. but since they were
>> interleaved w/ actual changes, it isn't always easy to break them
>> into a
>> separate commit after the fact. If you *really* want to see those
>> as a
>> separate commit, I'll break them out.
>
> It is easy with git :)
> http://gitcasts.com/posts/interactive-adding
ahh, that is the coolest thing since sliced bread
this will be very helpful, thx!
>
>> either way, I'll resend the patch with the component-role stuff
>> split out..
>> that part really needs to go along w/ it's corresponding changes in
>> some
>> other files
>
> Thanks.
>
>>> In general I try to answer these questions:
>>> * What does the patch do?
>>> * Why do we want it?
>>> * What is the impact?
>>
>> btw, I guess I should have put this in the commit msg, but main
>> purpose of
>> the patch is to make it easier for the various element classes to
>> have
>> properties which use OMX_{Get,Set}Parameter, for example. This is
>> used in
>> some of the later commits. But was a big enough change by itself
>> that I
>> wanted to break it into it's own commit.
>
> Yeah, exactly, this should go into the commit message. But it's still
> not clear to me; anybody can do OMX_{Get,Set}Parameter already, and
> the changes of component and library name seem completely independent
> of that.
>
>> Why do we want it? I think it simplifies usage of the GOmxCore/
>> GOmxPort
>> utility classes by making it possible to initialize the core/port
>> objects in
>> the element constructor while still deferring instantiation of the
>> OMX
>> component (in the normal case) until where they were previously
>> instantiated. (For example, NULL_TO_READ state change for classes
>> that
>> inherit from GstOmxBaseFilter)
>
> So you want to change the point at which OpenMAX is really
> initialized? There's some patches ready pending merging that serialize
> omx to gst state changes, although I'm not sure if they would be
> useful to you; in my testing those would require dynamic port
> configuration to work, and it doesn't seem to in TI's omx video
> components.
do you mind sending these patches to me? Even if they are only half-
baked and not ready to merge yet. I can have a look and see if I need
to change my patch to fit in better with these other patches
(btw, I have some later patches that I'm still working on for dynamic
port enable/disable/reconfig. Although these aren't for use w/ the
omap3 omx components that you are familiar with. And really has
nothing to do with this patch.)
>
>> The impact will come later, when some properties that use Get/
>> SetParameter()
>> are introduced, that if the properties are set, the OMX component
>> will be
>> instantiated earlier. But this is mainly only in debug uses, such
>> as if you
>> use gst-inspect. In normal cases startup order stays the same.
>
> I see. In that case the impact is: non-functional/code-reorganization
> or something like that.
>
> Anyway, I see you only have one branch of development. It's generally
> not a good idea to do that because most probably one of the later
> patches might depend on the first ones, so if the merge/review process
> is slow for the initial patches, even if they are trivial, the
> important changes would be delayed. If you have multiple branches,
> then you can send multiple patch series for review at the same time.
> For internal development you can merge all your branches into a
> working branch. It sounds complicated but once you learn your git
> ropes then it's easy :)
>
well, several of these early commits are laying groundwork for some
later commits.. so they aren't all completely independent. Although
some of them are, and different branches for the independent commits
probably would have simplified life.. but I'm learning new things
about git every day ;-)
BR,
-R
|
|
From: Rob C. <ro...@ti...> - 2009-11-06 02:33:44
|
On Nov 5, 2009, at 3:21 PM, Stefan Kost wrote:
> Rob Clark schrieb:
>> Signed-off-by: Rob Clark <ro...@ti...>
>> ---
>> omx/gstomx_base_filter.c | 24 ++------
>> omx/gstomx_base_sink.c | 21 ++------
>> omx/gstomx_base_src.c | 22 ++------
>> omx/gstomx_util.c | 133 ++++++++++++++++++++++++++++++++++
>> +-----------
>> omx/gstomx_util.h | 12 +++--
>> 5 files changed, 123 insertions(+), 89 deletions(-)
>>
>
>> void
>> -g_omx_core_init (GOmxCore *core,
>> - const gchar *library_name,
>> - const gchar *component_name)
>> +g_omx_core_init (GOmxCore *core)
>> {
>> + gchar *library_name=NULL, *component_name=NULL;
>> +
>> + if (core->omx_handle)
>> + return;
>> +
>> + GST_DEBUG_OBJECT (core->object, "loading: %s (%s)",
>> component_name, library_name);
>> +
>> + g_object_get (core->object,
>> + "component-name", &component_name,
>> + "library-name", &library_name,
>> + NULL);
>> +
>> + g_return_if_fail (component_name);
>> + g_return_if_fail (library_name);
>> +
>> core->imp = request_imp (library_name);
>>
>
> just use g_assert here, if that is never supposed to fail.
> g_return_if_fail is
> to handle external wrong api usage (things that you can't control),
> and g_assert
> is for own mistakes. People who are using stable releases of a
> software would
> turn the assert off. When they ship their product and its well
> tested, they
> could turn the g_return_if_fail off too (if there are not going to
> be other
> users of the library).
>
agreed.. should be g_assert since this is never supposed to fail..
when I re-submit, I'll change this.
BR,
-R
|
|
From: Stefan K. <en...@ho...> - 2009-11-05 21:21:20
|
Rob Clark schrieb:
> Signed-off-by: Rob Clark <ro...@ti...>
> ---
> omx/gstomx_base_filter.c | 24 ++------
> omx/gstomx_base_sink.c | 21 ++------
> omx/gstomx_base_src.c | 22 ++------
> omx/gstomx_util.c | 133 +++++++++++++++++++++++++++++++++++-----------
> omx/gstomx_util.h | 12 +++--
> 5 files changed, 123 insertions(+), 89 deletions(-)
>
> void
> -g_omx_core_init (GOmxCore *core,
> - const gchar *library_name,
> - const gchar *component_name)
> +g_omx_core_init (GOmxCore *core)
> {
> + gchar *library_name=NULL, *component_name=NULL;
> +
> + if (core->omx_handle)
> + return;
> +
> + GST_DEBUG_OBJECT (core->object, "loading: %s (%s)", component_name, library_name);
> +
> + g_object_get (core->object,
> + "component-name", &component_name,
> + "library-name", &library_name,
> + NULL);
> +
> + g_return_if_fail (component_name);
> + g_return_if_fail (library_name);
> +
> core->imp = request_imp (library_name);
>
just use g_assert here, if that is never supposed to fail. g_return_if_fail is
to handle external wrong api usage (things that you can't control), and g_assert
is for own mistakes. People who are using stable releases of a software would
turn the assert off. When they ship their product and its well tested, they
could turn the g_return_if_fail off too (if there are not going to be other
users of the library).
Stefan
|
|
From: Felipe C. <fel...@gm...> - 2009-11-05 16:57:07
|
On Wed, Nov 4, 2009 at 5:17 PM, Rob Clark <ro...@ti...> wrote:
> On Nov 4, 2009, at 8:31 AM, Felipe Contreras wrote:
>> This doesn't fit with $subject, seems to be a logically independent
>> trivial rename that's also changing code-style at the same time.
>
> [RC] not really.. if you look a bit further down g_omx_core_get_port()
> became a public (to the gstomx elements) API and most of the functionality
> was split out into an internal get_port helper function which is called by
> g_omx_core_get_port() and some other places.
Ok, so it's a different function with essentially the same name.
BTW. No need to prefix your replies with "[RC]". I'm not sure why TI
people do that.
> Is your preference that additional parameters to a function go on separate
> lines? If so, my mistake.. I thought that was only for purposes of line
> wrapping long lines.
Well, yeah, that's how that function is right now. It probably doesn't
matter since the coding style will change, but it introduces noise in
the patch.
>> Again, that's a logically separate change.
>
> [RC] hmm, yeah, that should have been one of the later patches.. looks like
> a couple small things slipped through in the process of trying to
> re-organize the commits I had already made. When a lot of different changes
> touch the same file, grouping them into different commits isn't
> straightforward. (Hmm, need a way to 'git add' parts of a file)
git add --patch $file
>> I'm not sure about passing a GObjectClass to the _new function. A
>> separate function would make more sense.
>
> [RC] yeah... but it is required to completely initialize the GOmxCore
> object. (Or could the klass be retrieved from the gobject?)
It's not required right now, is it? The component_name and
library_name are only needed in the _init function.
> The GOmxCore object isn't really complete w/o knowing the library and
> component name. And I was trying to keep things simpler for the gstomx
> element classes.
Currently GOmxCore is independent of the actual OpenMAX
implementation. If you want to change that I think that should be a
different patch.
>>> + g_return_if_fail (component_name);
>>> + g_return_if_fail (library_name);
>>
>> If one component_name is there but not library_name there would be a
>> memory leak, right?
>
> [RC] yup.. but you get a useful assert message about what was screwed up so
> you can fix it. Rather than just a segfault.
g_return_if_fail is not fatal, it would just silently return.
> maybe those should be g_assert()'s, since it is pretty much a bad situation
> of you don't know the component or library name.
Maybe, unless we alternatively obtain those values from somewhere else
(not happening right now).
>>> +/**
>>> + * Accessor for OMX component handle. If the OMX component is not
>>> constructed
>>> + * yet, this will trigger it to be constructed (OMX_GetHandle()). This
>>> should
>>> + * at least be used in places where g_omx_core_init() might not have
>>> been
>>> + * called yet (such as setting/getting properties)
>>> + */
>>> +OMX_HANDLETYPE
>>> +g_omx_core_get_handle (GOmxCore *core)
>>> +{
>>> + if (!core->omx_handle) g_omx_core_init (core);
>>> + return core->omx_handle;
>>> +}
>>
>> Why do we want to do this?
>
> [RC] this way, you can do things like GetConfig/GetParameter earlier in
> startup. This was needed by some of the later patches, and is basically the
> main purpose of the patch
Perhaps, but I still don't see why another patch would *need* this. If
anything, g_omx_core_init should be called in some other strategic
place, not leaked in like this... it messes up the semantics of the
API.
>> I'm not completely against this patch, but it's difficult to review
>> with so many unrelated changes, and at the end of the day I still
>> wonder; What's the point of this patch? I'm sure the purpose would be
>> revealed in latter patches, but each individual patch must make sense
>> on it's own: explain in detail on the commit message.
>
> [RC] yeah, sorry.. in process of making those changes I added a bunch of
> traces (which is most of the unrelated changes).. but since they were
> interleaved w/ actual changes, it isn't always easy to break them into a
> separate commit after the fact. If you *really* want to see those as a
> separate commit, I'll break them out.
It is easy with git :)
http://gitcasts.com/posts/interactive-adding
> either way, I'll resend the patch with the component-role stuff split out..
> that part really needs to go along w/ it's corresponding changes in some
> other files
Thanks.
>> In general I try to answer these questions:
>> * What does the patch do?
>> * Why do we want it?
>> * What is the impact?
>
> btw, I guess I should have put this in the commit msg, but main purpose of
> the patch is to make it easier for the various element classes to have
> properties which use OMX_{Get,Set}Parameter, for example. This is used in
> some of the later commits. But was a big enough change by itself that I
> wanted to break it into it's own commit.
Yeah, exactly, this should go into the commit message. But it's still
not clear to me; anybody can do OMX_{Get,Set}Parameter already, and
the changes of component and library name seem completely independent
of that.
> Why do we want it? I think it simplifies usage of the GOmxCore/GOmxPort
> utility classes by making it possible to initialize the core/port objects in
> the element constructor while still deferring instantiation of the OMX
> component (in the normal case) until where they were previously
> instantiated. (For example, NULL_TO_READ state change for classes that
> inherit from GstOmxBaseFilter)
So you want to change the point at which OpenMAX is really
initialized? There's some patches ready pending merging that serialize
omx to gst state changes, although I'm not sure if they would be
useful to you; in my testing those would require dynamic port
configuration to work, and it doesn't seem to in TI's omx video
components.
> The impact will come later, when some properties that use Get/SetParameter()
> are introduced, that if the properties are set, the OMX component will be
> instantiated earlier. But this is mainly only in debug uses, such as if you
> use gst-inspect. In normal cases startup order stays the same.
I see. In that case the impact is: non-functional/code-reorganization
or something like that.
Anyway, I see you only have one branch of development. It's generally
not a good idea to do that because most probably one of the later
patches might depend on the first ones, so if the merge/review process
is slow for the initial patches, even if they are trivial, the
important changes would be delayed. If you have multiple branches,
then you can send multiple patch series for review at the same time.
For internal development you can merge all your branches into a
working branch. It sounds complicated but once you learn your git
ropes then it's easy :)
Cheers.
--
Felipe Contreras
|
|
From: Rob C. <ro...@ti...> - 2009-11-04 15:19:21
|
On Nov 4, 2009, at 8:51 AM, Felipe Contreras wrote: > On Wed, Nov 4, 2009 at 4:23 AM, Rob Clark <ro...@ti...> wrote: >> Hi All, >> >> We've been working on the omap branch of gst-openmax for a few months >> now, and I've started cleaning up and porting some of the generic >> (non- >> omap specific) changes back to the master branch so that we can >> contribute them back to the community. So far I'm about 25% through >> the rebasing, but I'll start sending patches. And I'll continue >> rebasing and sending patches as time permits, hopefully finishing in >> the next couple weeks. > > I'm not sure how you are sending the patch series, but it's a bit hard > to follow the ordering. > > Maybe it would help to follow this: > http://felipec.wordpress.com/2009/10/25/git-send-email-tricks/ Hmm, yeah, I realized that after I sent the patches.. :-( well, if it helps, my "staging area" is here: http://gitorious.org/robclark-gstreamer/gst-openmax/commits/master you can see there the order of commits. BR, -R |
|
From: Rob C. <ro...@ti...> - 2009-11-04 15:17:29
|
Hi Felipe,
On Nov 4, 2009, at 8:31 AM, Felipe Contreras wrote:
> Hi,
>
> The subject is too long. See the 'discussion' section in 'man git-
> commit'[1].
>
> On Wed, Nov 4, 2009 at 4:25 AM, Rob Clark <ro...@ti...> wrote:
>>
>> Signed-off-by: Rob Clark <ro...@ti...>
>> ---
>> omx/gstomx_base_filter.c | 24 ++------
>> omx/gstomx_base_sink.c | 21 ++------
>> omx/gstomx_base_src.c | 22 ++------
>> omx/gstomx_util.c | 133 ++++++++++++++++++++++++++++++++++
>> +-----------
>> omx/gstomx_util.h | 12 +++--
>> 5 files changed, 123 insertions(+), 89 deletions(-)
>
> [...]
>
>> diff --git a/omx/gstomx_util.c b/omx/gstomx_util.c
>> index 39d900b..1cd224f 100644
>> --- a/omx/gstomx_util.c
>> +++ b/omx/gstomx_util.c
>> @@ -22,6 +22,7 @@
>>
>> #include "gstomx_util.h"
>> #include <dlfcn.h>
>> +#include <string.h>
>>
>> #include "gstomx.h"
>>
>> @@ -76,9 +77,7 @@ omx_state_to_str (OMX_STATETYPE omx_state);
>> static inline const char *
>> omx_error_to_str (OMX_ERRORTYPE omx_error);
>>
>> -static inline GOmxPort *
>> -g_omx_core_get_port (GOmxCore *core,
>> - guint index);
>> +static inline GOmxPort *get_port (GOmxCore *core, guint index);
>
> This doesn't fit with $subject, seems to be a logically independent
> trivial rename that's also changing code-style at the same time.
[RC] not really.. if you look a bit further down g_omx_core_get_port()
became a public (to the gstomx elements) API and most of the
functionality was split out into an internal get_port helper function
which is called by g_omx_core_get_port() and some other places.
Is your preference that additional parameters to a function go on
separate lines? If so, my mistake.. I thought that was only for
purposes of line wrapping long lines.
>
>> static inline void
>> port_free_buffers (GOmxPort *port);
>> @@ -133,7 +132,7 @@ core_for_each_port (GOmxCore *core,
>> {
>> GOmxPort *port;
>>
>> - port = g_omx_core_get_port (core, index);
>> + port = get_port (core, index);
>
> ditto.
>
>> if (port)
>> func (port);
>> @@ -159,6 +158,7 @@ imp_new (const gchar *name)
>> void *handle;
>>
>> imp->dl_handle = handle = dlopen (name, RTLD_LAZY);
>> + GST_DEBUG ("dlopen(%s) -> %p", name, handle);
>
> Again, that's a logically separate change.
[RC] hmm, yeah, that should have been one of the later patches..
looks like a couple small things slipped through in the process of
trying to re-organize the commits I had already made. When a lot of
different changes touch the same file, grouping them into different
commits isn't straightforward. (Hmm, need a way to 'git add' parts of
a file)
>
>> if (!handle)
>> {
>> g_warning ("%s\n", dlerror ());
>> @@ -264,13 +264,22 @@ g_omx_deinit (void)
>> * Core
>> */
>>
>> +/**
>> + * Construct new core
>> + *
>> + * @object: the GstOmx object (ie. GstOmxBaseFilter,
>> GstOmxBaseSrc, or
>> + * GstOmxBaseSink). The GstOmx object should have "component-
>> name"
>> + * and "library-name" properties.
>> + */
>
> Also doing more than advertised.
>
>> GOmxCore *
>> -g_omx_core_new (void)
>> +g_omx_core_new (gpointer object, gpointer klass)
>
> I'm not sure about passing a GObjectClass to the _new function. A
> separate function would make more sense.
[RC] yeah... but it is required to completely initialize the GOmxCore
object. (Or could the klass be retrieved from the gobject?)
The GOmxCore object isn't really complete w/o knowing the library and
component name. And I was trying to keep things simpler for the
gstomx element classes.
>
>> {
>> GOmxCore *core;
>>
>> core = g_new0 (GOmxCore, 1);
>>
>> + core->object = object;
>> +
>> core->ports = g_ptr_array_new ();
>>
>> core->omx_state_condition = g_cond_new ();
>> @@ -282,12 +291,33 @@ g_omx_core_new (void)
>>
>> core->omx_state = OMX_StateInvalid;
>>
>> + {
>> + gchar *library_name, *component_name, *component_role;
>> +
>> + library_name = g_type_get_qdata (G_OBJECT_CLASS_TYPE
>> (klass),
>> + g_quark_from_static_string ("library-name"));
>> +
>> + component_name = g_type_get_qdata (G_OBJECT_CLASS_TYPE
>> (klass),
>> + g_quark_from_static_string ("component-name"));
>> +
>> + component_role = g_type_get_qdata (G_OBJECT_CLASS_TYPE
>> (klass),
>> + g_quark_from_static_string ("component-role"));
>
> "component-role"? Again, that's a completely independent change.
[RC] yeah, that is another one that was supposed to be part of a later
commit but slipped through.. my bad
>
>> + g_object_set (core->object,
>> + "component-role", component_role,
>> + "component-name", component_name,
>> + "library-name", library_name,
>> + NULL);
>> + }
>> +
>> return core;
>> }
>>
>> void
>> g_omx_core_free (GOmxCore *core)
>> {
>> + g_omx_core_deinit (core); /* just in case we didn't have a
>> READY->NULL.. mainly for gst-inspect */
>
> That comment seems unnecessary; if that's the way it is, then that's
> the way it is. But I'm worried about what would happen with multiple
> calls to core_deinit.
[RC] yeah, I was running into a problem w/ gst-inspect otherwise. My
solution was to just make it ok to call g_omx_core_deinit() multiple
times.
>
>> g_sem_free (core->port_sem);
>> g_sem_free (core->flush_sem);
>> g_sem_free (core->done_sem);
>> @@ -301,10 +331,23 @@ 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)
>> {
>> + gchar *library_name=NULL, *component_name=NULL;
>> +
>> + if (core->omx_handle)
>> + return;
>> +
>> + GST_DEBUG_OBJECT (core->object, "loading: %s (%s)",
>> component_name, library_name);
>
> Unrelated change.
>
>> + g_object_get (core->object,
>> + "component-name", &component_name,
>> + "library-name", &library_name,
>> + NULL);
>> +
>> + g_return_if_fail (component_name);
>> + g_return_if_fail (library_name);
>
> If one component_name is there but not library_name there would be a
> memory leak, right?
[RC] yup.. but you get a useful assert message about what was screwed
up so you can fix it. Rather than just a segfault.
maybe those should be g_assert()'s, since it is pretty much a bad
situation of you don't know the component or library name.
>
>> core->imp = request_imp (library_name);
>>
>> if (!core->imp)
>> @@ -314,8 +357,15 @@ g_omx_core_init (GOmxCore *core,
>> (char *)
>> component_name,
>> core,
>> &callbacks);
>> +
>> + GST_DEBUG_OBJECT (core->object, "OMX_GetHandle(&%p) -> %d",
>> + core->omx_handle, core->omx_error);
>
> Unrelated.
>
>> if (!core->omx_error)
>> core->omx_state = OMX_StateLoaded;
>> +
>> + g_free (component_name);
>> + g_free (library_name);
>> }
>>
>> void
>> @@ -328,7 +378,12 @@ g_omx_core_deinit (GOmxCore *core)
>> core->omx_state == OMX_StateInvalid)
>> {
>> if (core->omx_handle)
>> + {
>> core->omx_error = core->imp->sym_table.free_handle (core-
>> >omx_handle);
>> + GST_DEBUG_OBJECT (core->object, "OMX_FreeHandle(%p) ->
>> %d",
>> + core->omx_handle, core->omx_error);
>
> Unrelated.
>
>> + core->omx_handle = NULL;
>
> This one seems to be a fix... still unrelated.
>
>> + }
>> }
>>
>> release_imp (core->imp);
>> @@ -394,37 +449,29 @@ g_omx_core_unload (GOmxCore *core)
>> g_ptr_array_clear (core->ports);
>> }
>>
>> -GOmxPort *
>> -g_omx_core_setup_port (GOmxCore *core,
>> - OMX_PARAM_PORTDEFINITIONTYPE *omx_port)
>> +static inline GOmxPort *
>> +get_port (GOmxCore *core, guint index)
>> {
>> - GOmxPort *port;
>> - guint index;
>> -
>> - index = omx_port->nPortIndex;
>> - port = g_omx_core_get_port (core, index);
>> -
>> - if (!port)
>> + if (G_LIKELY (index < core->ports->len))
>> {
>> - port = g_omx_port_new (core);
>> - g_ptr_array_insert (core->ports, index, port);
>> + return g_ptr_array_index (core->ports, index);
>> }
>>
>> - g_omx_port_setup (port, omx_port);
>> -
>> - return port;
>> + return NULL;
>> }
>>
>> -static inline GOmxPort *
>> -g_omx_core_get_port (GOmxCore *core,
>> - guint index)
>> +GOmxPort *
>> +g_omx_core_get_port (GOmxCore *core, guint index)
>> {
>> - if (G_LIKELY (index < core->ports->len))
>> + GOmxPort *port = get_port (core, index);
>> +
>> + if (!port)
>> {
>> - return g_ptr_array_index (core->ports, index);
>> + port = g_omx_port_new (core, index);
>> + g_ptr_array_insert (core->ports, index, port);
>> }
>>
>> - return NULL;
>> + return port;
>> }
>>
>> void
>> @@ -452,17 +499,31 @@ g_omx_core_flush_stop (GOmxCore *core)
>> core_for_each_port (core, g_omx_port_resume);
>> }
>>
>> +/**
>> + * Accessor for OMX component handle. If the OMX component is not
>> constructed
>> + * yet, this will trigger it to be constructed (OMX_GetHandle()).
>> This should
>> + * at least be used in places where g_omx_core_init() might not
>> have been
>> + * called yet (such as setting/getting properties)
>> + */
>> +OMX_HANDLETYPE
>> +g_omx_core_get_handle (GOmxCore *core)
>> +{
>> + if (!core->omx_handle) g_omx_core_init (core);
>> + return core->omx_handle;
>> +}
>
> Why do we want to do this?
[RC] this way, you can do things like GetConfig/GetParameter earlier
in startup. This was needed by some of the later patches, and is
basically the main purpose of the patch
>
>> /*
>> * Port
>> */
>>
>> GOmxPort *
>> -g_omx_port_new (GOmxCore *core)
>> +g_omx_port_new (GOmxCore *core, guint index)
>> {
>> GOmxPort *port;
>> port = g_new0 (GOmxPort, 1);
>>
>> port->core = core;
>> + port->port_index = index;
>> port->num_buffers = 0;
>> port->buffer_size = 0;
>> port->buffers = NULL;
>> @@ -508,6 +569,10 @@ g_omx_port_setup (GOmxPort *port,
>> port->buffer_size = omx_port->nBufferSize;
>> port->port_index = omx_port->nPortIndex;
>>
>> + GST_DEBUG_OBJECT (port->core->object,
>> + "type=%d, num_buffers=%d, buffer_size=%d, port_index=%d",
>> + port->type, port->num_buffers, port->buffer_size, port-
>> >port_index);
>
> Unrelated.
>
>> g_free (port->buffers);
>> port->buffers = g_new0 (OMX_BUFFERHEADERTYPE *, port-
>> >num_buffers);
>> }
>> @@ -840,6 +905,8 @@ EventHandler (OMX_HANDLETYPE omx_handle,
>>
>> cmd = (OMX_COMMANDTYPE) data_1;
>>
>> + GST_DEBUG_OBJECT (core->object,
>> "OMX_EventCmdComplete: %d", cmd);
>
> Unrelated.
>
>> switch (cmd)
>> {
>> case OMX_CommandStateSet:
>> @@ -858,6 +925,7 @@ EventHandler (OMX_HANDLETYPE omx_handle,
>> }
>> case OMX_EventBufferFlag:
>> {
>> + GST_DEBUG_OBJECT (core->object,
>> "OMX_EventBufferFlag");
>
> I think you got the point.
>
>> if (data_2 & OMX_BUFFERFLAG_EOS)
>> {
>> g_omx_core_set_done (core);
>> @@ -866,6 +934,7 @@ EventHandler (OMX_HANDLETYPE omx_handle,
>> }
>> case OMX_EventPortSettingsChanged:
>> {
>> + GST_DEBUG_OBJECT (core->object,
>> "OMX_EventPortSettingsChanged");
>> /** @todo only on the relevant port. */
>> if (core->settings_changed_cb)
>> {
>> @@ -902,7 +971,7 @@ EmptyBufferDone (OMX_HANDLETYPE omx_handle,
>> GOmxPort *port;
>>
>> core = (GOmxCore*) app_data;
>> - port = g_omx_core_get_port (core, omx_buffer->nInputPortIndex);
>> + port = get_port (core, omx_buffer->nInputPortIndex);
>>
>> GST_CAT_LOG_OBJECT (gstomx_util_debug, core->object, "omx_buffer=
>> %p", omx_buffer);
>> got_buffer (core, port, omx_buffer);
>> @@ -919,7 +988,7 @@ FillBufferDone (OMX_HANDLETYPE omx_handle,
>> GOmxPort *port;
>>
>> core = (GOmxCore *) app_data;
>> - port = g_omx_core_get_port (core, omx_buffer->nOutputPortIndex);
>> + port = get_port (core, omx_buffer->nOutputPortIndex);
>>
>> GST_CAT_LOG_OBJECT (gstomx_util_debug, core->object, "omx_buffer=
>> %p", omx_buffer);
>> got_buffer (core, port, omx_buffer);
>> diff --git a/omx/gstomx_util.h b/omx/gstomx_util.h
>> index f0cf045..4857265 100644
>> --- a/omx/gstomx_util.h
>> +++ b/omx/gstomx_util.h
>> @@ -114,9 +114,9 @@ struct GOmxPort
>> void g_omx_init (void);
>> void g_omx_deinit (void);
>>
>> -GOmxCore *g_omx_core_new (void);
>> +GOmxCore *g_omx_core_new (gpointer object, gpointer klass);
>> 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);
>> @@ -127,9 +127,11 @@ void g_omx_core_set_done (GOmxCore *core);
>> void g_omx_core_wait_for_done (GOmxCore *core);
>> void g_omx_core_flush_start (GOmxCore *core);
>> void g_omx_core_flush_stop (GOmxCore *core);
>> -GOmxPort *g_omx_core_setup_port (GOmxCore *core,
>> OMX_PARAM_PORTDEFINITIONTYPE *omx_port);
>> +OMX_HANDLETYPE g_omx_core_get_handle (GOmxCore *core);
>> +GOmxPort *g_omx_core_get_port (GOmxCore *core, guint index);
>>
>> -GOmxPort *g_omx_port_new (GOmxCore *core);
>> +
>> +GOmxPort *g_omx_port_new (GOmxCore *core, guint index);
>> void g_omx_port_free (GOmxPort *port);
>> void g_omx_port_setup (GOmxPort *port, OMX_PARAM_PORTDEFINITIONTYPE
>> *omx_port);
>> void g_omx_port_push_buffer (GOmxPort *port, OMX_BUFFERHEADERTYPE
>> *omx_buffer);
>> @@ -142,4 +144,6 @@ void g_omx_port_enable (GOmxPort *port);
>> void g_omx_port_disable (GOmxPort *port);
>> void g_omx_port_finish (GOmxPort *port);
>>
>> +
>> +
>
> Definitely not needed.
>
>> #endif /* GSTOMX_UTIL_H */
>> --
>> 1.6.3.2
>
> I'm not completely against this patch, but it's difficult to review
> with so many unrelated changes, and at the end of the day I still
> wonder; What's the point of this patch? I'm sure the purpose would be
> revealed in latter patches, but each individual patch must make sense
> on it's own: explain in detail on the commit message.
>
[RC] yeah, sorry.. in process of making those changes I added a bunch
of traces (which is most of the unrelated changes).. but since they
were interleaved w/ actual changes, it isn't always easy to break them
into a separate commit after the fact. If you *really* want to see
those as a separate commit, I'll break them out.
either way, I'll resend the patch with the component-role stuff split
out.. that part really needs to go along w/ it's corresponding changes
in some other files
> In general I try to answer these questions:
> * What does the patch do?
> * Why do we want it?
> * What is the impact?
btw, I guess I should have put this in the commit msg, but main
purpose of the patch is to make it easier for the various element
classes to have properties which use OMX_{Get,Set}Parameter, for
example. This is used in some of the later commits. But was a big
enough change by itself that I wanted to break it into it's own commit.
Why do we want it? I think it simplifies usage of the GOmxCore/
GOmxPort utility classes by making it possible to initialize the core/
port objects in the element constructor while still deferring
instantiation of the OMX component (in the normal case) until where
they were previously instantiated. (For example, NULL_TO_READ state
change for classes that inherit from GstOmxBaseFilter)
The impact will come later, when some properties that use Get/
SetParameter() are introduced, that if the properties are set, the OMX
component will be instantiated earlier. But this is mainly only in
debug uses, such as if you use gst-inspect. In normal cases startup
order stays the same.
BR,
-R
>
> [1] http://www.kernel.org/pub/software/scm/git/docs/git-commit.html
>
> --
> Felipe Contreras
>
|
|
From: Felipe C. <fel...@gm...> - 2009-11-04 14:51:56
|
On Wed, Nov 4, 2009 at 4:23 AM, Rob Clark <ro...@ti...> wrote: > Hi All, > > We've been working on the omap branch of gst-openmax for a few months > now, and I've started cleaning up and porting some of the generic (non- > omap specific) changes back to the master branch so that we can > contribute them back to the community. So far I'm about 25% through > the rebasing, but I'll start sending patches. And I'll continue > rebasing and sending patches as time permits, hopefully finishing in > the next couple weeks. I'm not sure how you are sending the patch series, but it's a bit hard to follow the ordering. Maybe it would help to follow this: http://felipec.wordpress.com/2009/10/25/git-send-email-tricks/ Cheers. -- Felipe Contreras |
|
From: Felipe C. <fel...@gm...> - 2009-11-04 14:31:16
|
Hi,
The subject is too long. See the 'discussion' section in 'man git-commit'[1].
On Wed, Nov 4, 2009 at 4:25 AM, Rob Clark <ro...@ti...> wrote:
>
> Signed-off-by: Rob Clark <ro...@ti...>
> ---
> omx/gstomx_base_filter.c | 24 ++------
> omx/gstomx_base_sink.c | 21 ++------
> omx/gstomx_base_src.c | 22 ++------
> omx/gstomx_util.c | 133 +++++++++++++++++++++++++++++++++++-----------
> omx/gstomx_util.h | 12 +++--
> 5 files changed, 123 insertions(+), 89 deletions(-)
[...]
> diff --git a/omx/gstomx_util.c b/omx/gstomx_util.c
> index 39d900b..1cd224f 100644
> --- a/omx/gstomx_util.c
> +++ b/omx/gstomx_util.c
> @@ -22,6 +22,7 @@
>
> #include "gstomx_util.h"
> #include <dlfcn.h>
> +#include <string.h>
>
> #include "gstomx.h"
>
> @@ -76,9 +77,7 @@ omx_state_to_str (OMX_STATETYPE omx_state);
> static inline const char *
> omx_error_to_str (OMX_ERRORTYPE omx_error);
>
> -static inline GOmxPort *
> -g_omx_core_get_port (GOmxCore *core,
> - guint index);
> +static inline GOmxPort *get_port (GOmxCore *core, guint index);
This doesn't fit with $subject, seems to be a logically independent
trivial rename that's also changing code-style at the same time.
> static inline void
> port_free_buffers (GOmxPort *port);
> @@ -133,7 +132,7 @@ core_for_each_port (GOmxCore *core,
> {
> GOmxPort *port;
>
> - port = g_omx_core_get_port (core, index);
> + port = get_port (core, index);
ditto.
> if (port)
> func (port);
> @@ -159,6 +158,7 @@ imp_new (const gchar *name)
> void *handle;
>
> imp->dl_handle = handle = dlopen (name, RTLD_LAZY);
> + GST_DEBUG ("dlopen(%s) -> %p", name, handle);
Again, that's a logically separate change.
> if (!handle)
> {
> g_warning ("%s\n", dlerror ());
> @@ -264,13 +264,22 @@ g_omx_deinit (void)
> * Core
> */
>
> +/**
> + * Construct new core
> + *
> + * @object: the GstOmx object (ie. GstOmxBaseFilter, GstOmxBaseSrc, or
> + * GstOmxBaseSink). The GstOmx object should have "component-name"
> + * and "library-name" properties.
> + */
Also doing more than advertised.
> GOmxCore *
> -g_omx_core_new (void)
> +g_omx_core_new (gpointer object, gpointer klass)
I'm not sure about passing a GObjectClass to the _new function. A
separate function would make more sense.
> {
> GOmxCore *core;
>
> core = g_new0 (GOmxCore, 1);
>
> + core->object = object;
> +
> core->ports = g_ptr_array_new ();
>
> core->omx_state_condition = g_cond_new ();
> @@ -282,12 +291,33 @@ g_omx_core_new (void)
>
> core->omx_state = OMX_StateInvalid;
>
> + {
> + gchar *library_name, *component_name, *component_role;
> +
> + library_name = g_type_get_qdata (G_OBJECT_CLASS_TYPE (klass),
> + g_quark_from_static_string ("library-name"));
> +
> + component_name = g_type_get_qdata (G_OBJECT_CLASS_TYPE (klass),
> + g_quark_from_static_string ("component-name"));
> +
> + component_role = g_type_get_qdata (G_OBJECT_CLASS_TYPE (klass),
> + g_quark_from_static_string ("component-role"));
"component-role"? Again, that's a completely independent change.
> + g_object_set (core->object,
> + "component-role", component_role,
> + "component-name", component_name,
> + "library-name", library_name,
> + NULL);
> + }
> +
> return core;
> }
>
> void
> g_omx_core_free (GOmxCore *core)
> {
> + g_omx_core_deinit (core); /* just in case we didn't have a READY->NULL.. mainly for gst-inspect */
That comment seems unnecessary; if that's the way it is, then that's
the way it is. But I'm worried about what would happen with multiple
calls to core_deinit.
> g_sem_free (core->port_sem);
> g_sem_free (core->flush_sem);
> g_sem_free (core->done_sem);
> @@ -301,10 +331,23 @@ 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)
> {
> + gchar *library_name=NULL, *component_name=NULL;
> +
> + if (core->omx_handle)
> + return;
> +
> + GST_DEBUG_OBJECT (core->object, "loading: %s (%s)", component_name, library_name);
Unrelated change.
> + g_object_get (core->object,
> + "component-name", &component_name,
> + "library-name", &library_name,
> + NULL);
> +
> + g_return_if_fail (component_name);
> + g_return_if_fail (library_name);
If one component_name is there but not library_name there would be a
memory leak, right?
> core->imp = request_imp (library_name);
>
> if (!core->imp)
> @@ -314,8 +357,15 @@ g_omx_core_init (GOmxCore *core,
> (char *) component_name,
> core,
> &callbacks);
> +
> + GST_DEBUG_OBJECT (core->object, "OMX_GetHandle(&%p) -> %d",
> + core->omx_handle, core->omx_error);
Unrelated.
> if (!core->omx_error)
> core->omx_state = OMX_StateLoaded;
> +
> + g_free (component_name);
> + g_free (library_name);
> }
>
> void
> @@ -328,7 +378,12 @@ g_omx_core_deinit (GOmxCore *core)
> core->omx_state == OMX_StateInvalid)
> {
> if (core->omx_handle)
> + {
> core->omx_error = core->imp->sym_table.free_handle (core->omx_handle);
> + GST_DEBUG_OBJECT (core->object, "OMX_FreeHandle(%p) -> %d",
> + core->omx_handle, core->omx_error);
Unrelated.
> + core->omx_handle = NULL;
This one seems to be a fix... still unrelated.
> + }
> }
>
> release_imp (core->imp);
> @@ -394,37 +449,29 @@ g_omx_core_unload (GOmxCore *core)
> g_ptr_array_clear (core->ports);
> }
>
> -GOmxPort *
> -g_omx_core_setup_port (GOmxCore *core,
> - OMX_PARAM_PORTDEFINITIONTYPE *omx_port)
> +static inline GOmxPort *
> +get_port (GOmxCore *core, guint index)
> {
> - GOmxPort *port;
> - guint index;
> -
> - index = omx_port->nPortIndex;
> - port = g_omx_core_get_port (core, index);
> -
> - if (!port)
> + if (G_LIKELY (index < core->ports->len))
> {
> - port = g_omx_port_new (core);
> - g_ptr_array_insert (core->ports, index, port);
> + return g_ptr_array_index (core->ports, index);
> }
>
> - g_omx_port_setup (port, omx_port);
> -
> - return port;
> + return NULL;
> }
>
> -static inline GOmxPort *
> -g_omx_core_get_port (GOmxCore *core,
> - guint index)
> +GOmxPort *
> +g_omx_core_get_port (GOmxCore *core, guint index)
> {
> - if (G_LIKELY (index < core->ports->len))
> + GOmxPort *port = get_port (core, index);
> +
> + if (!port)
> {
> - return g_ptr_array_index (core->ports, index);
> + port = g_omx_port_new (core, index);
> + g_ptr_array_insert (core->ports, index, port);
> }
>
> - return NULL;
> + return port;
> }
>
> void
> @@ -452,17 +499,31 @@ g_omx_core_flush_stop (GOmxCore *core)
> core_for_each_port (core, g_omx_port_resume);
> }
>
> +/**
> + * Accessor for OMX component handle. If the OMX component is not constructed
> + * yet, this will trigger it to be constructed (OMX_GetHandle()). This should
> + * at least be used in places where g_omx_core_init() might not have been
> + * called yet (such as setting/getting properties)
> + */
> +OMX_HANDLETYPE
> +g_omx_core_get_handle (GOmxCore *core)
> +{
> + if (!core->omx_handle) g_omx_core_init (core);
> + return core->omx_handle;
> +}
Why do we want to do this?
> /*
> * Port
> */
>
> GOmxPort *
> -g_omx_port_new (GOmxCore *core)
> +g_omx_port_new (GOmxCore *core, guint index)
> {
> GOmxPort *port;
> port = g_new0 (GOmxPort, 1);
>
> port->core = core;
> + port->port_index = index;
> port->num_buffers = 0;
> port->buffer_size = 0;
> port->buffers = NULL;
> @@ -508,6 +569,10 @@ g_omx_port_setup (GOmxPort *port,
> port->buffer_size = omx_port->nBufferSize;
> port->port_index = omx_port->nPortIndex;
>
> + GST_DEBUG_OBJECT (port->core->object,
> + "type=%d, num_buffers=%d, buffer_size=%d, port_index=%d",
> + port->type, port->num_buffers, port->buffer_size, port->port_index);
Unrelated.
> g_free (port->buffers);
> port->buffers = g_new0 (OMX_BUFFERHEADERTYPE *, port->num_buffers);
> }
> @@ -840,6 +905,8 @@ EventHandler (OMX_HANDLETYPE omx_handle,
>
> cmd = (OMX_COMMANDTYPE) data_1;
>
> + GST_DEBUG_OBJECT (core->object, "OMX_EventCmdComplete: %d", cmd);
Unrelated.
> switch (cmd)
> {
> case OMX_CommandStateSet:
> @@ -858,6 +925,7 @@ EventHandler (OMX_HANDLETYPE omx_handle,
> }
> case OMX_EventBufferFlag:
> {
> + GST_DEBUG_OBJECT (core->object, "OMX_EventBufferFlag");
I think you got the point.
> if (data_2 & OMX_BUFFERFLAG_EOS)
> {
> g_omx_core_set_done (core);
> @@ -866,6 +934,7 @@ EventHandler (OMX_HANDLETYPE omx_handle,
> }
> case OMX_EventPortSettingsChanged:
> {
> + GST_DEBUG_OBJECT (core->object, "OMX_EventPortSettingsChanged");
> /** @todo only on the relevant port. */
> if (core->settings_changed_cb)
> {
> @@ -902,7 +971,7 @@ EmptyBufferDone (OMX_HANDLETYPE omx_handle,
> GOmxPort *port;
>
> core = (GOmxCore*) app_data;
> - port = g_omx_core_get_port (core, omx_buffer->nInputPortIndex);
> + port = get_port (core, omx_buffer->nInputPortIndex);
>
> GST_CAT_LOG_OBJECT (gstomx_util_debug, core->object, "omx_buffer=%p", omx_buffer);
> got_buffer (core, port, omx_buffer);
> @@ -919,7 +988,7 @@ FillBufferDone (OMX_HANDLETYPE omx_handle,
> GOmxPort *port;
>
> core = (GOmxCore *) app_data;
> - port = g_omx_core_get_port (core, omx_buffer->nOutputPortIndex);
> + port = get_port (core, omx_buffer->nOutputPortIndex);
>
> GST_CAT_LOG_OBJECT (gstomx_util_debug, core->object, "omx_buffer=%p", omx_buffer);
> got_buffer (core, port, omx_buffer);
> diff --git a/omx/gstomx_util.h b/omx/gstomx_util.h
> index f0cf045..4857265 100644
> --- a/omx/gstomx_util.h
> +++ b/omx/gstomx_util.h
> @@ -114,9 +114,9 @@ struct GOmxPort
> void g_omx_init (void);
> void g_omx_deinit (void);
>
> -GOmxCore *g_omx_core_new (void);
> +GOmxCore *g_omx_core_new (gpointer object, gpointer klass);
> 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);
> @@ -127,9 +127,11 @@ void g_omx_core_set_done (GOmxCore *core);
> void g_omx_core_wait_for_done (GOmxCore *core);
> void g_omx_core_flush_start (GOmxCore *core);
> void g_omx_core_flush_stop (GOmxCore *core);
> -GOmxPort *g_omx_core_setup_port (GOmxCore *core, OMX_PARAM_PORTDEFINITIONTYPE *omx_port);
> +OMX_HANDLETYPE g_omx_core_get_handle (GOmxCore *core);
> +GOmxPort *g_omx_core_get_port (GOmxCore *core, guint index);
>
> -GOmxPort *g_omx_port_new (GOmxCore *core);
> +
> +GOmxPort *g_omx_port_new (GOmxCore *core, guint index);
> void g_omx_port_free (GOmxPort *port);
> void g_omx_port_setup (GOmxPort *port, OMX_PARAM_PORTDEFINITIONTYPE *omx_port);
> void g_omx_port_push_buffer (GOmxPort *port, OMX_BUFFERHEADERTYPE *omx_buffer);
> @@ -142,4 +144,6 @@ void g_omx_port_enable (GOmxPort *port);
> void g_omx_port_disable (GOmxPort *port);
> void g_omx_port_finish (GOmxPort *port);
>
> +
> +
Definitely not needed.
> #endif /* GSTOMX_UTIL_H */
> --
> 1.6.3.2
I'm not completely against this patch, but it's difficult to review
with so many unrelated changes, and at the end of the day I still
wonder; What's the point of this patch? I'm sure the purpose would be
revealed in latter patches, but each individual patch must make sense
on it's own: explain in detail on the commit message.
In general I try to answer these questions:
* What does the patch do?
* Why do we want it?
* What is the impact?
[1] http://www.kernel.org/pub/software/scm/git/docs/git-commit.html
--
Felipe Contreras
|
|
From: Rob C. <ro...@ti...> - 2009-11-04 02:27:22
|
Not properly flushing output port buffers was causing a problem with seek. We would get a buffer from before the flush-start/flush-stop/newsegment sequence, which had an old timestamp, throwing off the AV sync logic in gst base sink classes.
Signed-off-by: Rob Clark <ro...@ti...>
---
omx/gstomx_util.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/omx/gstomx_util.c b/omx/gstomx_util.c
index 2bd25b4..ea97918 100644
--- a/omx/gstomx_util.c
+++ b/omx/gstomx_util.c
@@ -709,6 +709,9 @@ g_omx_port_flush (GOmxPort *port)
{
if (port->type == GOMX_PORT_OUTPUT)
{
+ /* This will get rid of any buffers that we have received, but not
+ * yet processed in the output_loop.
+ */
OMX_BUFFERHEADERTYPE *omx_buffer;
while ((omx_buffer = async_queue_pop_forced (port->queue)))
{
@@ -716,11 +719,9 @@ g_omx_port_flush (GOmxPort *port)
g_omx_port_release_buffer (port, omx_buffer);
}
}
- else
- {
- OMX_SendCommand (port->core->omx_handle, OMX_CommandFlush, port->port_index, NULL);
- g_sem_down (port->core->flush_sem);
- }
+
+ OMX_SendCommand (port->core->omx_handle, OMX_CommandFlush, port->port_index, NULL);
+ g_sem_down (port->core->flush_sem);
}
void
--
1.6.3.2
|
|
From: Rob C. <ro...@ti...> - 2009-11-04 02:27:09
|
Refactor some common functionality, in particular the settings_changed_cb, into an abstract base class.
Signed-off-by: Rob Clark <ro...@ti...>
---
omx/Makefile.am | 1 +
omx/gstomx_aacdec.c | 42 +-------------------
omx/gstomx_aacdec.h | 6 +-
omx/gstomx_adpcmdec.c | 1 +
omx/gstomx_amrnbdec.c | 45 +--------------------
omx/gstomx_amrnbdec.h | 6 +-
omx/gstomx_amrwbdec.c | 45 +--------------------
omx/gstomx_amrwbdec.h | 6 +-
omx/gstomx_base_audiodec.c | 96 ++++++++++++++++++++++++++++++++++++++++++++
omx/gstomx_base_audiodec.h | 53 ++++++++++++++++++++++++
omx/gstomx_g711dec.c | 1 +
omx/gstomx_g729dec.c | 4 +-
omx/gstomx_g729dec.h | 6 +-
omx/gstomx_ilbcdec.c | 1 +
omx/gstomx_mp2dec.c | 52 +-----------------------
omx/gstomx_mp2dec.h | 6 +-
omx/gstomx_mp3dec.c | 53 +------------------------
omx/gstomx_mp3dec.h | 6 +-
omx/gstomx_vorbisdec.c | 43 +-------------------
omx/gstomx_vorbisdec.h | 6 +-
20 files changed, 182 insertions(+), 297 deletions(-)
create mode 100644 omx/gstomx_base_audiodec.c
create mode 100644 omx/gstomx_base_audiodec.h
diff --git a/omx/Makefile.am b/omx/Makefile.am
index 4a3fbf9..f5b2ffc 100644
--- a/omx/Makefile.am
+++ b/omx/Makefile.am
@@ -6,6 +6,7 @@ libgstomx_la_SOURCES = gstomx.c gstomx.h \
gstomx_base_filter.c gstomx_base_filter.h \
gstomx_base_videodec.c gstomx_base_videodec.h \
gstomx_base_videoenc.c gstomx_base_videoenc.h \
+ gstomx_base_audiodec.c gstomx_base_audiodec.h \
gstomx_dummy.c gstomx_dummy.h \
gstomx_volume.c gstomx_volume.h \
gstomx_mpeg4dec.c gstomx_mpeg4dec.h \
diff --git a/omx/gstomx_aacdec.c b/omx/gstomx_aacdec.c
index 4f20370..8b9129f 100644
--- a/omx/gstomx_aacdec.c
+++ b/omx/gstomx_aacdec.c
@@ -20,12 +20,11 @@
*/
#include "gstomx_aacdec.h"
-#include "gstomx_base_filter.h"
#include "gstomx.h"
#include <string.h> /* for memset */
-GSTOMX_BOILERPLATE (GstOmxAacDec, gst_omx_aacdec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
+GSTOMX_BOILERPLATE (GstOmxAacDec, gst_omx_aacdec, GstOmxBaseAudioDec, GST_OMX_BASE_AUDIODEC_TYPE);
static GstCaps *
generate_src_template (void)
@@ -129,43 +128,6 @@ type_class_init (gpointer g_class,
{
}
-static void
-settings_changed_cb (GOmxCore *core)
-{
- GstOmxBaseFilter *omx_base;
- guint rate;
- guint channels;
-
- omx_base = core->object;
-
- GST_DEBUG_OBJECT (omx_base, "settings changed");
-
- {
- OMX_AUDIO_PARAM_PCMMODETYPE param;
-
- G_OMX_PORT_GET_PARAM (omx_base->out_port, OMX_IndexParamAudioPcm, ¶m);
-
- rate = param.nSamplingRate;
- channels = param.nChannels;
- }
-
- {
- GstCaps *new_caps;
-
- new_caps = gst_caps_new_simple ("audio/x-raw-int",
- "width", G_TYPE_INT, 16,
- "depth", G_TYPE_INT, 16,
- "rate", G_TYPE_INT, rate,
- "signed", G_TYPE_BOOLEAN, TRUE,
- "endianness", G_TYPE_INT, G_BYTE_ORDER,
- "channels", G_TYPE_INT, channels,
- NULL);
-
- GST_INFO_OBJECT (omx_base, "caps are: %" GST_PTR_FORMAT, new_caps);
- gst_pad_set_caps (omx_base->srcpad, new_caps);
- }
-}
-
static gboolean
sink_setcaps (GstPad *pad,
GstCaps *caps)
@@ -203,7 +165,5 @@ type_instance_init (GTypeInstance *instance,
omx_base = GST_OMX_BASE_FILTER (instance);
- omx_base->gomx->settings_changed_cb = settings_changed_cb;
-
gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps);
}
diff --git a/omx/gstomx_aacdec.h b/omx/gstomx_aacdec.h
index b53b030..1b431fd 100644
--- a/omx/gstomx_aacdec.h
+++ b/omx/gstomx_aacdec.h
@@ -32,16 +32,16 @@ G_BEGIN_DECLS
typedef struct GstOmxAacDec GstOmxAacDec;
typedef struct GstOmxAacDecClass GstOmxAacDecClass;
-#include "gstomx_base_filter.h"
+#include "gstomx_base_audiodec.h"
struct GstOmxAacDec
{
- GstOmxBaseFilter omx_base;
+ GstOmxBaseAudioDec omx_base;
};
struct GstOmxAacDecClass
{
- GstOmxBaseFilterClass parent_class;
+ GstOmxBaseAudioDecClass parent_class;
};
GType gst_omx_aacdec_get_type (void);
diff --git a/omx/gstomx_adpcmdec.c b/omx/gstomx_adpcmdec.c
index 61b0d20..ec3d54e 100644
--- a/omx/gstomx_adpcmdec.c
+++ b/omx/gstomx_adpcmdec.c
@@ -25,6 +25,7 @@
#include <string.h> /* for memset */
+/* should this class extend GstOmxBaseAudioDec? */
GSTOMX_BOILERPLATE (GstOmxAdpcmDec, gst_omx_adpcmdec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
diff --git a/omx/gstomx_amrnbdec.c b/omx/gstomx_amrnbdec.c
index f481e6d..27d5eef 100644
--- a/omx/gstomx_amrnbdec.c
+++ b/omx/gstomx_amrnbdec.c
@@ -20,12 +20,11 @@
*/
#include "gstomx_amrnbdec.h"
-#include "gstomx_base_filter.h"
#include "gstomx.h"
#include <string.h> /* for memset */
-GSTOMX_BOILERPLATE (GstOmxAmrNbDec, gst_omx_amrnbdec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
+GSTOMX_BOILERPLATE (GstOmxAmrNbDec, gst_omx_amrnbdec, GstOmxBaseAudioDec, GST_OMX_BASE_AUDIODEC_TYPE);
static GstCaps *
generate_src_template (void)
@@ -103,49 +102,7 @@ type_class_init (gpointer g_class,
}
static void
-settings_changed_cb (GOmxCore *core)
-{
- GstOmxBaseFilter *omx_base;
- guint rate;
- guint channels;
-
- omx_base = core->object;
-
- GST_DEBUG_OBJECT (omx_base, "settings changed");
-
- {
- OMX_AUDIO_PARAM_PCMMODETYPE param;
-
- G_OMX_PORT_GET_PARAM (omx_base->out_port, OMX_IndexParamAudioPcm, ¶m);
-
- rate = param.nSamplingRate;
- channels = param.nChannels;
- }
-
- {
- GstCaps *new_caps;
-
- new_caps = gst_caps_new_simple ("audio/x-raw-int",
- "width", G_TYPE_INT, 16,
- "depth", G_TYPE_INT, 16,
- "rate", G_TYPE_INT, rate,
- "signed", G_TYPE_BOOLEAN, TRUE,
- "endianness", G_TYPE_INT, G_BYTE_ORDER,
- "channels", G_TYPE_INT, channels,
- NULL);
-
- GST_INFO_OBJECT (omx_base, "caps are: %" GST_PTR_FORMAT, new_caps);
- gst_pad_set_caps (omx_base->srcpad, new_caps);
- }
-}
-
-static void
type_instance_init (GTypeInstance *instance,
gpointer g_class)
{
- GstOmxBaseFilter *omx_base;
-
- omx_base = GST_OMX_BASE_FILTER (instance);
-
- omx_base->gomx->settings_changed_cb = settings_changed_cb;
}
diff --git a/omx/gstomx_amrnbdec.h b/omx/gstomx_amrnbdec.h
index 3ec66c2..781e4ed 100644
--- a/omx/gstomx_amrnbdec.h
+++ b/omx/gstomx_amrnbdec.h
@@ -32,16 +32,16 @@ G_BEGIN_DECLS
typedef struct GstOmxAmrNbDec GstOmxAmrNbDec;
typedef struct GstOmxAmrNbDecClass GstOmxAmrNbDecClass;
-#include "gstomx_base_filter.h"
+#include "gstomx_base_audiodec.h"
struct GstOmxAmrNbDec
{
- GstOmxBaseFilter omx_base;
+ GstOmxBaseAudioDec omx_base;
};
struct GstOmxAmrNbDecClass
{
- GstOmxBaseFilterClass parent_class;
+ GstOmxBaseAudioDecClass parent_class;
};
GType gst_omx_amrnbdec_get_type (void);
diff --git a/omx/gstomx_amrwbdec.c b/omx/gstomx_amrwbdec.c
index cee5334..5ddd605 100644
--- a/omx/gstomx_amrwbdec.c
+++ b/omx/gstomx_amrwbdec.c
@@ -20,12 +20,11 @@
*/
#include "gstomx_amrwbdec.h"
-#include "gstomx_base_filter.h"
#include "gstomx.h"
#include <string.h> /* for memset */
-GSTOMX_BOILERPLATE (GstOmxAmrWbDec, gst_omx_amrwbdec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
+GSTOMX_BOILERPLATE (GstOmxAmrWbDec, gst_omx_amrwbdec, GstOmxBaseAudioDec, GST_OMX_BASE_AUDIODEC_TYPE);
static GstCaps *
generate_src_template (void)
@@ -103,49 +102,7 @@ type_class_init (gpointer g_class,
}
static void
-settings_changed_cb (GOmxCore *core)
-{
- GstOmxBaseFilter *omx_base;
- guint rate;
- guint channels;
-
- omx_base = core->object;
-
- GST_DEBUG_OBJECT (omx_base, "settings changed");
-
- {
- OMX_AUDIO_PARAM_PCMMODETYPE param;
-
- G_OMX_PORT_GET_PARAM (omx_base->out_port, OMX_IndexParamAudioPcm, ¶m);
-
- rate = param.nSamplingRate;
- channels = param.nChannels;
- }
-
- {
- GstCaps *new_caps;
-
- new_caps = gst_caps_new_simple ("audio/x-raw-int",
- "width", G_TYPE_INT, 16,
- "depth", G_TYPE_INT, 16,
- "rate", G_TYPE_INT, rate,
- "signed", G_TYPE_BOOLEAN, TRUE,
- "endianness", G_TYPE_INT, G_BYTE_ORDER,
- "channels", G_TYPE_INT, channels,
- NULL);
-
- GST_INFO_OBJECT (omx_base, "caps are: %" GST_PTR_FORMAT, new_caps);
- gst_pad_set_caps (omx_base->srcpad, new_caps);
- }
-}
-
-static void
type_instance_init (GTypeInstance *instance,
gpointer g_class)
{
- GstOmxBaseFilter *omx_base;
-
- omx_base = GST_OMX_BASE_FILTER (instance);
-
- omx_base->gomx->settings_changed_cb = settings_changed_cb;
}
diff --git a/omx/gstomx_amrwbdec.h b/omx/gstomx_amrwbdec.h
index ae0a2cf..61870b8 100644
--- a/omx/gstomx_amrwbdec.h
+++ b/omx/gstomx_amrwbdec.h
@@ -32,16 +32,16 @@ G_BEGIN_DECLS
typedef struct GstOmxAmrWbDec GstOmxAmrWbDec;
typedef struct GstOmxAmrWbDecClass GstOmxAmrWbDecClass;
-#include "gstomx_base_filter.h"
+#include "gstomx_base_audiodec.h"
struct GstOmxAmrWbDec
{
- GstOmxBaseFilter omx_base;
+ GstOmxBaseAudioDec omx_base;
};
struct GstOmxAmrWbDecClass
{
- GstOmxBaseFilterClass parent_class;
+ GstOmxBaseAudioDecClass parent_class;
};
GType gst_omx_amrwbdec_get_type (void);
diff --git a/omx/gstomx_base_audiodec.c b/omx/gstomx_base_audiodec.c
new file mode 100644
index 0000000..de4defb
--- /dev/null
+++ b/omx/gstomx_base_audiodec.c
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2009 Texas Instruments, Inc - http://www.ti.com/
+ *
+ * Description: Base audio decoder element
+ * Created on: Aug 2, 2009
+ * Author: Rob Clark <ro...@ti...>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "gstomx_base_audiodec.h"
+#include "gstomx.h"
+
+#include <string.h> /* for memset */
+
+GSTOMX_BOILERPLATE (GstOmxBaseAudioDec, gst_omx_base_audiodec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
+
+static void
+type_base_init (gpointer g_class)
+{
+}
+
+static void
+type_class_init (gpointer g_class,
+ gpointer class_data)
+{
+}
+
+static void
+settings_changed_cb (GOmxCore *core)
+{
+ GstOmxBaseFilter *omx_base;
+ guint rate;
+ guint channels;
+
+ omx_base = core->object;
+
+ GST_DEBUG_OBJECT (omx_base, "settings changed");
+
+ {
+ OMX_AUDIO_PARAM_PCMMODETYPE param;
+
+ G_OMX_PORT_GET_PARAM (omx_base->out_port, OMX_IndexParamAudioPcm, ¶m);
+
+ rate = param.nSamplingRate;
+ channels = param.nChannels;
+ if (rate == 0)
+ {
+ /** @todo: this shouldn't happen. */
+ GST_WARNING_OBJECT (omx_base, "Bad samplerate");
+ rate = 44100;
+ }
+ }
+
+ {
+ GstCaps *new_caps;
+
+ new_caps = gst_caps_new_simple ("audio/x-raw-int",
+ "width", G_TYPE_INT, 16,
+ "depth", G_TYPE_INT, 16,
+ "rate", G_TYPE_INT, rate,
+ "signed", G_TYPE_BOOLEAN, TRUE,
+ "endianness", G_TYPE_INT, G_BYTE_ORDER,
+ "channels", G_TYPE_INT, channels,
+ NULL);
+
+ GST_INFO_OBJECT (omx_base, "caps are: %" GST_PTR_FORMAT, new_caps);
+ gst_pad_set_caps (omx_base->srcpad, new_caps);
+ }
+}
+
+static void
+type_instance_init (GTypeInstance *instance,
+ gpointer g_class)
+{
+ GstOmxBaseFilter *omx_base;
+
+ omx_base = GST_OMX_BASE_FILTER (instance);
+
+ GST_DEBUG_OBJECT (omx_base, "start");
+
+ omx_base->gomx->settings_changed_cb = settings_changed_cb;
+}
diff --git a/omx/gstomx_base_audiodec.h b/omx/gstomx_base_audiodec.h
new file mode 100644
index 0000000..83472e6
--- /dev/null
+++ b/omx/gstomx_base_audiodec.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2009 Texas Instruments, Inc - http://www.ti.com/
+ *
+ * Description: Base audio decoder element
+ * Created on: Aug 2, 2009
+ * Author: Rob Clark <ro...@ti...>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef GSTOMX_BASE_AUDIODEC_H
+#define GSTOMX_BASE_AUDIODEC_H
+
+#include <gst/gst.h>
+
+G_BEGIN_DECLS
+
+#define GST_OMX_BASE_AUDIODEC(obj) (GstOmxBaseAudioDec *) (obj)
+#define GST_OMX_BASE_AUDIODEC_TYPE (gst_omx_base_audiodec_get_type ())
+
+typedef struct GstOmxBaseAudioDec GstOmxBaseAudioDec;
+typedef struct GstOmxBaseAudioDecClass GstOmxBaseAudioDecClass;
+
+#include "gstomx_base_filter.h"
+
+struct GstOmxBaseAudioDec
+{
+ GstOmxBaseFilter omx_base;
+};
+
+struct GstOmxBaseAudioDecClass
+{
+ GstOmxBaseFilterClass parent_class;
+};
+
+GType gst_omx_base_audiodec_get_type (void);
+
+G_END_DECLS
+
+#endif /* GSTOMX_BASE_AUDIODEC_H */
diff --git a/omx/gstomx_g711dec.c b/omx/gstomx_g711dec.c
index 14edf5d..c1e64a9 100644
--- a/omx/gstomx_g711dec.c
+++ b/omx/gstomx_g711dec.c
@@ -25,6 +25,7 @@
#include <string.h> /* for memset, strcmp */
+/* should this class extend GstOmxBaseAudioDec? */
GSTOMX_BOILERPLATE (GstOmxG711Dec, gst_omx_g711dec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
diff --git a/omx/gstomx_g729dec.c b/omx/gstomx_g729dec.c
index 666d5ab..a558011 100644
--- a/omx/gstomx_g729dec.c
+++ b/omx/gstomx_g729dec.c
@@ -20,10 +20,9 @@
*/
#include "gstomx_g729dec.h"
-#include "gstomx_base_filter.h"
#include "gstomx.h"
-GSTOMX_BOILERPLATE (GstOmxG729Dec, gst_omx_g729dec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
+GSTOMX_BOILERPLATE (GstOmxG729Dec, gst_omx_g729dec, GstOmxBaseAudioDec, GST_OMX_BASE_AUDIODEC_TYPE);
static GstCaps *
generate_src_template (void)
@@ -105,6 +104,7 @@ type_class_init (gpointer g_class,
{
}
+/* should we be overriding the settings_changed_cb from parent class like this?? */
static void
settings_changed_cb (GOmxCore *core)
{
diff --git a/omx/gstomx_g729dec.h b/omx/gstomx_g729dec.h
index abe5504..49e525f 100644
--- a/omx/gstomx_g729dec.h
+++ b/omx/gstomx_g729dec.h
@@ -32,16 +32,16 @@ G_BEGIN_DECLS
typedef struct GstOmxG729Dec GstOmxG729Dec;
typedef struct GstOmxG729DecClass GstOmxG729DecClass;
-#include "gstomx_base_filter.h"
+#include "gstomx_base_audiodec.h"
struct GstOmxG729Dec
{
- GstOmxBaseFilter omx_base;
+ GstOmxBaseAudioDec omx_base;
};
struct GstOmxG729DecClass
{
- GstOmxBaseFilterClass parent_class;
+ GstOmxBaseAudioDecClass parent_class;
};
GType gst_omx_g729dec_get_type (void);
diff --git a/omx/gstomx_ilbcdec.c b/omx/gstomx_ilbcdec.c
index 9d03f01..ff899ac 100644
--- a/omx/gstomx_ilbcdec.c
+++ b/omx/gstomx_ilbcdec.c
@@ -23,6 +23,7 @@
#include "gstomx_base_filter.h"
#include "gstomx.h"
+/* should this class extend GstOmxBaseAudioDec? */
GSTOMX_BOILERPLATE (GstOmxIlbcDec, gst_omx_ilbcdec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
diff --git a/omx/gstomx_mp2dec.c b/omx/gstomx_mp2dec.c
index 8160c53..984b142 100644
--- a/omx/gstomx_mp2dec.c
+++ b/omx/gstomx_mp2dec.c
@@ -25,7 +25,7 @@
#include <string.h> /* for memset */
-GSTOMX_BOILERPLATE (GstOmxMp2Dec, gst_omx_mp2dec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
+GSTOMX_BOILERPLATE (GstOmxMp2Dec, gst_omx_mp2dec, GstOmxBaseAudioDec, GST_OMX_BASE_AUDIODEC_TYPE);
static GstCaps *
generate_src_template (void)
@@ -106,57 +106,7 @@ type_class_init (gpointer g_class,
}
static void
-settings_changed_cb (GOmxCore *core)
-{
- GstOmxBaseFilter *omx_base;
- guint rate;
- guint channels;
-
- omx_base = core->object;
-
- GST_DEBUG_OBJECT (omx_base, "settings changed");
-
- {
- OMX_AUDIO_PARAM_PCMMODETYPE param;
-
- G_OMX_PORT_GET_PARAM (omx_base->out_port, OMX_IndexParamAudioPcm, ¶m);
-
- rate = param.nSamplingRate;
- channels = param.nChannels;
- if (rate == 0)
- {
- /** @todo: this shouldn't happen. */
- GST_WARNING_OBJECT (omx_base, "Bad samplerate");
- rate = 44100;
- }
- }
-
- {
- GstCaps *new_caps;
-
- new_caps = gst_caps_new_simple ("audio/x-raw-int",
- "width", G_TYPE_INT, 16,
- "depth", G_TYPE_INT, 16,
- "rate", G_TYPE_INT, rate,
- "signed", G_TYPE_BOOLEAN, TRUE,
- "endianness", G_TYPE_INT, G_BYTE_ORDER,
- "channels", G_TYPE_INT, channels,
- NULL);
-
- GST_INFO_OBJECT (omx_base, "caps are: %" GST_PTR_FORMAT, new_caps);
- gst_pad_set_caps (omx_base->srcpad, new_caps);
- }
-}
-
-static void
type_instance_init (GTypeInstance *instance,
gpointer g_class)
{
- GstOmxBaseFilter *omx_base;
-
- omx_base = GST_OMX_BASE_FILTER (instance);
-
- GST_DEBUG_OBJECT (omx_base, "start");
-
- omx_base->gomx->settings_changed_cb = settings_changed_cb;
}
diff --git a/omx/gstomx_mp2dec.h b/omx/gstomx_mp2dec.h
index 877d3c5..c6c517e 100644
--- a/omx/gstomx_mp2dec.h
+++ b/omx/gstomx_mp2dec.h
@@ -32,16 +32,16 @@ G_BEGIN_DECLS
typedef struct GstOmxMp2Dec GstOmxMp2Dec;
typedef struct GstOmxMp2DecClass GstOmxMp2DecClass;
-#include "gstomx_base_filter.h"
+#include "gstomx_base_audiodec.h"
struct GstOmxMp2Dec
{
- GstOmxBaseFilter omx_base;
+ GstOmxBaseAudioDec omx_base;
};
struct GstOmxMp2DecClass
{
- GstOmxBaseFilterClass parent_class;
+ GstOmxBaseAudioDecClass parent_class;
};
GType gst_omx_mp2dec_get_type (void);
diff --git a/omx/gstomx_mp3dec.c b/omx/gstomx_mp3dec.c
index facf03f..ee7fdd4 100644
--- a/omx/gstomx_mp3dec.c
+++ b/omx/gstomx_mp3dec.c
@@ -20,12 +20,11 @@
*/
#include "gstomx_mp3dec.h"
-#include "gstomx_base_filter.h"
#include "gstomx.h"
#include <string.h> /* for memset */
-GSTOMX_BOILERPLATE (GstOmxMp3Dec, gst_omx_mp3dec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
+GSTOMX_BOILERPLATE (GstOmxMp3Dec, gst_omx_mp3dec, GstOmxBaseAudioDec, GST_OMX_BASE_AUDIODEC_TYPE);
static GstCaps *
generate_src_template (void)
@@ -106,57 +105,7 @@ type_class_init (gpointer g_class,
}
static void
-settings_changed_cb (GOmxCore *core)
-{
- GstOmxBaseFilter *omx_base;
- guint rate;
- guint channels;
-
- omx_base = core->object;
-
- GST_DEBUG_OBJECT (omx_base, "settings changed");
-
- {
- OMX_AUDIO_PARAM_PCMMODETYPE param;
-
- G_OMX_PORT_GET_PARAM (omx_base->out_port, OMX_IndexParamAudioPcm, ¶m);
-
- rate = param.nSamplingRate;
- channels = param.nChannels;
- if (rate == 0)
- {
- /** @todo: this shouldn't happen. */
- GST_WARNING_OBJECT (omx_base, "Bad samplerate");
- rate = 44100;
- }
- }
-
- {
- GstCaps *new_caps;
-
- new_caps = gst_caps_new_simple ("audio/x-raw-int",
- "width", G_TYPE_INT, 16,
- "depth", G_TYPE_INT, 16,
- "rate", G_TYPE_INT, rate,
- "signed", G_TYPE_BOOLEAN, TRUE,
- "endianness", G_TYPE_INT, G_BYTE_ORDER,
- "channels", G_TYPE_INT, channels,
- NULL);
-
- GST_INFO_OBJECT (omx_base, "caps are: %" GST_PTR_FORMAT, new_caps);
- gst_pad_set_caps (omx_base->srcpad, new_caps);
- }
-}
-
-static void
type_instance_init (GTypeInstance *instance,
gpointer g_class)
{
- GstOmxBaseFilter *omx_base;
-
- omx_base = GST_OMX_BASE_FILTER (instance);
-
- GST_DEBUG_OBJECT (omx_base, "start");
-
- omx_base->gomx->settings_changed_cb = settings_changed_cb;
}
diff --git a/omx/gstomx_mp3dec.h b/omx/gstomx_mp3dec.h
index f353ee5..c0a7d78 100644
--- a/omx/gstomx_mp3dec.h
+++ b/omx/gstomx_mp3dec.h
@@ -32,16 +32,16 @@ G_BEGIN_DECLS
typedef struct GstOmxMp3Dec GstOmxMp3Dec;
typedef struct GstOmxMp3DecClass GstOmxMp3DecClass;
-#include "gstomx_base_filter.h"
+#include "gstomx_base_audiodec.h"
struct GstOmxMp3Dec
{
- GstOmxBaseFilter omx_base;
+ GstOmxBaseAudioDec omx_base;
};
struct GstOmxMp3DecClass
{
- GstOmxBaseFilterClass parent_class;
+ GstOmxBaseAudioDecClass parent_class;
};
GType gst_omx_mp3dec_get_type (void);
diff --git a/omx/gstomx_vorbisdec.c b/omx/gstomx_vorbisdec.c
index b906e67..a5f9b4f 100644
--- a/omx/gstomx_vorbisdec.c
+++ b/omx/gstomx_vorbisdec.c
@@ -20,12 +20,11 @@
*/
#include "gstomx_vorbisdec.h"
-#include "gstomx_base_filter.h"
#include "gstomx.h"
#include <string.h> /* for memset */
-GSTOMX_BOILERPLATE (GstOmxVorbisDec, gst_omx_vorbisdec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
+GSTOMX_BOILERPLATE (GstOmxVorbisDec, gst_omx_vorbisdec, GstOmxBaseAudioDec, GST_OMX_BASE_AUDIODEC_TYPE);
static GstCaps *
generate_src_template (void)
@@ -101,44 +100,6 @@ type_class_init (gpointer g_class,
}
static void
-settings_changed_cb (GOmxCore *core)
-{
- GstOmxBaseFilter *omx_base;
- guint rate;
- guint channels;
-
- omx_base = core->object;
-
- GST_DEBUG_OBJECT (omx_base, "settings changed");
-
- {
- OMX_AUDIO_PARAM_PCMMODETYPE param;
-
- G_OMX_PORT_GET_PARAM (omx_base->out_port, OMX_IndexParamAudioPcm, ¶m);
-
-
- rate = param.nSamplingRate;
- channels = param.nChannels;
- }
-
- {
- GstCaps *new_caps;
-
- new_caps = gst_caps_new_simple ("audio/x-raw-int",
- "rate", G_TYPE_INT, rate,
- "signed", G_TYPE_BOOLEAN, TRUE,
- "channels", G_TYPE_INT, channels,
- "endianness", G_TYPE_INT, G_BYTE_ORDER,
- "width", G_TYPE_INT, 16,
- "depth", G_TYPE_INT, 16,
- NULL);
-
- GST_INFO_OBJECT (omx_base, "caps are: %" GST_PTR_FORMAT, new_caps);
- gst_pad_set_caps (omx_base->srcpad, new_caps);
- }
-}
-
-static void
type_instance_init (GTypeInstance *instance,
gpointer g_class)
{
@@ -149,6 +110,4 @@ type_instance_init (GTypeInstance *instance,
GST_DEBUG_OBJECT (omx_base, "start");
omx_base->use_timestamps = FALSE;
-
- omx_base->gomx->settings_changed_cb = settings_changed_cb;
}
diff --git a/omx/gstomx_vorbisdec.h b/omx/gstomx_vorbisdec.h
index 05ce070..c7737a3 100644
--- a/omx/gstomx_vorbisdec.h
+++ b/omx/gstomx_vorbisdec.h
@@ -32,16 +32,16 @@ G_BEGIN_DECLS
typedef struct GstOmxVorbisDec GstOmxVorbisDec;
typedef struct GstOmxVorbisDecClass GstOmxVorbisDecClass;
-#include "gstomx_base_filter.h"
+#include "gstomx_base_audiodec.h"
struct GstOmxVorbisDec
{
- GstOmxBaseFilter omx_base;
+ GstOmxBaseAudioDec omx_base;
};
struct GstOmxVorbisDecClass
{
- GstOmxBaseFilterClass parent_class;
+ GstOmxBaseAudioDecClass parent_class;
};
GType gst_omx_vorbisdec_get_type (void);
--
1.6.3.2
|
|
From: Rob C. <ro...@ti...> - 2009-11-04 02:26:54
|
These work like the GST_BOILERPLATE macros, but following the naming conventions for init functions used in the gst-openmax code, to remove a lot of gobject related boilerplate code.
Signed-off-by: Rob Clark <ro...@ti...>
---
omx/gstomx_aacdec.c | 27 +----------------------
omx/gstomx_aacenc.c | 28 +----------------------
omx/gstomx_adpcmdec.c | 27 +----------------------
omx/gstomx_adpcmenc.c | 27 +----------------------
omx/gstomx_amrnbdec.c | 27 +----------------------
omx/gstomx_amrnbenc.c | 28 +----------------------
omx/gstomx_amrwbdec.c | 27 +----------------------
omx/gstomx_amrwbenc.c | 28 +----------------------
omx/gstomx_audiosink.c | 27 +----------------------
omx/gstomx_base_filter.c | 51 +++++++++++++++++--------------------------
omx/gstomx_base_sink.c | 52 ++++++++++++++++---------------------------
omx/gstomx_base_src.c | 32 +++++----------------------
omx/gstomx_base_videodec.c | 27 +----------------------
omx/gstomx_base_videoenc.c | 28 +----------------------
omx/gstomx_dummy.c | 27 +----------------------
omx/gstomx_filereadersrc.c | 27 +----------------------
omx/gstomx_g711dec.c | 27 +----------------------
omx/gstomx_g711enc.c | 27 +----------------------
omx/gstomx_g729dec.c | 27 +----------------------
omx/gstomx_g729enc.c | 28 +----------------------
omx/gstomx_h263dec.c | 27 +----------------------
omx/gstomx_h263enc.c | 27 +----------------------
omx/gstomx_h264dec.c | 27 +----------------------
omx/gstomx_h264enc.c | 27 +----------------------
omx/gstomx_ilbcdec.c | 27 +----------------------
omx/gstomx_ilbcenc.c | 27 +----------------------
omx/gstomx_jpegenc.c | 28 +----------------------
omx/gstomx_mp2dec.c | 27 +----------------------
omx/gstomx_mp3dec.c | 27 +----------------------
omx/gstomx_mpeg4dec.c | 27 +----------------------
omx/gstomx_mpeg4enc.c | 27 +----------------------
omx/gstomx_util.h | 42 +++++++++++++++++++++++++++++++++++
omx/gstomx_videosink.c | 28 +----------------------
omx/gstomx_volume.c | 27 +----------------------
omx/gstomx_vorbisdec.c | 28 +----------------------
omx/gstomx_wmvdec.c | 27 +----------------------
36 files changed, 119 insertions(+), 930 deletions(-)
diff --git a/omx/gstomx_aacdec.c b/omx/gstomx_aacdec.c
index dbe7846..4f20370 100644
--- a/omx/gstomx_aacdec.c
+++ b/omx/gstomx_aacdec.c
@@ -25,7 +25,7 @@
#include <string.h> /* for memset */
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxAacDec, gst_omx_aacdec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -127,7 +127,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static void
@@ -208,27 +207,3 @@ type_instance_init (GTypeInstance *instance,
gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps);
}
-
-GType
-gst_omx_aacdec_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxAacDecClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxAacDec);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxAacDec", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_aacenc.c b/omx/gstomx_aacenc.c
index e1f8720..f640ed4 100644
--- a/omx/gstomx_aacenc.c
+++ b/omx/gstomx_aacenc.c
@@ -37,7 +37,7 @@ enum
#define DEFAULT_PROFILE OMX_AUDIO_AACObjectLC
#define DEFAULT_OUTPUT_FORMAT OMX_AUDIO_AACStreamFormatRAW
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxAacEnc, gst_omx_aacenc, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
#define GST_TYPE_OMX_AACENC_PROFILE (gst_omx_aacenc_profile_get_type ())
static GType
@@ -251,8 +251,6 @@ type_class_init (gpointer g_class,
gobject_class = G_OBJECT_CLASS (g_class);
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
-
/* Properties stuff */
{
gobject_class->set_property = set_property;
@@ -406,27 +404,3 @@ type_instance_init (GTypeInstance *instance,
self->profile = DEFAULT_PROFILE;
self->output_format = DEFAULT_OUTPUT_FORMAT;
}
-
-GType
-gst_omx_aacenc_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxAacEncClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxAacEnc);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxAacEnc", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_adpcmdec.c b/omx/gstomx_adpcmdec.c
index a35a6cc..61b0d20 100644
--- a/omx/gstomx_adpcmdec.c
+++ b/omx/gstomx_adpcmdec.c
@@ -25,7 +25,7 @@
#include <string.h> /* for memset */
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxAdpcmDec, gst_omx_adpcmdec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -101,7 +101,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static gboolean
@@ -165,27 +164,3 @@ type_instance_init (GTypeInstance *instance,
gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps);
}
-
-GType
-gst_omx_adpcmdec_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxAdpcmDecClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxAdpcmDec);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxAdpcmDec", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_adpcmenc.c b/omx/gstomx_adpcmenc.c
index c17a7b4..7e4b5c6 100644
--- a/omx/gstomx_adpcmenc.c
+++ b/omx/gstomx_adpcmenc.c
@@ -25,7 +25,7 @@
#include <string.h> /* for memset */
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxAdpcmEnc, gst_omx_adpcmenc, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -101,7 +101,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static void
@@ -223,27 +222,3 @@ type_instance_init (GTypeInstance *instance,
gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps);
}
-
-GType
-gst_omx_adpcmenc_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxAdpcmEncClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxAdpcmEnc);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxAdpcmEnc", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_amrnbdec.c b/omx/gstomx_amrnbdec.c
index 9250420..f481e6d 100644
--- a/omx/gstomx_amrnbdec.c
+++ b/omx/gstomx_amrnbdec.c
@@ -25,7 +25,7 @@
#include <string.h> /* for memset */
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxAmrNbDec, gst_omx_amrnbdec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -100,7 +100,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static void
@@ -150,27 +149,3 @@ type_instance_init (GTypeInstance *instance,
omx_base->gomx->settings_changed_cb = settings_changed_cb;
}
-
-GType
-gst_omx_amrnbdec_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxAmrNbDecClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxAmrNbDec);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxAmrNbDec", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_amrnbenc.c b/omx/gstomx_amrnbenc.c
index 92df603..0309d89 100644
--- a/omx/gstomx_amrnbenc.c
+++ b/omx/gstomx_amrnbenc.c
@@ -33,7 +33,7 @@ enum
#define DEFAULT_BITRATE 64000
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxAmrNbEnc, gst_omx_amrnbenc, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -155,8 +155,6 @@ type_class_init (gpointer g_class,
gobject_class = G_OBJECT_CLASS (g_class);
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
-
/* Properties stuff */
{
gobject_class->set_property = set_property;
@@ -253,27 +251,3 @@ type_instance_init (GTypeInstance *instance,
self->bitrate = DEFAULT_BITRATE;
}
-
-GType
-gst_omx_amrnbenc_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxAmrNbEncClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxAmrNbEnc);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxAmrNbEnc", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_amrwbdec.c b/omx/gstomx_amrwbdec.c
index bc406c0..cee5334 100644
--- a/omx/gstomx_amrwbdec.c
+++ b/omx/gstomx_amrwbdec.c
@@ -25,7 +25,7 @@
#include <string.h> /* for memset */
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxAmrWbDec, gst_omx_amrwbdec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -100,7 +100,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static void
@@ -150,27 +149,3 @@ type_instance_init (GTypeInstance *instance,
omx_base->gomx->settings_changed_cb = settings_changed_cb;
}
-
-GType
-gst_omx_amrwbdec_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxAmrWbDecClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxAmrWbDec);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxAmrWbDec", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_amrwbenc.c b/omx/gstomx_amrwbenc.c
index 40d0cf5..b73fa9c 100644
--- a/omx/gstomx_amrwbenc.c
+++ b/omx/gstomx_amrwbenc.c
@@ -33,7 +33,7 @@ enum
#define DEFAULT_BITRATE 64000
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxAmrWbEnc, gst_omx_amrwbenc, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -155,8 +155,6 @@ type_class_init (gpointer g_class,
gobject_class = G_OBJECT_CLASS (g_class);
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
-
/* Properties stuff */
{
gobject_class->set_property = set_property;
@@ -253,27 +251,3 @@ type_instance_init (GTypeInstance *instance,
self->bitrate = DEFAULT_BITRATE;
}
-
-GType
-gst_omx_amrwbenc_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxAmrWbEncClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxAmrWbEnc);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxAmrWbEnc", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_audiosink.c b/omx/gstomx_audiosink.c
index 44dc92a..d74623b 100644
--- a/omx/gstomx_audiosink.c
+++ b/omx/gstomx_audiosink.c
@@ -24,7 +24,7 @@
#include <string.h> /* for memset */
-static GstOmxBaseSinkClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxAudioSink, gst_omx_audiosink, GstOmxBaseSink, GST_OMX_BASE_SINK_TYPE);
static GstCaps *
generate_sink_template (void)
@@ -130,7 +130,6 @@ type_class_init (gpointer g_class,
{
GstBaseSinkClass *gst_base_sink_class;
- parent_class = g_type_class_ref (GST_OMX_BASE_SINK_TYPE);
gst_base_sink_class = GST_BASE_SINK_CLASS (g_class);
gst_base_sink_class->set_caps = setcaps;
@@ -146,27 +145,3 @@ type_instance_init (GTypeInstance *instance,
GST_DEBUG_OBJECT (omx_base, "start");
}
-
-GType
-gst_omx_audiosink_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxAudioSinkClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxAudioSink);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_SINK_TYPE, "GstOmxAudioSink", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_base_filter.c b/omx/gstomx_base_filter.c
index 418915c..f57ce96 100644
--- a/omx/gstomx_base_filter.c
+++ b/omx/gstomx_base_filter.c
@@ -35,7 +35,8 @@ enum
ARG_NUM_OUTPUT_BUFFERS,
};
-static GstElementClass *parent_class;
+static void init_interfaces (GType type);
+GSTOMX_BOILERPLATE_FULL (GstOmxBaseFilter, gst_omx_base_filter, GstElement, GST_TYPE_ELEMENT, init_interfaces);
static inline void
log_buffer (GstOmxBaseFilter *self,
@@ -281,6 +282,11 @@ get_property (GObject *obj,
}
static void
+type_base_init (gpointer g_class)
+{
+}
+
+static void
type_class_init (gpointer g_class,
gpointer class_data)
{
@@ -290,8 +296,6 @@ type_class_init (gpointer g_class,
gobject_class = G_OBJECT_CLASS (g_class);
gstelement_class = GST_ELEMENT_CLASS (g_class);
- parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
-
gobject_class->finalize = finalize;
gstelement_class->change_state = change_state;
@@ -993,38 +997,23 @@ interface_init (GstImplementsInterfaceClass *klass)
klass->supported = interface_supported;
}
-GType
-gst_omx_base_filter_get_type (void)
+static void
+init_interfaces (GType type)
{
- static GType type = 0;
+ GInterfaceInfo *iface_info;
+ GInterfaceInfo *omx_info;
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
- GInterfaceInfo *iface_info;
- GInterfaceInfo *omx_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxBaseFilterClass);
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxBaseFilter);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_TYPE_ELEMENT, "GstOmxBaseFilter", type_info, 0);
- g_free (type_info);
- iface_info = g_new0 (GInterfaceInfo, 1);
- iface_info->interface_init = (GInterfaceInitFunc) interface_init;
+ iface_info = g_new0 (GInterfaceInfo, 1);
+ iface_info->interface_init = (GInterfaceInitFunc) interface_init;
- g_type_add_interface_static (type, GST_TYPE_IMPLEMENTS_INTERFACE, iface_info);
- g_free (iface_info);
+ g_type_add_interface_static (type, GST_TYPE_IMPLEMENTS_INTERFACE, iface_info);
+ g_free (iface_info);
- omx_info = g_new0 (GInterfaceInfo, 1);
- omx_info->interface_init = (GInterfaceInitFunc) omx_interface_init;
+ omx_info = g_new0 (GInterfaceInfo, 1);
+ omx_info->interface_init = (GInterfaceInitFunc) omx_interface_init;
- g_type_add_interface_static (type, GST_TYPE_OMX, omx_info);
- g_free (omx_info);
- }
-
- return type;
+ g_type_add_interface_static (type, GST_TYPE_OMX, omx_info);
+ g_free (omx_info);
}
+
diff --git a/omx/gstomx_base_sink.c b/omx/gstomx_base_sink.c
index c25c0ad..3e3347b 100644
--- a/omx/gstomx_base_sink.c
+++ b/omx/gstomx_base_sink.c
@@ -39,7 +39,8 @@ enum
ARG_LIBRARY_NAME,
};
-static GstElementClass *parent_class;
+static void init_interfaces (GType type);
+GSTOMX_BOILERPLATE_FULL (GstOmxBaseSink, gst_omx_base_sink, GstBaseSink, GST_TYPE_BASE_SINK, init_interfaces);
static void
setup_ports (GstOmxBaseSink *self)
@@ -328,6 +329,11 @@ get_property (GObject *obj,
}
static void
+type_base_init (gpointer g_class)
+{
+}
+
+static void
type_class_init (gpointer g_class,
gpointer class_data)
{
@@ -339,8 +345,6 @@ type_class_init (gpointer g_class,
gst_base_sink_class = GST_BASE_SINK_CLASS (g_class);
gstelement_class = GST_ELEMENT_CLASS (g_class);
- parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
-
gobject_class->finalize = finalize;
gstelement_class->change_state = change_state;
@@ -484,39 +488,21 @@ interface_init (GstImplementsInterfaceClass *klass)
{
klass->supported = interface_supported;
}
-
-GType
-gst_omx_base_sink_get_type (void)
+static void
+init_interfaces (GType type)
{
- static GType type = 0;
+ GInterfaceInfo *iface_info;
+ GInterfaceInfo *omx_info;
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
- GInterfaceInfo *iface_info;
- GInterfaceInfo *omx_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxBaseSinkClass);
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxBaseSink);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_TYPE_BASE_SINK, "GstOmxBaseSink", type_info, 0);
- g_free (type_info);
+ iface_info = g_new0 (GInterfaceInfo, 1);
+ iface_info->interface_init = (GInterfaceInitFunc) interface_init;
- iface_info = g_new0 (GInterfaceInfo, 1);
- iface_info->interface_init = (GInterfaceInitFunc) interface_init;
+ g_type_add_interface_static (type, GST_TYPE_IMPLEMENTS_INTERFACE, iface_info);
+ g_free (iface_info);
- g_type_add_interface_static (type, GST_TYPE_IMPLEMENTS_INTERFACE, iface_info);
- g_free (iface_info);
-
- omx_info = g_new0 (GInterfaceInfo, 1);
- omx_info->interface_init = (GInterfaceInitFunc) omx_interface_init;
-
- g_type_add_interface_static (type, GST_TYPE_OMX, omx_info);
- g_free (omx_info);
- }
+ omx_info = g_new0 (GInterfaceInfo, 1);
+ omx_info->interface_init = (GInterfaceInitFunc) omx_interface_init;
- return type;
+ g_type_add_interface_static (type, GST_TYPE_OMX, omx_info);
+ g_free (omx_info);
}
diff --git a/omx/gstomx_base_src.c b/omx/gstomx_base_src.c
index 94bf5e9..1c9ff48 100644
--- a/omx/gstomx_base_src.c
+++ b/omx/gstomx_base_src.c
@@ -31,7 +31,7 @@ enum
ARG_LIBRARY_NAME,
};
-static GstElementClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxBaseSrc, gst_omx_base_src, GstBaseSrc, GST_TYPE_BASE_SRC);
static void
setup_ports (GstOmxBaseSrc *self)
@@ -398,6 +398,11 @@ get_property (GObject *obj,
}
static void
+type_base_init (gpointer g_class)
+{
+}
+
+static void
type_class_init (gpointer g_class,
gpointer class_data)
{
@@ -407,8 +412,6 @@ type_class_init (gpointer g_class,
gobject_class = G_OBJECT_CLASS (g_class);
gst_base_src_class = GST_BASE_SRC_CLASS (g_class);
- parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
-
gobject_class->finalize = finalize;
gst_base_src_class->start = start;
@@ -449,26 +452,3 @@ type_instance_init (GTypeInstance *instance,
GST_LOG_OBJECT (self, "end");
}
-
-GType
-gst_omx_base_src_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxBaseSrcClass);
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxBaseSrc);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_TYPE_BASE_SRC, "GstOmxBaseSrc", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_base_videodec.c b/omx/gstomx_base_videodec.c
index ce7dfc8..91436d3 100644
--- a/omx/gstomx_base_videodec.c
+++ b/omx/gstomx_base_videodec.c
@@ -24,7 +24,7 @@
#include <string.h> /* for memset */
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxBaseVideoDec, gst_omx_base_videodec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -91,7 +91,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static void
@@ -256,27 +255,3 @@ type_instance_init (GTypeInstance *instance,
gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps);
}
-
-GType
-gst_omx_base_videodec_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxBaseVideoDecClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxBaseVideoDec);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxBaseVideoDec", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_base_videoenc.c b/omx/gstomx_base_videoenc.c
index a3e0625..c9067c4 100644
--- a/omx/gstomx_base_videoenc.c
+++ b/omx/gstomx_base_videoenc.c
@@ -32,7 +32,7 @@ enum
#define DEFAULT_BITRATE 0
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxBaseVideoEnc, gst_omx_base_videoenc, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_sink_template (void)
@@ -146,8 +146,6 @@ type_class_init (gpointer g_class,
gobject_class = G_OBJECT_CLASS (g_class);
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
-
/* Properties stuff */
{
gobject_class->set_property = set_property;
@@ -285,27 +283,3 @@ type_instance_init (GTypeInstance *instance,
self->bitrate = DEFAULT_BITRATE;
}
-
-GType
-gst_omx_base_videoenc_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxBaseVideoEncClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxBaseVideoEnc);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxBaseVideoEnc", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_dummy.c b/omx/gstomx_dummy.c
index 63fde61..03ebc41 100644
--- a/omx/gstomx_dummy.c
+++ b/omx/gstomx_dummy.c
@@ -23,7 +23,7 @@
#include "gstomx_base_filter.h"
#include "gstomx.h"
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxDummy, gst_omx_dummy, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -88,7 +88,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static void
@@ -101,27 +100,3 @@ type_instance_init (GTypeInstance *instance,
GST_DEBUG_OBJECT (omx_base, "start");
}
-
-GType
-gst_omx_dummy_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxDummyClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxDummy);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxDummy", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_filereadersrc.c b/omx/gstomx_filereadersrc.c
index cea5ca9..38b6964 100644
--- a/omx/gstomx_filereadersrc.c
+++ b/omx/gstomx_filereadersrc.c
@@ -29,7 +29,7 @@ enum
ARG_FILE_NAME,
};
-static GstOmxBaseSrcClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxFilereaderSrc, gst_omx_filereadersrc, GstOmxBaseSrc, GST_OMX_BASE_SRC_TYPE);
static GstCaps *
generate_src_template (void)
@@ -167,7 +167,6 @@ type_class_init (gpointer g_class,
GstBaseSrcClass *gst_base_src_class;
GObjectClass *gobject_class;
- parent_class = g_type_class_ref (GST_OMX_BASE_SRC_TYPE);
gst_base_src_class = GST_BASE_SRC_CLASS (g_class);
gobject_class = G_OBJECT_CLASS (g_class);
@@ -201,27 +200,3 @@ type_instance_init (GTypeInstance *instance,
GST_DEBUG_OBJECT (omx_base, "end");
}
-
-GType
-gst_omx_filereadersrc_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxFilereaderSrcClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxFilereaderSrc);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_SRC_TYPE, "GstOmxFilereaderSrc", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_g711dec.c b/omx/gstomx_g711dec.c
index f62796b..14edf5d 100644
--- a/omx/gstomx_g711dec.c
+++ b/omx/gstomx_g711dec.c
@@ -25,7 +25,7 @@
#include <string.h> /* for memset, strcmp */
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxG711Dec, gst_omx_g711dec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -112,7 +112,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static gboolean
@@ -182,27 +181,3 @@ type_instance_init (GTypeInstance *instance,
gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps);
}
-
-GType
-gst_omx_g711dec_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxG711DecClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxG711Dec);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxG711Dec", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_g711enc.c b/omx/gstomx_g711enc.c
index bcfb72b..2137cfe 100644
--- a/omx/gstomx_g711enc.c
+++ b/omx/gstomx_g711enc.c
@@ -25,7 +25,7 @@
#include <string.h> /* for memset, strcmp */
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxG711Enc, gst_omx_g711enc, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -112,7 +112,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static gboolean
@@ -196,27 +195,3 @@ type_instance_init (GTypeInstance *instance,
gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps);
}
-
-GType
-gst_omx_g711enc_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxG711EncClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxG711Enc);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxG711Enc", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_g729dec.c b/omx/gstomx_g729dec.c
index 1aefa60..666d5ab 100644
--- a/omx/gstomx_g729dec.c
+++ b/omx/gstomx_g729dec.c
@@ -23,7 +23,7 @@
#include "gstomx_base_filter.h"
#include "gstomx.h"
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxG729Dec, gst_omx_g729dec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -103,7 +103,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static void
@@ -142,27 +141,3 @@ type_instance_init (GTypeInstance *instance,
omx_base->gomx->settings_changed_cb = settings_changed_cb;
}
-
-GType
-gst_omx_g729dec_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxG729DecClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxG729Dec);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxG729Dec", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_g729enc.c b/omx/gstomx_g729enc.c
index aa44c35..9a2cf3e 100644
--- a/omx/gstomx_g729enc.c
+++ b/omx/gstomx_g729enc.c
@@ -33,7 +33,7 @@ enum
ARG_DTX,
};
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxG729Enc, gst_omx_g729enc, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -160,8 +160,6 @@ type_class_init (gpointer g_class,
gobject_class = G_OBJECT_CLASS (g_class);
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
-
/* Properties stuff */
{
gobject_class->set_property = set_property;
@@ -253,27 +251,3 @@ type_instance_init (GTypeInstance *instance,
self->dtx = DEFAULT_DTX;
}
-
-GType
-gst_omx_g729enc_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxG729EncClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxG729Enc);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxG729Enc", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_h263dec.c b/omx/gstomx_h263dec.c
index 14d65b7..233e041 100644
--- a/omx/gstomx_h263dec.c
+++ b/omx/gstomx_h263dec.c
@@ -22,7 +22,7 @@
#include "gstomx_h263dec.h"
#include "gstomx.h"
-static GstOmxBaseVideoDecClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxH263Dec, gst_omx_h263dec, GstOmxBaseVideoDec, GST_OMX_BASE_VIDEODEC_TYPE);
static GstCaps *
generate_sink_template (void)
@@ -77,7 +77,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_VIDEODEC_TYPE);
}
static void
@@ -90,27 +89,3 @@ type_instance_init (GTypeInstance *instance,
omx_base->compression_format = OMX_VIDEO_CodingH263;
}
-
-GType
-gst_omx_h263dec_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxH263DecClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxH263Dec);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_VIDEODEC_TYPE, "GstOmxH263Dec", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_h263enc.c b/omx/gstomx_h263enc.c
index 19d313a..f9af2ce 100644
--- a/omx/gstomx_h263enc.c
+++ b/omx/gstomx_h263enc.c
@@ -24,7 +24,7 @@
#include <string.h> /* for memset */
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxH263Enc, gst_omx_h263enc, GstOmxBaseVideoEnc, GST_OMX_BASE_VIDEOENC_TYPE);
static GstCaps *
generate_src_template (void)
@@ -74,7 +74,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static void
@@ -129,27 +128,3 @@ type_instance_init (GTypeInstance *instance,
omx_base_filter->gomx->settings_changed_cb = settings_changed_cb;
}
-
-GType
-gst_omx_h263enc_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxH263EncClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxH263Enc);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_VIDEOENC_TYPE, "GstOmxH263Enc", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_h264dec.c b/omx/gstomx_h264dec.c
index bf13966..4f950df 100644
--- a/omx/gstomx_h264dec.c
+++ b/omx/gstomx_h264dec.c
@@ -22,7 +22,7 @@
#include "gstomx_h264dec.h"
#include "gstomx.h"
-static GstOmxBaseVideoDecClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxH264Dec, gst_omx_h264dec, GstOmxBaseVideoDec, GST_OMX_BASE_VIDEODEC_TYPE);
static GstCaps *
generate_sink_template (void)
@@ -76,7 +76,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_VIDEODEC_TYPE);
}
static void
@@ -89,27 +88,3 @@ type_instance_init (GTypeInstance *instance,
omx_base->compression_format = OMX_VIDEO_CodingAVC;
}
-
-GType
-gst_omx_h264dec_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxH264DecClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxH264Dec);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_VIDEODEC_TYPE, "GstOmxH264Dec", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_h264enc.c b/omx/gstomx_h264enc.c
index 1a4510e..c1e9966 100644
--- a/omx/gstomx_h264enc.c
+++ b/omx/gstomx_h264enc.c
@@ -24,7 +24,7 @@
#include <string.h> /* for memset */
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxH264Enc, gst_omx_h264enc, GstOmxBaseVideoEnc, GST_OMX_BASE_VIDEOENC_TYPE);
static GstCaps *
generate_src_template (void)
@@ -73,7 +73,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static void
@@ -127,27 +126,3 @@ type_instance_init (GTypeInstance *instance,
omx_base_filter->gomx->settings_changed_cb = settings_changed_cb;
}
-
-GType
-gst_omx_h264enc_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxH264EncClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxH264Enc);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_VIDEOENC_TYPE, "GstOmxH264Enc", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_ilbcdec.c b/omx/gstomx_ilbcdec.c
index 0547768..9d03f01 100644
--- a/omx/gstomx_ilbcdec.c
+++ b/omx/gstomx_ilbcdec.c
@@ -23,7 +23,7 @@
#include "gstomx_base_filter.h"
#include "gstomx.h"
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxIlbcDec, gst_omx_ilbcdec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -122,7 +122,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static gboolean
@@ -167,27 +166,3 @@ type_instance_init (GTypeInstance *instance,
gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps);
}
-
-GType
-gst_omx_ilbcdec_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxIlbcDecClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxIlbcDec);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxIlbcDec", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_ilbcenc.c b/omx/gstomx_ilbcenc.c
index 789c381..1da2c53 100644
--- a/omx/gstomx_ilbcenc.c
+++ b/omx/gstomx_ilbcenc.c
@@ -23,7 +23,7 @@
#include "gstomx_base_filter.h"
#include "gstomx.h"
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxIlbcEnc, gst_omx_ilbcenc, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -122,7 +122,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static gboolean
@@ -167,27 +166,3 @@ type_instance_init (GTypeInstance *instance,
gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps);
}
-
-GType
-gst_omx_ilbcenc_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxIlbcEncClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxIlbcEnc);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxIlbcEnc", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_jpegenc.c b/omx/gstomx_jpegenc.c
index d826149..b42171c 100644
--- a/omx/gstomx_jpegenc.c
+++ b/omx/gstomx_jpegenc.c
@@ -34,7 +34,7 @@ enum
#define DEFAULT_QUALITY 90
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxJpegEnc, gst_omx_jpegenc, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -177,8 +177,6 @@ type_class_init (gpointer g_class,
gobject_class = G_OBJECT_CLASS (g_class);
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
-
/* Properties stuff */
{
gobject_class->set_property = set_property;
@@ -354,27 +352,3 @@ type_instance_init (GTypeInstance *instance,
self->framerate_denom = 1;
self->quality = DEFAULT_QUALITY;
}
-
-GType
-gst_omx_jpegenc_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxJpegEncClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxJpegEnc);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxJpegEnc", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_mp2dec.c b/omx/gstomx_mp2dec.c
index b6bef4f..8160c53 100644
--- a/omx/gstomx_mp2dec.c
+++ b/omx/gstomx_mp2dec.c
@@ -25,7 +25,7 @@
#include <string.h> /* for memset */
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxMp2Dec, gst_omx_mp2dec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -103,7 +103,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static void
@@ -161,27 +160,3 @@ type_instance_init (GTypeInstance *instance,
omx_base->gomx->settings_changed_cb = settings_changed_cb;
}
-
-GType
-gst_omx_mp2dec_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxMp2DecClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxMp2Dec);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxMp2Dec", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_mp3dec.c b/omx/gstomx_mp3dec.c
index 0036fac..facf03f 100644
--- a/omx/gstomx_mp3dec.c
+++ b/omx/gstomx_mp3dec.c
@@ -25,7 +25,7 @@
#include <string.h> /* for memset */
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxMp3Dec, gst_omx_mp3dec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -103,7 +103,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static void
@@ -161,27 +160,3 @@ type_instance_init (GTypeInstance *instance,
omx_base->gomx->settings_changed_cb = settings_changed_cb;
}
-
-GType
-gst_omx_mp3dec_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxMp3DecClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxMp3Dec);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxMp3Dec", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_mpeg4dec.c b/omx/gstomx_mpeg4dec.c
index 614daf6..a23fef0 100644
--- a/omx/gstomx_mpeg4dec.c
+++ b/omx/gstomx_mpeg4dec.c
@@ -22,7 +22,7 @@
#include "gstomx_mpeg4dec.h"
#include "gstomx.h"
-static GstOmxBaseVideoDecClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxMpeg4Dec, gst_omx_mpeg4dec, GstOmxBaseVideoDec, GST_OMX_BASE_VIDEODEC_TYPE);
static GstCaps *
generate_sink_template (void)
@@ -103,7 +103,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_VIDEODEC_TYPE);
}
static void
@@ -116,27 +115,3 @@ type_instance_init (GTypeInstance *instance,
omx_base->compression_format = OMX_VIDEO_CodingMPEG4;
}
-
-GType
-gst_omx_mpeg4dec_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxMpeg4DecClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxMpeg4Dec);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_VIDEODEC_TYPE, "GstOmxMpeg4Dec", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_mpeg4enc.c b/omx/gstomx_mpeg4enc.c
index 62f9f23..8311c3b 100644
--- a/omx/gstomx_mpeg4enc.c
+++ b/omx/gstomx_mpeg4enc.c
@@ -24,7 +24,7 @@
#include <string.h> /* for memset */
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxMpeg4Enc, gst_omx_mpeg4enc, GstOmxBaseVideoEnc, GST_OMX_BASE_VIDEOENC_TYPE);
static GstCaps *
generate_src_template (void)
@@ -75,7 +75,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static void
@@ -131,27 +130,3 @@ type_instance_init (GTypeInstance *instance,
omx_base_filter->gomx->settings_changed_cb = settings_changed_cb;
}
-
-GType
-gst_omx_mpeg4enc_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxMpeg4EncClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxMpeg4Enc);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_VIDEOENC_TYPE, "GstOmxMpeg4Enc", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_util.h b/omx/gstomx_util.h
index 6627a49..76152ba 100644
--- a/omx/gstomx_util.h
+++ b/omx/gstomx_util.h
@@ -144,6 +144,48 @@ void g_omx_port_enable (GOmxPort *port);
void g_omx_port_disable (GOmxPort *port);
void g_omx_port_finish (GOmxPort *port);
+/**
+ * Basically like GST_BOILERPLATE / GST_BOILERPLATE_FULL, but follows the
+ * init fxn naming conventions used by gst-openmax. It expects the following
+ * functions to be defined in the same src file following this macro
+ * <ul>
+ * <li> type_base_init(gpointer g_class)
+ * <li> type_class_init(gpointer g_class, gpointer class_data)
+ * <li> type_instance_init(GTypeInstance *instance, gpointer g_class)
+ * </ul>
+ */
+#define GSTOMX_BOILERPLATE_FULL(type, type_as_function, parent_type, parent_type_macro, additional_initializations) \
+static void type_base_init (gpointer g_class); \
+static void type_class_init (gpointer g_class, gpointer class_data); \
+static void type_instance_init (GTypeInstance *instance, gpointer g_class); \
+static parent_type ## Class *parent_class; \
+static void type_class_init_trampoline (gpointer g_class, gpointer class_data)\
+{ \
+ parent_class = g_type_class_ref (parent_type_macro); \
+ type_class_init (g_class, class_data); \
+} \
+GType type_as_function ## _get_type (void) \
+{ \
+ static GType _type = 0; \
+ if (G_UNLIKELY (_type == 0)) \
+ { \
+ GTypeInfo *type_info; \
+ type_info = g_new0 (GTypeInfo, 1); \
+ type_info->class_size = sizeof (type ## Class); \
+ type_info->base_init = type_base_init; \
+ type_info->class_init = type_class_init_trampoline; \
+ type_info->instance_size = sizeof (type); \
+ type_info->instance_init = type_instance_init; \
+ _type = g_type_register_static (parent_type_macro, #type, type_info, 0);\
+ g_free (type_info); \
+ additional_initializations (_type); \
+ } \
+ return _type; \
+}
+#define GSTOMX_BOILERPLATE(type,type_as_function,parent_type,parent_type_macro) \
+ GSTOMX_BOILERPLATE_FULL (type, type_as_function, parent_type, parent_type_macro, \
+ __GST_DO_NOTHING)
+
/* Utility Macros */
diff --git a/omx/gstomx_videosink.c b/omx/gstomx_videosink.c
index dbced76..b2186c6 100644
--- a/omx/gstomx_videosink.c
+++ b/omx/gstomx_videosink.c
@@ -25,7 +25,7 @@
#include <string.h> /* for memset, strcmp */
-static GstOmxBaseSinkClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxVideoSink, gst_omx_videosink, GstOmxBaseSink, GST_OMX_BASE_SINK_TYPE);
enum
{
@@ -280,8 +280,6 @@ type_class_init (gpointer g_class,
gobject_class = (GObjectClass *) g_class;
gst_base_sink_class = GST_BASE_SINK_CLASS (g_class);
- parent_class = g_type_class_ref (GST_OMX_BASE_SINK_TYPE);
-
gst_base_sink_class->set_caps = setcaps;
gobject_class->set_property = set_property;
@@ -313,27 +311,3 @@ type_instance_init (GTypeInstance *instance,
GST_DEBUG_OBJECT (omx_base, "start");
}
-
-GType
-gst_omx_videosink_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxVideoSinkClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxVideoSink);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_SINK_TYPE, "GstOmxVideoSink", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_volume.c b/omx/gstomx_volume.c
index 9e79176..7ccc772 100644
--- a/omx/gstomx_volume.c
+++ b/omx/gstomx_volume.c
@@ -26,7 +26,7 @@
#include <string.h> /* for memset */
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxVolume, gst_omx_volume, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -105,7 +105,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static void
@@ -163,27 +162,3 @@ type_instance_init (GTypeInstance *instance,
omx_base->gomx->settings_changed_cb = settings_changed_cb;
}
-
-GType
-gst_omx_volume_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxVolumeClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxVolume);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxVolume", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_vorbisdec.c b/omx/gstomx_vorbisdec.c
index aba6b45..b906e67 100644
--- a/omx/gstomx_vorbisdec.c
+++ b/omx/gstomx_vorbisdec.c
@@ -25,7 +25,7 @@
#include <string.h> /* for memset */
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxVorbisDec, gst_omx_vorbisdec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -98,7 +98,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static void
@@ -153,28 +152,3 @@ type_instance_init (GTypeInstance *instance,
omx_base->gomx->settings_changed_cb = settings_changed_cb;
}
-
-GType
-gst_omx_vorbisdec_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
-
- type_info->class_size = sizeof (GstOmxVorbisDecClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxVorbisDec);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxVorbisDec", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_wmvdec.c b/omx/gstomx_wmvdec.c
index 7c12336..b16fd88 100644
--- a/omx/gstomx_wmvdec.c
+++ b/omx/gstomx_wmvdec.c
@@ -22,7 +22,7 @@
#include "gstomx_wmvdec.h"
#include "gstomx.h"
-static GstOmxBaseVideoDecClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxWmvDec, gst_omx_wmvdec, GstOmxBaseVideoDec, GST_OMX_BASE_VIDEODEC_TYPE);
static GstCaps *
generate_sink_template (void)
@@ -76,7 +76,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_VIDEODEC_TYPE);
}
static void
@@ -89,27 +88,3 @@ type_instance_init (GTypeInstance *instance,
omx_base->compression_format = OMX_VIDEO_CodingWMV;
}
-
-GType
-gst_omx_wmvdec_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxWmvDecClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxWmvDec);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_VIDEODEC_TYPE, "GstOmxWmvDec", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
--
1.6.3.2
|
|
From: Rob C. <ro...@ti...> - 2009-11-04 02:26:17
|
Signed-off-by: Rob Clark <ro...@ti...>
---
omx/gstomx_base_filter.c | 18 ++++++++++++++++++
omx/gstomx_util.c | 11 ++++++++---
omx/gstomx_util.h | 8 ++++++++
3 files changed, 34 insertions(+), 3 deletions(-)
diff --git a/omx/gstomx_base_filter.c b/omx/gstomx_base_filter.c
index 35571ae..418915c 100644
--- a/omx/gstomx_base_filter.c
+++ b/omx/gstomx_base_filter.c
@@ -70,6 +70,7 @@ setup_ports (GstOmxBaseFilter *self)
if (g_getenv ("OMX_ALLOCATE_ON"))
{
+ GST_DEBUG_OBJECT (self, "OMX_ALLOCATE_ON");
self->in_port->omx_allocate = TRUE;
self->out_port->omx_allocate = TRUE;
self->share_input_buffer = FALSE;
@@ -77,14 +78,25 @@ setup_ports (GstOmxBaseFilter *self)
}
else if (g_getenv ("OMX_SHARE_HACK_ON"))
{
+ GST_DEBUG_OBJECT (self, "OMX_SHARE_HACK_ON");
self->share_input_buffer = TRUE;
self->share_output_buffer = TRUE;
}
else if (g_getenv ("OMX_SHARE_HACK_OFF"))
{
+ GST_DEBUG_OBJECT (self, "OMX_SHARE_HACK_OFF");
self->share_input_buffer = FALSE;
self->share_output_buffer = FALSE;
}
+ else
+ {
+ GST_DEBUG_OBJECT (self, "default sharing and allocation");
+ }
+
+ GST_DEBUG_OBJECT (self, "in_port->omx_allocate=%d, out_port->omx_allocate=%d",
+ self->in_port->omx_allocate, self->out_port->omx_allocate);
+ GST_DEBUG_OBJECT (self, "share_input_buffer=%d, share_output_buffer=%d",
+ self->share_input_buffer, self->share_output_buffer);
}
static GstStateChangeReturn
@@ -324,6 +336,8 @@ push_buffer (GstOmxBaseFilter *self,
{
GstFlowReturn ret;
+ PRINT_BUFFER (self, buf);
+
/** @todo check if tainted */
GST_LOG_OBJECT (self, "begin");
ret = gst_pad_push (self->srcpad, buf);
@@ -407,6 +421,8 @@ output_loop (gpointer data)
/* buf is always null when the output buffer pointer isn't shared. */
buf = omx_buffer->pAppPrivate;
+ PRINT_BUFFER (self, buf);
+
/** @todo we need to move all the caps handling to one single
* place, in the output loop probably. */
if (G_UNLIKELY (omx_buffer->nFlags & 0x80))
@@ -571,6 +587,8 @@ pad_chain (GstPad *pad,
self = GST_OMX_BASE_FILTER (GST_OBJECT_PARENT (pad));
+ PRINT_BUFFER (self, buf);
+
gomx = self->gomx;
GST_LOG_OBJECT (self, "begin");
diff --git a/omx/gstomx_util.c b/omx/gstomx_util.c
index 1cd224f..2bd25b4 100644
--- a/omx/gstomx_util.c
+++ b/omx/gstomx_util.c
@@ -358,14 +358,16 @@ g_omx_core_init (GOmxCore *core)
core,
&callbacks);
+ g_free (component_name);
+ g_free (library_name);
+
GST_DEBUG_OBJECT (core->object, "OMX_GetHandle(&%p) -> %d",
core->omx_handle, core->omx_error);
+ g_return_if_fail (core->omx_handle);
+
if (!core->omx_error)
core->omx_state = OMX_StateLoaded;
-
- g_free (component_name);
- g_free (library_name);
}
void
@@ -509,6 +511,7 @@ OMX_HANDLETYPE
g_omx_core_get_handle (GOmxCore *core)
{
if (!core->omx_handle) g_omx_core_init (core);
+ g_return_val_if_fail (core->omx_handle, NULL);
return core->omx_handle;
}
@@ -589,6 +592,7 @@ port_allocate_buffers (GOmxPort *port)
{
if (port->omx_allocate)
{
+ GST_DEBUG_OBJECT (port->core->object, "%d: OMX_AllocateBuffer(), size=%d", i, size);
OMX_AllocateBuffer (port->core->omx_handle,
&port->buffers[i],
port->port_index,
@@ -599,6 +603,7 @@ port_allocate_buffers (GOmxPort *port)
{
gpointer buffer_data;
buffer_data = g_malloc (size);
+ GST_DEBUG_OBJECT (port->core->object, "%d: OMX_UseBuffer(), size=%d", i, size);
OMX_UseBuffer (port->core->omx_handle,
&port->buffers[i],
port->port_index,
diff --git a/omx/gstomx_util.h b/omx/gstomx_util.h
index be9290f..6627a49 100644
--- a/omx/gstomx_util.h
+++ b/omx/gstomx_util.h
@@ -198,5 +198,13 @@ void g_omx_port_finish (GOmxPort *port);
OMX_SetConfig ( \
g_omx_core_get_handle ((port)->core), idx, (param))
+#define PRINT_BUFFER(obj, buffer) G_STMT_START { \
+ if (buffer) { \
+ GST_DEBUG_OBJECT (obj, #buffer "=0x%08x (time=%"GST_TIME_FORMAT", duration=%"GST_TIME_FORMAT", flags=%08x)", (buffer), GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer)), GST_TIME_ARGS (GST_BUFFER_DURATION(buffer)), GST_BUFFER_FLAGS (buffer)); \
+ } else { \
+ GST_DEBUG_OBJECT (obj, #buffer "=null"); \
+ } \
+ } G_STMT_END
+
#endif /* GSTOMX_UTIL_H */
--
1.6.3.2
|
|
From: Rob C. <ro...@ti...> - 2009-11-04 02:26:04
|
Signed-off-by: Rob Clark <ro...@ti...>
---
omx/gstomx_base_filter.c | 43 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 43 insertions(+), 0 deletions(-)
diff --git a/omx/gstomx_base_filter.c b/omx/gstomx_base_filter.c
index 5a68d02..35571ae 100644
--- a/omx/gstomx_base_filter.c
+++ b/omx/gstomx_base_filter.c
@@ -31,6 +31,8 @@ enum
ARG_COMPONENT_NAME,
ARG_LIBRARY_NAME,
ARG_USE_TIMESTAMPS,
+ ARG_NUM_INPUT_BUFFERS,
+ ARG_NUM_OUTPUT_BUFFERS,
};
static GstElementClass *parent_class;
@@ -205,6 +207,22 @@ set_property (GObject *obj,
case ARG_USE_TIMESTAMPS:
self->use_timestamps = g_value_get_boolean (value);
break;
+ case ARG_NUM_INPUT_BUFFERS:
+ case ARG_NUM_OUTPUT_BUFFERS:
+ {
+ OMX_PARAM_PORTDEFINITIONTYPE param;
+ OMX_U32 nBufferCountActual = g_value_get_uint (value);
+ guint nPortIndex = (prop_id == ARG_NUM_INPUT_BUFFERS) ? 0 : 1;
+ GOmxPort *port = g_omx_core_get_port (self->gomx, nPortIndex);
+
+ G_OMX_PORT_GET_PARAM (port, OMX_IndexParamPortDefinition, ¶m);
+
+ g_return_if_fail (nBufferCountActual >= param.nBufferCountMin);
+ param.nBufferCountActual = nBufferCountActual;
+
+ G_OMX_PORT_SET_PARAM (port, OMX_IndexParamPortDefinition, ¶m);
+ }
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
break;
@@ -232,6 +250,18 @@ get_property (GObject *obj,
case ARG_USE_TIMESTAMPS:
g_value_set_boolean (value, self->use_timestamps);
break;
+ case ARG_NUM_INPUT_BUFFERS:
+ case ARG_NUM_OUTPUT_BUFFERS:
+ {
+ OMX_PARAM_PORTDEFINITIONTYPE param;
+ guint nPortIndex = (prop_id == ARG_NUM_INPUT_BUFFERS) ? 0 : 1;
+ GOmxPort *port = g_omx_core_get_port (self->gomx, nPortIndex);
+
+ G_OMX_PORT_GET_PARAM (port, OMX_IndexParamPortDefinition, ¶m);
+
+ g_value_set_uint (value, param.nBufferCountActual);
+ }
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
break;
@@ -272,6 +302,19 @@ type_class_init (gpointer g_class,
g_param_spec_boolean ("use-timestamps", "Use timestamps",
"Whether or not to use timestamps",
TRUE, G_PARAM_READWRITE));
+
+ /* note: the default values for these are just a guess.. since we wouldn't know
+ * until the OMX component is constructed. But that is ok, these properties are
+ * only for debugging
+ */
+ g_object_class_install_property (gobject_class, ARG_NUM_INPUT_BUFFERS,
+ g_param_spec_uint ("input-buffers", "Input buffers",
+ "The number of OMX input buffers",
+ 1, 10, 4, G_PARAM_READWRITE));
+ g_object_class_install_property (gobject_class, ARG_NUM_OUTPUT_BUFFERS,
+ g_param_spec_uint ("output-buffers", "Output buffers",
+ "The number of OMX output buffers",
+ 1, 10, 4, G_PARAM_READWRITE));
}
}
--
1.6.3.2
|
|
From: Rob C. <ro...@ti...> - 2009-11-04 02:25:39
|
Signed-off-by: Rob Clark <ro...@ti...>
---
omx/gstomx_aacdec.c | 8 +-----
omx/gstomx_aacenc.c | 38 +++++-------------------------
omx/gstomx_adpcmdec.c | 10 +------
omx/gstomx_adpcmenc.c | 18 ++------------
omx/gstomx_amrnbdec.c | 8 +-----
omx/gstomx_amrnbenc.c | 18 ++------------
omx/gstomx_amrwbdec.c | 8 +-----
omx/gstomx_amrwbenc.c | 18 ++------------
omx/gstomx_audiosink.c | 10 +------
omx/gstomx_base_filter.c | 14 +----------
omx/gstomx_base_sink.c | 11 +--------
omx/gstomx_base_src.c | 11 +--------
omx/gstomx_base_videodec.c | 27 ++++------------------
omx/gstomx_base_videoenc.c | 19 +++------------
omx/gstomx_g711dec.c | 10 +------
omx/gstomx_g711enc.c | 10 +------
omx/gstomx_g729enc.c | 10 +------
omx/gstomx_h263enc.c | 8 +-----
omx/gstomx_h264enc.c | 8 +-----
omx/gstomx_jpegenc.c | 36 +++++------------------------
omx/gstomx_mp2dec.c | 8 +-----
omx/gstomx_mp3dec.c | 8 +-----
omx/gstomx_mpeg4enc.c | 8 +-----
omx/gstomx_util.h | 53 ++++++++++++++++++++++++++++++++++++++++++++
omx/gstomx_videosink.c | 30 +++++--------------------
omx/gstomx_volume.c | 8 +-----
omx/gstomx_vorbisdec.c | 7 +-----
27 files changed, 115 insertions(+), 307 deletions(-)
diff --git a/omx/gstomx_aacdec.c b/omx/gstomx_aacdec.c
index 2ec2b4d..dbe7846 100644
--- a/omx/gstomx_aacdec.c
+++ b/omx/gstomx_aacdec.c
@@ -144,13 +144,7 @@ settings_changed_cb (GOmxCore *core)
{
OMX_AUDIO_PARAM_PCMMODETYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_AUDIO_PARAM_PCMMODETYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
-
- param.nPortIndex = 1;
- OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ G_OMX_PORT_GET_PARAM (omx_base->out_port, OMX_IndexParamAudioPcm, ¶m);
rate = param.nSamplingRate;
channels = param.nChannels;
diff --git a/omx/gstomx_aacenc.c b/omx/gstomx_aacenc.c
index eabc855..e1f8720 100644
--- a/omx/gstomx_aacenc.c
+++ b/omx/gstomx_aacenc.c
@@ -304,18 +304,12 @@ sink_setcaps (GstPad *pad,
{
OMX_AUDIO_PARAM_PCMMODETYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_AUDIO_PARAM_PCMMODETYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
-
- param.nPortIndex = 0;
- OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ G_OMX_PORT_GET_PARAM (omx_base->in_port, OMX_IndexParamAudioPcm, ¶m);
param.nSamplingRate = rate;
param.nChannels = channels;
- OMX_SetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ G_OMX_PORT_SET_PARAM (omx_base->in_port, OMX_IndexParamAudioPcm, ¶m);
}
{
@@ -350,15 +344,9 @@ omx_setup (GstOmxBaseFilter *omx_base)
{
OMX_AUDIO_PARAM_AACPROFILETYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_AUDIO_PARAM_AACPROFILETYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
-
/* Output port configuration. */
{
- param.nPortIndex = 1;
- OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioAac, ¶m);
+ G_OMX_PORT_GET_PARAM (omx_base->out_port, OMX_IndexParamAudioAac, ¶m);
GST_DEBUG_OBJECT (omx_base, "setting bitrate: %i", self->bitrate);
param.nBitRate = self->bitrate;
@@ -370,7 +358,7 @@ omx_setup (GstOmxBaseFilter *omx_base)
self->output_format);
param.eAACStreamFormat = self->output_format;
- OMX_SetParameter (gomx->omx_handle, OMX_IndexParamAudioAac, ¶m);
+ G_OMX_PORT_SET_PARAM (omx_base->out_port, OMX_IndexParamAudioAac, ¶m);
}
}
@@ -379,13 +367,7 @@ omx_setup (GstOmxBaseFilter *omx_base)
{
OMX_AUDIO_PARAM_PCMMODETYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_AUDIO_PARAM_PCMMODETYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
-
- param.nPortIndex = 0;
- OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ G_OMX_PORT_GET_PARAM (omx_base->in_port, OMX_IndexParamAudioPcm, ¶m);
rate = param.nSamplingRate;
channels = param.nChannels;
@@ -394,18 +376,12 @@ omx_setup (GstOmxBaseFilter *omx_base)
{
OMX_AUDIO_PARAM_AACPROFILETYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_AUDIO_PARAM_AACPROFILETYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
-
- param.nPortIndex = 1;
- OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioAac, ¶m);
+ G_OMX_PORT_GET_PARAM (omx_base->out_port, OMX_IndexParamAudioAac, ¶m);
param.nSampleRate = rate;
param.nChannels = channels;
- OMX_SetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioAac, ¶m);
+ G_OMX_PORT_SET_PARAM (omx_base->out_port, OMX_IndexParamAudioAac, ¶m);
}
#endif
diff --git a/omx/gstomx_adpcmdec.c b/omx/gstomx_adpcmdec.c
index 86bb54c..a35a6cc 100644
--- a/omx/gstomx_adpcmdec.c
+++ b/omx/gstomx_adpcmdec.c
@@ -126,17 +126,11 @@ sink_setcaps (GstPad *pad,
{
OMX_AUDIO_PARAM_PCMMODETYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_AUDIO_PARAM_PCMMODETYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
-
- param.nPortIndex = 1;
- OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ G_OMX_PORT_GET_PARAM (omx_base->out_port, OMX_IndexParamAudioPcm, ¶m);
param.nSamplingRate = rate;
- OMX_SetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ G_OMX_PORT_SET_PARAM (omx_base->out_port, OMX_IndexParamAudioPcm, ¶m);
}
/* set caps on the srcpad */
diff --git a/omx/gstomx_adpcmenc.c b/omx/gstomx_adpcmenc.c
index 967ebf9..c17a7b4 100644
--- a/omx/gstomx_adpcmenc.c
+++ b/omx/gstomx_adpcmenc.c
@@ -117,13 +117,7 @@ settings_changed_cb (GOmxCore *core)
{
OMX_AUDIO_PARAM_ADPCMTYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_AUDIO_PARAM_ADPCMTYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
-
- param.nPortIndex = 1;
- OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioAdpcm, ¶m);
+ G_OMX_PORT_GET_PARAM (omx_base->out_port, OMX_IndexParamAudioAdpcm, ¶m);
rate = param.nSampleRate;
}
@@ -181,17 +175,11 @@ sink_setcaps (GstPad *pad,
{
OMX_AUDIO_PARAM_PCMMODETYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_AUDIO_PARAM_PCMMODETYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
-
- param.nPortIndex = 0;
- OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ G_OMX_PORT_GET_PARAM (omx_base->in_port, OMX_IndexParamAudioPcm, ¶m);
param.nSamplingRate = rate;
- OMX_SetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ G_OMX_PORT_SET_PARAM (omx_base->in_port, OMX_IndexParamAudioPcm, ¶m);
}
/* set caps on the srcpad */
diff --git a/omx/gstomx_amrnbdec.c b/omx/gstomx_amrnbdec.c
index bdacb06..9250420 100644
--- a/omx/gstomx_amrnbdec.c
+++ b/omx/gstomx_amrnbdec.c
@@ -117,13 +117,7 @@ settings_changed_cb (GOmxCore *core)
{
OMX_AUDIO_PARAM_PCMMODETYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_AUDIO_PARAM_PCMMODETYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
-
- param.nPortIndex = 1;
- OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ G_OMX_PORT_GET_PARAM (omx_base->out_port, OMX_IndexParamAudioPcm, ¶m);
rate = param.nSamplingRate;
channels = param.nChannels;
diff --git a/omx/gstomx_amrnbenc.c b/omx/gstomx_amrnbenc.c
index d8b921b..92df603 100644
--- a/omx/gstomx_amrnbenc.c
+++ b/omx/gstomx_amrnbenc.c
@@ -182,13 +182,7 @@ settings_changed_cb (GOmxCore *core)
{
OMX_AUDIO_PARAM_AMRTYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_AUDIO_PARAM_AMRTYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
-
- param.nPortIndex = 1;
- OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioAmr, ¶m);
+ G_OMX_PORT_GET_PARAM (omx_base->out_port, OMX_IndexParamAudioAmr, ¶m);
channels = param.nChannels;
}
@@ -232,18 +226,12 @@ sink_setcaps (GstPad *pad,
{
OMX_AUDIO_PARAM_PCMMODETYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_AUDIO_PARAM_PCMMODETYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
-
- param.nPortIndex = 0;
- OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ G_OMX_PORT_GET_PARAM (omx_base->in_port, OMX_IndexParamAudioPcm, ¶m);
param.nSamplingRate = rate;
param.nChannels = channels;
- OMX_SetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ G_OMX_PORT_SET_PARAM (omx_base->in_port, OMX_IndexParamAudioPcm, ¶m);
}
return gst_pad_set_caps (pad, caps);
diff --git a/omx/gstomx_amrwbdec.c b/omx/gstomx_amrwbdec.c
index 0914f84..bc406c0 100644
--- a/omx/gstomx_amrwbdec.c
+++ b/omx/gstomx_amrwbdec.c
@@ -117,13 +117,7 @@ settings_changed_cb (GOmxCore *core)
{
OMX_AUDIO_PARAM_PCMMODETYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_AUDIO_PARAM_PCMMODETYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
-
- param.nPortIndex = 1;
- OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ G_OMX_PORT_GET_PARAM (omx_base->out_port, OMX_IndexParamAudioPcm, ¶m);
rate = param.nSamplingRate;
channels = param.nChannels;
diff --git a/omx/gstomx_amrwbenc.c b/omx/gstomx_amrwbenc.c
index 176ccb3..40d0cf5 100644
--- a/omx/gstomx_amrwbenc.c
+++ b/omx/gstomx_amrwbenc.c
@@ -182,13 +182,7 @@ settings_changed_cb (GOmxCore *core)
{
OMX_AUDIO_PARAM_AMRTYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_AUDIO_PARAM_AMRTYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
-
- param.nPortIndex = 1;
- OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioAmr, ¶m);
+ G_OMX_PORT_GET_PARAM (omx_base->out_port, OMX_IndexParamAudioAmr, ¶m);
channels = param.nChannels;
}
@@ -232,18 +226,12 @@ sink_setcaps (GstPad *pad,
{
OMX_AUDIO_PARAM_PCMMODETYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_AUDIO_PARAM_PCMMODETYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
-
- param.nPortIndex = 0;
- OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ G_OMX_PORT_GET_PARAM (omx_base->in_port, OMX_IndexParamAudioPcm, ¶m);
param.nSamplingRate = rate;
param.nChannels = channels;
- OMX_SetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ G_OMX_PORT_SET_PARAM (omx_base->in_port, OMX_IndexParamAudioPcm, ¶m);
}
return gst_pad_set_caps (pad, caps);
diff --git a/omx/gstomx_audiosink.c b/omx/gstomx_audiosink.c
index 8fa1748..44dc92a 100644
--- a/omx/gstomx_audiosink.c
+++ b/omx/gstomx_audiosink.c
@@ -109,13 +109,7 @@ setcaps (GstBaseSink *gst_sink,
{
OMX_AUDIO_PARAM_PCMMODETYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_AUDIO_PARAM_PCMMODETYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
-
- param.nPortIndex = 0;
- OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ G_OMX_PORT_GET_PARAM (self->in_port, OMX_IndexParamAudioPcm, ¶m);
param.nChannels = channels;
param.eNumData = is_signed ? OMX_NumericalDataSigned : OMX_NumericalDataUnsigned;
@@ -123,7 +117,7 @@ setcaps (GstBaseSink *gst_sink,
param.nBitPerSample = width;
param.nSamplingRate = rate;
- OMX_SetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ G_OMX_PORT_SET_PARAM (self->in_port, OMX_IndexParamAudioPcm, ¶m);
}
}
diff --git a/omx/gstomx_base_filter.c b/omx/gstomx_base_filter.c
index 6b90673..5a68d02 100644
--- a/omx/gstomx_base_filter.c
+++ b/omx/gstomx_base_filter.c
@@ -52,27 +52,17 @@ log_buffer (GstOmxBaseFilter *self,
static void
setup_ports (GstOmxBaseFilter *self)
{
- GOmxCore *core;
OMX_PARAM_PORTDEFINITIONTYPE param;
- core = self->gomx;
-
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_PARAM_PORTDEFINITIONTYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
-
/* Input port configuration. */
- param.nPortIndex = 0;
- OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ G_OMX_PORT_GET_PARAM (self->in_port, OMX_IndexParamPortDefinition, ¶m);
g_omx_port_setup (self->in_port, ¶m);
gst_pad_set_element_private (self->sinkpad, self->in_port);
/* Output port configuration. */
- param.nPortIndex = 1;
- OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ G_OMX_PORT_GET_PARAM (self->out_port, OMX_IndexParamPortDefinition, ¶m);
g_omx_port_setup (self->out_port, ¶m);
gst_pad_set_element_private (self->srcpad, self->out_port);
diff --git a/omx/gstomx_base_sink.c b/omx/gstomx_base_sink.c
index 1f2e271..c25c0ad 100644
--- a/omx/gstomx_base_sink.c
+++ b/omx/gstomx_base_sink.c
@@ -44,20 +44,11 @@ static GstElementClass *parent_class;
static void
setup_ports (GstOmxBaseSink *self)
{
- GOmxCore *core;
OMX_PARAM_PORTDEFINITIONTYPE param;
- core = self->gomx;
-
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_PARAM_PORTDEFINITIONTYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
-
/* Input port configuration. */
- param.nPortIndex = 0;
- OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ G_OMX_PORT_GET_PARAM (self->in_port, OMX_IndexParamPortDefinition, ¶m);
g_omx_port_setup (self->in_port, ¶m);
gst_pad_set_element_private (self->sinkpad, self->in_port);
}
diff --git a/omx/gstomx_base_src.c b/omx/gstomx_base_src.c
index e8a1c95..94bf5e9 100644
--- a/omx/gstomx_base_src.c
+++ b/omx/gstomx_base_src.c
@@ -36,20 +36,11 @@ static GstElementClass *parent_class;
static void
setup_ports (GstOmxBaseSrc *self)
{
- GOmxCore *core;
OMX_PARAM_PORTDEFINITIONTYPE param;
- core = self->gomx;
-
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_PARAM_PORTDEFINITIONTYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
-
/* Input port configuration. */
- param.nPortIndex = 0;
- OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ G_OMX_PORT_GET_PARAM (self->out_port, OMX_IndexParamPortDefinition, ¶m);
g_omx_port_setup (self->out_port, ¶m);
if (self->setup_ports)
diff --git a/omx/gstomx_base_videodec.c b/omx/gstomx_base_videodec.c
index 5cebc4b..ce7dfc8 100644
--- a/omx/gstomx_base_videodec.c
+++ b/omx/gstomx_base_videodec.c
@@ -113,12 +113,7 @@ settings_changed_cb (GOmxCore *core)
memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_PARAM_PORTDEFINITIONTYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
-
- param.nPortIndex = 1;
- OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ G_OMX_PORT_GET_PARAM (omx_base->out_port, OMX_IndexParamPortDefinition, ¶m);
width = param.format.video.nFrameWidth;
height = param.format.video.nFrameHeight;
@@ -194,11 +189,6 @@ sink_setcaps (GstPad *pad,
}
}
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_PARAM_PORTDEFINITIONTYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
-
{
const GValue *codec_data;
GstBuffer *buffer;
@@ -214,13 +204,12 @@ sink_setcaps (GstPad *pad,
/* Input port configuration. */
{
- param.nPortIndex = 0;
- OMX_GetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ G_OMX_PORT_GET_PARAM (omx_base->in_port, OMX_IndexParamPortDefinition, ¶m);
param.format.video.nFrameWidth = width;
param.format.video.nFrameHeight = height;
- OMX_SetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ G_OMX_PORT_SET_PARAM (omx_base->in_port, OMX_IndexParamPortDefinition, ¶m);
}
return gst_pad_set_caps (pad, caps);
@@ -240,19 +229,13 @@ omx_setup (GstOmxBaseFilter *omx_base)
{
OMX_PARAM_PORTDEFINITIONTYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_PARAM_PORTDEFINITIONTYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
-
/* Input port configuration. */
{
- param.nPortIndex = 0;
- OMX_GetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ G_OMX_PORT_GET_PARAM (omx_base->in_port, OMX_IndexParamPortDefinition, ¶m);
param.format.video.eCompressionFormat = self->compression_format;
- OMX_SetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ G_OMX_PORT_SET_PARAM (omx_base->in_port, OMX_IndexParamPortDefinition, ¶m);
}
}
diff --git a/omx/gstomx_base_videoenc.c b/omx/gstomx_base_videoenc.c
index f788817..a3e0625 100644
--- a/omx/gstomx_base_videoenc.c
+++ b/omx/gstomx_base_videoenc.c
@@ -216,15 +216,10 @@ sink_setcaps (GstPad *pad,
{
OMX_PARAM_PORTDEFINITIONTYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_PARAM_PORTDEFINITIONTYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
/* Input port configuration. */
{
- param.nPortIndex = 0;
- OMX_GetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ G_OMX_PORT_GET_PARAM (omx_base->in_port, OMX_IndexParamPortDefinition, ¶m);
param.format.video.nFrameWidth = width;
param.format.video.nFrameHeight = height;
@@ -237,7 +232,7 @@ sink_setcaps (GstPad *pad,
gst_value_get_fraction_denominator (framerate);
}
- OMX_SetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ G_OMX_PORT_SET_PARAM (omx_base->in_port, OMX_IndexParamPortDefinition, ¶m);
}
}
@@ -258,22 +253,16 @@ omx_setup (GstOmxBaseFilter *omx_base)
{
OMX_PARAM_PORTDEFINITIONTYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_PARAM_PORTDEFINITIONTYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
-
/* Output port configuration. */
{
- param.nPortIndex = 1;
- OMX_GetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ G_OMX_PORT_GET_PARAM (omx_base->out_port, OMX_IndexParamPortDefinition, ¶m);
param.format.video.eCompressionFormat = self->compression_format;
if (self->bitrate != 0)
param.format.video.nBitrate = self->bitrate;
- OMX_SetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ G_OMX_PORT_SET_PARAM (omx_base->out_port, OMX_IndexParamPortDefinition, ¶m);
}
}
diff --git a/omx/gstomx_g711dec.c b/omx/gstomx_g711dec.c
index f2b5e73..f62796b 100644
--- a/omx/gstomx_g711dec.c
+++ b/omx/gstomx_g711dec.c
@@ -138,20 +138,14 @@ sink_setcaps (GstPad *pad,
{
OMX_AUDIO_PARAM_PCMMODETYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_AUDIO_PARAM_PCMMODETYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
-
- param.nPortIndex = 0;
- OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ G_OMX_PORT_GET_PARAM (omx_base->in_port, OMX_IndexParamAudioPcm, ¶m);
if (strcmp (mode, "audio/x-alaw") == 0)
param.ePCMMode = OMX_AUDIO_PCMModeALaw;
else if (strcmp (mode, "audio/x-mulaw") == 0)
param.ePCMMode = OMX_AUDIO_PCMModeMULaw;
- OMX_SetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ G_OMX_PORT_SET_PARAM (omx_base->in_port, OMX_IndexParamAudioPcm, ¶m);
}
/* set caps on the srcpad */
diff --git a/omx/gstomx_g711enc.c b/omx/gstomx_g711enc.c
index 440f3f4..bcfb72b 100644
--- a/omx/gstomx_g711enc.c
+++ b/omx/gstomx_g711enc.c
@@ -148,20 +148,14 @@ sink_setcaps (GstPad *pad,
{
OMX_AUDIO_PARAM_PCMMODETYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_AUDIO_PARAM_PCMMODETYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
-
- param.nPortIndex = 1;
- OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ G_OMX_PORT_GET_PARAM (omx_base->out_port, OMX_IndexParamAudioPcm, ¶m);
if (strcmp (mode, "audio/x-alaw") == 0)
param.ePCMMode = OMX_AUDIO_PCMModeALaw;
else if (strcmp (mode, "audio/x-mulaw") == 0)
param.ePCMMode = OMX_AUDIO_PCMModeMULaw;
- OMX_SetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ G_OMX_PORT_SET_PARAM (omx_base->out_port, OMX_IndexParamAudioPcm, ¶m);
}
leave:
diff --git a/omx/gstomx_g729enc.c b/omx/gstomx_g729enc.c
index 1a2c853..aa44c35 100644
--- a/omx/gstomx_g729enc.c
+++ b/omx/gstomx_g729enc.c
@@ -227,17 +227,11 @@ omx_setup (GstOmxBaseFilter *omx_base)
{
OMX_AUDIO_PARAM_G729TYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_AUDIO_PARAM_G729TYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
-
- param.nPortIndex = 1;
- OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioG729, ¶m);
+ G_OMX_PORT_GET_PARAM (omx_base->out_port, OMX_IndexParamAudioG729, ¶m);
param.bDTX = self->dtx;
- OMX_SetParameter (gomx->omx_handle, OMX_IndexParamAudioG729, ¶m);
+ G_OMX_PORT_SET_PARAM (omx_base->out_port, OMX_IndexParamAudioG729, ¶m);
}
GST_INFO_OBJECT (omx_base, "end");
diff --git a/omx/gstomx_h263enc.c b/omx/gstomx_h263enc.c
index 90237e4..19d313a 100644
--- a/omx/gstomx_h263enc.c
+++ b/omx/gstomx_h263enc.c
@@ -93,13 +93,7 @@ settings_changed_cb (GOmxCore *core)
{
OMX_PARAM_PORTDEFINITIONTYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_PARAM_PORTDEFINITIONTYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
-
- param.nPortIndex = 1;
- OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ G_OMX_PORT_GET_PARAM (omx_base_filter->out_port, OMX_IndexParamPortDefinition, ¶m);
width = param.format.video.nFrameWidth;
height = param.format.video.nFrameHeight;
diff --git a/omx/gstomx_h264enc.c b/omx/gstomx_h264enc.c
index 3dbf245..1a4510e 100644
--- a/omx/gstomx_h264enc.c
+++ b/omx/gstomx_h264enc.c
@@ -92,13 +92,7 @@ settings_changed_cb (GOmxCore *core)
{
OMX_PARAM_PORTDEFINITIONTYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_PARAM_PORTDEFINITIONTYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
-
- param.nPortIndex = 1;
- OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ G_OMX_PORT_GET_PARAM (omx_base_filter->out_port, OMX_IndexParamPortDefinition, ¶m);
width = param.format.video.nFrameWidth;
height = param.format.video.nFrameHeight;
diff --git a/omx/gstomx_jpegenc.c b/omx/gstomx_jpegenc.c
index e78b5b1..d826149 100644
--- a/omx/gstomx_jpegenc.c
+++ b/omx/gstomx_jpegenc.c
@@ -207,13 +207,7 @@ settings_changed_cb (GOmxCore *core)
{
OMX_PARAM_PORTDEFINITIONTYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_PARAM_PORTDEFINITIONTYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
-
- param.nPortIndex = 1;
- OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ G_OMX_PORT_GET_PARAM (omx_base->out_port, OMX_IndexParamPortDefinition, ¶m);
width = param.format.image.nFrameWidth;
height = param.format.image.nFrameHeight;
@@ -288,21 +282,15 @@ sink_setcaps (GstPad *pad,
{
OMX_PARAM_PORTDEFINITIONTYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_PARAM_PORTDEFINITIONTYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
-
/* Input port configuration. */
{
- param.nPortIndex = 0;
- OMX_GetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ G_OMX_PORT_GET_PARAM (omx_base->in_port, OMX_IndexParamPortDefinition, ¶m);
param.format.image.nFrameWidth = width;
param.format.image.nFrameHeight = height;
param.format.image.eColorFormat = color_format;
- OMX_SetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ G_OMX_PORT_SET_PARAM (omx_base->in_port, OMX_IndexParamPortDefinition, ¶m);
}
}
@@ -323,34 +311,24 @@ omx_setup (GstOmxBaseFilter *omx_base)
{
OMX_PARAM_PORTDEFINITIONTYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_PARAM_PORTDEFINITIONTYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
-
/* Output port configuration. */
{
- param.nPortIndex = 1;
- OMX_GetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ G_OMX_PORT_GET_PARAM (omx_base->out_port, OMX_IndexParamPortDefinition, ¶m);
param.format.image.eCompressionFormat = OMX_IMAGE_CodingJPEG;
- OMX_SetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ G_OMX_PORT_SET_PARAM (omx_base->out_port, OMX_IndexParamPortDefinition, ¶m);
}
}
{
OMX_IMAGE_PARAM_QFACTORTYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_IMAGE_PARAM_QFACTORTYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
+ G_OMX_PORT_GET_PARAM (omx_base->out_port, OMX_IndexParamQFactor, ¶m);
param.nQFactor = self->quality;
- param.nPortIndex = 1;
- OMX_SetParameter (gomx->omx_handle, OMX_IndexParamQFactor, ¶m);
+ G_OMX_PORT_SET_PARAM (omx_base->out_port, OMX_IndexParamQFactor, ¶m);
}
GST_INFO_OBJECT (omx_base, "end");
diff --git a/omx/gstomx_mp2dec.c b/omx/gstomx_mp2dec.c
index 90dcb7f..b6bef4f 100644
--- a/omx/gstomx_mp2dec.c
+++ b/omx/gstomx_mp2dec.c
@@ -120,13 +120,7 @@ settings_changed_cb (GOmxCore *core)
{
OMX_AUDIO_PARAM_PCMMODETYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_AUDIO_PARAM_PCMMODETYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
-
- param.nPortIndex = 1;
- OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ G_OMX_PORT_GET_PARAM (omx_base->out_port, OMX_IndexParamAudioPcm, ¶m);
rate = param.nSamplingRate;
channels = param.nChannels;
diff --git a/omx/gstomx_mp3dec.c b/omx/gstomx_mp3dec.c
index ad53d29..0036fac 100644
--- a/omx/gstomx_mp3dec.c
+++ b/omx/gstomx_mp3dec.c
@@ -120,13 +120,7 @@ settings_changed_cb (GOmxCore *core)
{
OMX_AUDIO_PARAM_PCMMODETYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_AUDIO_PARAM_PCMMODETYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
-
- param.nPortIndex = 1;
- OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ G_OMX_PORT_GET_PARAM (omx_base->out_port, OMX_IndexParamAudioPcm, ¶m);
rate = param.nSamplingRate;
channels = param.nChannels;
diff --git a/omx/gstomx_mpeg4enc.c b/omx/gstomx_mpeg4enc.c
index 8f40da1..62f9f23 100644
--- a/omx/gstomx_mpeg4enc.c
+++ b/omx/gstomx_mpeg4enc.c
@@ -94,13 +94,7 @@ settings_changed_cb (GOmxCore *core)
{
OMX_PARAM_PORTDEFINITIONTYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_PARAM_PORTDEFINITIONTYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
-
- param.nPortIndex = 1;
- OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ G_OMX_PORT_GET_PARAM (omx_base_filter->out_port, OMX_IndexParamPortDefinition, ¶m);
width = param.format.video.nFrameWidth;
height = param.format.video.nFrameHeight;
diff --git a/omx/gstomx_util.h b/omx/gstomx_util.h
index 4857265..be9290f 100644
--- a/omx/gstomx_util.h
+++ b/omx/gstomx_util.h
@@ -145,5 +145,58 @@ void g_omx_port_disable (GOmxPort *port);
void g_omx_port_finish (GOmxPort *port);
+/* Utility Macros */
+
+#define _G_OMX_INIT_PARAM(param) G_STMT_START { /* util for other macros */ \
+ memset ((param), 0, sizeof (*(param))); \
+ (param)->nSize = sizeof (*(param)); \
+ (param)->nVersion.s.nVersionMajor = 1; \
+ (param)->nVersion.s.nVersionMinor = 1; \
+ } G_STMT_END
+
+/* "CORE" macros for GetParameter/SetParameter and GetConfig/SetConfig */
+
+#define G_OMX_CORE_GET_PARAM(core, idx, param) G_STMT_START { \
+ _G_OMX_INIT_PARAM (param); \
+ OMX_GetParameter (g_omx_core_get_handle (core), (idx), (param)); \
+ } G_STMT_END
+
+#define G_OMX_CORE_SET_PARAM(core, idx, param) \
+ OMX_SetParameter ( \
+ g_omx_core_get_handle (core), (idx), (param))
+
+#define G_OMX_CORE_GET_CONFIG(core, idx, param) G_STMT_START { \
+ _G_OMX_INIT_PARAM (param); \
+ OMX_GetConfig (g_omx_core_get_handle (core), (idx), (param)); \
+ } G_STMT_END
+
+#define G_OMX_CORE_SET_CONFIG(core, idx, param) \
+ OMX_SetConfig ( \
+ g_omx_core_get_handle (core), (idx), (param))
+
+/* "PORT" macros for GetParameter/SetParameter and GetConfig/SetConfig
+ * of port specific params/configs
+ */
+
+#define G_OMX_PORT_GET_PARAM(port, idx, param) G_STMT_START { \
+ _G_OMX_INIT_PARAM (param); \
+ (param)->nPortIndex = (port)->port_index; \
+ OMX_GetParameter (g_omx_core_get_handle ((port)->core), idx, (param));\
+ } G_STMT_END
+
+#define G_OMX_PORT_SET_PARAM(port, idx, param) \
+ OMX_SetParameter ( \
+ g_omx_core_get_handle ((port)->core), idx, (param))
+
+#define G_OMX_PORT_GET_CONFIG(port, idx, param) G_STMT_START { \
+ _G_OMX_INIT_PARAM (param); \
+ (param)->nPortIndex = (port)->port_index; \
+ OMX_GetConfig (g_omx_core_get_handle ((port)->core), idx, (param)); \
+ } G_STMT_END
+
+#define G_OMX_PORT_SET_CONFIG(port, idx, param) \
+ OMX_SetConfig ( \
+ g_omx_core_get_handle ((port)->core), idx, (param))
+
#endif /* GSTOMX_UTIL_H */
diff --git a/omx/gstomx_videosink.c b/omx/gstomx_videosink.c
index 923b5ed..dbced76 100644
--- a/omx/gstomx_videosink.c
+++ b/omx/gstomx_videosink.c
@@ -161,13 +161,7 @@ setcaps (GstBaseSink *gst_sink,
{
OMX_PARAM_PORTDEFINITIONTYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_PARAM_PORTDEFINITIONTYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
-
- param.nPortIndex = 0;
- OMX_GetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ G_OMX_PORT_GET_PARAM (omx_base->in_port, OMX_IndexParamPortDefinition, ¶m);
switch (color_format)
{
@@ -194,40 +188,28 @@ setcaps (GstBaseSink *gst_sink,
gst_value_get_fraction_denominator (framerate);
}
- OMX_SetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ G_OMX_PORT_SET_PARAM (omx_base->in_port, OMX_IndexParamPortDefinition, ¶m);
}
{
OMX_CONFIG_ROTATIONTYPE config;
- memset (&config, 0, sizeof (config));
- config.nSize = sizeof (OMX_CONFIG_ROTATIONTYPE);
- config.nVersion.s.nVersionMajor = 1;
- config.nVersion.s.nVersionMinor = 1;
-
- config.nPortIndex = 0;
- OMX_GetConfig (gomx->omx_handle, OMX_IndexConfigCommonScale, &config);
+ G_OMX_PORT_GET_CONFIG (omx_base->in_port, OMX_IndexConfigCommonScale, &config);
config.nRotation = self->rotation;
- OMX_SetConfig (gomx->omx_handle, OMX_IndexConfigCommonRotate, &config);
+ G_OMX_PORT_SET_CONFIG (omx_base->in_port, OMX_IndexConfigCommonRotate, &config);
}
{
OMX_CONFIG_SCALEFACTORTYPE config;
- memset (&config, 0, sizeof (config));
- config.nSize = sizeof (OMX_CONFIG_SCALEFACTORTYPE);
- config.nVersion.s.nVersionMajor = 1;
- config.nVersion.s.nVersionMinor = 1;
-
- config.nPortIndex = 0;
- OMX_GetConfig (gomx->omx_handle, OMX_IndexConfigCommonScale, &config);
+ G_OMX_PORT_GET_CONFIG (omx_base->in_port, OMX_IndexConfigCommonScale, &config);
config.xWidth = self->x_scale;
config.xHeight = self->y_scale;
- OMX_SetConfig (gomx->omx_handle, OMX_IndexConfigCommonScale, &config);
+ G_OMX_PORT_SET_CONFIG (omx_base->in_port, OMX_IndexConfigCommonScale, &config);
}
}
diff --git a/omx/gstomx_volume.c b/omx/gstomx_volume.c
index 3fbc4e9..9e79176 100644
--- a/omx/gstomx_volume.c
+++ b/omx/gstomx_volume.c
@@ -122,13 +122,7 @@ settings_changed_cb (GOmxCore *core)
{
OMX_AUDIO_PARAM_PCMMODETYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_AUDIO_PARAM_PCMMODETYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
-
- param.nPortIndex = 1;
- OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ G_OMX_PORT_GET_PARAM (omx_base->out_port, OMX_IndexParamAudioPcm, ¶m);
rate = param.nSamplingRate;
channels = param.nChannels;
diff --git a/omx/gstomx_vorbisdec.c b/omx/gstomx_vorbisdec.c
index 437dc90..aba6b45 100644
--- a/omx/gstomx_vorbisdec.c
+++ b/omx/gstomx_vorbisdec.c
@@ -115,13 +115,8 @@ settings_changed_cb (GOmxCore *core)
{
OMX_AUDIO_PARAM_PCMMODETYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_AUDIO_PARAM_PCMMODETYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
+ G_OMX_PORT_GET_PARAM (omx_base->out_port, OMX_IndexParamAudioPcm, ¶m);
- param.nPortIndex = 1;
- OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
rate = param.nSamplingRate;
channels = param.nChannels;
--
1.6.3.2
|
|
From: Rob C. <ro...@ti...> - 2009-11-04 02:25:24
|
Signed-off-by: Rob Clark <ro...@ti...>
---
omx/gstomx_base_filter.c | 24 ++------
omx/gstomx_base_sink.c | 21 ++------
omx/gstomx_base_src.c | 22 ++------
omx/gstomx_util.c | 133 +++++++++++++++++++++++++++++++++++-----------
omx/gstomx_util.h | 12 +++--
5 files changed, 123 insertions(+), 89 deletions(-)
diff --git a/omx/gstomx_base_filter.c b/omx/gstomx_base_filter.c
index 287f50c..6b90673 100644
--- a/omx/gstomx_base_filter.c
+++ b/omx/gstomx_base_filter.c
@@ -66,14 +66,14 @@ setup_ports (GstOmxBaseFilter *self)
param.nPortIndex = 0;
OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m);
- self->in_port = g_omx_core_setup_port (core, ¶m);
+ g_omx_port_setup (self->in_port, ¶m);
gst_pad_set_element_private (self->sinkpad, self->in_port);
/* Output port configuration. */
param.nPortIndex = 1;
OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m);
- self->out_port = g_omx_core_setup_port (core, ¶m);
+ g_omx_port_setup (self->out_port, ¶m);
gst_pad_set_element_private (self->srcpad, self->out_port);
if (g_getenv ("OMX_ALLOCATE_ON"))
@@ -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;
@@ -898,11 +898,9 @@ type_instance_init (GTypeInstance *instance,
self->use_timestamps = TRUE;
/* GOmx */
- {
- GOmxCore *gomx;
- self->gomx = gomx = g_omx_core_new ();
- gomx->object = self;
- }
+ self->gomx = g_omx_core_new (self, g_class);
+ self->in_port = g_omx_core_get_port (self->gomx, 0);
+ self->out_port = g_omx_core_get_port (self->gomx, 1);
self->ready_lock = g_mutex_new ();
@@ -922,16 +920,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->omx_library = 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);
- }
-
GST_LOG_OBJECT (self, "end");
}
diff --git a/omx/gstomx_base_sink.c b/omx/gstomx_base_sink.c
index b50564d..1f2e271 100644
--- a/omx/gstomx_base_sink.c
+++ b/omx/gstomx_base_sink.c
@@ -58,7 +58,7 @@ setup_ports (GstOmxBaseSink *self)
param.nPortIndex = 0;
OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m);
- self->in_port = g_omx_core_setup_port (core, ¶m);
+ g_omx_port_setup (self->in_port, ¶m);
gst_pad_set_element_private (self->sinkpad, self->in_port);
}
@@ -420,7 +420,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;
@@ -461,21 +461,8 @@ type_instance_init (GTypeInstance *instance,
GST_LOG_OBJECT (self, "begin");
/* GOmx */
- {
- GOmxCore *gomx;
- self->gomx = gomx = g_omx_core_new ();
- gomx->object = self;
- }
-
- {
- 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);
- 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 = g_omx_core_new (self, g_class);
+ self->in_port = g_omx_core_get_port (self->gomx, 0);
{
GstPad *sinkpad;
diff --git a/omx/gstomx_base_src.c b/omx/gstomx_base_src.c
index 9b02b22..e8a1c95 100644
--- a/omx/gstomx_base_src.c
+++ b/omx/gstomx_base_src.c
@@ -50,7 +50,7 @@ setup_ports (GstOmxBaseSrc *self)
param.nPortIndex = 0;
OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m);
- self->out_port = g_omx_core_setup_port (core, ¶m);
+ g_omx_port_setup (self->out_port, ¶m);
if (self->setup_ports)
{
@@ -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;
@@ -453,22 +453,8 @@ type_instance_init (GTypeInstance *instance,
GST_LOG_OBJECT (self, "begin");
/* GOmx */
- {
- GOmxCore *gomx;
- self->gomx = gomx = g_omx_core_new ();
- gomx->object = self;
- }
-
- {
- 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);
- 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 = g_omx_core_new (self, g_class);
+ self->out_port = g_omx_core_get_port (self->gomx, 0);
GST_LOG_OBJECT (self, "end");
}
diff --git a/omx/gstomx_util.c b/omx/gstomx_util.c
index 39d900b..1cd224f 100644
--- a/omx/gstomx_util.c
+++ b/omx/gstomx_util.c
@@ -22,6 +22,7 @@
#include "gstomx_util.h"
#include <dlfcn.h>
+#include <string.h>
#include "gstomx.h"
@@ -76,9 +77,7 @@ omx_state_to_str (OMX_STATETYPE omx_state);
static inline const char *
omx_error_to_str (OMX_ERRORTYPE omx_error);
-static inline GOmxPort *
-g_omx_core_get_port (GOmxCore *core,
- guint index);
+static inline GOmxPort *get_port (GOmxCore *core, guint index);
static inline void
port_free_buffers (GOmxPort *port);
@@ -133,7 +132,7 @@ core_for_each_port (GOmxCore *core,
{
GOmxPort *port;
- port = g_omx_core_get_port (core, index);
+ port = get_port (core, index);
if (port)
func (port);
@@ -159,6 +158,7 @@ imp_new (const gchar *name)
void *handle;
imp->dl_handle = handle = dlopen (name, RTLD_LAZY);
+ GST_DEBUG ("dlopen(%s) -> %p", name, handle);
if (!handle)
{
g_warning ("%s\n", dlerror ());
@@ -264,13 +264,22 @@ g_omx_deinit (void)
* Core
*/
+/**
+ * Construct new core
+ *
+ * @object: the GstOmx object (ie. GstOmxBaseFilter, GstOmxBaseSrc, or
+ * GstOmxBaseSink). The GstOmx object should have "component-name"
+ * and "library-name" properties.
+ */
GOmxCore *
-g_omx_core_new (void)
+g_omx_core_new (gpointer object, gpointer klass)
{
GOmxCore *core;
core = g_new0 (GOmxCore, 1);
+ core->object = object;
+
core->ports = g_ptr_array_new ();
core->omx_state_condition = g_cond_new ();
@@ -282,12 +291,33 @@ g_omx_core_new (void)
core->omx_state = OMX_StateInvalid;
+ {
+ gchar *library_name, *component_name, *component_role;
+
+ library_name = g_type_get_qdata (G_OBJECT_CLASS_TYPE (klass),
+ g_quark_from_static_string ("library-name"));
+
+ component_name = g_type_get_qdata (G_OBJECT_CLASS_TYPE (klass),
+ g_quark_from_static_string ("component-name"));
+
+ component_role = g_type_get_qdata (G_OBJECT_CLASS_TYPE (klass),
+ g_quark_from_static_string ("component-role"));
+
+ g_object_set (core->object,
+ "component-role", component_role,
+ "component-name", component_name,
+ "library-name", library_name,
+ NULL);
+ }
+
return core;
}
void
g_omx_core_free (GOmxCore *core)
{
+ g_omx_core_deinit (core); /* just in case we didn't have a READY->NULL.. mainly for gst-inspect */
+
g_sem_free (core->port_sem);
g_sem_free (core->flush_sem);
g_sem_free (core->done_sem);
@@ -301,10 +331,23 @@ 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)
{
+ gchar *library_name=NULL, *component_name=NULL;
+
+ if (core->omx_handle)
+ return;
+
+ GST_DEBUG_OBJECT (core->object, "loading: %s (%s)", component_name, library_name);
+
+ g_object_get (core->object,
+ "component-name", &component_name,
+ "library-name", &library_name,
+ NULL);
+
+ g_return_if_fail (component_name);
+ g_return_if_fail (library_name);
+
core->imp = request_imp (library_name);
if (!core->imp)
@@ -314,8 +357,15 @@ g_omx_core_init (GOmxCore *core,
(char *) component_name,
core,
&callbacks);
+
+ GST_DEBUG_OBJECT (core->object, "OMX_GetHandle(&%p) -> %d",
+ core->omx_handle, core->omx_error);
+
if (!core->omx_error)
core->omx_state = OMX_StateLoaded;
+
+ g_free (component_name);
+ g_free (library_name);
}
void
@@ -328,7 +378,12 @@ g_omx_core_deinit (GOmxCore *core)
core->omx_state == OMX_StateInvalid)
{
if (core->omx_handle)
+ {
core->omx_error = core->imp->sym_table.free_handle (core->omx_handle);
+ GST_DEBUG_OBJECT (core->object, "OMX_FreeHandle(%p) -> %d",
+ core->omx_handle, core->omx_error);
+ core->omx_handle = NULL;
+ }
}
release_imp (core->imp);
@@ -394,37 +449,29 @@ g_omx_core_unload (GOmxCore *core)
g_ptr_array_clear (core->ports);
}
-GOmxPort *
-g_omx_core_setup_port (GOmxCore *core,
- OMX_PARAM_PORTDEFINITIONTYPE *omx_port)
+static inline GOmxPort *
+get_port (GOmxCore *core, guint index)
{
- GOmxPort *port;
- guint index;
-
- index = omx_port->nPortIndex;
- port = g_omx_core_get_port (core, index);
-
- if (!port)
+ if (G_LIKELY (index < core->ports->len))
{
- port = g_omx_port_new (core);
- g_ptr_array_insert (core->ports, index, port);
+ return g_ptr_array_index (core->ports, index);
}
- g_omx_port_setup (port, omx_port);
-
- return port;
+ return NULL;
}
-static inline GOmxPort *
-g_omx_core_get_port (GOmxCore *core,
- guint index)
+GOmxPort *
+g_omx_core_get_port (GOmxCore *core, guint index)
{
- if (G_LIKELY (index < core->ports->len))
+ GOmxPort *port = get_port (core, index);
+
+ if (!port)
{
- return g_ptr_array_index (core->ports, index);
+ port = g_omx_port_new (core, index);
+ g_ptr_array_insert (core->ports, index, port);
}
- return NULL;
+ return port;
}
void
@@ -452,17 +499,31 @@ g_omx_core_flush_stop (GOmxCore *core)
core_for_each_port (core, g_omx_port_resume);
}
+/**
+ * Accessor for OMX component handle. If the OMX component is not constructed
+ * yet, this will trigger it to be constructed (OMX_GetHandle()). This should
+ * at least be used in places where g_omx_core_init() might not have been
+ * called yet (such as setting/getting properties)
+ */
+OMX_HANDLETYPE
+g_omx_core_get_handle (GOmxCore *core)
+{
+ if (!core->omx_handle) g_omx_core_init (core);
+ return core->omx_handle;
+}
+
/*
* Port
*/
GOmxPort *
-g_omx_port_new (GOmxCore *core)
+g_omx_port_new (GOmxCore *core, guint index)
{
GOmxPort *port;
port = g_new0 (GOmxPort, 1);
port->core = core;
+ port->port_index = index;
port->num_buffers = 0;
port->buffer_size = 0;
port->buffers = NULL;
@@ -508,6 +569,10 @@ g_omx_port_setup (GOmxPort *port,
port->buffer_size = omx_port->nBufferSize;
port->port_index = omx_port->nPortIndex;
+ GST_DEBUG_OBJECT (port->core->object,
+ "type=%d, num_buffers=%d, buffer_size=%d, port_index=%d",
+ port->type, port->num_buffers, port->buffer_size, port->port_index);
+
g_free (port->buffers);
port->buffers = g_new0 (OMX_BUFFERHEADERTYPE *, port->num_buffers);
}
@@ -840,6 +905,8 @@ EventHandler (OMX_HANDLETYPE omx_handle,
cmd = (OMX_COMMANDTYPE) data_1;
+ GST_DEBUG_OBJECT (core->object, "OMX_EventCmdComplete: %d", cmd);
+
switch (cmd)
{
case OMX_CommandStateSet:
@@ -858,6 +925,7 @@ EventHandler (OMX_HANDLETYPE omx_handle,
}
case OMX_EventBufferFlag:
{
+ GST_DEBUG_OBJECT (core->object, "OMX_EventBufferFlag");
if (data_2 & OMX_BUFFERFLAG_EOS)
{
g_omx_core_set_done (core);
@@ -866,6 +934,7 @@ EventHandler (OMX_HANDLETYPE omx_handle,
}
case OMX_EventPortSettingsChanged:
{
+ GST_DEBUG_OBJECT (core->object, "OMX_EventPortSettingsChanged");
/** @todo only on the relevant port. */
if (core->settings_changed_cb)
{
@@ -902,7 +971,7 @@ EmptyBufferDone (OMX_HANDLETYPE omx_handle,
GOmxPort *port;
core = (GOmxCore*) app_data;
- port = g_omx_core_get_port (core, omx_buffer->nInputPortIndex);
+ port = get_port (core, omx_buffer->nInputPortIndex);
GST_CAT_LOG_OBJECT (gstomx_util_debug, core->object, "omx_buffer=%p", omx_buffer);
got_buffer (core, port, omx_buffer);
@@ -919,7 +988,7 @@ FillBufferDone (OMX_HANDLETYPE omx_handle,
GOmxPort *port;
core = (GOmxCore *) app_data;
- port = g_omx_core_get_port (core, omx_buffer->nOutputPortIndex);
+ port = get_port (core, omx_buffer->nOutputPortIndex);
GST_CAT_LOG_OBJECT (gstomx_util_debug, core->object, "omx_buffer=%p", omx_buffer);
got_buffer (core, port, omx_buffer);
diff --git a/omx/gstomx_util.h b/omx/gstomx_util.h
index f0cf045..4857265 100644
--- a/omx/gstomx_util.h
+++ b/omx/gstomx_util.h
@@ -114,9 +114,9 @@ struct GOmxPort
void g_omx_init (void);
void g_omx_deinit (void);
-GOmxCore *g_omx_core_new (void);
+GOmxCore *g_omx_core_new (gpointer object, gpointer klass);
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);
@@ -127,9 +127,11 @@ void g_omx_core_set_done (GOmxCore *core);
void g_omx_core_wait_for_done (GOmxCore *core);
void g_omx_core_flush_start (GOmxCore *core);
void g_omx_core_flush_stop (GOmxCore *core);
-GOmxPort *g_omx_core_setup_port (GOmxCore *core, OMX_PARAM_PORTDEFINITIONTYPE *omx_port);
+OMX_HANDLETYPE g_omx_core_get_handle (GOmxCore *core);
+GOmxPort *g_omx_core_get_port (GOmxCore *core, guint index);
-GOmxPort *g_omx_port_new (GOmxCore *core);
+
+GOmxPort *g_omx_port_new (GOmxCore *core, guint index);
void g_omx_port_free (GOmxPort *port);
void g_omx_port_setup (GOmxPort *port, OMX_PARAM_PORTDEFINITIONTYPE *omx_port);
void g_omx_port_push_buffer (GOmxPort *port, OMX_BUFFERHEADERTYPE *omx_buffer);
@@ -142,4 +144,6 @@ void g_omx_port_enable (GOmxPort *port);
void g_omx_port_disable (GOmxPort *port);
void g_omx_port_finish (GOmxPort *port);
+
+
#endif /* GSTOMX_UTIL_H */
--
1.6.3.2
|
|
From: Rob C. <ro...@ti...> - 2009-11-04 02:23:49
|
Hi All, We've been working on the omap branch of gst-openmax for a few months now, and I've started cleaning up and porting some of the generic (non- omap specific) changes back to the master branch so that we can contribute them back to the community. So far I'm about 25% through the rebasing, but I'll start sending patches. And I'll continue rebasing and sending patches as time permits, hopefully finishing in the next couple weeks. (fyi, in case you are curious, you can see our commits at http://github.com/roopar/gst-openmax/commits/omap) BR, -R |
|
From: Felipe C. <fel...@gm...> - 2009-11-02 22:23:12
|
On Mon, Nov 2, 2009 at 6:44 AM, Tejas Bhanabhagavanwala <te...@or...> wrote: > Hi Felipe, > It is relly nice to have reply from you. Which one is easier > and can be completed within sshort time. Either gstreamer plugin or with the > help of OpenMAX. Ans also guide me some steps how can i start ? It depends on your background. Just look at example implementations: http://github.com/felipec/libomxil-g http://cgit.freedesktop.org/gstreamer/gst-template/ -- Felipe Contreras |
|
From: Tejas B. <te...@or...> - 2009-11-02 04:45:06
|
Hi Felipe,
It is relly nice to have reply from you. Which one is easier
and can be completed within sshort time. Either gstreamer plugin or with the
help of OpenMAX. Ans also guide me some steps how can i start ?
Thanks InAdvance,
Tejas.
----- Original Message -----
From: "Felipe Contreras" <fel...@gm...>
To: "Tejas Bhanabhagavanwala" <te...@or...>
Cc: <gst...@li...>
Sent: Monday, November 02, 2009 12:16 AM
Subject: Re: [Gstreamer-openmax] Want to integrate video codec library with
the help of gst-openmax and gstreamer for beagleboard
On Sat, Oct 31, 2009 at 9:24 AM, Tejas Bhanabhagavanwala
<te...@or...> wrote:
> Hello All,
> I am involved in the reasearch programme for my company. I
> would like to decode .mp4 which contains video container as .h264 and
> .mpeg4
> on beagle board. I do not want to use opensource ffmeg codecs, instead we
> have developed own video codec library and have our own apis for the same.
> I
> have cross compiled gstreamer with the help of sbox2 for beagle board. Now
> i
> want to integrate our codec library to openmax and gstreamer. But i am not
> getting much details. Can anyone help me out into my research project?
> Waiting for your kind response.
>
> NOTE :: We are not using hardware(DSP) for decoding of streame, instead we
> have our own video codec which is software based.
I don't know what you are looking for. If you want to use gst-openmax
you must have an OpenMAX IL implementation. If you don't have it, then
you would have to write it.
--
Felipe Contreras
|
|
From: Felipe C. <fel...@gm...> - 2009-11-01 18:47:04
|
On Sat, Oct 31, 2009 at 9:24 AM, Tejas Bhanabhagavanwala <te...@or...> wrote: > Hello All, > I am involved in the reasearch programme for my company. I > would like to decode .mp4 which contains video container as .h264 and .mpeg4 > on beagle board. I do not want to use opensource ffmeg codecs, instead we > have developed own video codec library and have our own apis for the same. I > have cross compiled gstreamer with the help of sbox2 for beagle board. Now i > want to integrate our codec library to openmax and gstreamer. But i am not > getting much details. Can anyone help me out into my research project? > Waiting for your kind response. > > NOTE :: We are not using hardware(DSP) for decoding of streame, instead we > have our own video codec which is software based. I don't know what you are looking for. If you want to use gst-openmax you must have an OpenMAX IL implementation. If you don't have it, then you would have to write it. -- Felipe Contreras |
|
From: Felipe C. <fel...@gm...> - 2009-11-01 18:45:09
|
On Sat, Oct 31, 2009 at 8:13 AM, Tejas Bhanabhagavanwala <te...@or...> wrote: > Hello All, > I am trying to configure gst-openmax for my beagle board by > giving following command. But i am failed at some point and it is giving me > following error. > > [root@Fedora gst-openmax-0.10.0.5]# sb2 ./autogen.sh --noconfigure You don't need to run that in scratchbox. It should work, but if it doesn't, try without it. -- Felipe Contreras |