00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include <string.h>
00026
00027 #include "libavformat/avformat.h"
00028 #include "libavcodec/avcodec.h"
00029 #include "libavutil/log.h"
00030 #include "libavutil/opt.h"
00031
00032 static void print_usage(void)
00033 {
00034 fprintf(stderr, "Usage: enum_options type\n"
00035 "type: format codec\n");
00036 exit(1);
00037 }
00038
00039 static void print_option(const AVClass *class, const AVOption *o)
00040 {
00041 printf("@item -%s @var{", o->name);
00042 switch (o->type) {
00043 case FF_OPT_TYPE_BINARY: printf("hexadecimal string"); break;
00044 case FF_OPT_TYPE_STRING: printf("string"); break;
00045 case FF_OPT_TYPE_INT:
00046 case FF_OPT_TYPE_INT64: printf("integer"); break;
00047 case FF_OPT_TYPE_FLOAT:
00048 case FF_OPT_TYPE_DOUBLE: printf("float"); break;
00049 case FF_OPT_TYPE_RATIONAL: printf("rational number"); break;
00050 case FF_OPT_TYPE_FLAGS: printf("flags"); break;
00051 default: printf("value"); break;
00052 }
00053 printf("} (@emph{");
00054
00055 if (o->flags & AV_OPT_FLAG_ENCODING_PARAM) {
00056 printf("input");
00057 if (o->flags & AV_OPT_FLAG_ENCODING_PARAM)
00058 printf("/");
00059 }
00060 if (o->flags & AV_OPT_FLAG_ENCODING_PARAM)
00061 printf("output");
00062
00063 printf("})\n");
00064 if (o->help)
00065 printf("%s\n", o->help);
00066
00067 if (o->unit) {
00068 const AVOption *u = NULL;
00069 printf("\nPossible values:\n@table @samp\n");
00070
00071 while ((u = av_next_option(&class, u)))
00072 if (u->type == FF_OPT_TYPE_CONST && u->unit && !strcmp(u->unit, o->unit))
00073 printf("@item %s\n%s\n", u->name, u->help ? u->help : "");
00074 printf("@end table\n");
00075 }
00076 }
00077
00078 static void show_opts(const AVClass *class)
00079 {
00080 const AVOption *o = NULL;
00081
00082 printf("@table @option\n");
00083 while ((o = av_next_option(&class, o)))
00084 if (o->type != FF_OPT_TYPE_CONST)
00085 print_option(class, o);
00086 printf("@end table\n");
00087 }
00088
00089 static void show_format_opts(void)
00090 {
00091 AVInputFormat *iformat = NULL;
00092 AVOutputFormat *oformat = NULL;
00093
00094 printf("@section Generic format AVOptions\n");
00095 show_opts(avformat_get_class());
00096
00097 printf("@section Format-specific AVOptions\n");
00098 while ((iformat = av_iformat_next(iformat))) {
00099 if (!iformat->priv_class)
00100 continue;
00101 printf("@subsection %s AVOptions\n", iformat->priv_class->class_name);
00102 show_opts(iformat->priv_class);
00103 }
00104 while ((oformat = av_oformat_next(oformat))) {
00105 if (!oformat->priv_class)
00106 continue;
00107 printf("@subsection %s AVOptions\n", oformat->priv_class->class_name);
00108 show_opts(oformat->priv_class);
00109 }
00110 }
00111
00112 static void show_codec_opts(void)
00113 {
00114 AVCodec *c = NULL;
00115
00116 printf("@section Generic codec AVOptions\n");
00117 show_opts(avcodec_get_class());
00118
00119 printf("@section Codec-specific AVOptions\n");
00120 while ((c = av_codec_next(c))) {
00121 if (!c->priv_class)
00122 continue;
00123 printf("@subsection %s AVOptions\n", c->priv_class->class_name);
00124 show_opts(c->priv_class);
00125 }
00126 }
00127
00128 int main(int argc, char **argv)
00129 {
00130 if (argc < 2)
00131 print_usage();
00132
00133 av_register_all();
00134
00135 if (!strcmp(argv[1], "format"))
00136 show_format_opts();
00137 else if (!strcmp(argv[1], "codec"))
00138 show_codec_opts();
00139 else
00140 print_usage();
00141
00142 return 0;
00143 }