From 4539164d3892701d6d358c558df5359b282a3568 Mon Sep 17 00:00:00 2001 From: crobibero Date: Sat, 19 Dec 2020 10:55:07 -0700 Subject: [PATCH] Add request parameters to OpenLiveStreamDto --- .../Controllers/MediaInfoController.cs | 28 +++++----- .../Models/MediaInfoDtos/OpenLiveStreamDto.cs | 55 +++++++++++++++++++ 2 files changed, 69 insertions(+), 14 deletions(-) diff --git a/Jellyfin.Api/Controllers/MediaInfoController.cs b/Jellyfin.Api/Controllers/MediaInfoController.cs index 2a1da31c9e..baa2e06361 100644 --- a/Jellyfin.Api/Controllers/MediaInfoController.cs +++ b/Jellyfin.Api/Controllers/MediaInfoController.cs @@ -259,24 +259,24 @@ namespace Jellyfin.Api.Controllers [FromQuery] int? subtitleStreamIndex, [FromQuery] int? maxAudioChannels, [FromQuery] Guid? itemId, - [FromBody] OpenLiveStreamDto openLiveStreamDto, - [FromQuery] bool enableDirectPlay = true, - [FromQuery] bool enableDirectStream = true) + [FromBody] OpenLiveStreamDto? openLiveStreamDto, + [FromQuery] bool? enableDirectPlay, + [FromQuery] bool? enableDirectStream) { var request = new LiveStreamRequest { - OpenToken = openToken, - UserId = userId ?? Guid.Empty, - PlaySessionId = playSessionId, - MaxStreamingBitrate = maxStreamingBitrate, - StartTimeTicks = startTimeTicks, - AudioStreamIndex = audioStreamIndex, - SubtitleStreamIndex = subtitleStreamIndex, - MaxAudioChannels = maxAudioChannels, - ItemId = itemId ?? Guid.Empty, + OpenToken = openToken ?? openLiveStreamDto?.OpenToken, + UserId = userId ?? openLiveStreamDto?.UserId ?? Guid.Empty, + PlaySessionId = playSessionId ?? openLiveStreamDto?.PlaySessionId, + MaxStreamingBitrate = maxStreamingBitrate ?? openLiveStreamDto?.MaxStreamingBitrate, + StartTimeTicks = startTimeTicks ?? openLiveStreamDto?.StartTimeTicks, + AudioStreamIndex = audioStreamIndex ?? openLiveStreamDto?.AudioStreamIndex, + SubtitleStreamIndex = subtitleStreamIndex ?? openLiveStreamDto?.SubtitleStreamIndex, + MaxAudioChannels = maxAudioChannels ?? openLiveStreamDto?.MaxAudioChannels, + ItemId = itemId ?? openLiveStreamDto?.ItemId ?? Guid.Empty, DeviceProfile = openLiveStreamDto?.DeviceProfile, - EnableDirectPlay = enableDirectPlay, - EnableDirectStream = enableDirectStream, + EnableDirectPlay = enableDirectPlay ?? openLiveStreamDto?.EnableDirectPlay ?? true, + EnableDirectStream = enableDirectStream ?? openLiveStreamDto?.EnableDirectStream ?? true, DirectPlayProtocols = openLiveStreamDto?.DirectPlayProtocols ?? new[] { MediaProtocol.Http } }; return await _mediaInfoHelper.OpenMediaSource(Request, request).ConfigureAwait(false); diff --git a/Jellyfin.Api/Models/MediaInfoDtos/OpenLiveStreamDto.cs b/Jellyfin.Api/Models/MediaInfoDtos/OpenLiveStreamDto.cs index b0b3de8553..7045423261 100644 --- a/Jellyfin.Api/Models/MediaInfoDtos/OpenLiveStreamDto.cs +++ b/Jellyfin.Api/Models/MediaInfoDtos/OpenLiveStreamDto.cs @@ -10,6 +10,61 @@ namespace Jellyfin.Api.Models.MediaInfoDtos /// public class OpenLiveStreamDto { + /// + /// Gets or sets the open token. + /// + public string? OpenToken { get; set; } + + /// + /// Gets or sets the user id. + /// + public Guid? UserId { get; set; } + + /// + /// Gets or sets the play session id. + /// + public string? PlaySessionId { get; set; } + + /// + /// Gets or sets the max streaming bitrate. + /// + public int? MaxStreamingBitrate { get; set; } + + /// + /// Gets or sets the start time in ticks. + /// + public long? StartTimeTicks { get; set; } + + /// + /// Gets or sets the audio stream index. + /// + public int? AudioStreamIndex { get; set; } + + /// + /// Gets or sets the subtitle stream index. + /// + public int? SubtitleStreamIndex { get; set; } + + /// + /// Gets or sets the max audio channels. + /// + public int? MaxAudioChannels { get; set; } + + /// + /// Gets or sets the item id. + /// + public Guid? ItemId { get; set; } + + /// + /// Gets or sets a value indicating whether to enable direct play. + /// + public bool? EnableDirectPlay { get; set; } + + /// + /// Gets or sets a value indicating whether to enale direct stream. + /// + public bool? EnableDirectStream { get; set; } + /// /// Gets or sets the device profile. ///