summaryrefslogtreecommitdiff
path: root/doc/dlna-profiles-example.xml
blob: 111e07e3d5ae1a6891cdc288d88b7ecc2a5b8e60 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
<?xml version="1.0"?>

<!--
  General notes:

  1. You can use the <include ref="..." /> directive to include another file

  2. Profiles are prioritised in the order that they are read (i.e. if A follows
     B and a stream matches both A and B, it is assumed to be of profile A.
-->

<dlna-profiles>

  <!--
    EXAMPLE 1: MP3

    This is a vanilla example to show what a basic profile would look like.
  -->

  <!--
    "name" is the DLNA profile name and "mime", the DLNA MIME type. These 2
    fields are mandatory for every dlna-profile.
  -->
  <dlna-profile name="MP3" mime="audio/mpeg">
    <!--
      Here the "type" corresponds to the stream type -
      video/audio/container/...
    -->
    <restriction type="audio">
      <!-- The name field is mandatory for all restrictions -->
      <field name="name" type="string">
        <value>audio/mpeg</value>
      </field>

      <!-- "name" and "type" are mandatory for every field -->
      <field name="mpegversion" type="int">
        <!-- mpegversion = (int) 1 -->
        <value>1</value>
      </field>

      <field name="layer" type="int">
        <!-- layer = (int) 3 -->
        <value>3</value>
      </field>

      <field name="channels" type="int">
        <!-- channels = (int) [ 1, 2 ] -->
        <range min="1" max="2" />
      </field>

      <field name="rate" type="int">
        <!-- rate = (int) { 32000, 44100, 48000 } -->
        <value>32000</value>
        <value>44100</value>
        <value>48000</value>
      </field>

      <field name="bitrate" type="int">
        <!-- bitrate = (int) [ 32000, 320000 ] -->
        <range min="32000" max="320000" />
      </field>

    </restriction>
  </dlna-profile>

  <!--
    EXAMPLE 2: AVC_MP4_BL_CIF15_AAC_520

    This one is a little more complicated. The video profile is composed of a
    container (systems portion), audio and video restrictions. In addition to
    this, each portion might occur in multiple profiles (for example, all the
    AVC_MP4_* profiles use the "MP4" systems portion.

    We tackle this by defining a global restrictions section first, where all
    the common bits are defined. Reusing these is helpful for the MPEG-2 and
    MPEG-4 profiles which have several commonalities.
  -->

  <!--
    Since several profiles share common restrictions, we define these
    separately for reuse.
  -->
  <restrictions>
    <!-- First, some common restrictions for reuse -->
    <restriction type="video" id="CIF">
      <field name="height" type="int">
	<value>352</value>
      </field>
      <field name="width" type="int">
	<value>288</value>
      </field>
    </restriction>

    <restriction type="video" id="QVGA_4:3">
      <field name="height" type="int">
	<value>320</value>
      </field>
      <field name="width" type="int">
	<value>240</value>
      </field>
    </restriction>

    <!-- and others, like QCIF, VGA, ... -->

    <restriction type="video" id="AVC_L1.2">
      <!-- This one doesn't exist yet -->
      <field name="avclevel" type="string">
	<value>1</value>
	<value>1b</value>
	<value>1.1</value>
	<value>1.2</value>
      </field>
    </restriction>

    <!-- and define other profiles and levels too -->

    <!-- Now, some "base classes" for the profiles -->

    <restriction type="container" id="MP4">
      <!-- MP4 container ("systems" profile) -->
      <field name="name" type="string">
        <value>audio/x-m4a</value>
      </field>
    </restriction>

    <restriction type="video" id="BL">
      <!-- AVC baseline profile -->
      <field name="name" type="string">
	<value>video/x-h264</value>
      </field>

      <!-- This one doesn't exist yet -->
      <field name="avcprofile" type="string">
	<value>baseline</value>
      </field>

      <field name="format" type="fourcc">
	<!-- Possible values with 4:2:0 format -->
	<value>I420</value>
	<value>YV12</value>
      </field>
    </restriction>

    <!--
      The "parent" tag allows you to reuse all the caps of a given restriction
      and then specify fields you want to append (if they are not present in
      the parent) or override (if they are).

      If there are multiple parents, the resultant restriction is the union of
      all parents.

      Note: The multiple-inheritance works differently for <dlna-profile>s
    -->
    <restriction type="video" id="BL_L1.2">
      <parent name="BL" />
      <parent name="AVC_L1.2" />
    </restriction>

    <restriction type="video" id="BL_L1.2_CIF">
      <parent name="BL_L1.2" />
      <parent name="CIF" />

      <field name="framerate" type="fraction">
	<value>15/1</value>
      </field>
    </restriction>

    <restriction type="video" id="BL_L1.2_QVGA_4:3">
      <parent name="BL_L1.2" />
      <parent name="QVGA_4:3" />

      <field name="framerate" type="fraction">
	<value>20/1</value>
      </field>
    </restriction>

    <!--
      Define BL_L1.2_525SIF, BL_L1.2_QVGA_16:9, ... in a similar fashion
    -->

    <!-- For audio, assume that AAC, AAC_LTP, AAC_520 are defined -->
  </restrictions>

  <!-- Finally, AVC_MP4_BL_CIF15_AAC_520 is defined here -->
  <dlna-profile name="AVC_MP4_BL_CIF15_AAC_520" mime="video/mp4" id="AVC">
    <!-- container -->
    <parent name="MP4" />
    <!-- audio -->
    <parent name="AAC_520" />
    <!-- video -->
    <!--
      If a profile has multiple parents of the same stream type (video in this
      case), it is sufficient for the media to match *any one* of these.

      Note: This is different from how multiple parents behave for
      <restriction>s
    -->
    <parent name="BL_L1.2_CIF" />
    <parent name="BL_L1.2_QVGA_4:3" />
    <!-- and so on -->
  </dlna-profile>

  <!--
    Same restrictions, differnt container - use the base-profile attribute. You
    can also append more restrictions, but you cannot override anything other
    than the container.
  -->
  <dlna-profile name="AVC_MP4_BL_CIF15_AAC_520" mime="video/mp4" base-profile="AVC">
    <!-- override container -->
    <restriction type="container">
      <field name="name" type="string">
        <value>video/quicktime</value>
      </field>
    </restriction>
  </dlna-profile>

</dlna-profiles>