[FFmpeg-devel] [RFC] av_tree enumeration

Peter Ross pross
Sat Nov 14 05:00:58 CET 2009

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.


   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
- stop enumerating if the callback function returns < 0.

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091114/57e79774/attachment.pgp>

More information about the ffmpeg-devel mailing list