<?xml version="1.0"?>

<dlna-profiles>
  <include ref="common.xml" />
  <include ref="mpeg-common.xml" />

  <restrictions>
    <restriction id="MPEG_TS_ISO" type="container">
      <field name="name" type="string">
        <value>video/mpegts</value>
      </field>
      <field name="systemstream" type="boolean">
        <value>true</value>
      </field>
      <field name="packetsize" type="int">
        <value>188</value>
      </field>
    </restriction>

    <!-- TS with 192 byte packet size and all zero timestamps -->
    <restriction id="MPEG_TS" type="container">
      <field name="name" type="string">
        <value>video/mpegts</value>
      </field>
      <field name="systemstream" type="boolean">
        <value>true</value>
      </field>
      <field name="packetsize" type="int">
        <value>192</value>
      </field>
    </restriction>

    <restriction id="MPEG_TS_AUDIO_BASE" type="audio">
      <field name="channels" type="int">
        <range min="1" max="6" />
      </field>
      <field name="bitrate" type="int" used="in-strict">
        <range min="1" max="448000" />
      </field>
    </restriction>

    <!-- audio rate restrictions for non-EU TS streams -->
    <restriction id="MPEG_TS_AUDIO" type="audio">
      <parent name="MPEG_TS_AUDIO_BASE" />
      <field name="rate" type="int">
        <value>48000</value>
      </field>
    </restriction>

    <!-- audio rate restrictions for EU TS streams -->
    <restriction id="MPEG_TS_AUDIO_EU" type="audio">
      <parent name="MPEG_TS_AUDIO_BASE"/>
      <field name="rate" type="int">
        <value>32000</value>
        <value>44100</value>
        <value>48000</value>
      </field>
    </restriction>

    <restriction id="MPEG_TS_VIDEO" type="video">
      <field name="name" type="string">
        <value>video/mpeg</value>
      </field>
      <field name="systemstream" type="boolean">
        <value>false</value>
      </field>
      <field name="mpegversion" type="int">
        <value>2</value>
      </field>
      <field name="profile" type="string">
        <value>simple</value>
        <value>main</value>
      </field>
      <field name="level" type="string">
        <value>low</value>
        <value>main</value>
        <value>high-1440</value>
        <value>high</value>
      </field>
      <field name="bitrate" type="int" used="in-strict">
        <!-- Max. system bitrate is 19.3927 Mb/s. Subtracting max. audio
             bitrate, and ignoring close caption data and other overhead -->
        <range min="1" max="18881700" />
      </field>
    </restriction>

    <!-- HD resolutions -->
    <restriction id="MPEG_TS_1920x1080" type="video">
      <parent name="1920x1080" />
      <field name="framerate" type="fraction">
        <value>30000/1001</value>
        <value>30/1</value>
        <value>24000/1001</value> <!-- Note: only valid for interlaced=false -->
        <value>24/1</value> <!-- Note: only valid for interlaced=false -->
      </field>
      <field name="pixel-aspect-ratio" type="fraction" used="in-strict">
        <value>1/1</value>
        <value>9/16</value>
      </field>
    </restriction>

    <restriction id="MPEG_TS_1280x720" type="video">
      <parent name="1280x720" />

      <field name="framerate" type="fraction">
        <value>30000/1001</value>
        <value>30/1</value>
        <value>24000/1001</value> <!-- Note: only valid for interlaced=false -->
        <value>24/1</value> <!-- Note: only valid for interlaced=false -->
      </field>
      <field name="pixel-aspect-ratio" type="fraction" used="in-strict">
        <value>1/1</value>
        <value>9/16</value>
      </field>
    </restriction>

    <restriction id="1440x1080" type="video">
      <field name="height" type="int">
        <value>1080</value>
      </field>
      <field name="width" type="int">
        <value>1440</value>
      </field>
      <field name="framerate" type="fraction">
        <value>30000/1001</value>
        <value>30/1</value>
        <value>24000/1001</value> <!-- Note: only valid for interlaced=false -->
        <value>24/1</value> <!-- Note: only valid for interlaced=false -->
      </field>
      <field name="pixel-aspect-ratio" type="fraction" used="in-strict">
        <value>4/3</value>
      </field>
    </restriction>

    <restriction id="1280x1080" type="video">
      <field name="height" type="int">
        <value>1080</value>
      </field>
      <field name="width" type="int">
        <value>1280</value>
      </field>
      <field name="framerate" type="fraction">
        <value>30000/1001</value>
        <value>30/1</value>
        <value>24000/1001</value> <!-- Note: only valid for interlaced=false -->
        <value>24/1</value> <!-- Note: only valid for interlaced=false -->
      </field>
      <field name="pixel-aspect-ratio" type="fraction" used="in-strict">
        <value>3/2</value>
      </field>
    </restriction>
  </restrictions>

  <dlna-profile id="MPEG_TS_SD_NA_BASE">
    <!-- Note: We have no way to restrict the system bitrate yet -->
    <parent name="MPEG_TS_ISO" />

    <restriction type="audio">
      <parent name="MPEG_TS_AUDIO" />

      <field name="name" type="string">
        <value>audio/x-ac3</value>
      </field>
    </restriction>

    <restriction type="audio">
      <parent name="MPEG_TS_AUDIO" />

      <field name="name" type="string">
        <value>audio/x-private1-ac3</value>
      </field>
    </restriction>

    <restriction type="audio">
      <parent name="MPEG_TS_AUDIO" />

      <field name="name" type="string">
        <value>audio/ac3</value>
      </field>
    </restriction>

    <restriction type="video">
      <parent name="MPEG_TS_VIDEO" />
      <parent name="720x480" />
    </restriction>

    <restriction type="video">
      <parent name="MPEG_TS_VIDEO" />
      <parent name="704x480" />
    </restriction>

    <restriction type="video">
      <parent name="MPEG_TS_VIDEO" />
      <parent name="640x480" />
    </restriction>

    <restriction type="video">
      <parent name="MPEG_TS_VIDEO" />
      <parent name="480x480" />
    </restriction>

    <restriction type="video">
      <parent name="MPEG_TS_VIDEO" />
      <parent name="544x480" />
    </restriction>

    <restriction type="video">
      <parent name="MPEG_TS_VIDEO" />
      <parent name="352x480" />
    </restriction>
  </dlna-profile>

  <dlna-profile id="MPEG_TS_SD_EU_BASE">
    <!-- Note: We have no way to restrict the system bitrate yet -->
    <restriction type="audio">
      <parent name="MPEG_TS_AUDIO_EU" />

      <field name="name" type="string">
          <value>audio/x-ac3</value>
      </field>
    </restriction>

    <restriction type="audio">
      <parent name="MPEG_TS_AUDIO_EU" />

      <field name="name" type="string">
          <value>audio/x-private1-ac3</value>
      </field>
    </restriction>

    <restriction type="audio">
      <parent name="MPEG_TS_AUDIO_EU" />

      <field name="name" type="string">
          <value>audio/ac3</value>
      </field>
    </restriction>

    <restriction type="audio">
      <parent name="MPEG_TS_AUDIO_EU" />

      <field name="name" type="string">
          <value>audio/mpeg</value>
      </field>
      <field name="mpegversion" type="int">
          <value>1</value>
          <value>2</value>
      </field>
    </restriction>

    <restriction type="video">
      <parent name="MPEG_TS_VIDEO" />
      <parent name="720x576" />
    </restriction>

    <restriction type="video">
      <parent name="MPEG_TS_VIDEO" />
      <parent name="544x576" />
    </restriction>

    <restriction type="video">
      <parent name="MPEG_TS_VIDEO" />
      <parent name="480x576" />
    </restriction>

    <restriction type="video">
      <parent name="MPEG_TS_VIDEO" />
      <parent name="352x576" />
    </restriction>

    <restriction type="video">
      <parent name="MPEG_TS_VIDEO" />
      <parent name="352x288" />
    </restriction>
  </dlna-profile>



  <dlna-profile id="MPEG_TS_HD_NA_BASE">
    <restriction type="audio">
      <parent name="MPEG_TS_AUDIO" />

      <field name="name" type="string">
	<value>audio/x-ac3</value>
      </field>
    </restriction>

    <restriction type="audio">
      <parent name="MPEG_TS_AUDIO" />

      <field name="name" type="string">
	<value>audio/x-private1-ac3</value>
      </field>
    </restriction>

    <restriction type="audio">
      <parent name="MPEG_TS_AUDIO" />

      <field name="name" type="string">
	<value>audio/ac3</value>
      </field>
    </restriction>

    <restriction type="video">
      <parent name="MPEG_TS_VIDEO" />
      <parent name="MPEG_TS_1920x1080" />
    </restriction>

    <restriction type="video">
      <parent name="MPEG_TS_VIDEO" />
      <parent name="MPEG_TS_1280x720" />
    </restriction>

    <restriction type="video">
      <parent name="MPEG_TS_VIDEO" />
      <parent name="1440x1080" />
    </restriction>

    <restriction type="video">
      <parent name="MPEG_TS_VIDEO" />
      <parent name="1280x1080" />
    </restriction>
  </dlna-profile>

  <dlna-profile name="MPEG_TS_SD_NA" mime="video/vnd.dlna.mpeg-tts" base-profile="MPEG_TS_SD_NA_BASE">
    <!-- Note: We have no way to restrict the system bitrate yet -->
    <restriction type="container">
      <parent name="MPEG_TS" />
    </restriction>
  </dlna-profile>

  <dlna-profile name="MPEG_TS_SD_NA_ISO" mime="video/mpeg" base-profile="MPEG_TS_SD_NA_BASE">
    <!-- Note: We have no way to restrict the system bitrate yet -->
    <restriction type="container">
      <parent name="MPEG_TS_ISO" />
    </restriction>
  </dlna-profile>

  <dlna-profile name="MPEG_TS_HD_NA" mime="video/vnd.dlna.mpeg-tts" base-profile="MPEG_TS_HD_NA_BASE">
    <!-- Note: We have no way to restrict the system bitrate yet -->
    <restriction type="container">
      <parent name="MPEG_TS" />
    </restriction>
  </dlna-profile>

  <dlna-profile name="MPEG_TS_HD_NA_ISO" mime="video/mpeg" base-profile="MPEG_TS_HD_NA_BASE">
    <!-- Note: We have no way to restrict the system bitrate yet -->
    <restriction type="container">
      <parent name="MPEG_TS_ISO" />
    </restriction>
  </dlna-profile>

  <dlna-profile name="MPEG_TS_SD_EU" mime="video/vnd.dlna.mpeg-tts" base-profile="MPEG_TS_SD_EU_BASE">
    <!-- Note: We have no way to restrict the system bitrate yet -->
    <restriction type="container">
      <parent name="MPEG_TS" />
    </restriction>
  </dlna-profile>

  <dlna-profile name="MPEG_TS_SD_EU_ISO" mime="video/mpeg" base-profile="MPEG_TS_SD_EU_BASE">
    <!-- Note: We have no way to restrict the system bitrate yet -->
    <restriction type="container">
      <parent name="MPEG_TS_ISO" />
    </restriction>
  </dlna-profile>
</dlna-profiles>
