mirror of https://github.com/ErsatzTV/ErsatzTV.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
967 B
27 lines
967 B
using System; |
|
using System.Text; |
|
using System.Threading.Tasks; |
|
using ErsatzTV.Core.FFmpeg; |
|
using Microsoft.AspNetCore.Http; |
|
using Microsoft.AspNetCore.Mvc.Formatters; |
|
using Microsoft.Net.Http.Headers; |
|
|
|
namespace ErsatzTV.Formatters |
|
{ |
|
public class ConcatPlaylistOutputFormatter : TextOutputFormatter |
|
{ |
|
public ConcatPlaylistOutputFormatter() |
|
{ |
|
SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse("text/plain")); |
|
|
|
SupportedEncodings.Add(Encoding.UTF8); |
|
SupportedEncodings.Add(Encoding.Unicode); |
|
} |
|
|
|
protected override bool CanWriteType(Type type) => typeof(ConcatPlaylist).IsAssignableFrom(type); |
|
|
|
public override Task WriteResponseBodyAsync(OutputFormatterWriteContext context, Encoding selectedEncoding) => |
|
// ReSharper disable once PossibleNullReferenceException |
|
context.HttpContext.Response.WriteAsync(((ConcatPlaylist) context.Object).ToString()); |
|
} |
|
}
|
|
|