Relase 0.6.1
[gupnp:gupnp-dlna.git] / doc / dlna-profiles-example.xml
1 <?xml version="1.0"?>
2
3 <!--
4   General notes:
5
6   1. You can use the <include ref="..." /> directive to include another file
7
8   2. Profiles are prioritised in the order that they are read (i.e. if A follows
9      B and a stream matches both A and B, it is assumed to be of profile A.
10 -->
11
12 <dlna-profiles>
13
14   <!--
15     EXAMPLE 1: MP3
16
17     This is a vanilla example to show what a basic profile would look like.
18   -->
19
20   <!--
21     "name" is the DLNA profile name and "mime", the DLNA MIME type. These 2
22     fields are mandatory for every dlna-profile.
23   -->
24   <dlna-profile name="MP3" mime="audio/mpeg">
25     <!--
26       Here the "type" corresponds to the stream type -
27       video/audio/container/...
28     -->
29     <restriction type="audio">
30       <!-- The name field is mandatory for all restrictions -->
31       <field name="name" type="string">
32         <value>audio/mpeg</value>
33       </field>
34
35       <!-- "name" and "type" are mandatory for every field -->
36       <field name="mpegversion" type="int">
37         <!-- mpegversion = (int) 1 -->
38         <value>1</value>
39       </field>
40
41       <field name="layer" type="int">
42         <!-- layer = (int) 3 -->
43         <value>3</value>
44       </field>
45
46       <field name="channels" type="int">
47         <!-- channels = (int) [ 1, 2 ] -->
48         <range min="1" max="2" />
49       </field>
50
51       <field name="rate" type="int">
52         <!-- rate = (int) { 32000, 44100, 48000 } -->
53         <value>32000</value>
54         <value>44100</value>
55         <value>48000</value>
56       </field>
57
58       <field name="bitrate" type="int">
59         <!-- bitrate = (int) [ 32000, 320000 ] -->
60         <range min="32000" max="320000" />
61       </field>
62
63     </restriction>
64   </dlna-profile>
65
66   <!--
67     EXAMPLE 2: AVC_MP4_BL_CIF15_AAC_520
68
69     This one is a little more complicated. The video profile is composed of a
70     container (systems portion), audio and video restrictions. In addition to
71     this, each portion might occur in multiple profiles (for example, all the
72     AVC_MP4_* profiles use the "MP4" systems portion.
73
74     We tackle this by defining a global restrictions section first, where all
75     the common bits are defined. Reusing these is helpful for the MPEG-2 and
76     MPEG-4 profiles which have several commonalities.
77   -->
78
79   <!--
80     Since several profiles share common restrictions, we define these
81     separately for reuse.
82   -->
83   <restrictions>
84     <!-- First, some common restrictions for reuse -->
85     <restriction type="video" id="CIF">
86       <field name="height" type="int">
87         <value>352</value>
88       </field>
89       <field name="width" type="int">
90         <value>288</value>
91       </field>
92     </restriction>
93
94     <restriction type="video" id="QVGA_4:3">
95       <field name="height" type="int">
96         <value>320</value>
97       </field>
98       <field name="width" type="int">
99         <value>240</value>
100       </field>
101     </restriction>
102
103     <!-- and others, like QCIF, VGA, ... -->
104
105     <restriction type="video" id="AVC_L1.2">
106       <!-- This one doesn't exist yet -->
107       <field name="avclevel" type="string">
108         <value>1</value>
109         <value>1b</value>
110         <value>1.1</value>
111         <value>1.2</value>
112       </field>
113     </restriction>
114
115     <!-- and define other profiles and levels too -->
116
117     <!-- Now, some "base classes" for the profiles -->
118
119     <restriction type="container" id="MP4">
120       <!-- MP4 container ("systems" profile) -->
121       <field name="name" type="string">
122         <value>audio/x-m4a</value>
123       </field>
124     </restriction>
125
126     <restriction type="video" id="BL">
127       <!-- AVC baseline profile -->
128       <field name="name" type="string">
129         <value>video/x-h264</value>
130       </field>
131
132       <!-- This one doesn't exist yet -->
133       <field name="avcprofile" type="string">
134         <value>baseline</value>
135       </field>
136
137       <field name="format" type="fourcc">
138         <!-- Possible values with 4:2:0 format -->
139         <value>I420</value>
140         <value>YV12</value>
141       </field>
142     </restriction>
143
144     <!--
145       The "parent" tag allows you to reuse all the caps of a given restriction
146       and then specify fields you want to append (if they are not present in
147       the parent) or override (if they are).
148
149       If there are multiple parents, the resultant restriction is the union of
150       all parents.
151
152       Note: The multiple-inheritance works differently for <dlna-profile>s
153     -->
154     <restriction type="video" id="BL_L1.2">
155       <parent name="BL" />
156       <parent name="AVC_L1.2" />
157     </restriction>
158
159     <restriction type="video" id="BL_L1.2_CIF">
160       <parent name="BL_L1.2" />
161       <parent name="CIF" />
162
163       <field name="framerate" type="fraction">
164         <value>15/1</value>
165       </field>
166     </restriction>
167
168     <restriction type="video" id="BL_L1.2_QVGA_4:3">
169       <parent name="BL_L1.2" />
170       <parent name="QVGA_4:3" />
171
172       <field name="framerate" type="fraction">
173         <value>20/1</value>
174       </field>
175     </restriction>
176
177     <!--
178       Define BL_L1.2_525SIF, BL_L1.2_QVGA_16:9, ... in a similar fashion
179     -->
180
181     <!-- For audio, assume that AAC, AAC_LTP, AAC_520 are defined -->
182   </restrictions>
183
184   <!-- Finally, AVC_MP4_BL_CIF15_AAC_520 is defined here -->
185   <dlna-profile name="AVC_MP4_BL_CIF15_AAC_520" mime="video/mp4" id="AVC">
186     <!-- container -->
187     <parent name="MP4" />
188     <!-- audio -->
189     <parent name="AAC_520" />
190     <!-- video -->
191     <!--
192       If a profile has multiple parents of the same stream type (video in this
193       case), it is sufficient for the media to match *any one* of these.
194
195       Note: This is different from how multiple parents behave for
196       <restriction>s
197     -->
198     <parent name="BL_L1.2_CIF" />
199     <parent name="BL_L1.2_QVGA_4:3" />
200     <!-- and so on -->
201   </dlna-profile>
202
203   <!--
204     Same restrictions, differnt container - use the base-profile attribute. You
205     can also append more restrictions, but you cannot override anything other
206     than the container.
207   -->
208   <dlna-profile name="AVC_MP4_BL_CIF15_AAC_520" mime="video/mp4" base-profile="AVC">
209     <!-- override container -->
210     <restriction type="container">
211       <field name="name" type="string">
212         <value>video/quicktime</value>
213       </field>
214     </restriction>
215   </dlna-profile>
216
217 </dlna-profiles>