[Ffmpeg-devel] AVOption and setting default values

Panagiotis Issaris takis.issaris
Fri Sep 8 10:16:17 CEST 2006


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.

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?

With friendly regards,
Takis




More information about the ffmpeg-devel mailing list