Bool scan_color(char *val, u32 *clr_prim, u32 *clr_tranf, u32 *clr_mx, Bool *clr_full_range)
{
	char *sep = strchr(val, ',');
	if (!sep) return GF_FALSE;
	sep[0] = 0;
	*clr_prim = gf_cicp_parse_color_primaries(val);
	sep[0] = ',';
	if (*clr_prim == (u32) -1) return GF_FALSE;
	val = sep+1;

	sep = strchr(val, ',');
	if (!sep) return GF_FALSE;
	sep[0] = 0;
	*clr_tranf = gf_cicp_parse_color_transfer(val);
	sep[0] = ',';
	if (*clr_tranf == (u32) -1) return GF_FALSE;
	val = sep+1;

	sep = strchr(val, ',');
	if (sep) sep[0] = 0;
	*clr_mx = gf_cicp_parse_color_matrix(val);
	if (sep) sep[0] = ',';
	if (*clr_mx == (u32) -1) return GF_FALSE;
	if (!sep) return GF_TRUE;

	val = sep+1;
	if (!strcmp(val, "yes") || !strcmp(val, "on")) {
		*clr_full_range = GF_TRUE;
		return GF_TRUE;
	}
	if (!strcmp(val, "no") || !strcmp(val, "off")) {
		*clr_full_range = GF_FALSE;
		return GF_TRUE;
	}

	if (sscanf(val, "%d", (s32*) clr_full_range) == 1)
		return GF_TRUE;

	return GF_FALSE;
}
Bool scan_color(char *val, u32 *clr_prim, u32 *clr_tranf, u32 *clr_mx, Bool *clr_full_range)
{
	char *sep = strchr(val, ',');
	if (!sep) return GF_FALSE;
	sep[0] = 0;
	*clr_prim = gf_cicp_parse_color_primaries(val);
	sep[0] = ',';
	if (*clr_prim == (u32) -1) return GF_FALSE;
	val = sep+1;

	sep = strchr(val, ',');
	if (!sep) return GF_FALSE;
	sep[0] = 0;
	*clr_tranf = gf_cicp_parse_color_transfer(val);
	sep[0] = ',';
	if (*clr_tranf == (u32) -1) return GF_FALSE;
	val = sep+1;

	sep = strchr(val, ',');
	if (sep) sep[0] = 0;
	*clr_mx = gf_cicp_parse_color_matrix(val);
	if (sep) sep[0] = ',';
	if (*clr_mx == (u32) -1) return GF_FALSE;
	if (!sep) return GF_TRUE;

	val = sep+1;
	if (!strcmp(val, "yes") || !strcmp(val, "on")) {
		*clr_full_range = GF_TRUE;
		return GF_TRUE;
	}
	if (!strcmp(val, "no") || !strcmp(val, "off")) {
		*clr_full_range = GF_FALSE;
		return GF_TRUE;
	}

	if (sscanf(val, "%d", (s32*) clr_full_range) == 1)
		return GF_TRUE;

	return GF_FALSE;
}