3 * Copyright (c) 2012 Nicolas George
5 * This file is part of FFmpeg.
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public License
9 * as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
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
15 * GNU Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with FFmpeg; if not, write to the Free Software * Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 #include "libavutil/log.h"
25 #include "libavutil/opt.h"
27 #include "tee_common.h"
29 static const char *const slave_opt_open
= "[";
30 static const char *const slave_opt_close
= "]";
31 static const char *const slave_opt_delim
= ":]"; /* must have the close too */
33 int ff_tee_parse_slave_options(void *log
, char *slave
,
34 AVDictionary
**options
, char **filename
)
40 if (!strspn(slave
, slave_opt_open
)) {
45 if (strspn(p
, slave_opt_close
)) {
46 *filename
= (char *)p
+ 1;
50 ret
= av_opt_get_key_value(&p
, "=", slave_opt_delim
, 0, &key
, &val
);
52 av_log(log
, AV_LOG_ERROR
, "No option found near \"%s\"\n", p
);
55 ret
= av_dict_set(options
, key
, val
,
56 AV_DICT_DONT_STRDUP_KEY
| AV_DICT_DONT_STRDUP_VAL
);
59 if (strspn(p
, slave_opt_close
))
63 *filename
= (char *)p
+ 1;
67 av_dict_free(options
);