<?xml version="1.0" encoding="UTF-8"?>
<Profiles version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.serviio.org/xsd/profiles/v/2.0/Profiles.xsd">
	<Profile id="nc+_wifibox+" name="NC+ WIFIBOX+" extendsProfileId="1">
	<!--
		STB for Polish satellite network NC+
		It's sold under the name "WIFIBOX+" but is based on Sagemcom DSIW74

		According to the manual available at https://pl.canalplus.com/-/media/ncplus/files/instrukcje_dekodery_rebranding/instrukcja-wifibox.pdf on page 21
		this device supports decoding of:
		* Video up to 1080i (1920x1080) in 4:3 and 16:9 AR
		** MPEG2 MP@HL
		** MPEG4 AVC MP@L4
		** MPEG4 AVC HP@L4
		* Audio
		** ISO/IEC 13818-3 (mp3)
		** MPEG-1 Layer 2 (mp2)
		** Dolby Digital (probably ac3 since files with this format work)
		** Dolby Digital+

		From manual testing both Matroska (.mkv) and MP4 containers work.

		For transcoding the only reliable targetContainer is "applehttp". MPEG containers either do not work at all or hang at playback. While not officially
		supported according to the manual the only reliable audio codec is AAC with default bitrate. MP2 and MP3 either do not work at all or hang at playback.

		Caveats:
		* no seeking is supported on the device
		
	-->
		<Detection>
	        <!-- This is probably too broad of a match -->
	        	<HttpHeaders>
	            		<User-Agent>.*SAGEMCOM/2.0.*</User-Agent>
			</HttpHeaders>
	      	</Detection>
		<DeviceDescription>
			<ModelName>NC+ WIFIBOX+ (DSIW74) for Serviio</ModelName>
			<Manufacturer>Sagemcom</Manufacturer>
		</DeviceDescription>
		<MediaFormatProfiles>
			<MediaFormatProfile mime-type="audio/mpeg">MP3</MediaFormatProfile>
			<MediaFormatProfile mime-type="audio/mpeg">MP2_MPS</MediaFormatProfile>
			<MediaFormatProfile mime-type="audio/mp4">AAC_ISO</MediaFormatProfile>
			<MediaFormatProfile mime-type="image/jpeg">JPEG_SM</MediaFormatProfile>
			<MediaFormatProfile mime-type="image/jpeg">JPEG_MED</MediaFormatProfile>
			<MediaFormatProfile mime-type="image/jpeg">JPEG_LRG</MediaFormatProfile>
			<MediaFormatProfile mime-type="image/jpeg">JPEG_TN</MediaFormatProfile>
			<MediaFormatProfile mime-type="video/x-matroska">MATROSKA</MediaFormatProfile>
			<MediaFormatProfile mime-type="video/x-matroska">AVC_MKV_MP_HD_AAC_MULT5</MediaFormatProfile>
			<MediaFormatProfile mime-type="video/x-matroska">AVC_MKV_MP_HD_AC3</MediaFormatProfile>
			<MediaFormatProfile mime-type="video/x-matroska">AVC_MKV_MP_HD_MPEG1_L3</MediaFormatProfile>
			<MediaFormatProfile mime-type="video/x-matroska">AVC_MKV_HP_HD_AAC_MULT5</MediaFormatProfile>
			<MediaFormatProfile mime-type="video/x-matroska">AVC_MKV_HP_HD_AC3</MediaFormatProfile>
			<MediaFormatProfile mime-type="video/x-matroska">AVC_MKV_HP_HD_MPEG1_L3</MediaFormatProfile>
			<MediaFormatProfile mime-type="video/mp4">AVC_MP4_MP_SD_AAC_MULT5</MediaFormatProfile>
			<MediaFormatProfile mime-type="video/mp4">AVC_MP4_MP_SD_MPEG1_L3</MediaFormatProfile>
			<MediaFormatProfile mime-type="video/mp4">AVC_MP4_MP_SD_AC3</MediaFormatProfile>
			<MediaFormatProfile mime-type="video/mp4">AVC_MP4_MP_HD_720p_AAC</MediaFormatProfile>
			<MediaFormatProfile mime-type="video/mp4">AVC_MP4_MP_HD_1080i_AAC</MediaFormatProfile>
			<MediaFormatProfile mime-type="video/mp4">AVC_MP4_HP_HD_AAC</MediaFormatProfile>
		</MediaFormatProfiles>
		<Transcoding>
			<!-- transcode any video that exceeds 1920x1080 -->
                        <Video targetContainer="applehttp" targetVCodec="h264" maxVBitrate="20000" forceVTranscoding="true" targetACodec="aac" maxWidth="1920" maxHeight="1080">
                                <Matches container="*" widthGreaterThan="1920" />
				<Matches container="*" heightGreaterThan="1080" />
                        </Video>
                        <!-- transcode any video with unsupported audio codec to AAC, leaving video remuxed -->
                        <Video targetContainer="applehttp" targetACodec="aac">
                                <Matches container="*" vCodec="h264" aCodec="dca" />
                                <Matches container="*" vCodec="mpeg2video" aCodec="dca" />
                                <Matches container="*" aCodec="dts-hd" />
                                <Matches container="*" aCodec="eac3" />
                                <Matches container="*" aCodec="wmav2" />
                                <Matches container="*" aCodec="wmapro" />
                                <Matches container="*" aCodec="flac" />
                                <Matches container="*" aCodec="vorbis" />
                                <Matches container="*" aCodec="truehd" />
                                <Matches container="*" aCodec="amrnb" />
                                <Matches container="*" aCodec="real" />
                                <Matches container="*" aCodec="speex" />
                                <Matches container="*" aCodec="opus" />
                        </Video>
                        <!-- transcode video unsupported by device, transcode audio regardless of codec -->
                        <Video targetContainer="applehttp" targetVCodec="h264" maxVBitrate="20000" forceVTranscoding="true" targetACodec="aac">
                                <Matches container="*" vCodec="h264" profile="high" levelGreaterThan="4.2" />
                                <Matches container="*" vCodec="h264" profile="main" levelGreaterThan="4.2" />
                                <Matches container="*" vCodec="mpeg1video"/>
                                <Matches container="*" vCodec="h263"/>
                                <Matches container="*" vCodec="h265"/>
                                <Matches container="*" vCodec="vc1"/>
                                <Matches container="*" vCodec="mjpeg"/>
                                <Matches container="*" vCodec="flv"/>
                                <Matches container="*" vCodec="vp6"/>
                                <Matches container="*" vCodec="vp8"/>
                                <Matches container="*" vCodec="vp9"/>
                                <Matches container="*" vCodec="theora"/>
                                <Matches container="*" vCodec="dvvideo"/>
                                <Matches container="*" vCodec="rv"/>
                                <Matches container="*" vCodec="svq1"/>
				<Matches container="*" vCodec="svq3"/>
				<Matches container="*" vCodec="cinepak"/>
				<Matches container="*" vCodec="wmv2"/>
                        </Video>
                        <!-- remux non-supported containers with supported contents -->
                        <Video targetContainer="applehttp">
                                <Matches container="wtv"/>
                                <Matches container="avi"/>
                                <Matches container="mpegvideo"/>
                                <Matches container="mpeg"/>
                        </Video>	
			<!-- this has not been tested well enough, but the specification lists mp3/mp2 -->
			<Audio targetContainer="mp3">
				<Matches container="*" />
				<!-- Convert everything to mp3 -->
			</Audio>
		</Transcoding>
		<GenericTranscoding>
			<Video targetContainer="applehttp" targetVCodec="h264" targetACodec="aac" />
		</GenericTranscoding>
		<AutomaticImageRotation>true</AutomaticImageRotation>
	</Profile>

	<Profile id="nc+_4k_ultrabox+" name="NC+ 4K ULTRABOX+" extendsProfileId="1">
	<!--
		STB for Polish satellite network NC+
		It's sold under the name "4K ULTRABOX+" with at least 2 models based on:
		* USW4001NCP (used to develop this profile)
		* NCP-3670SF (shares specifications according to manual https://pl.canalplus.com/-/media/ncplus/files/instrukcje_dekodery_rebranding/instrukcja_g9_bis_adb_2019_jw_internet.pdf)

		According to the manual available at https://pl.canalplus.com/-/media/ncplus/files/instrukcje_dekodery_rebranding/instrukcja_g9_2019_technicolor_jw_internet.pdf on page 30:
		this device supports decoding of:
		* Video up to 2160p in 4:3 and 16:9 AR
		** MPEG2 MP@ML
		** MPEG4 AVC MP@L3
		** HEVC H.265 L5.1
		* Audio
		** AAC-LC
		** AAC-HE
		** MPEG-1 Layers 1,2 and 3 (mp2, mp3)
		** Dolby Digital (probably ac3 since files with this format work)
		** Dolby Digital+

		From manual testing both Matroska (.mkv) and MP4 containers work.
	-->
		<Detection>
			<UPnPSearch>
				<FriendlyName>4K\ Ultrabox\+</FriendlyName>
				<!-- this is also present but can differ because there are 2 devices sold under the same name
					<ModelName>USW4001NCP.*</ModelName>
					<Manufacturer>ADB</Manufacturer>
				-->
			</UPnPSearch>
	        	<HttpHeaders>
	            		<FriendlyName.dlna.org>4K\ Ultrabox\+.*</FriendlyName.dlna.org>
			</HttpHeaders>
	      	</Detection>
		<DeviceDescription>
			<ModelName>NC+ 4K ULTRABOX+ (USW4001NCP) for Serviio</ModelName>
			<Manufacturer>Technicolor Delivery Technologies</Manufacturer>
		</DeviceDescription>
		<MediaFormatProfiles>
			<MediaFormatProfile mime-type="video/x-mkv">MATROSKA</MediaFormatProfile>
                        <MediaFormatProfile mime-type="video/x-mkv">AVC_MKV_MP_HD_AAC_MULT5</MediaFormatProfile>
                        <MediaFormatProfile mime-type="video/x-mkv">AVC_MKV_MP_HD_AC3</MediaFormatProfile>
                        <MediaFormatProfile mime-type="video/x-mkv">AVC_MKV_MP_HD_MPEG1_L3</MediaFormatProfile>
			<MediaFormatProfile mime-type="video/mp4">AVC_MP4_MP_SD_AAC_MULT5</MediaFormatProfile>
			<MediaFormatProfile mime-type="video/mp4">AVC_MP4_MP_SD_MPEG1_L3</MediaFormatProfile>
			<MediaFormatProfile mime-type="video/mp4">AVC_MP4_MP_SD_AC3</MediaFormatProfile>
			<MediaFormatProfile mime-type="video/mp4">AVC_MP4_MP_HD_720p_AAC</MediaFormatProfile>
			<MediaFormatProfile mime-type="video/mp4">AVC_MP4_MP_HD_1080i_AAC</MediaFormatProfile>
			<MediaFormatProfile mime-type="video/mp4">AVC_MP4_HP_HD_AAC</MediaFormatProfile>
			<MediaFormatProfile mime-type="video/mp4">MPEG4_P2_MP4_ASP_AAC</MediaFormatProfile>
			<MediaFormatProfile mime-type="video/mp4">MPEG4_P2_MP4_SP_L6_AAC</MediaFormatProfile>
			<MediaFormatProfile mime-type="video/mp4">MPEG4_P2_MP4_NDSD</MediaFormatProfile>
			<MediaFormatProfile mime-type="audio/mpeg">MP3</MediaFormatProfile>
		</MediaFormatProfiles>
		<Transcoding>
			<Video targetContainer="mpegts" targetVCodec="h264" maxVBitrate="20000" targetACodec="mp3" aBitrate="320" maxWidth="3840" maxHeight="2160" >
                                <!-- According to the device manual H264 is limited to Main profile Level 3, but testing has shown that it's <4.2 for High and Main profiles instead -->
                                <Matches container="*" vCodec="h264" profile="high_10" />
                                <Matches container="*" vCodec="h264" profile="high" levelGreaterThan="4.2" />
                                <Matches container="*" vCodec="h264" profile="main" levelGreaterThan="4.2" />
                                <!-- exotic audio formats have to be converted -->
                                <Matches container="*" aCodec="eac3" />
                                <Matches container="*" aCodec="lpcm" />
                                <Matches container="*" aCodec="wmav2" />
                                <Matches container="*" aCodec="wmapro" />
                                <Matches container="*" aCodec="dca" />
                                <Matches container="*" aCodec="dts-hd" />
                                <Matches container="*" aCodec="flac" />
                                <Matches container="*" aCodec="vorbis" />
                                <Matches container="*" aCodec="truehd" />
                                <Matches container="*" aCodec="amrnb" />
                                <Matches container="*" aCodec="real" />
                                <Matches container="*" aCodec="speex" />
                                <Matches container="*" aCodec="opus" />
                                <!-- exotic containers -->
                                <Matches container="asf" />
                                <Matches container="mpegts" />
                                <Matches container="avi" />
                                <Matches container="flv" />
                                <Matches container="wtv" />
                                <Matches container="ogg" />
                                <Matches container="3gp" />
                                <Matches container="rtp" />
                                <Matches container="rtsp" />
                                <Matches container="rm" />
                                <!-- this device is limited to 3840x2160 -->
                                <Matches container="*" widthGreaterThan="3840" />
                                <Matches container="*" heightGreaterThan="2160" />
                        </Video>

			<Audio targetContainer="mp3">
				<Matches container="*" />
				<!-- Convert everything to mp3 -->
			</Audio>
		</Transcoding>
		<GenericTranscoding>
			<Video targetContainer="mpegts" targetVCodec="h264" targetACodec="mp3" />
		</GenericTranscoding>
		<AutomaticImageRotation>true</AutomaticImageRotation>
	</Profile>
</Profiles>
