[Ffmpeg-devel] AVOption and setting default values

Michael Niedermayer michaelni
Fri Sep 8 10:35:33 CEST 2006


Hi

On Fri, Sep 08, 2006 at 10:16:17AM +0200, Panagiotis Issaris wrote:
> Hi,
> 
> In the libavformat/utils.c file, I do not really understand the following code:
> 
>      467 static const AVOption options[]={
>      468 {"probesize", NULL, OFFSET(probesize), FF_OPT_TYPE_INT, DEFAULT, 32, INT_MAX, D},
>      469 {"fflags", NULL, OFFSET(flags), FF_OPT_TYPE_FLAGS, DEFAULT, INT_MIN, INT_MAX, D, "fflags"},
>      470 {"ignidx", "ignore index", 0, FF_OPT_TYPE_CONST, AVFMT_FLAG_IGNIDX, INT_MIN, INT_MAX, D, "fflags"},
>      471 {"genpts", "generate pts", 0, FF_OPT_TYPE_CONST, AVFMT_FLAG_GENPTS, INT_MIN, INT_MAX, D, "fflags"},
>      472 {NULL},
>      473 };
>      474
>      475 static const AVClass av_format_context_class = { "AVFormatContext", format_to_name, options };
>      476
>      477 void avformat_get_context_defaults(AVFormatContext *s){
>      478     memset(s, 0, sizeof(AVFormatContext));
>      479
>      480     /* from mpegts.c: 1.0 second at 24Mbit/s */
>      481     s->probesize=32000;
>      482 }
> 
> Why is the default set to 0 in the AVOption array, while being set to 32000 on line 481? Furthermore,
> it is set to 0, which seems to be illegal as the minimum is specified as being 32.

the defaults in the array are unused (patch welcome ...), the 0 is wrong of
course


> 
> Is it set explicitly in avformat_get_context_defaults() to enable resetting an already
> allocated and used AVFormatContext again back to the default values? If so, wouldn't it be better
> if those values were taken from the options[] array?

yes, its just that the avformat_get_context_defaults() code was there before
AVOption and the default values in the AVOption array arent used currently ...

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is




More information about the ffmpeg-devel mailing list