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.

609 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) 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. av_get_number(obj, name, o_out, &num, &den, &intnum);
  261. return num*intnum/den;
  262. }
  263. AVRational av_get_q(void *obj, const char *name, const AVOption **o_out)
  264. {
  265. int64_t intnum=1;
  266. double num=1;
  267. int den=1;
  268. av_get_number(obj, name, o_out, &num, &den, &intnum);
  269. if (num == 1.0 && (int)intnum == intnum)
  270. return (AVRational){intnum, den};
  271. else
  272. return av_d2q(num*intnum/den, 1<<24);
  273. }
  274. int64_t av_get_int(void *obj, const char *name, const AVOption **o_out)
  275. {
  276. int64_t intnum=1;
  277. double num=1;
  278. int den=1;
  279. if (av_get_number(obj, name, o_out, &num, &den, &intnum) < 0)
  280. return -1;
  281. return num*intnum/den;
  282. }
  283. static void opt_list(void *obj, void *av_log_obj, const char *unit,
  284. int req_flags, int rej_flags)
  285. {
  286. const AVOption *opt=NULL;
  287. while ((opt= av_next_option(obj, opt))) {
  288. if (!(opt->flags & req_flags) || (opt->flags & rej_flags))
  289. continue;
  290. /* Don't print CONST's on level one.
  291. * Don't print anything but CONST's on level two.
  292. * Only print items from the requested unit.
  293. */
  294. if (!unit && opt->type==FF_OPT_TYPE_CONST)
  295. continue;
  296. else if (unit && opt->type!=FF_OPT_TYPE_CONST)
  297. continue;
  298. else if (unit && opt->type==FF_OPT_TYPE_CONST && strcmp(unit, opt->unit))
  299. continue;
  300. else if (unit && opt->type == FF_OPT_TYPE_CONST)
  301. av_log(av_log_obj, AV_LOG_INFO, " %-15s ", opt->name);
  302. else
  303. av_log(av_log_obj, AV_LOG_INFO, "-%-17s ", opt->name);
  304. switch (opt->type) {
  305. case FF_OPT_TYPE_FLAGS:
  306. av_log(av_log_obj, AV_LOG_INFO, "%-7s ", "<flags>");
  307. break;
  308. case FF_OPT_TYPE_INT:
  309. av_log(av_log_obj, AV_LOG_INFO, "%-7s ", "<int>");
  310. break;
  311. case FF_OPT_TYPE_INT64:
  312. av_log(av_log_obj, AV_LOG_INFO, "%-7s ", "<int64>");
  313. break;
  314. case FF_OPT_TYPE_DOUBLE:
  315. av_log(av_log_obj, AV_LOG_INFO, "%-7s ", "<double>");
  316. break;
  317. case FF_OPT_TYPE_FLOAT:
  318. av_log(av_log_obj, AV_LOG_INFO, "%-7s ", "<float>");
  319. break;
  320. case FF_OPT_TYPE_STRING:
  321. av_log(av_log_obj, AV_LOG_INFO, "%-7s ", "<string>");
  322. break;
  323. case FF_OPT_TYPE_RATIONAL:
  324. av_log(av_log_obj, AV_LOG_INFO, "%-7s ", "<rational>");
  325. break;
  326. case FF_OPT_TYPE_BINARY:
  327. av_log(av_log_obj, AV_LOG_INFO, "%-7s ", "<binary>");
  328. break;
  329. case FF_OPT_TYPE_CONST:
  330. default:
  331. av_log(av_log_obj, AV_LOG_INFO, "%-7s ", "");
  332. break;
  333. }
  334. av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_ENCODING_PARAM) ? 'E' : '.');
  335. av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_DECODING_PARAM) ? 'D' : '.');
  336. av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_VIDEO_PARAM ) ? 'V' : '.');
  337. av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_AUDIO_PARAM ) ? 'A' : '.');
  338. av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_SUBTITLE_PARAM) ? 'S' : '.');
  339. if (opt->help)
  340. av_log(av_log_obj, AV_LOG_INFO, " %s", opt->help);
  341. av_log(av_log_obj, AV_LOG_INFO, "\n");
  342. if (opt->unit && opt->type != FF_OPT_TYPE_CONST) {
  343. opt_list(obj, av_log_obj, opt->unit, req_flags, rej_flags);
  344. }
  345. }
  346. }
  347. int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags)
  348. {
  349. if (!obj)
  350. return -1;
  351. av_log(av_log_obj, AV_LOG_INFO, "%s AVOptions:\n", (*(AVClass**)obj)->class_name);
  352. opt_list(obj, av_log_obj, NULL, req_flags, rej_flags);
  353. return 0;
  354. }
  355. /** Set the values of the AVCodecContext or AVFormatContext structure.
  356. * They are set to the defaults specified in the according AVOption options
  357. * array default_val field.
  358. *
  359. * @param s AVCodecContext or AVFormatContext for which the defaults will be set
  360. */
  361. void av_opt_set_defaults2(void *s, int mask, int flags)
  362. {
  363. const AVOption *opt = NULL;
  364. while ((opt = av_next_option(s, opt)) != NULL) {
  365. if ((opt->flags & mask) != flags)
  366. continue;
  367. switch (opt->type) {
  368. case FF_OPT_TYPE_CONST:
  369. /* Nothing to be done here */
  370. break;
  371. case FF_OPT_TYPE_FLAGS:
  372. case FF_OPT_TYPE_INT: {
  373. int val;
  374. val = opt->default_val.dbl;
  375. av_set_int(s, opt->name, val);
  376. }
  377. break;
  378. case FF_OPT_TYPE_INT64:
  379. if ((double)(opt->default_val.dbl+0.6) == opt->default_val.dbl)
  380. av_log(s, AV_LOG_DEBUG, "loss of precision in default of %s\n", opt->name);
  381. av_set_int(s, opt->name, opt->default_val.dbl);
  382. break;
  383. case FF_OPT_TYPE_DOUBLE:
  384. case FF_OPT_TYPE_FLOAT: {
  385. double val;
  386. val = opt->default_val.dbl;
  387. av_set_double(s, opt->name, val);
  388. }
  389. break;
  390. case FF_OPT_TYPE_RATIONAL: {
  391. AVRational val;
  392. val = av_d2q(opt->default_val.dbl, INT_MAX);
  393. av_set_q(s, opt->name, val);
  394. }
  395. break;
  396. case FF_OPT_TYPE_STRING:
  397. case FF_OPT_TYPE_BINARY:
  398. /* Cannot set default for string as default_val is of type * double */
  399. break;
  400. default:
  401. av_log(s, AV_LOG_DEBUG, "AVOption type %d of option %s not implemented yet\n", opt->type, opt->name);
  402. }
  403. }
  404. }
  405. void av_opt_set_defaults(void *s)
  406. {
  407. av_opt_set_defaults2(s, 0, 0);
  408. }
  409. /**
  410. * Store the value in the field in ctx that is named like key.
  411. * ctx must be an AVClass context, storing is done using AVOptions.
  412. *
  413. * @param buf the string to parse, buf will be updated to point at the
  414. * separator just after the parsed key/value pair
  415. * @param key_val_sep a 0-terminated list of characters used to
  416. * separate key from value
  417. * @param pairs_sep a 0-terminated list of characters used to separate
  418. * two pairs from each other
  419. * @return 0 if the key/value pair has been successfully parsed and
  420. * set, or a negative value corresponding to an AVERROR code in case
  421. * of error:
  422. * AVERROR(EINVAL) if the key/value pair cannot be parsed,
  423. * the error code issued by av_set_string3() if the key/value pair
  424. * cannot be set
  425. */
  426. static int parse_key_value_pair(void *ctx, const char **buf,
  427. const char *key_val_sep, const char *pairs_sep)
  428. {
  429. char *key = av_get_token(buf, key_val_sep);
  430. char *val;
  431. int ret;
  432. if (*key && strspn(*buf, key_val_sep)) {
  433. (*buf)++;
  434. val = av_get_token(buf, pairs_sep);
  435. } else {
  436. av_log(ctx, AV_LOG_ERROR, "Missing key or no key/value separator found after key '%s'\n", key);
  437. av_free(key);
  438. return AVERROR(EINVAL);
  439. }
  440. av_log(ctx, AV_LOG_DEBUG, "Setting value '%s' for key '%s'\n", val, key);
  441. ret = av_set_string3(ctx, key, val, 1, NULL);
  442. if (ret == AVERROR_OPTION_NOT_FOUND)
  443. av_log(ctx, AV_LOG_ERROR, "Key '%s' not found.\n", key);
  444. av_free(key);
  445. av_free(val);
  446. return ret;
  447. }
  448. int av_set_options_string(void *ctx, const char *opts,
  449. const char *key_val_sep, const char *pairs_sep)
  450. {
  451. int ret, count = 0;
  452. while (*opts) {
  453. if ((ret = parse_key_value_pair(ctx, &opts, key_val_sep, pairs_sep)) < 0)
  454. return ret;
  455. count++;
  456. if (*opts)
  457. opts++;
  458. }
  459. return count;
  460. }
  461. #ifdef TEST
  462. #undef printf
  463. typedef struct TestContext
  464. {
  465. const AVClass *class;
  466. int num;
  467. int toggle;
  468. char *string;
  469. int flags;
  470. AVRational rational;
  471. } TestContext;
  472. #define OFFSET(x) offsetof(TestContext, x)
  473. #define TEST_FLAG_COOL 01
  474. #define TEST_FLAG_LAME 02
  475. #define TEST_FLAG_MU 04
  476. static const AVOption test_options[]= {
  477. {"num", "set num", OFFSET(num), FF_OPT_TYPE_INT, 0, 0, 100 },
  478. {"toggle", "set toggle", OFFSET(toggle), FF_OPT_TYPE_INT, 0, 0, 1 },
  479. {"rational", "set rational", OFFSET(rational), FF_OPT_TYPE_RATIONAL, 0, 0, 10 },
  480. {"string", "set string", OFFSET(string), FF_OPT_TYPE_STRING, 0, CHAR_MIN, CHAR_MAX },
  481. {"flags", "set flags", OFFSET(flags), FF_OPT_TYPE_FLAGS, 0, 0, INT_MAX, 0, "flags" },
  482. {"cool", "set cool flag ", 0, FF_OPT_TYPE_CONST, TEST_FLAG_COOL, INT_MIN, INT_MAX, 0, "flags" },
  483. {"lame", "set lame flag ", 0, FF_OPT_TYPE_CONST, TEST_FLAG_LAME, INT_MIN, INT_MAX, 0, "flags" },
  484. {"mu", "set mu flag ", 0, FF_OPT_TYPE_CONST, TEST_FLAG_MU, INT_MIN, INT_MAX, 0, "flags" },
  485. {NULL},
  486. };
  487. static const char *test_get_name(void *ctx)
  488. {
  489. return "test";
  490. }
  491. static const AVClass test_class = {
  492. "TestContext",
  493. test_get_name,
  494. test_options
  495. };
  496. int main(void)
  497. {
  498. int i;
  499. printf("\nTesting av_set_options_string()\n");
  500. {
  501. TestContext test_ctx;
  502. const char *options[] = {
  503. "",
  504. ":",
  505. "=",
  506. "foo=:",
  507. ":=foo",
  508. "=foo",
  509. "foo=",
  510. "foo",
  511. "foo=val",
  512. "foo==val",
  513. "toggle=:",
  514. "string=:",
  515. "toggle=1 : foo",
  516. "toggle=100",
  517. "toggle==1",
  518. "flags=+mu-lame : num=42: toggle=0",
  519. "num=42 : string=blahblah",
  520. "rational=0 : rational=1/2 : rational=1/-1",
  521. "rational=-1/0",
  522. };
  523. test_ctx.class = &test_class;
  524. av_opt_set_defaults2(&test_ctx, 0, 0);
  525. test_ctx.string = av_strdup("default");
  526. av_log_set_level(AV_LOG_DEBUG);
  527. for (i=0; i < FF_ARRAY_ELEMS(options); i++) {
  528. av_log(&test_ctx, AV_LOG_DEBUG, "Setting options string '%s'\n", options[i]);
  529. if (av_set_options_string(&test_ctx, options[i], "=", ":") < 0)
  530. av_log(&test_ctx, AV_LOG_ERROR, "Error setting options string: '%s'\n", options[i]);
  531. printf("\n");
  532. }
  533. }
  534. return 0;
  535. }
  536. #endif