99a29d5cfe108e2c017c36a4875f122109ecc888
[platform/upstream/gstreamer.git] / docs / random / omega / type-properties
1 A type properties system might look like following:
2
3
4 1) Type definition includes the properties and their ranges:
5
6 audio/mp3
7         layer:          1 - 3
8         bitrate:        8 - 320
9
10 audio/raw
11         format:         bitfield (using asound.h definitions)
12         depth:          8 - 32
13         rate:           4000 - 96000
14         channels:       1 - n
15         interleave:     boolean
16
17 video/raw
18         format:         32-bit FOURCC
19         bpp:            1 - 32
20         width:          1 - n
21         height:         1 - n
22         framerate:      32-bit float
23
24 etc.
25
26
27 2) An element can specify what subtypes it can deal with by creating a list of property tables:
28
29 mpg123: audio/mp3
30         layer:          1 - 3
31         bitrate:        8 - 320
32
33 osssink:
34         format:         S8, S16, etc.
35         depth:          8 - 16
36         rate:           8000 - 48000
37         channels:       1 - 2
38         interleave:     true
39
40 And you could list several of these, so for instance if the card only supports 8-bit at up to 22KHz in
41 mono, you can remove S8 from the above list and add a second entry:
42
43 osssink:
44         format:         S8
45         depth:          8
46         rate:           8000 - 22050
47         channels:       1
48         interleave:     false (irrelevant)
49
50 The obvious problem with these examples is that the rate isn't really 8000 - 48000, it's 8000, 11025,
51 16000, 22050, 44100, and 48000.  However, we may be able to leave these to pad connect time.
52
53
54
55
56
57 struct _type_definition {
58   char *mime_type;
59
60   ....
61
62   GData *properties;
63 }
64
65 gst_type_add_property_int(_type *type,gchar *propname,int min,int max) {
66   struct _type_prop_int prop_int;
67   GQuark quark = g_quark_from_string(propname);
68
69   prop_int->id = quark;
70   prop_int->min = min;
71   prop_int->max = max;
72   g_datalist_id_set_data(type->properties,quark,&prop_int);
73 }