[FFmpeg-devel] [RFC] av_tree enumeration

Michael Niedermayer michaelni
Sat Nov 14 12:22:58 CET 2009


On Sat, Nov 14, 2009 at 03:00:58PM +1100, Peter Ross wrote:
> On Sat, Nov 14, 2009 at 01:41:17AM +0100, Stefano Sabatini wrote:
> > Hi all,
> > 
> > I'm considering to use av_tree for storing elements of FFmpeg,
> > e.g. filters, codecs etc.
> [...]
> 
> > Could someone explain how to use that function, and if it can be used
> > to do this? I could try some guesswork, but it's faster if someone can
> > give some hints about it.
> 
> Um, call av_tree_enumerate with pointer to the tree and a callback
> function. The callback function is invoked for every item in the tree.
> 
> Example:
> 
>    int print_item(void *cntx, void *elem) {
>       Datatype *s = elem;  
>       printf("%s\n", s->name);
>       return 0;
>    } 
>    
>    av_tree_enumerate(tree, cntx, print_item);
> 
> I am using a copy of tree.c/h in another project, and have made the following 
> (trivial) fixes to av_tree_enumerate().
> 
> - enumerate the tree in ascending/left-to-right order

suggestion implemented


> - stop enumerating if the callback function returns < 0.

I think that can be done through use of cmp() and opaque in my code with
the advantage that if its not needed no extra return checks are needed


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 2
"100% positive feedback" - "All either got their money back or didnt complain"
"Best seller ever, very honest" - "Seller refunded buyer after failed scam"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091114/83af1bf4/attachment.pgp>



More information about the ffmpeg-devel mailing list