| 
					
				 | 
			
			
				@@ -1,4 +1,4 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-using System; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using System; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using System.Collections.Generic; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using System.ComponentModel.DataAnnotations; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using System.Diagnostics.CodeAnalysis; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -113,7 +113,6 @@ namespace Jellyfin.Api.Controllers 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// Gets a video hls playlist stream. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// </summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <param name="itemId">The item id.</param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        /// <param name="container">The video container. Possible values are: ts, webm, asf, wmv, ogv, mp4, m4v, mkv, mpeg, mpg, avi, 3gp, wmv, wtv, m2ts, mov, iso, flv. </param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <param name="static">Optional. If true, the original file will be streamed statically without any encoding. Use either no url extension or the original file extension. true/false.</param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <param name="params">The streaming parameters.</param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <param name="tag">The tag.</param> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -170,7 +169,6 @@ namespace Jellyfin.Api.Controllers 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         [ProducesPlaylistFile] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         public async Task<ActionResult> GetMasterHlsVideoPlaylist( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             [FromRoute, Required] Guid itemId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            [FromRoute, Required] string container, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             [FromQuery] bool? @static, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             [FromQuery] string? @params, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             [FromQuery] string? tag, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -223,7 +221,6 @@ namespace Jellyfin.Api.Controllers 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             var streamingRequest = new HlsVideoRequestDto 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 Id = itemId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                Container = container, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 Static = @static ?? true, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 Params = @params, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 Tag = tag, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -281,7 +278,6 @@ namespace Jellyfin.Api.Controllers 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// Gets an audio hls playlist stream. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// </summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <param name="itemId">The item id.</param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        /// <param name="container">The video container. Possible values are: ts, webm, asf, wmv, ogv, mp4, m4v, mkv, mpeg, mpg, avi, 3gp, wmv, wtv, m2ts, mov, iso, flv. </param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <param name="static">Optional. If true, the original file will be streamed statically without any encoding. Use either no url extension or the original file extension. true/false.</param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <param name="params">The streaming parameters.</param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <param name="tag">The tag.</param> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -338,7 +334,6 @@ namespace Jellyfin.Api.Controllers 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         [ProducesPlaylistFile] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         public async Task<ActionResult> GetMasterHlsAudioPlaylist( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             [FromRoute, Required] Guid itemId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            [FromQuery, Required] string container, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             [FromQuery] bool? @static, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             [FromQuery] string? @params, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             [FromQuery] string? tag, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -391,7 +386,6 @@ namespace Jellyfin.Api.Controllers 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             var streamingRequest = new HlsAudioRequestDto 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 Id = itemId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                Container = container, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 Static = @static ?? true, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 Params = @params, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 Tag = tag, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -449,7 +443,6 @@ namespace Jellyfin.Api.Controllers 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// Gets a video stream using HTTP live streaming. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// </summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <param name="itemId">The item id.</param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        /// <param name="container">The video container. Possible values are: ts, webm, asf, wmv, ogv, mp4, m4v, mkv, mpeg, mpg, avi, 3gp, wmv, wtv, m2ts, mov, iso, flv. </param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <param name="static">Optional. If true, the original file will be streamed statically without any encoding. Use either no url extension or the original file extension. true/false.</param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <param name="params">The streaming parameters.</param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <param name="tag">The tag.</param> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -504,7 +497,6 @@ namespace Jellyfin.Api.Controllers 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         [ProducesPlaylistFile] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         public async Task<ActionResult> GetVariantHlsVideoPlaylist( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             [FromRoute, Required] Guid itemId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            [FromQuery, Required] string container, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             [FromQuery] bool? @static, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             [FromQuery] string? @params, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             [FromQuery] string? tag, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -557,7 +549,6 @@ namespace Jellyfin.Api.Controllers 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             var streamingRequest = new VideoRequestDto 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 Id = itemId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                Container = container, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 Static = @static ?? true, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 Params = @params, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 Tag = tag, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -615,7 +606,6 @@ namespace Jellyfin.Api.Controllers 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// Gets an audio stream using HTTP live streaming. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// </summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <param name="itemId">The item id.</param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        /// <param name="container">The video container. Possible values are: ts, webm, asf, wmv, ogv, mp4, m4v, mkv, mpeg, mpg, avi, 3gp, wmv, wtv, m2ts, mov, iso, flv. </param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <param name="static">Optional. If true, the original file will be streamed statically without any encoding. Use either no url extension or the original file extension. true/false.</param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <param name="params">The streaming parameters.</param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <param name="tag">The tag.</param> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -670,7 +660,6 @@ namespace Jellyfin.Api.Controllers 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         [ProducesPlaylistFile] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         public async Task<ActionResult> GetVariantHlsAudioPlaylist( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             [FromRoute, Required] Guid itemId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            [FromQuery, Required] string container, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             [FromQuery] bool? @static, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             [FromQuery] string? @params, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             [FromQuery] string? tag, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -723,7 +712,6 @@ namespace Jellyfin.Api.Controllers 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             var streamingRequest = new StreamingRequestDto 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 Id = itemId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                Container = container, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 Static = @static ?? true, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 Params = @params, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 Tag = tag, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -841,7 +829,7 @@ namespace Jellyfin.Api.Controllers 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             [FromRoute, Required] Guid itemId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             [FromRoute, Required] string playlistId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             [FromRoute, Required] int segmentId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            [FromRoute, Required] string container, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            [FromRoute] string container, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             [FromQuery] bool? @static, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             [FromQuery] string? @params, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             [FromQuery] string? tag, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1011,7 +999,7 @@ namespace Jellyfin.Api.Controllers 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             [FromRoute, Required] Guid itemId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             [FromRoute, Required] string playlistId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             [FromRoute, Required] int segmentId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            [FromRoute, Required] string container, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            [FromRoute] string container, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             [FromQuery] bool? @static, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             [FromQuery] string? @params, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             [FromQuery] string? tag, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1144,30 +1132,30 @@ namespace Jellyfin.Api.Controllers 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             var builder = new StringBuilder(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            builder.AppendLine("#EXTM3U"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            builder.AppendLine("#EXT-X-PLAYLIST-TYPE:VOD"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            builder.AppendLine("#EXT-X-VERSION:3"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            builder.AppendLine("#EXT-X-TARGETDURATION:" + Math.Ceiling(segmentLengths.Length > 0 ? segmentLengths.Max() : state.SegmentLength).ToString(CultureInfo.InvariantCulture)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            builder.AppendLine("#EXT-X-MEDIA-SEQUENCE:0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            builder.AppendLine("#EXTM3U") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .AppendLine("#EXT-X-PLAYLIST-TYPE:VOD") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .AppendLine("#EXT-X-VERSION:3") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .Append("#EXT-X-TARGETDURATION:") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .Append(Math.Ceiling(segmentLengths.Length > 0 ? segmentLengths.Max() : state.SegmentLength)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .AppendLine() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .AppendLine("#EXT-X-MEDIA-SEQUENCE:0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            var queryString = Request.QueryString; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             var index = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             var segmentExtension = GetSegmentFileExtension(streamingRequest.SegmentContainer); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var queryString = Request.QueryString; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             foreach (var length in segmentLengths) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                builder.AppendLine("#EXTINF:" + length.ToString("0.0000", CultureInfo.InvariantCulture) + ", nodesc"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                builder.AppendLine( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    string.Format( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        CultureInfo.InvariantCulture, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        "hls1/{0}/{1}{2}{3}", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        name, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        index.ToString(CultureInfo.InvariantCulture), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        segmentExtension, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        queryString)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                index++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                builder.Append("#EXTINF:") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .Append(length.ToString("0.0000", CultureInfo.InvariantCulture)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .AppendLine(", nodesc") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .Append("hls1/") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .Append(name) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .Append('/') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .Append(index++) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .Append(segmentExtension) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .Append(queryString) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .AppendLine(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             builder.AppendLine("#EXT-X-ENDLIST"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1465,7 +1453,7 @@ namespace Jellyfin.Api.Controllers 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             var args = "-codec:v:0 " + codec; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // if (state.EnableMpegtsM2TsMode) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // if  (state.EnableMpegtsM2TsMode) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //     args += " -mpegts_m2ts_mode 1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // } 
			 |