summaryrefslogtreecommitdiff
path: root/docs/random/caps_grammar
blob: a2c406214e2e8e51ecb2bc8a0e86bc96a3e7117c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54

Canonical caps/structure strings (those created by gst_caps_to_string()
and gst_structure_to_string()) do not have AUTO_VALUE.

Goals:
 - UTF-8 clean
 - SIMPLE_STRINGs should cover most simple cases that don't interfere
   with other parts of the gst_caps or gst_parse grammar
 - forward-parsed grammar
 - quoted strings handle backslash escaping as well as XML-style (&ack;)
   escaping

CAPS = STRUCTURE [ ';' STRUCTURE ]*

STRUCTURE = STRUCTURE_NAME [ ',' FIELD ]*

STRUCTURE_NAME = STRING

FIELD = FIELD_NAME '=' TYPED_VALUE

FIELD_NAME = SIMPLE_STRING

TYPED_VALUE = CANONICAL_VALUE | AUTO_VALUE

CANONICAL_VALUE = '{' TYPED_VALUE [ ',' TYPED_VALUE ]* '}'
                | '[' TYPED_VALUE ',' TYPED_VALUE ']'
                | '(' TYPE ')' VALUE

AUTO_VALUE = [-+]?[0-9][0-9]*
           | [-+]?[0-9][0-9]*[.][0-9]*[eE][-+][0-9]*
	   | STRING

VALUE = STRING

STRING = ["][^"]["]
       | ['][^'][']
       | SIMPLE_STRING

SIMPLE_STRING = [A-Za-z0-9_+-:./]+

TYPE = "int" | "i" | "float" | "f" | "double" | "d" | "fourcc" | "4"
     | "boolean" | "bool" | "b"
     | GTYPE


Canonical Examples:

"audio/raw"
"audio/raw", rate=(int)44100
"audio/raw", rate=(int)44100, signed=(boolean)true
"audio/raw", rate={ (int)44100, (int)48000 }
"audio/raw", rate=[ (int)8000, (int)48000 ]