mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-30 19:32:57 +01:00
fixes #838 - Support rtmp protocol with channels
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using MediaBrowser.Model.MediaInfo;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Controller.Channels
|
||||
@@ -20,16 +21,18 @@ namespace MediaBrowser.Controller.Channels
|
||||
public int? AudioChannels { get; set; }
|
||||
public int? AudioSampleRate { get; set; }
|
||||
|
||||
public bool IsRemote { get; set; }
|
||||
|
||||
public string VideoProfile { get; set; }
|
||||
public float? VideoLevel { get; set; }
|
||||
public float? Framerate { get; set; }
|
||||
|
||||
public MediaProtocol Protocol { get; set; }
|
||||
|
||||
public ChannelMediaInfo()
|
||||
{
|
||||
RequiredHttpHeaders = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
IsRemote = true;
|
||||
|
||||
// This is most common
|
||||
Protocol = MediaProtocol.Http;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -67,13 +67,6 @@ namespace MediaBrowser.Controller.Dto
|
||||
/// <returns>ChapterInfoDto.</returns>
|
||||
ChapterInfoDto GetChapterInfoDto(ChapterInfo chapterInfo, BaseItem item);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the media sources.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <returns>List{MediaSourceInfo}.</returns>
|
||||
List<MediaSourceInfo> GetMediaSources(BaseItem item);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the item by name dto.
|
||||
/// </summary>
|
||||
|
||||
@@ -3,6 +3,7 @@ using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.MediaInfo;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -191,7 +192,7 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||
var info = new MediaSourceInfo
|
||||
{
|
||||
Id = i.Id.ToString("N"),
|
||||
LocationType = locationType,
|
||||
Protocol = locationType == LocationType.Remote ? MediaProtocol.Http : MediaProtocol.File,
|
||||
MediaStreams = ItemRepository.GetMediaStreams(new MediaStreamQuery { ItemId = i.Id }).ToList(),
|
||||
Name = i.Name,
|
||||
Path = enablePathSubstituion ? GetMappedPath(i.Path, locationType) : i.Path,
|
||||
|
||||
@@ -549,7 +549,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
Id = i.Id.ToString("N"),
|
||||
IsoType = i.IsoType,
|
||||
LocationType = locationType,
|
||||
Protocol = locationType == LocationType.Remote ? MediaProtocol.Http : MediaProtocol.File,
|
||||
MediaStreams = mediaStreams,
|
||||
Name = GetMediaSourceName(i, mediaStreams),
|
||||
Path = enablePathSubstitution ? GetMappedPath(i.Path, locationType) : i.Path,
|
||||
|
||||
@@ -6,7 +6,7 @@ using System.Linq;
|
||||
|
||||
namespace MediaBrowser.Controller.LiveTv
|
||||
{
|
||||
public class LiveTvChannel : BaseItem, IItemByName
|
||||
public class LiveTvChannel : BaseItem, IItemByName, IHasMediaSources
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the user data key.
|
||||
@@ -114,5 +114,10 @@ namespace MediaBrowser.Controller.LiveTv
|
||||
{
|
||||
return new List<BaseItem>();
|
||||
}
|
||||
|
||||
public IEnumerable<Model.Dto.MediaSourceInfo> GetMediaSources(bool enablePathSubstitution)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.MediaInfo;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
@@ -35,59 +36,37 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
/// Extracts the video image.
|
||||
/// </summary>
|
||||
/// <param name="inputFiles">The input files.</param>
|
||||
/// <param name="type">The type.</param>
|
||||
/// <param name="protocol">The protocol.</param>
|
||||
/// <param name="threedFormat">The threed format.</param>
|
||||
/// <param name="offset">The offset.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task{Stream}.</returns>
|
||||
Task<Stream> ExtractVideoImage(string[] inputFiles, InputType type, Video3DFormat? threedFormat, TimeSpan? offset, CancellationToken cancellationToken);
|
||||
Task<Stream> ExtractVideoImage(string[] inputFiles, MediaProtocol protocol, Video3DFormat? threedFormat, TimeSpan? offset, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the media info.
|
||||
/// </summary>
|
||||
/// <param name="inputFiles">The input files.</param>
|
||||
/// <param name="type">The type.</param>
|
||||
/// <param name="protocol">The protocol.</param>
|
||||
/// <param name="isAudio">if set to <c>true</c> [is audio].</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task.</returns>
|
||||
Task<InternalMediaInfoResult> GetMediaInfo(string[] inputFiles, InputType type, bool isAudio, CancellationToken cancellationToken);
|
||||
Task<InternalMediaInfoResult> GetMediaInfo(string[] inputFiles, MediaProtocol protocol, bool isAudio, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the probe size argument.
|
||||
/// </summary>
|
||||
/// <param name="type">The type.</param>
|
||||
/// <param name="inputFiles">The input files.</param>
|
||||
/// <param name="protocol">The protocol.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
string GetProbeSizeArgument(InputType type);
|
||||
string GetProbeSizeArgument(string[] inputFiles, MediaProtocol protocol);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the input argument.
|
||||
/// </summary>
|
||||
/// <param name="inputFiles">The input files.</param>
|
||||
/// <param name="type">The type.</param>
|
||||
/// <param name="protocol">The protocol.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
string GetInputArgument(string[] inputFiles, InputType type);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enum InputType
|
||||
/// </summary>
|
||||
public enum InputType
|
||||
{
|
||||
/// <summary>
|
||||
/// The file
|
||||
/// </summary>
|
||||
File,
|
||||
/// <summary>
|
||||
/// The bluray
|
||||
/// </summary>
|
||||
Bluray,
|
||||
/// <summary>
|
||||
/// The DVD
|
||||
/// </summary>
|
||||
Dvd,
|
||||
/// <summary>
|
||||
/// The URL
|
||||
/// </summary>
|
||||
Url
|
||||
string GetInputArgument(string[] inputFiles, MediaProtocol protocol);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.MediaInfo;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
@@ -17,56 +18,22 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
/// Gets the input argument.
|
||||
/// </summary>
|
||||
/// <param name="videoPath">The video path.</param>
|
||||
/// <param name="isRemote">if set to <c>true</c> [is remote].</param>
|
||||
/// <param name="videoType">Type of the video.</param>
|
||||
/// <param name="isoType">Type of the iso.</param>
|
||||
/// <param name="protocol">The protocol.</param>
|
||||
/// <param name="isoMount">The iso mount.</param>
|
||||
/// <param name="playableStreamFileNames">The playable stream file names.</param>
|
||||
/// <param name="type">The type.</param>
|
||||
/// <returns>System.String[][].</returns>
|
||||
public static string[] GetInputArgument(string videoPath, bool isRemote, VideoType videoType, IsoType? isoType, IIsoMount isoMount, IEnumerable<string> playableStreamFileNames, out InputType type)
|
||||
public static string[] GetInputArgument(string videoPath, MediaProtocol protocol, IIsoMount isoMount, List<string> playableStreamFileNames)
|
||||
{
|
||||
var inputPath = isoMount == null ? new[] { videoPath } : new[] { isoMount.MountedPath };
|
||||
|
||||
type = InputType.File;
|
||||
|
||||
switch (videoType)
|
||||
if (playableStreamFileNames.Count > 0)
|
||||
{
|
||||
case VideoType.BluRay:
|
||||
type = InputType.Bluray;
|
||||
inputPath = GetPlayableStreamFiles(inputPath[0], playableStreamFileNames).ToArray();
|
||||
break;
|
||||
case VideoType.Dvd:
|
||||
type = InputType.Dvd;
|
||||
inputPath = GetPlayableStreamFiles(inputPath[0], playableStreamFileNames).ToArray();
|
||||
break;
|
||||
case VideoType.Iso:
|
||||
if (isoType.HasValue)
|
||||
{
|
||||
switch (isoType.Value)
|
||||
{
|
||||
case IsoType.BluRay:
|
||||
type = InputType.Bluray;
|
||||
inputPath = GetPlayableStreamFiles(inputPath[0], playableStreamFileNames).ToArray();
|
||||
break;
|
||||
case IsoType.Dvd:
|
||||
type = InputType.Dvd;
|
||||
inputPath = GetPlayableStreamFiles(inputPath[0], playableStreamFileNames).ToArray();
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case VideoType.VideoFile:
|
||||
{
|
||||
if (isRemote)
|
||||
{
|
||||
type = InputType.Url;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (isoMount == null)
|
||||
{
|
||||
return GetPlayableStreamFiles(videoPath, playableStreamFileNames).ToArray();
|
||||
}
|
||||
return GetPlayableStreamFiles(isoMount.MountedPath, playableStreamFileNames).ToArray();
|
||||
}
|
||||
|
||||
return inputPath;
|
||||
return new[] {videoPath};
|
||||
}
|
||||
|
||||
public static List<string> GetPlayableStreamFiles(string rootPath, IEnumerable<string> filenames)
|
||||
@@ -80,46 +47,6 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the type of the input.
|
||||
/// </summary>
|
||||
/// <param name="videoType">Type of the video.</param>
|
||||
/// <param name="isoType">Type of the iso.</param>
|
||||
/// <returns>InputType.</returns>
|
||||
public static InputType GetInputType(VideoType? videoType, IsoType? isoType)
|
||||
{
|
||||
var type = InputType.File;
|
||||
|
||||
if (videoType.HasValue)
|
||||
{
|
||||
switch (videoType.Value)
|
||||
{
|
||||
case VideoType.BluRay:
|
||||
type = InputType.Bluray;
|
||||
break;
|
||||
case VideoType.Dvd:
|
||||
type = InputType.Dvd;
|
||||
break;
|
||||
case VideoType.Iso:
|
||||
if (isoType.HasValue)
|
||||
{
|
||||
switch (isoType.Value)
|
||||
{
|
||||
case IsoType.BluRay:
|
||||
type = InputType.Bluray;
|
||||
break;
|
||||
case IsoType.Dvd:
|
||||
type = InputType.Dvd;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
public static MediaInfo GetMediaInfo(InternalMediaInfoResult data)
|
||||
{
|
||||
var internalStreams = data.streams ?? new MediaStreamInfo[] { };
|
||||
|
||||
Reference in New Issue
Block a user