You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

613 lines
20KB

  1. /*
  2. * AVOptions
  3. * Copyright (c) 2005 Michael Niedermayer <michaelni@gmx.at>
  4. *
  5. * This file is part of FFmpeg.
  6. *
  7. * FFmpeg is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * FFmpeg is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with FFmpeg; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. /**
  22. * @file
  23. * AVOptions
  24. * @author Michael Niedermayer <michaelni@gmx.at>
  25. */
  26. #include "avutil.h"
  27. #include "avstring.h"
  28. #include "opt.h"
  29. #include "eval.h"
  30. //FIXME order them and do a bin search
  31. const AVOption *av_find_opt(void *v, const char *name, const char *unit, int mask, int flags)
  32. {
  33. const AVOption *o = NULL;
  34. while ((o = av_next_option(v, o))) {
  35. if (!strcmp(o->name, name) && (!unit || (o->unit && !strcmp(o->unit, unit))) && (o->flags & mask) == flags)
  36. return o;
  37. }
  38. return NULL;
  39. }
  40. const AVOption *av_next_option(void *obj, const AVOption *last)
  41. {
  42. if (last && last[1].name) return ++last;
  43. else if (last || !(*(AVClass**)obj)->option->name) return NULL;
  44. else return (*(AVClass**)obj)->option;
  45. }
  46. static int av_set_number2(void *obj, const char *name, double num, int den, int64_t intnum, const AVOption **o_out)
  47. {
  48. const AVOption *o= av_find_opt(obj, name, NULL, 0, 0);
  49. void *dst;
  50. if (o_out)
  51. *o_out= o;
  52. if (!o || o->offset<=0)
  53. return AVERROR_OPTION_NOT_FOUND;
  54. if (o->max*den < num*intnum || o->min*den > num*intnum) {
  55. av_log(obj, AV_LOG_ERROR, "Value %lf for parameter '%s' out of range\n", num, name);
  56. return AVERROR(ERANGE);
  57. }
  58. dst= ((uint8_t*)obj) + o->offset;
  59. switch (o->type) {
  60. case FF_OPT_TYPE_FLAGS:
  61. case FF_OPT_TYPE_INT: *(int *)dst= llrint(num/den)*intnum; break;
  62. case FF_OPT_TYPE_INT64: *(int64_t *)dst= llrint(num/den)*intnum; break;
  63. case FF_OPT_TYPE_FLOAT: *(float *)dst= num*intnum/den; break;
  64. case FF_OPT_TYPE_DOUBLE:*(double *)dst= num*intnum/den; break;
  65. case FF_OPT_TYPE_RATIONAL:
  66. if ((int)num == num) *(AVRational*)dst= (AVRational){num*intnum, den};
  67. else *(AVRational*)dst= av_d2q(num*intnum/den, 1<<24);
  68. break;
  69. default:
  70. return AVERROR(EINVAL);
  71. }
  72. return 0;
  73. }
  74. static const AVOption *av_set_number(void *obj, const char *name, double num, int den, int64_t intnum)
  75. {
  76. const AVOption *o = NULL;
  77. if (av_set_number2(obj, name, num, den, intnum, &o) < 0)
  78. return NULL;
  79. else
  80. return o;
  81. }
  82. static const double const_values[] = {
  83. M_PI,
  84. M_E,
  85. FF_QP2LAMBDA,
  86. 0
  87. };
  88. static const char * const const_names[] = {
  89. "PI",
  90. "E",
  91. "QP2LAMBDA",
  92. 0
  93. };
  94. static int hexchar2int(char c) {
  95. if (c >= '0' && c <= '9') return c - '0';
  96. if (c >= 'a' && c <= 'f') return c - 'a' + 10;
  97. if (c >= 'A' && c <= 'F') return c - 'A' + 10;
  98. return -1;
  99. }
  100. int av_set_string3(void *obj, const char *name, const char *val, int alloc, const AVOption **o_out)
  101. {
  102. int ret;
  103. const AVOption *o= av_find_opt(obj, name, NULL, 0, 0);
  104. if (o_out)
  105. *o_out = o;
  106. if (!o)
  107. return AVERROR_OPTION_NOT_FOUND;
  108. if ((!val && o->type != FF_OPT_TYPE_STRING) || o->offset<=0)
  109. return AVERROR(EINVAL);
  110. if (o->type == FF_OPT_TYPE_BINARY) {
  111. uint8_t **dst = (uint8_t **)(((uint8_t*)obj) + o->offset);
  112. int *lendst = (int *)(dst + 1);
  113. uint8_t *bin, *ptr;
  114. int len = strlen(val);
  115. av_freep(dst);
  116. *lendst = 0;
  117. if (len & 1) return AVERROR(EINVAL);
  118. len /= 2;
  119. ptr = bin = av_malloc(len);
  120. while (*val) {
  121. int a = hexchar2int(*val++);
  122. int b = hexchar2int(*val++);
  123. if (a < 0 || b < 0) {
  124. av_free(bin);
  125. return AVERROR(EINVAL);
  126. }
  127. *ptr++ = (a << 4) | b;
  128. }
  129. *dst = bin;
  130. *lendst = len;
  131. return 0;
  132. }
  133. if (o->type != FF_OPT_TYPE_STRING) {
  134. int notfirst=0;
  135. for (;;) {
  136. int i;
  137. char buf[256];
  138. int cmd=0;
  139. double d;
  140. if (*val == '+' || *val == '-')
  141. cmd= *(val++);
  142. for (i=0; i<sizeof(buf)-1 && val[i] && val[i]!='+' && val[i]!='-'; i++)
  143. buf[i]= val[i];
  144. buf[i]=0;
  145. {
  146. const AVOption *o_named= av_find_opt(obj, buf, o->unit, 0, 0);
  147. if (o_named && o_named->type == FF_OPT_TYPE_CONST)
  148. d= o_named->default_val.dbl;
  149. else if (!strcmp(buf, "default")) d= o->default_val.dbl;
  150. else if (!strcmp(buf, "max" )) d= o->max;
  151. else if (!strcmp(buf, "min" )) d= o->min;
  152. else if (!strcmp(buf, "none" )) d= 0;
  153. else if (!strcmp(buf, "all" )) d= ~0;
  154. else {
  155. int res = av_expr_parse_and_eval(&d, buf, const_names, const_values, NULL, NULL, NULL, NULL, NULL, 0, obj);
  156. if (res < 0) {
  157. av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\"\n", val);
  158. return res;
  159. }
  160. }
  161. }
  162. if (o->type == FF_OPT_TYPE_FLAGS) {
  163. if (cmd=='+') d= av_get_int(obj, name, NULL) | (int64_t)d;
  164. else if (cmd=='-') d= av_get_int(obj, name, NULL) &~(int64_t)d;
  165. } else {
  166. if (cmd=='+') d= notfirst*av_get_double(obj, name, NULL) + d;
  167. else if (cmd=='-') d= notfirst*av_get_double(obj, name, NULL) - d;
  168. }
  169. if ((ret = av_set_number2(obj, name, d, 1, 1, o_out)) < 0)
  170. return ret;
  171. val+= i;
  172. if (!*val)
  173. return 0;
  174. notfirst=1;
  175. }
  176. return AVERROR(EINVAL);
  177. }
  178. if (alloc) {
  179. av_free(*(void**)(((uint8_t*)obj) + o->offset));
  180. val= av_strdup(val);
  181. }
  182. memcpy(((uint8_t*)obj) + o->offset, &val, sizeof(val));
  183. return 0;
  184. }
  185. const AVOption *av_set_double(void *obj, const char *name, double n)
  186. {
  187. return av_set_number(obj, name, n, 1, 1);
  188. }
  189. const AVOption *av_set_q(void *obj, const char *name, AVRational n)
  190. {
  191. return av_set_number(obj, name, n.num, n.den, 1);
  192. }
  193. const AVOption *av_set_int(void *obj, const char *name, int64_t n)
  194. {
  195. return av_set_number(obj, name, 1, 1, n);
  196. }
  197. /**
  198. *
  199. * @param buf a buffer which is used for returning non string values as strings, can be NULL
  200. * @param buf_len allocated length in bytes of buf
  201. */
  202. const char *av_get_string(void *obj, const char *name, const AVOption **o_out, char *buf, int buf_len)
  203. {
  204. const AVOption *o= av_find_opt(obj, name, NULL, 0, 0);
  205. void *dst;
  206. uint8_t *bin;
  207. int len, i;
  208. if (!o || o->offset<=0)
  209. return NULL;
  210. if (o->type != FF_OPT_TYPE_STRING && (!buf || !buf_len))
  211. return NULL;
  212. dst= ((uint8_t*)obj) + o->offset;
  213. if (o_out) *o_out= o;
  214. switch (o->type) {
  215. case FF_OPT_TYPE_FLAGS: snprintf(buf, buf_len, "0x%08X",*(int *)dst);break;
  216. case FF_OPT_TYPE_INT: snprintf(buf, buf_len, "%d" , *(int *)dst);break;
  217. case FF_OPT_TYPE_INT64: snprintf(buf, buf_len, "%"PRId64, *(int64_t*)dst);break;
  218. case FF_OPT_TYPE_FLOAT: snprintf(buf, buf_len, "%f" , *(float *)dst);break;
  219. case FF_OPT_TYPE_DOUBLE: snprintf(buf, buf_len, "%f" , *(double *)dst);break;
  220. case FF_OPT_TYPE_RATIONAL: snprintf(buf, buf_len, "%d/%d", ((AVRational*)dst)->num, ((AVRational*)dst)->den);break;
  221. case FF_OPT_TYPE_STRING: return *(void**)dst;
  222. case FF_OPT_TYPE_BINARY:
  223. len = *(int*)(((uint8_t *)dst) + sizeof(uint8_t *));
  224. if (len >= (buf_len + 1)/2) return NULL;
  225. bin = *(uint8_t**)dst;
  226. for (i = 0; i < len; i++) snprintf(buf + i*2, 3, "%02X", bin[i]);
  227. break;
  228. default: return NULL;
  229. }
  230. return buf;
  231. }
  232. static int av_get_number(void *obj, const char *name, const AVOption **o_out, double *num, int *den, int64_t *intnum)
  233. {
  234. const AVOption *o= av_find_opt(obj, name, NULL, 0, 0);
  235. void *dst;
  236. if (!o || (o->offset<=0 && o->type != FF_OPT_TYPE_CONST))
  237. goto error;
  238. dst= ((uint8_t*)obj) + o->offset;
  239. if (o_out) *o_out= o;
  240. switch (o->type) {
  241. case FF_OPT_TYPE_FLAGS: *intnum= *(unsigned int*)dst;return 0;
  242. case FF_OPT_TYPE_INT: *intnum= *(int *)dst;return 0;
  243. case FF_OPT_TYPE_INT64: *intnum= *(int64_t*)dst;return 0;
  244. case FF_OPT_TYPE_FLOAT: *num= *(float *)dst;return 0;
  245. case FF_OPT_TYPE_DOUBLE: *num= *(double *)dst;return 0;
  246. case FF_OPT_TYPE_RATIONAL: *intnum= ((AVRational*)dst)->num;
  247. *den = ((AVRational*)dst)->den;
  248. return 0;
  249. case FF_OPT_TYPE_CONST: *intnum= o->default_val.dbl;return 0;
  250. }
  251. error:
  252. *den=*intnum=0;
  253. return -1;
  254. }
  255. double av_get_double(void *obj, const char *name, const AVOption **o_out)
  256. {
  257. int64_t intnum=1;
  258. double num=1;
  259. int den=1;
  260. if (av_get_number(obj, name, o_out, &num, &den, &intnum) < 0)
  261. return NAN;
  262. return num*intnum/den;
  263. }
  264. AVRational av_get_q(void *obj, const char *name, const AVOption **o_out)
  265. {
  266. int64_t intnum=1;
  267. double num=1;
  268. int den=1;
  269. if (av_get_number(obj, name, o_out, &num, &den, &intnum) < 0)
  270. return (AVRational){0, 0};
  271. if (num == 1.0 && (int)intnum == intnum)
  272. return (AVRational){intnum, den};
  273. else
  274. return av_d2q(num*intnum/den, 1<<24);
  275. }
  276. int64_t av_get_int(void *obj, const char *name, const AVOption **o_out)
  277. {
  278. int64_t intnum=1;
  279. double num=1;
  280. int den=1;
  281. if (av_get_number(obj, name, o_out, &num, &den, &intnum) < 0)
  282. return -1;
  283. return num*intnum/den;
  284. }
  285. static void opt_list(void *obj, void *av_log_obj, const char *unit,
  286. int req_flags, int rej_flags)
  287. {
  288. const AVOption *opt=NULL;
  289. while ((opt= av_next_option(obj, opt))) {
  290. if (!(opt->flags & req_flags) || (opt->flags & rej_flags))
  291. continue;
  292. /* Don't print CONST's on level one.
  293. * Don't print anything but CONST's on level two.
  294. * Only print items from the requested unit.
  295. */
  296. if (!unit && opt->type==FF_OPT_TYPE_CONST)
  297. continue;
  298. else if (unit && opt->type!=FF_OPT_TYPE_CONST)
  299. continue;
  300. else if (unit && opt->type==FF_OPT_TYPE_CONST && strcmp(unit, opt->unit))
  301. continue;
  302. else if (unit && opt->type == FF_OPT_TYPE_CONST)
  303. av_log(av_log_obj, AV_LOG_INFO, " %-15s ", opt->name);
  304. else
  305. av_log(av_log_obj, AV_LOG_INFO, "-%-17s ", opt->name);
  306. switch (opt->type) {
  307. case FF_OPT_TYPE_FLAGS:
  308. av_log(av_log_obj, AV_LOG_INFO, "%-7s ", "<flags>");
  309. break;
  310. case FF_OPT_TYPE_INT:
  311. av_log(av_log_obj, AV_LOG_INFO, "%-7s ", "<int>");
  312. break;
  313. case FF_OPT_TYPE_INT64:
  314. av_log(av_log_obj, AV_LOG_INFO, "%-7s ", "<int64>");
  315. break;
  316. case FF_OPT_TYPE_DOUBLE:
  317. av_log(av_log_obj, AV_LOG_INFO, "%-7s ", "<double>");
  318. break;
  319. case FF_OPT_TYPE_FLOAT:
  320. av_log(av_log_obj, AV_LOG_INFO, "%-7s ", "<float>");
  321. break;
  322. case FF_OPT_TYPE_STRING:
  323. av_log(av_log_obj, AV_LOG_INFO, "%-7s ", "<string>");
  324. break;
  325. case FF_OPT_TYPE_RATIONAL:
  326. av_log(av_log_obj, AV_LOG_INFO, "%-7s ", "<rational>");
  327. break;
  328. case FF_OPT_TYPE_BINARY:
  329. av_log(av_log_obj, AV_LOG_INFO, "%-7s ", "<binary>");
  330. break;
  331. case FF_OPT_TYPE_CONST:
  332. default:
  333. av_log(av_log_obj, AV_LOG_INFO, "%-7s ", "");
  334. break;
  335. }
  336. av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_ENCODING_PARAM) ? 'E' : '.');
  337. av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_DECODING_PARAM) ? 'D' : '.');
  338. av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_VIDEO_PARAM ) ? 'V' : '.');
  339. av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_AUDIO_PARAM ) ? 'A' : '.');
  340. av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_SUBTITLE_PARAM) ? 'S' : '.');
  341. if (opt->help)
  342. av_log(av_log_obj, AV_LOG_INFO, " %s", opt->help);
  343. av_log(av_log_obj, AV_LOG_INFO, "\n");
  344. if (opt->unit && opt->type != FF_OPT_TYPE_CONST) {
  345. opt_list(obj, av_log_obj, opt->unit, req_flags, rej_flags);
  346. }
  347. }
  348. }
  349. int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags)
  350. {
  351. if (!obj)
  352. return -1;
  353. av_log(av_log_obj, AV_LOG_INFO, "%s AVOptions:\n", (*(AVClass**)obj)->class_name);
  354. opt_list(obj, av_log_obj, NULL, req_flags, rej_flags);
  355. return 0;
  356. }
  357. /** Set the values of the AVCodecContext or AVFormatContext structure.
  358. * They are set to the defaults specified in the according AVOption options
  359. * array default_val field.
  360. *
  361. * @param s AVCodecContext or AVFormatContext for which the defaults will be set
  362. */
  363. void av_opt_set_defaults2(void *s, int mask, int flags)
  364. {
  365. const AVOption *opt = NULL;
  366. while ((opt = av_next_option(s, opt)) != NULL) {
  367. if ((opt->flags & mask) != flags)
  368. continue;
  369. switch (opt->type) {
  370. case FF_OPT_TYPE_CONST:
  371. /* Nothing to be done here */
  372. break;
  373. case FF_OPT_TYPE_FLAGS:
  374. case FF_OPT_TYPE_INT: {
  375. int val;
  376. val = opt->default_val.dbl;
  377. av_set_int(s, opt->name, val);
  378. }
  379. break;
  380. case FF_OPT_TYPE_INT64:
  381. if ((double)(opt->default_val.dbl+0.6) == opt->default_val.dbl)
  382. av_log(s, AV_LOG_DEBUG, "loss of precision in default of %s\n", opt->name);
  383. av_set_int(s, opt->name, opt->default_val.dbl);
  384. break;
  385. case FF_OPT_TYPE_DOUBLE:
  386. case FF_OPT_TYPE_FLOAT: {
  387. double val;
  388. val = opt->default_val.dbl;
  389. av_set_double(s, opt->name, val);
  390. }
  391. break;
  392. case FF_OPT_TYPE_RATIONAL: {
  393. AVRational val;
  394. val = av_d2q(opt->default_val.dbl, INT_MAX);
  395. av_set_q(s, opt->name, val);
  396. }
  397. break;
  398. case FF_OPT_TYPE_STRING:
  399. av_set_string3(s, opt->name, opt->default_val.str, 1, NULL);
  400. break;
  401. case FF_OPT_TYPE_BINARY:
  402. /* Cannot set default for binary */
  403. break;
  404. default:
  405. av_log(s, AV_LOG_DEBUG, "AVOption type %d of option %s not implemented yet\n", opt->type, opt->name);
  406. }
  407. }
  408. }
  409. void av_opt_set_defaults(void *s)
  410. {
  411. av_opt_set_defaults2(s, 0, 0);
  412. }
  413. /**
  414. * Store the value in the field in ctx that is named like key.
  415. * ctx must be an AVClass context, storing is done using AVOptions.
  416. *
  417. * @param buf the string to parse, buf will be updated to point at the
  418. * separator just after the parsed key/value pair
  419. * @param key_val_sep a 0-terminated list of characters used to
  420. * separate key from value
  421. * @param pairs_sep a 0-terminated list of characters used to separate
  422. * two pairs from each other
  423. * @return 0 if the key/value pair has been successfully parsed and
  424. * set, or a negative value corresponding to an AVERROR code in case
  425. * of error:
  426. * AVERROR(EINVAL) if the key/value pair cannot be parsed,
  427. * the error code issued by av_set_string3() if the key/value pair
  428. * cannot be set
  429. */
  430. static int parse_key_value_pair(void *ctx, const char **buf,
  431. const char *key_val_sep, const char *pairs_sep)
  432. {
  433. char *key = av_get_token(buf, key_val_sep);
  434. char *val;
  435. int ret;
  436. if (*key && strspn(*buf, key_val_sep)) {
  437. (*buf)++;
  438. val = av_get_token(buf, pairs_sep);
  439. } else {
  440. av_log(ctx, AV_LOG_ERROR, "Missing key or no key/value separator found after key '%s'\n", key);
  441. av_free(key);
  442. return AVERROR(EINVAL);
  443. }
  444. av_log(ctx, AV_LOG_DEBUG, "Setting value '%s' for key '%s'\n", val, key);
  445. ret = av_set_string3(ctx, key, val, 1, NULL);
  446. if (ret == AVERROR_OPTION_NOT_FOUND)
  447. av_log(ctx, AV_LOG_ERROR, "Key '%s' not found.\n", key);
  448. av_free(key);
  449. av_free(val);
  450. return ret;
  451. }
  452. int av_set_options_string(void *ctx, const char *opts,
  453. const char *key_val_sep, const char *pairs_sep)
  454. {
  455. int ret, count = 0;
  456. while (*opts) {
  457. if ((ret = parse_key_value_pair(ctx, &opts, key_val_sep, pairs_sep)) < 0)
  458. return ret;
  459. count++;
  460. if (*opts)
  461. opts++;
  462. }
  463. return count;
  464. }
  465. #ifdef TEST
  466. #undef printf
  467. typedef struct TestContext
  468. {
  469. const AVClass *class;
  470. int num;
  471. int toggle;
  472. char *string;
  473. int flags;
  474. AVRational rational;
  475. } TestContext;
  476. #define OFFSET(x) offsetof(TestContext, x)
  477. #define TEST_FLAG_COOL 01
  478. #define TEST_FLAG_LAME 02
  479. #define TEST_FLAG_MU 04
  480. static const AVOption test_options[]= {
  481. {"num", "set num", OFFSET(num), FF_OPT_TYPE_INT, 0, 0, 100 },
  482. {"toggle", "set toggle", OFFSET(toggle), FF_OPT_TYPE_INT, 0, 0, 1 },
  483. {"rational", "set rational", OFFSET(rational), FF_OPT_TYPE_RATIONAL, 0, 0, 10 },
  484. {"string", "set string", OFFSET(string), FF_OPT_TYPE_STRING, 0, CHAR_MIN, CHAR_MAX },
  485. {"flags", "set flags", OFFSET(flags), FF_OPT_TYPE_FLAGS, 0, 0, INT_MAX, 0, "flags" },
  486. {"cool", "set cool flag ", 0, FF_OPT_TYPE_CONST, TEST_FLAG_COOL, INT_MIN, INT_MAX, 0, "flags" },
  487. {"lame", "set lame flag ", 0, FF_OPT_TYPE_CONST, TEST_FLAG_LAME, INT_MIN, INT_MAX, 0, "flags" },
  488. {"mu", "set mu flag ", 0, FF_OPT_TYPE_CONST, TEST_FLAG_MU, INT_MIN, INT_MAX, 0, "flags" },
  489. {NULL},
  490. };
  491. static const char *test_get_name(void *ctx)
  492. {
  493. return "test";
  494. }
  495. static const AVClass test_class = {
  496. "TestContext",
  497. test_get_name,
  498. test_options
  499. };
  500. int main(void)
  501. {
  502. int i;
  503. printf("\nTesting av_set_options_string()\n");
  504. {
  505. TestContext test_ctx;
  506. const char *options[] = {
  507. "",
  508. ":",
  509. "=",
  510. "foo=:",
  511. ":=foo",
  512. "=foo",
  513. "foo=",
  514. "foo",
  515. "foo=val",
  516. "foo==val",
  517. "toggle=:",
  518. "string=:",
  519. "toggle=1 : foo",
  520. "toggle=100",
  521. "toggle==1",
  522. "flags=+mu-lame : num=42: toggle=0",
  523. "num=42 : string=blahblah",
  524. "rational=0 : rational=1/2 : rational=1/-1",
  525. "rational=-1/0",
  526. };
  527. test_ctx.class = &test_class;
  528. av_opt_set_defaults2(&test_ctx, 0, 0);
  529. test_ctx.string = av_strdup("default");
  530. av_log_set_level(AV_LOG_DEBUG);
  531. for (i=0; i < FF_ARRAY_ELEMS(options); i++) {
  532. av_log(&test_ctx, AV_LOG_DEBUG, "Setting options string '%s'\n", options[i]);
  533. if (av_set_options_string(&test_ctx, options[i], "=", ":") < 0)
  534. av_log(&test_ctx, AV_LOG_ERROR, "Error setting options string: '%s'\n", options[i]);
  535. printf("\n");
  536. }
  537. }
  538. return 0;
  539. }
  540. #endif