MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / parse_primary

Function parse_primary

libavcodec/eval.c:175–282  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

173}
174
175static AVExpr * parse_primary(Parser *p) {
176 AVExpr * d = av_mallocz(sizeof(AVExpr));
177 char *next= p->s;
178 int i;
179
180 if (!d)
181 return NULL;
182
183 /* number */
184 d->value = av_strtod(p->s, &next);
185 if(next != p->s){
186 d->type = e_value;
187 p->s= next;
188 return d;
189 }
190 d->value = 1;
191
192 /* named constants */
193 for(i=0; p->const_name && p->const_name[i]; i++){
194 if(strmatch(p->s, p->const_name[i])){
195 p->s+= strlen(p->const_name[i]);
196 d->type = e_const;
197 d->a.const_index = i;
198 return d;
199 }
200 }
201
202 p->s= strchr(p->s, '(');
203 if(p->s==NULL){
204 *p->error = "undefined constant or missing (";
205 p->s= next;
206 ff_free_expr(d);
207 return NULL;
208 }
209 p->s++; // "("
210 if (*next == '(') { // special case do-nothing
211 av_freep(&d);
212 d = parse_expr(p);
213 if(p->s[0] != ')'){
214 *p->error = "missing )";
215 ff_free_expr(d);
216 return NULL;
217 }
218 p->s++; // ")"
219 return d;
220 }
221 d->param[0] = parse_expr(p);
222 if(p->s[0]== ','){
223 p->s++; // ","
224 d->param[1] = parse_expr(p);
225 }
226 if(p->s[0] != ')'){
227 *p->error = "missing )";
228 ff_free_expr(d);
229 return NULL;
230 }
231 p->s++; // ")"
232

Callers 1

parse_powFunction · 0.85

Calls 6

av_malloczFunction · 0.85
av_strtodFunction · 0.85
strmatchFunction · 0.85
ff_free_exprFunction · 0.85
av_freepFunction · 0.85
parse_exprFunction · 0.85

Tested by

no test coverage detected