Mercurial > libavcodec.hg
comparison opt.c @ 5976:58ee364cd8fb libavcodec
make the AVOption code work with strings instead of crash
author | michael |
---|---|
date | Mon, 03 Dec 2007 01:03:54 +0000 |
parents | 2b72f9bc4f06 |
children | 853d1ea80942 |
comparison
equal
deleted
inserted
replaced
5975:04f8a627587b | 5976:58ee364cd8fb |
---|---|
157 return o; | 157 return o; |
158 } | 158 } |
159 return NULL; | 159 return NULL; |
160 } | 160 } |
161 | 161 |
162 memcpy(((uint8_t*)obj) + o->offset, val, sizeof(val)); | 162 memcpy(((uint8_t*)obj) + o->offset, &val, sizeof(val)); |
163 return o; | 163 return o; |
164 } | 164 } |
165 | 165 |
166 const AVOption *av_set_double(void *obj, const char *name, double n){ | 166 const AVOption *av_set_double(void *obj, const char *name, double n){ |
167 return av_set_number(obj, name, n, 1, 1); | 167 return av_set_number(obj, name, n, 1, 1); |
190 | 190 |
191 dst= ((uint8_t*)obj) + o->offset; | 191 dst= ((uint8_t*)obj) + o->offset; |
192 if(o_out) *o_out= o; | 192 if(o_out) *o_out= o; |
193 | 193 |
194 if(o->type == FF_OPT_TYPE_STRING) | 194 if(o->type == FF_OPT_TYPE_STRING) |
195 return dst; | 195 return *(void**)dst; |
196 | 196 |
197 switch(o->type){ | 197 switch(o->type){ |
198 case FF_OPT_TYPE_FLAGS: snprintf(buf, buf_len, "0x%08X",*(int *)dst);break; | 198 case FF_OPT_TYPE_FLAGS: snprintf(buf, buf_len, "0x%08X",*(int *)dst);break; |
199 case FF_OPT_TYPE_INT: snprintf(buf, buf_len, "%d" , *(int *)dst);break; | 199 case FF_OPT_TYPE_INT: snprintf(buf, buf_len, "%d" , *(int *)dst);break; |
200 case FF_OPT_TYPE_INT64: snprintf(buf, buf_len, "%"PRId64, *(int64_t*)dst);break; | 200 case FF_OPT_TYPE_INT64: snprintf(buf, buf_len, "%"PRId64, *(int64_t*)dst);break; |