From 181c2de2ee3fa549f5d08e84cbcb4f9c951451c3 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 9 Dec 2019 12:23:24 +0100 Subject: [PATCH] parser: only recurse into CHOICE when 1 value Only try to collect the CHOICE value when there is only 1 value. This makes it possible to parse the complete choice as a SPA_Pod. --- spa/include/spa/pod/parser.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spa/include/spa/pod/parser.h b/spa/include/spa/pod/parser.h index f1bd8b435..59dcf1440 100644 --- a/spa/include/spa/pod/parser.h +++ b/spa/include/spa/pod/parser.h @@ -484,7 +484,8 @@ static inline int spa_pod_parser_getv(struct spa_pod_parser *parser, va_list arg } SPA_POD_PARSER_SKIP(*format, args); } else { - if (pod->type == SPA_TYPE_Choice && *format != 'V') + if (pod->type == SPA_TYPE_Choice && *format != 'V' && + SPA_POD_CHOICE_TYPE(pod) == SPA_CHOICE_None) pod = SPA_POD_CHOICE_CHILD(pod); SPA_POD_PARSER_COLLECT(pod, *format, args);