Re: [Mlt-devel] Frei0r & Ladspa Filters
Brought to you by:
ddennedy,
lilo_booter
From: Dan D. <da...@de...> - 2009-09-20 06:58:02
|
On Fri, Sep 18, 2009 at 1:39 PM, Dan Dennedy <da...@de...> wrote: > On Fri, Sep 18, 2009 at 12:25 PM, Jonathan Thomas > <jon...@gm...> wrote: >> Dan, sorry to bother you again, but I have been unable to successfully get >> properties out of the mlt.repository object. I took a look at the mlt >> source code, and really tried to figure this out. I'm not sure if this is a >> problem with swig or mlt or the way I'm using it. =) >> >> When I call the r.metadata method, I always get back a mlt.Properties >> object, no matter what I pass to the metadata function. Looking at your >> source code, it should return a NULL if it can't find any properties. >> Howerver, I always get back a <mlt.Properties; proxy of <Swig Object>>. >> When I call any method on this returned object, it seg faults. >> >> For example: >>>> import mlt >>>> f = mlt.Factory() >>>> r = f.init() >>>> props = r.metadata(mlt.filter_type, "sepia") >>>> props.count() >> Segmentation fault I remember now that you should call props.is_valid() here to prevent this. > Not all services have metadata. Most of them do not, in fact. This is > something I added within the past year and half or so, and it takes > time to develop it out, especially when not getting much help. > Fortunately, everything Marco Gittler works on is documented, and that > includes frei0r and oldfilm modules. If you want to try to make > Filters generic and automatically expand with MLT, then you will need > to help me flesh out this metadata. However, I am not even certain > that you want to do this. There are filters that really need a custom > UI, and some filters you do not want users to add since they are kind > of internal, utilitarian - like the new imageconvert filter. > >> However, this also returns a mlt.properties object... and then breaks when I >> access any methods: >> >>>> props = r.metadata(mlt.filter_type, "asdf1234") >>>> props.count() > >>>> p = r.metadata(mlt.filter_type, 'frei0r.water') >>>> p.dump() > schema_version=0.1 > title=Water > version=3.0 > identifier=frei0r.water > description=water drops on a video surface > creator=Jaromil > type=filter > > ...but dump() does not recurse into the nested parameters list. > >>>> p.get_data('paramaters') > <Swig Object of type 'void *' at 0x69a20> >>>> mlt.Properties(p.get_data('parameters')).count() > segfault > > ...even though parameters is a nested properties that exists. > This is fixed with the latest commit. Next, you need to understand that properties that act as a list instead of key/value pair take a numeric string as the key. The first parameter has key '0' and so on. This means you would iterate over them like this. params = mlt.Properties(p.get_data('parameters')) if params.is_valid(): for i in range(params.count()): param = mlt.Properties(params.get_data(str(i))) if param.is_valid(): param.dump() -- +-DRD-+ |