Added MimeType to PlayTo profile
This commit is contained in:
parent
5fcfe3bda5
commit
438b0078cc
|
@ -53,7 +53,7 @@
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="PlayTo\Argument.cs" />
|
<Compile Include="PlayTo\Argument.cs" />
|
||||||
<Compile Include="PlayTo\Configuration\DlnaProfile.cs" />
|
<Compile Include="PlayTo\Configuration\DlnaProfile.cs" />
|
||||||
<Compile Include="PlayTo\Configuration\PluginConfiguration.cs" />
|
<Compile Include="PlayTo\Configuration\PlayToConfiguration.cs" />
|
||||||
<Compile Include="PlayTo\Configuration\TranscodeSetting.cs" />
|
<Compile Include="PlayTo\Configuration\TranscodeSetting.cs" />
|
||||||
<Compile Include="PlayTo\CurrentIdEventArgs.cs" />
|
<Compile Include="PlayTo\CurrentIdEventArgs.cs" />
|
||||||
<Compile Include="PlayTo\Device.cs">
|
<Compile Include="PlayTo\Device.cs">
|
||||||
|
|
|
@ -29,7 +29,12 @@
|
||||||
FriendlyName = "^TV$",
|
FriendlyName = "^TV$",
|
||||||
ModelNumber = @"1\.0",
|
ModelNumber = @"1\.0",
|
||||||
ModelName = "Samsung DTV DMR",
|
ModelName = "Samsung DTV DMR",
|
||||||
TranscodeSettings = TranscodeSettings.GetDefaultTranscodingSettings()
|
TranscodeSettings = new[]
|
||||||
|
{
|
||||||
|
new TranscodeSettings {Container = "mkv", MimeType = "x-mkv"},
|
||||||
|
new TranscodeSettings {Container = "flac", TargetContainer = "mp3"},
|
||||||
|
new TranscodeSettings {Container = "m4a", TargetContainer = "mp3"}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var profile1 = new DlnaProfile
|
var profile1 = new DlnaProfile
|
||||||
|
@ -38,7 +43,12 @@
|
||||||
ClientType = "DLNA",
|
ClientType = "DLNA",
|
||||||
FriendlyName = @"(^\[TV\][A-Z]{2}\d{2}(E|F)[A-Z]?\d{3,4}.*)|^\[TV\] Samsung",
|
FriendlyName = @"(^\[TV\][A-Z]{2}\d{2}(E|F)[A-Z]?\d{3,4}.*)|^\[TV\] Samsung",
|
||||||
ModelNumber = @"(1\.0)|(AllShare1\.0)",
|
ModelNumber = @"(1\.0)|(AllShare1\.0)",
|
||||||
TranscodeSettings = TranscodeSettings.GetDefaultTranscodingSettings()
|
TranscodeSettings = new[]
|
||||||
|
{
|
||||||
|
new TranscodeSettings {Container = "mkv", MimeType = "x-mkv"},
|
||||||
|
new TranscodeSettings {Container = "flac", TargetContainer = "mp3"},
|
||||||
|
new TranscodeSettings {Container = "m4a", TargetContainer = "mp3"}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var profile2 = new DlnaProfile
|
var profile2 = new DlnaProfile
|
||||||
|
@ -47,7 +57,12 @@
|
||||||
ClientType = "DLNA",
|
ClientType = "DLNA",
|
||||||
FriendlyName = @"(^TV-\d{2}C\d{3}.*)|(^\[TV\][A-Z]{2}\d{2}(D)[A-Z]?\d{3,4}.*)|^\[TV\] Samsung",
|
FriendlyName = @"(^TV-\d{2}C\d{3}.*)|(^\[TV\][A-Z]{2}\d{2}(D)[A-Z]?\d{3,4}.*)|^\[TV\] Samsung",
|
||||||
ModelNumber = @"(1\.0)|(AllShare1\.0)",
|
ModelNumber = @"(1\.0)|(AllShare1\.0)",
|
||||||
TranscodeSettings = TranscodeSettings.GetDefaultTranscodingSettings()
|
TranscodeSettings = new[]
|
||||||
|
{
|
||||||
|
new TranscodeSettings {Container = "mkv", MimeType = "x-mkv"},
|
||||||
|
new TranscodeSettings {Container = "flac", TargetContainer = "mp3"},
|
||||||
|
new TranscodeSettings {Container = "m4a", TargetContainer = "mp3"}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var profile3 = new DlnaProfile
|
var profile3 = new DlnaProfile
|
|
@ -21,6 +21,12 @@ namespace MediaBrowser.Dlna.PlayTo.Configuration
|
||||||
/// </value>
|
/// </value>
|
||||||
public string TargetContainer { get; set; }
|
public string TargetContainer { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Mimetype to enforce
|
||||||
|
/// </summary>
|
||||||
|
/// <value>
|
||||||
|
/// The MimeType.
|
||||||
|
/// </value>
|
||||||
public string MimeType { get; set; }
|
public string MimeType { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -16,6 +16,8 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
|
|
||||||
public string FileFormat { get; set; }
|
public string FileFormat { get; set; }
|
||||||
|
|
||||||
|
public string MimeType { get; set; }
|
||||||
|
|
||||||
public int PlayState { get; set; }
|
public int PlayState { get; set; }
|
||||||
|
|
||||||
public string StreamUrl { get; set; }
|
public string StreamUrl { get; set; }
|
||||||
|
@ -51,10 +53,21 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(transcodeSetting.Container))
|
if (string.IsNullOrWhiteSpace(transcodeSetting.Container))
|
||||||
continue;
|
continue;
|
||||||
if (path.EndsWith(transcodeSetting.Container))
|
if (path.EndsWith(transcodeSetting.Container) && !string.IsNullOrWhiteSpace(transcodeSetting.TargetContainer))
|
||||||
{
|
{
|
||||||
playlistItem.Transcode = true;
|
playlistItem.Transcode = true;
|
||||||
playlistItem.FileFormat = transcodeSetting.TargetContainer;
|
playlistItem.FileFormat = transcodeSetting.TargetContainer;
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(transcodeSetting.MimeType))
|
||||||
|
playlistItem.MimeType = transcodeSetting.MimeType;
|
||||||
|
|
||||||
|
return playlistItem;
|
||||||
|
}
|
||||||
|
if (path.EndsWith(transcodeSetting.Container) && !string.IsNullOrWhiteSpace(transcodeSetting.MimeType))
|
||||||
|
{
|
||||||
|
playlistItem.Transcode = false;
|
||||||
|
playlistItem.FileFormat = transcodeSetting.Container;
|
||||||
|
playlistItem.MimeType = transcodeSetting.MimeType;
|
||||||
return playlistItem;
|
return playlistItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,9 +96,12 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
/// <returns>The url to send to the device</returns>
|
/// <returns>The url to send to the device</returns>
|
||||||
internal static string GetVideoUrl(DeviceProperties deviceProperties, PlaylistItem item, List<MediaStream> streams, string serverAddress)
|
internal static string GetVideoUrl(DeviceProperties deviceProperties, PlaylistItem item, List<MediaStream> streams, string serverAddress)
|
||||||
{
|
{
|
||||||
|
string dlnaCommand = string.Empty;
|
||||||
if (!item.Transcode)
|
if (!item.Transcode)
|
||||||
return string.Format("{0}/Videos/{1}/stream.{2}?Static=True", serverAddress, item.ItemId, item.FileFormat);
|
{
|
||||||
|
dlnaCommand = BuildDlnaUrl(deviceProperties.UUID, !item.Transcode, null, null, null, null, null, null, null, null, null, null, item.MimeType);
|
||||||
|
return string.Format("{0}/Videos/{1}/stream.{2}?{3}", serverAddress, item.ItemId, item.FileFormat, dlnaCommand);
|
||||||
|
}
|
||||||
var videostream = streams.Where(m => m.Type == MediaStreamType.Video).OrderBy(m => m.IsDefault).FirstOrDefault();
|
var videostream = streams.Where(m => m.Type == MediaStreamType.Video).OrderBy(m => m.IsDefault).FirstOrDefault();
|
||||||
var audiostream = streams.Where(m => m.Type == MediaStreamType.Audio).OrderBy(m => m.IsDefault).FirstOrDefault();
|
var audiostream = streams.Where(m => m.Type == MediaStreamType.Audio).OrderBy(m => m.IsDefault).FirstOrDefault();
|
||||||
|
|
||||||
|
@ -117,7 +120,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
audioChannels = 2;
|
audioChannels = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
string dlnaCommand = BuildDlnaUrl(deviceProperties.UUID, videoCodec, audioCodec, null, null, videoBitrate, audioChannels, audioBitrate, item.StartPositionTicks, "baseline", "3");
|
dlnaCommand = BuildDlnaUrl(deviceProperties.UUID, !item.Transcode, videoCodec, audioCodec, null, null, videoBitrate, audioChannels, audioBitrate, item.StartPositionTicks, "baseline", "3", item.MimeType);
|
||||||
return string.Format("{0}/Videos/{1}/stream.{2}?{3}", serverAddress, item.ItemId, item.FileFormat, dlnaCommand);
|
return string.Format("{0}/Videos/{1}/stream.{2}?{3}", serverAddress, item.ItemId, item.FileFormat, dlnaCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,12 +165,12 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Builds the dlna URL.
|
/// Builds the dlna URL.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static string BuildDlnaUrl(string deviceID, VideoCodecs? videoCodec, AudioCodecs? audioCodec, int? subtitleIndex, int? audiostreamIndex, int? videoBitrate, int? audiochannels, int? audioBitrate, long? startPositionTicks, string profile, string videoLevel)
|
private static string BuildDlnaUrl(string deviceID, bool isStatic, VideoCodecs? videoCodec, AudioCodecs? audioCodec, int? subtitleIndex, int? audiostreamIndex, int? videoBitrate, int? audiochannels, int? audioBitrate, long? startPositionTicks, string profile, string videoLevel, string mimeType)
|
||||||
{
|
{
|
||||||
var usCulture = new CultureInfo("en-US");
|
var usCulture = new CultureInfo("en-US");
|
||||||
|
|
||||||
var dlnaparam = string.Format("Params={0};", deviceID);
|
var dlnaparam = string.Format("Params={0};", deviceID);
|
||||||
|
dlnaparam += isStatic ? "true;" : "false;";
|
||||||
dlnaparam += videoCodec.HasValue ? videoCodec.Value + ";" : ";";
|
dlnaparam += videoCodec.HasValue ? videoCodec.Value + ";" : ";";
|
||||||
dlnaparam += audioCodec.HasValue ? audioCodec.Value + ";" : ";";
|
dlnaparam += audioCodec.HasValue ? audioCodec.Value + ";" : ";";
|
||||||
dlnaparam += audiostreamIndex.HasValue ? audiostreamIndex.Value.ToString(usCulture) + ";" : ";";
|
dlnaparam += audiostreamIndex.HasValue ? audiostreamIndex.Value.ToString(usCulture) + ";" : ";";
|
||||||
|
@ -178,6 +181,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
dlnaparam += startPositionTicks.HasValue ? startPositionTicks.Value.ToString(usCulture) + ";" : ";";
|
dlnaparam += startPositionTicks.HasValue ? startPositionTicks.Value.ToString(usCulture) + ";" : ";";
|
||||||
dlnaparam += profile + ";";
|
dlnaparam += profile + ";";
|
||||||
dlnaparam += videoLevel + ";";
|
dlnaparam += videoLevel + ";";
|
||||||
|
dlnaparam += mimeType + ";";
|
||||||
|
|
||||||
return dlnaparam;
|
return dlnaparam;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user