| 31 | static const char *const slave_opt_delim = ":]"; /* must have the close too */ |
| 32 | |
| 33 | int ff_tee_parse_slave_options(void *log, char *slave, |
| 34 | AVDictionary **options, char **filename) |
| 35 | { |
| 36 | const char *p; |
| 37 | char *key, *val; |
| 38 | int ret; |
| 39 | |
| 40 | if (!strspn(slave, slave_opt_open)) { |
| 41 | *filename = slave; |
| 42 | return 0; |
| 43 | } |
| 44 | p = slave + 1; |
| 45 | if (strspn(p, slave_opt_close)) { |
| 46 | *filename = (char *)p + 1; |
| 47 | return 0; |
| 48 | } |
| 49 | while (1) { |
| 50 | ret = av_opt_get_key_value(&p, "=", slave_opt_delim, 0, &key, &val); |
| 51 | if (ret < 0) { |
| 52 | av_log(log, AV_LOG_ERROR, "No option found near \"%s\"\n", p); |
| 53 | goto fail; |
| 54 | } |
| 55 | ret = av_dict_set(options, key, val, |
| 56 | AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL); |
| 57 | if (ret < 0) |
| 58 | goto fail; |
| 59 | if (strspn(p, slave_opt_close)) |
| 60 | break; |
| 61 | p++; |
| 62 | } |
| 63 | *filename = (char *)p + 1; |
| 64 | return 0; |
| 65 | |
| 66 | fail: |
| 67 | av_dict_free(options); |
| 68 | return ret; |
| 69 | } |
no test coverage detected