mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-15 23:02:18 +01:00
fixes #838 - Support rtmp protocol with channels
This commit is contained in:
@@ -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