[Ffmpeg-devel] [PATCH 1/2] Enable usage of AVOption default value

Panagiotis Issaris takis.issaris
Sat Sep 9 10:29:11 CEST 2006


Hi,

On za, 2006-09-09 at 00:21 +0200, Aurelien Jacobs wrote:
> [...]
> Any reason why you implemented this as a macro instead of a function ?
Ah! You are absolutely right! In fact, I _had_ a reason during the
writing of the patch... but it is gone now.

The thing is, I initially wrote the patch for libavformat. Then I 
tried making it general for libavformat and libavcodec, but there was
one problem, namely the handling of flags. I _mistakenly_ wrote the
handling of tags like this:
[...]
case FF_OPT_TYPE_CONST: {
    int val;
    avl = opt->default_val
    s->flags |= val;
}
break;
[...]

As you can see I needed to access the flags field, of which I didn't
see that it was an AVOption similar to the others addressable through
opt->offset. Thus, I thought I had to use a macro, because "flags"
obviously was not in AVClass.

After this, I finally got how flags in AVOption worked, and rewrote
the flag handling of the patch, so in fact the reason for writing it as
a macro was gone... I will turn it into a function ASAP and resend a
patch.

With friendly regards,
Takis





More information about the ffmpeg-devel mailing list