annotate opts.c @ 2016:f8ef6f664234 libavcodec

UINT64_MAX fix
author michael
date Tue, 11 May 2004 12:24:42 +0000
parents 932d306bf1dc
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
962
c5aef83c6a3f * first shot for generaly usable option parser for codecs
kabi
parents:
diff changeset
1 /*
c5aef83c6a3f * first shot for generaly usable option parser for codecs
kabi
parents:
diff changeset
2 * LGPL
c5aef83c6a3f * first shot for generaly usable option parser for codecs
kabi
parents:
diff changeset
3 */
c5aef83c6a3f * first shot for generaly usable option parser for codecs
kabi
parents:
diff changeset
4
1106
1e39f273ecd6 per file doxy
michaelni
parents: 1058
diff changeset
5 /**
1e39f273ecd6 per file doxy
michaelni
parents: 1058
diff changeset
6 * @file opts.c
1e39f273ecd6 per file doxy
michaelni
parents: 1058
diff changeset
7 * options parser.
962
c5aef83c6a3f * first shot for generaly usable option parser for codecs
kabi
parents:
diff changeset
8 * typical parsed command line:
c5aef83c6a3f * first shot for generaly usable option parser for codecs
kabi
parents:
diff changeset
9 * msmpeg4:bitrate=720000:qmax=16
c5aef83c6a3f * first shot for generaly usable option parser for codecs
kabi
parents:
diff changeset
10 *
c5aef83c6a3f * first shot for generaly usable option parser for codecs
kabi
parents:
diff changeset
11 */
c5aef83c6a3f * first shot for generaly usable option parser for codecs
kabi
parents:
diff changeset
12
c5aef83c6a3f * first shot for generaly usable option parser for codecs
kabi
parents:
diff changeset
13 #include "avcodec.h"
1125
0980ae063f4e restoring OS/2 compatibility patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents: 1124
diff changeset
14
1124
64c7c76ed17c * 'externaly' visible option list begins avoptions_ prefix
kabi
parents: 1114
diff changeset
15 const AVOption avoptions_common[] = {
1114
e4762efc3617 * more generic avoption_parse
kabi
parents: 1106
diff changeset
16 AVOPTION_CODEC_FLAG("bit_exact", "use only bit-exact stuff", flags, CODEC_FLAG_BITEXACT, 0),
e4762efc3617 * more generic avoption_parse
kabi
parents: 1106
diff changeset
17 AVOPTION_CODEC_FLAG("mm_force", "force mm flags", dsp_mask, FF_MM_FORCE, 0),
e4762efc3617 * more generic avoption_parse
kabi
parents: 1106
diff changeset
18 #ifdef HAVE_MMX
e4762efc3617 * more generic avoption_parse
kabi
parents: 1106
diff changeset
19 AVOPTION_CODEC_FLAG("mm_mmx", "mask MMX feature", dsp_mask, FF_MM_MMX, 0),
e4762efc3617 * more generic avoption_parse
kabi
parents: 1106
diff changeset
20 AVOPTION_CODEC_FLAG("mm_3dnow", "mask 3DNow feature", dsp_mask, FF_MM_3DNOW, 0),
e4762efc3617 * more generic avoption_parse
kabi
parents: 1106
diff changeset
21 AVOPTION_CODEC_FLAG("mm_mmxext", "mask MMXEXT (MMX2) feature", dsp_mask, FF_MM_MMXEXT, 0),
e4762efc3617 * more generic avoption_parse
kabi
parents: 1106
diff changeset
22 AVOPTION_CODEC_FLAG("mm_sse", "mask SSE feature", dsp_mask, FF_MM_SSE, 0),
e4762efc3617 * more generic avoption_parse
kabi
parents: 1106
diff changeset
23 AVOPTION_CODEC_FLAG("mm_sse2", "mask SSE2 feature", dsp_mask, FF_MM_SSE2, 0),
e4762efc3617 * more generic avoption_parse
kabi
parents: 1106
diff changeset
24 #endif
1058
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
25 AVOPTION_END()
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
26 };
962
c5aef83c6a3f * first shot for generaly usable option parser for codecs
kabi
parents:
diff changeset
27
1124
64c7c76ed17c * 'externaly' visible option list begins avoptions_ prefix
kabi
parents: 1114
diff changeset
28 const AVOption avoptions_workaround_bug[] = {
64c7c76ed17c * 'externaly' visible option list begins avoptions_ prefix
kabi
parents: 1114
diff changeset
29 AVOPTION_CODEC_FLAG("bug_autodetect", "workaround bug autodetection", workaround_bugs, FF_BUG_AUTODETECT, 1),
64c7c76ed17c * 'externaly' visible option list begins avoptions_ prefix
kabi
parents: 1114
diff changeset
30 AVOPTION_CODEC_FLAG("bug_old_msmpeg4", "workaround old msmpeg4 bug", workaround_bugs, FF_BUG_OLD_MSMPEG4, 0),
64c7c76ed17c * 'externaly' visible option list begins avoptions_ prefix
kabi
parents: 1114
diff changeset
31 AVOPTION_CODEC_FLAG("bug_xvid_ilace", "workaround XviD interlace bug", workaround_bugs, FF_BUG_XVID_ILACE, 0),
64c7c76ed17c * 'externaly' visible option list begins avoptions_ prefix
kabi
parents: 1114
diff changeset
32 AVOPTION_CODEC_FLAG("bug_ump4", "workaround ump4 bug", workaround_bugs, FF_BUG_UMP4, 0),
64c7c76ed17c * 'externaly' visible option list begins avoptions_ prefix
kabi
parents: 1114
diff changeset
33 AVOPTION_CODEC_FLAG("bug_no_padding", "workaround padding bug", workaround_bugs, FF_BUG_NO_PADDING, 0),
64c7c76ed17c * 'externaly' visible option list begins avoptions_ prefix
kabi
parents: 1114
diff changeset
34 AVOPTION_CODEC_FLAG("bug_ac_vlc", "workaround ac VLC bug", workaround_bugs, FF_BUG_AC_VLC, 0),
64c7c76ed17c * 'externaly' visible option list begins avoptions_ prefix
kabi
parents: 1114
diff changeset
35 AVOPTION_CODEC_FLAG("bug_qpel_chroma", "workaround qpel chroma bug", workaround_bugs, FF_BUG_QPEL_CHROMA, 0),
64c7c76ed17c * 'externaly' visible option list begins avoptions_ prefix
kabi
parents: 1114
diff changeset
36 AVOPTION_CODEC_FLAG("bug_std_qpel", "workaround std qpel bug", workaround_bugs, FF_BUG_STD_QPEL, 0),
64c7c76ed17c * 'externaly' visible option list begins avoptions_ prefix
kabi
parents: 1114
diff changeset
37 AVOPTION_CODEC_FLAG("bug_qpel_chroma2", "workaround qpel chroma2 bug", workaround_bugs, FF_BUG_QPEL_CHROMA2, 0),
64c7c76ed17c * 'externaly' visible option list begins avoptions_ prefix
kabi
parents: 1114
diff changeset
38 AVOPTION_CODEC_FLAG("bug_direct_blocksize", "workaround direct blocksize bug", workaround_bugs, FF_BUG_DIRECT_BLOCKSIZE, 0),
64c7c76ed17c * 'externaly' visible option list begins avoptions_ prefix
kabi
parents: 1114
diff changeset
39 AVOPTION_END()
64c7c76ed17c * 'externaly' visible option list begins avoptions_ prefix
kabi
parents: 1114
diff changeset
40 };
64c7c76ed17c * 'externaly' visible option list begins avoptions_ prefix
kabi
parents: 1114
diff changeset
41
1446
daa70b33fc44 removed os_support.h
bellard
parents: 1128
diff changeset
42 /* avoid compatibility problems by redefining it */
daa70b33fc44 removed os_support.h
bellard
parents: 1128
diff changeset
43 static int av_strcasecmp(const char *s1, const char *s2)
daa70b33fc44 removed os_support.h
bellard
parents: 1128
diff changeset
44 {
daa70b33fc44 removed os_support.h
bellard
parents: 1128
diff changeset
45 signed char val;
daa70b33fc44 removed os_support.h
bellard
parents: 1128
diff changeset
46
daa70b33fc44 removed os_support.h
bellard
parents: 1128
diff changeset
47 for(;;) {
daa70b33fc44 removed os_support.h
bellard
parents: 1128
diff changeset
48 val = toupper(*s1) - toupper(*s2);
daa70b33fc44 removed os_support.h
bellard
parents: 1128
diff changeset
49 if (val != 0)
daa70b33fc44 removed os_support.h
bellard
parents: 1128
diff changeset
50 break;
daa70b33fc44 removed os_support.h
bellard
parents: 1128
diff changeset
51 if (*s1 != '\0')
daa70b33fc44 removed os_support.h
bellard
parents: 1128
diff changeset
52 break;
daa70b33fc44 removed os_support.h
bellard
parents: 1128
diff changeset
53 s1++;
daa70b33fc44 removed os_support.h
bellard
parents: 1128
diff changeset
54 s2++;
daa70b33fc44 removed os_support.h
bellard
parents: 1128
diff changeset
55 }
daa70b33fc44 removed os_support.h
bellard
parents: 1128
diff changeset
56 return val;
daa70b33fc44 removed os_support.h
bellard
parents: 1128
diff changeset
57 }
daa70b33fc44 removed os_support.h
bellard
parents: 1128
diff changeset
58
1124
64c7c76ed17c * 'externaly' visible option list begins avoptions_ prefix
kabi
parents: 1114
diff changeset
59
1058
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
60 static int parse_bool(const AVOption *c, char *s, int *var)
1019
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
61 {
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
62 int b = 1; /* by default -on- when present */
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
63 if (s) {
1446
daa70b33fc44 removed os_support.h
bellard
parents: 1128
diff changeset
64 if (!av_strcasecmp(s, "off") || !av_strcasecmp(s, "false")
1019
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
65 || !strcmp(s, "0"))
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
66 b = 0;
1446
daa70b33fc44 removed os_support.h
bellard
parents: 1128
diff changeset
67 else if (!av_strcasecmp(s, "on") || !av_strcasecmp(s, "true")
1019
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
68 || !strcmp(s, "1"))
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
69 b = 1;
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
70 else
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
71 return -1;
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
72 }
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
73
1124
64c7c76ed17c * 'externaly' visible option list begins avoptions_ prefix
kabi
parents: 1114
diff changeset
74 if (c->type == FF_OPT_TYPE_FLAG) {
64c7c76ed17c * 'externaly' visible option list begins avoptions_ prefix
kabi
parents: 1114
diff changeset
75 if (b)
64c7c76ed17c * 'externaly' visible option list begins avoptions_ prefix
kabi
parents: 1114
diff changeset
76 *var |= (int)c->min;
64c7c76ed17c * 'externaly' visible option list begins avoptions_ prefix
kabi
parents: 1114
diff changeset
77 else
64c7c76ed17c * 'externaly' visible option list begins avoptions_ prefix
kabi
parents: 1114
diff changeset
78 *var &= ~(int)c->min;
64c7c76ed17c * 'externaly' visible option list begins avoptions_ prefix
kabi
parents: 1114
diff changeset
79 } else
64c7c76ed17c * 'externaly' visible option list begins avoptions_ prefix
kabi
parents: 1114
diff changeset
80 *var = b;
1019
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
81 return 0;
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
82 }
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
83
1058
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
84 static int parse_double(const AVOption *c, char *s, double *var)
1019
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
85 {
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
86 double d;
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
87 if (!s)
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
88 return -1;
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
89 d = atof(s);
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
90 if (c->min != c->max) {
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
91 if (d < c->min || d > c->max) {
1598
932d306bf1dc av_log() patch by (Michel Bardiaux <mbardiaux at peaktime dot be>)
michael
parents: 1446
diff changeset
92 av_log(NULL, AV_LOG_ERROR, "Option: %s double value: %f out of range <%f, %f>\n",
1019
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
93 c->name, d, c->min, c->max);
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
94 return -1;
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
95 }
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
96 }
1058
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
97 *var = d;
1019
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
98 return 0;
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
99 }
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
100
1058
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
101 static int parse_int(const AVOption* c, char* s, int* var)
1019
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
102 {
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
103 int i;
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
104 if (!s)
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
105 return -1;
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
106 i = atoi(s);
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
107 if (c->min != c->max) {
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
108 if (i < (int)c->min || i > (int)c->max) {
1598
932d306bf1dc av_log() patch by (Michel Bardiaux <mbardiaux at peaktime dot be>)
michael
parents: 1446
diff changeset
109 av_log(NULL, AV_LOG_ERROR, "Option: %s integer value: %d out of range <%d, %d>\n",
1019
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
110 c->name, i, (int)c->min, (int)c->max);
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
111 return -1;
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
112 }
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
113 }
1058
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
114 *var = i;
1019
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
115 return 0;
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
116 }
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
117
1114
e4762efc3617 * more generic avoption_parse
kabi
parents: 1106
diff changeset
118 static int parse_string(const AVOption *c, char *s, void* strct, char **var)
1019
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
119 {
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
120 if (!s)
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
121 return -1;
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
122
1058
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
123 if (c->type == FF_OPT_TYPE_RCOVERRIDE) {
1019
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
124 int sf, ef, qs;
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
125 float qf;
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
126 if (sscanf(s, "%d,%d,%d,%f", &sf, &ef, &qs, &qf) == 4 && sf < ef) {
1114
e4762efc3617 * more generic avoption_parse
kabi
parents: 1106
diff changeset
127 AVCodecContext *avctx = (AVCodecContext *) strct;
1058
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
128 RcOverride *o;
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
129 avctx->rc_override = av_realloc(avctx->rc_override,
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
130 sizeof(RcOverride) * (avctx->rc_override_count + 1));
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
131 o = avctx->rc_override + avctx->rc_override_count++;
1019
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
132 o->start_frame = sf;
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
133 o->end_frame = ef;
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
134 o->qscale = qs;
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
135 o->quality_factor = qf;
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
136
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
137 //printf("parsed Rc: %d,%d,%d,%f (%d)\n", sf,ef,qs,qf, avctx->rc_override_count);
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
138 } else {
1598
932d306bf1dc av_log() patch by (Michel Bardiaux <mbardiaux at peaktime dot be>)
michael
parents: 1446
diff changeset
139 av_log(NULL, AV_LOG_ERROR, "incorrect/unparsable Rc: \"%s\"\n", s);
1019
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
140 }
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
141 } else
1058
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
142 *var = av_strdup(s);
1019
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
143 return 0;
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
144 }
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
145
1114
e4762efc3617 * more generic avoption_parse
kabi
parents: 1106
diff changeset
146 int avoption_parse(void* strct, const AVOption* list, const char *opts)
962
c5aef83c6a3f * first shot for generaly usable option parser for codecs
kabi
parents:
diff changeset
147 {
1058
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
148 int r = 0;
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
149 char* dopts = av_strdup(opts);
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
150 if (dopts) {
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
151 char *str = dopts;
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
152
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
153 while (str && *str && r == 0) {
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
154 const AVOption *stack[FF_OPT_MAX_DEPTH];
1114
e4762efc3617 * more generic avoption_parse
kabi
parents: 1106
diff changeset
155 const AVOption *c = list;
1058
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
156 int depth = 0;
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
157 char* e = strchr(str, ':');
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
158 char* p;
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
159 if (e)
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
160 *e++ = 0;
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
161
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
162 p = strchr(str, '=');
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
163 if (p)
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
164 *p++ = 0;
962
c5aef83c6a3f * first shot for generaly usable option parser for codecs
kabi
parents:
diff changeset
165
1058
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
166 // going through option structures
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
167 for (;;) {
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
168 if (!c->name) {
1114
e4762efc3617 * more generic avoption_parse
kabi
parents: 1106
diff changeset
169 if (c->help) {
1058
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
170 stack[depth++] = c;
1114
e4762efc3617 * more generic avoption_parse
kabi
parents: 1106
diff changeset
171 c = (const AVOption*) c->help;
1058
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
172 assert(depth > FF_OPT_MAX_DEPTH);
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
173 } else {
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
174 if (depth == 0)
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
175 break; // finished
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
176 c = stack[--depth];
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
177 c++;
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
178 }
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
179 } else {
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
180 if (!strcmp(c->name, str)) {
1114
e4762efc3617 * more generic avoption_parse
kabi
parents: 1106
diff changeset
181 void* ptr = (char*)strct + c->offset;
962
c5aef83c6a3f * first shot for generaly usable option parser for codecs
kabi
parents:
diff changeset
182
1058
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
183 switch (c->type & FF_OPT_TYPE_MASK) {
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
184 case FF_OPT_TYPE_BOOL:
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
185 r = parse_bool(c, p, (int*)ptr);
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
186 break;
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
187 case FF_OPT_TYPE_DOUBLE:
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
188 r = parse_double(c, p, (double*)ptr);
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
189 break;
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
190 case FF_OPT_TYPE_INT:
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
191 r = parse_int(c, p, (int*)ptr);
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
192 break;
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
193 case FF_OPT_TYPE_STRING:
1114
e4762efc3617 * more generic avoption_parse
kabi
parents: 1106
diff changeset
194 r = parse_string(c, p, strct, (char**)ptr);
1058
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
195 break;
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
196 default:
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
197 assert(0 == 1);
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
198 }
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
199 }
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
200 c++;
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
201 }
1019
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
202 }
1058
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
203 str = e;
1019
ef905ded19fe * code for parsing options
kabi
parents: 962
diff changeset
204 }
1058
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
205 av_free(dopts);
962
c5aef83c6a3f * first shot for generaly usable option parser for codecs
kabi
parents:
diff changeset
206 }
1058
3c3da6edc9a1 * still unfinished code for Options
kabi
parents: 1019
diff changeset
207 return r;
962
c5aef83c6a3f * first shot for generaly usable option parser for codecs
kabi
parents:
diff changeset
208 }