aboutsummaryrefslogtreecommitdiffstats
path: root/cmdutils.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2011-08-29 07:54:56 +0200
committerAnton Khirnov <anton@khirnov.net>2011-09-04 13:12:00 +0200
commit6361c5e1e61033259e91b480f23ae81bed775c8b (patch)
tree5aa1a4981835e2a49e09d20eb9a58fefb8d4979f /cmdutils.c
parent2f8e586df14649ebf1538dc610928c844e0068ec (diff)
downloadffmpeg-6361c5e1e61033259e91b480f23ae81bed775c8b.tar.gz
cmdutils: allow storing per-stream/chapter/.... options in a generic way
Diffstat (limited to 'cmdutils.c')
-rw-r--r--cmdutils.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/cmdutils.c b/cmdutils.c
index 1eed404647..6c64d47d01 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -207,6 +207,7 @@ int parse_option(void *optctx, const char *opt, const char *arg, const OptionDef
{
const OptionDef *po;
int bool_val = 1;
+ int *dstcount;
void *dst;
po = find_option(options, opt);
@@ -231,7 +232,17 @@ unknown_opt:
/* new-style options contain an offset into optctx, old-style address of
* a global var*/
- dst = po->flags & (OPT_OFFSET) ? (uint8_t*)optctx + po->u.off : po->u.dst_ptr;
+ dst = po->flags & (OPT_OFFSET|OPT_SPEC) ? (uint8_t*)optctx + po->u.off : po->u.dst_ptr;
+
+ if (po->flags & OPT_SPEC) {
+ SpecifierOpt **so = dst;
+ char *p = strchr(opt, ':');
+
+ dstcount = (int*)(so + 1);
+ *so = grow_array(*so, sizeof(**so), dstcount, *dstcount + 1);
+ (*so)[*dstcount - 1].specifier = av_strdup(p ? p + 1 : "");
+ dst = &(*so)[*dstcount - 1].u;
+ }
if (po->flags & OPT_STRING) {
char *str;