Skip to content

Commit

Permalink
Use file-scoped namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
barronpm committed Nov 22, 2023
1 parent 6800de2 commit 59d82f6
Show file tree
Hide file tree
Showing 66 changed files with 7,410 additions and 7,473 deletions.
89 changes: 44 additions & 45 deletions src/Jellyfin.Plugin.Dlna.Model/DlnaFlags.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,48 @@

using System;

namespace Jellyfin.Plugin.Dlna.Model
namespace Jellyfin.Plugin.Dlna.Model;

[Flags]
public enum DlnaFlags : ulong
{
[Flags]
public enum DlnaFlags : ulong
{
/*! <i>Background</i> transfer mode.
For use with upload and download transfers to and from the server.
The primary difference between \ref DH_TransferMode_Interactive and
\ref DH_TransferMode_Bulk is that the latter assumes that the user
is not relying on the transfer for immediately rendering the content
and there are no issues with causing a buffer overflow if the
receiver uses TCP flow control to reduce total throughput.
*/
BackgroundTransferMode = 1 << 22,

ByteBasedSeek = 1 << 29,
ConnectionStall = 1 << 21,

DlnaV15 = 1 << 20,

/*! <i>Interactive</i> transfer mode.
For best effort transfer of images and non-real-time transfers.
URIs with image content usually support \ref DH_TransferMode_Bulk too.
The primary difference between \ref DH_TransferMode_Interactive and
\ref DH_TransferMode_Bulk is that the former assumes that the
transfer is intended for immediate rendering.
*/
InteractiveTransferMode = 1 << 23,

PlayContainer = 1 << 28,
RtspPause = 1 << 25,
S0Increase = 1 << 27,
SenderPaced = 1L << 31,
SnIncrease = 1 << 26,

/*! <i>Streaming</i> transfer mode.
The server transmits at a throughput sufficient for real-time playback of
audio or video. URIs with audio or video often support the
\ref DH_TransferMode_Interactive and \ref DH_TransferMode_Bulk transfer modes.
The most well-known exception to this general claim is for live streams.
*/
StreamingTransferMode = 1 << 24,

TimeBasedSeek = 1 << 30
}
}
/*! <i>Background</i> transfer mode.
For use with upload and download transfers to and from the server.
The primary difference between \ref DH_TransferMode_Interactive and
\ref DH_TransferMode_Bulk is that the latter assumes that the user
is not relying on the transfer for immediately rendering the content
and there are no issues with causing a buffer overflow if the
receiver uses TCP flow control to reduce total throughput.
*/
BackgroundTransferMode = 1 << 22,

ByteBasedSeek = 1 << 29,
ConnectionStall = 1 << 21,

DlnaV15 = 1 << 20,

/*! <i>Interactive</i> transfer mode.
For best effort transfer of images and non-real-time transfers.
URIs with image content usually support \ref DH_TransferMode_Bulk too.
The primary difference between \ref DH_TransferMode_Interactive and
\ref DH_TransferMode_Bulk is that the former assumes that the
transfer is intended for immediate rendering.
*/
InteractiveTransferMode = 1 << 23,

PlayContainer = 1 << 28,
RtspPause = 1 << 25,
S0Increase = 1 << 27,
SenderPaced = 1L << 31,
SnIncrease = 1 << 26,

/*! <i>Streaming</i> transfer mode.
The server transmits at a throughput sufficient for real-time playback of
audio or video. URIs with audio or video often support the
\ref DH_TransferMode_Interactive and \ref DH_TransferMode_Bulk transfer modes.
The most well-known exception to this general claim is for live streams.
*/
StreamingTransferMode = 1 << 24,

TimeBasedSeek = 1 << 30
}
57 changes: 28 additions & 29 deletions src/Jellyfin.Plugin.Dlna.Model/DlnaMaps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,45 +3,44 @@
using System.Globalization;
using MediaBrowser.Model.Dlna;

namespace Jellyfin.Plugin.Dlna.Model
namespace Jellyfin.Plugin.Dlna.Model;

public static class DlnaMaps
{
public static class DlnaMaps
public static string FlagsToString(DlnaFlags flags)
{
public static string FlagsToString(DlnaFlags flags)
{
return string.Format(CultureInfo.InvariantCulture, "{0:X8}{1:D24}", (ulong)flags, 0);
}

public static string GetOrgOpValue(bool hasKnownRuntime, bool isDirectStream, TranscodeSeekInfo profileTranscodeSeekInfo)
{
if (hasKnownRuntime)
{
string orgOp = string.Empty;

// Time-based seeking currently only possible when transcoding
orgOp += isDirectStream ? "0" : "1";

// Byte-based seeking only possible when not transcoding
orgOp += isDirectStream || profileTranscodeSeekInfo == TranscodeSeekInfo.Bytes ? "1" : "0";

return orgOp;
}

// No seeking is available if we don't know the content runtime
return "00";
}
return string.Format(CultureInfo.InvariantCulture, "{0:X8}{1:D24}", (ulong)flags, 0);
}

public static string GetImageOrgOpValue()
public static string GetOrgOpValue(bool hasKnownRuntime, bool isDirectStream, TranscodeSeekInfo profileTranscodeSeekInfo)
{
if (hasKnownRuntime)
{
string orgOp = string.Empty;

// Time-based seeking currently only possible when transcoding
orgOp += "0";
orgOp += isDirectStream ? "0" : "1";

// Byte-based seeking only possible when not transcoding
orgOp += "0";
orgOp += isDirectStream || profileTranscodeSeekInfo == TranscodeSeekInfo.Bytes ? "1" : "0";

return orgOp;
}

// No seeking is available if we don't know the content runtime
return "00";
}

public static string GetImageOrgOpValue()
{
string orgOp = string.Empty;

// Time-based seeking currently only possible when transcoding
orgOp += "0";

// Byte-based seeking only possible when not transcoding
orgOp += "0";

return orgOp;
}
}
}
123 changes: 61 additions & 62 deletions src/Jellyfin.Plugin.Dlna.Model/IDlnaManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,76 +5,75 @@
using MediaBrowser.Model.Dlna;
using Microsoft.AspNetCore.Http;

namespace Jellyfin.Plugin.Dlna.Model
namespace Jellyfin.Plugin.Dlna.Model;

public interface IDlnaManager
{
public interface IDlnaManager
{
/// <summary>
/// Gets the profile infos.
/// </summary>
/// <returns>IEnumerable{DeviceProfileInfo}.</returns>
IEnumerable<DeviceProfileInfo> GetProfileInfos();
/// <summary>
/// Gets the profile infos.
/// </summary>
/// <returns>IEnumerable{DeviceProfileInfo}.</returns>
IEnumerable<DeviceProfileInfo> GetProfileInfos();

/// <summary>
/// Gets the profile.
/// </summary>
/// <param name="headers">The headers.</param>
/// <returns>DeviceProfile.</returns>
DeviceProfile? GetProfile(IHeaderDictionary headers);
/// <summary>
/// Gets the profile.
/// </summary>
/// <param name="headers">The headers.</param>
/// <returns>DeviceProfile.</returns>
DeviceProfile? GetProfile(IHeaderDictionary headers);

/// <summary>
/// Gets the default profile.
/// </summary>
/// <returns>DeviceProfile.</returns>
DeviceProfile GetDefaultProfile();
/// <summary>
/// Gets the default profile.
/// </summary>
/// <returns>DeviceProfile.</returns>
DeviceProfile GetDefaultProfile();

/// <summary>
/// Creates the profile.
/// </summary>
/// <param name="profile">The profile.</param>
void CreateProfile(DeviceProfile profile);
/// <summary>
/// Creates the profile.
/// </summary>
/// <param name="profile">The profile.</param>
void CreateProfile(DeviceProfile profile);

/// <summary>
/// Updates the profile.
/// </summary>
/// <param name="profileId">The profile id.</param>
/// <param name="profile">The profile.</param>
void UpdateProfile(string profileId, DeviceProfile profile);
/// <summary>
/// Updates the profile.
/// </summary>
/// <param name="profileId">The profile id.</param>
/// <param name="profile">The profile.</param>
void UpdateProfile(string profileId, DeviceProfile profile);

/// <summary>
/// Deletes the profile.
/// </summary>
/// <param name="id">The identifier.</param>
void DeleteProfile(string id);
/// <summary>
/// Deletes the profile.
/// </summary>
/// <param name="id">The identifier.</param>
void DeleteProfile(string id);

/// <summary>
/// Gets the profile.
/// </summary>
/// <param name="id">The identifier.</param>
/// <returns>DeviceProfile.</returns>
DeviceProfile? GetProfile(string id);
/// <summary>
/// Gets the profile.
/// </summary>
/// <param name="id">The identifier.</param>
/// <returns>DeviceProfile.</returns>
DeviceProfile? GetProfile(string id);

/// <summary>
/// Gets the profile.
/// </summary>
/// <param name="deviceInfo">The device information.</param>
/// <returns>DeviceProfile.</returns>
DeviceProfile? GetProfile(DeviceIdentification deviceInfo);
/// <summary>
/// Gets the profile.
/// </summary>
/// <param name="deviceInfo">The device information.</param>
/// <returns>DeviceProfile.</returns>
DeviceProfile? GetProfile(DeviceIdentification deviceInfo);

/// <summary>
/// Gets the server description XML.
/// </summary>
/// <param name="headers">The headers.</param>
/// <param name="serverUuId">The server uu identifier.</param>
/// <param name="serverAddress">The server address.</param>
/// <returns>System.String.</returns>
string GetServerDescriptionXml(IHeaderDictionary headers, string serverUuId, string serverAddress);
/// <summary>
/// Gets the server description XML.
/// </summary>
/// <param name="headers">The headers.</param>
/// <param name="serverUuId">The server uu identifier.</param>
/// <param name="serverAddress">The server address.</param>
/// <returns>System.String.</returns>
string GetServerDescriptionXml(IHeaderDictionary headers, string serverUuId, string serverAddress);

/// <summary>
/// Gets the icon.
/// </summary>
/// <param name="filename">The filename.</param>
/// <returns>DlnaIconResponse.</returns>
ImageStream? GetIcon(string filename);
}
/// <summary>
/// Gets the icon.
/// </summary>
/// <param name="filename">The filename.</param>
/// <returns>DlnaIconResponse.</returns>
ImageStream? GetIcon(string filename);
}
Loading

0 comments on commit 59d82f6

Please sign in to comment.