play to fixes

pull/702/head
Luke Pulverenti 11 years ago
parent 87ebe39107
commit 7683fe878f

@ -24,11 +24,21 @@ namespace MediaBrowser.Dlna
{
Container = "mp3",
Type = DlnaProfileType.Audio
},
new TranscodingProfile
{
Container = "ts",
Type = DlnaProfileType.Video
}
},
DirectPlayProfiles = new[]
{
new DirectPlayProfile
{
Containers = new[]{"mp3"},
Type = DlnaProfileType.Audio
},
new DirectPlayProfile
{
Containers = new[]{"mkv"},
@ -40,6 +50,11 @@ namespace MediaBrowser.Dlna
Containers = new[]{"avi"},
MimeType = "x-msvideo",
Type = DlnaProfileType.Video
},
new DirectPlayProfile
{
Containers = new[]{"mp4"},
Type = DlnaProfileType.Video
}
}
});
@ -57,11 +72,21 @@ namespace MediaBrowser.Dlna
{
Container = "mp3",
Type = DlnaProfileType.Audio
},
new TranscodingProfile
{
Container = "ts",
Type = DlnaProfileType.Video
}
},
DirectPlayProfiles = new[]
{
new DirectPlayProfile
{
Containers = new[]{"mp3"},
Type = DlnaProfileType.Audio
},
new DirectPlayProfile
{
Containers = new[]{"mkv"},
@ -73,6 +98,11 @@ namespace MediaBrowser.Dlna
Containers = new[]{"avi"},
MimeType = "x-msvideo",
Type = DlnaProfileType.Video
},
new DirectPlayProfile
{
Containers = new[]{"mp4"},
Type = DlnaProfileType.Video
}
}
});
@ -89,11 +119,21 @@ namespace MediaBrowser.Dlna
{
Container = "mp3",
Type = DlnaProfileType.Audio
},
new TranscodingProfile
{
Container = "ts",
Type = DlnaProfileType.Video
}
},
DirectPlayProfiles = new[]
{
new DirectPlayProfile
{
Containers = new[]{"mp3"},
Type = DlnaProfileType.Audio
},
new DirectPlayProfile
{
Containers = new[]{"mkv"},
@ -105,6 +145,11 @@ namespace MediaBrowser.Dlna
Containers = new[]{"avi"},
MimeType = "x-msvideo",
Type = DlnaProfileType.Video
},
new DirectPlayProfile
{
Containers = new[]{"mp4"},
Type = DlnaProfileType.Video
}
}
});
@ -130,6 +175,11 @@ namespace MediaBrowser.Dlna
DirectPlayProfiles = new[]
{
new DirectPlayProfile
{
Containers = new[]{"mp3"},
Type = DlnaProfileType.Audio
},
new DirectPlayProfile
{
Containers = new[]{"avi"},
@ -161,6 +211,11 @@ namespace MediaBrowser.Dlna
DirectPlayProfiles = new[]
{
new DirectPlayProfile
{
Containers = new[]{"mp3"},
Type = DlnaProfileType.Audio
},
new DirectPlayProfile
{
Containers = new[]{"avi"},
@ -172,8 +227,7 @@ namespace MediaBrowser.Dlna
list.Add(new DlnaProfile
{
//Linksys DMA2100us does not need any transcoding of the formats we support statically
Name = "Sony Bravia TV (2012)",
Name = "Sony Bravia (2012)",
ClientType = "DLNA",
FriendlyName = @"BRAVIA KDL-\d{2}[A-Z]X\d5(\d|G).*",
@ -193,6 +247,11 @@ namespace MediaBrowser.Dlna
DirectPlayProfiles = new[]
{
new DirectPlayProfile
{
Containers = new[]{"mp3"},
Type = DlnaProfileType.Audio
},
new DirectPlayProfile
{
Containers = new[]{"avi"},
@ -273,7 +332,7 @@ namespace MediaBrowser.Dlna
{
new DirectPlayProfile
{
Containers = new[]{"mp3", "wma", "m4a"},
Containers = new[]{"mp3", "wma"},
Type = DlnaProfileType.Audio
},
@ -314,4 +373,4 @@ namespace MediaBrowser.Dlna
return GetDefaultProfile();
}
}
}
}

@ -269,11 +269,10 @@ namespace MediaBrowser.Dlna.PlayTo
var result = await new SsdpHttpClient(_httpClient).SendCommandAsync(Properties.BaseUrl, service, command.Name, AvCommands.BuildPost(command, service.ServiceType, url, dictionary), header)
.ConfigureAwait(false);
if (!IsPlaying)
{
await Task.Delay(50).ConfigureAwait(false);
await SetPlay().ConfigureAwait(false);
}
await Task.Delay(50).ConfigureAwait(false);
await SetPlay().ConfigureAwait(false);
_lapsCount = GetLapsCount();
RestartTimer();
@ -350,7 +349,6 @@ namespace MediaBrowser.Dlna.PlayTo
var result = await new SsdpHttpClient(_httpClient).SendCommandAsync(Properties.BaseUrl, service, command.Name, RendererCommands.BuildPost(command, service.ServiceType, 1))
.ConfigureAwait(false);
await Task.Delay(50).ConfigureAwait(false);
return true;
}
@ -799,4 +797,3 @@ namespace MediaBrowser.Dlna.PlayTo
}
}

@ -446,6 +446,7 @@ namespace MediaBrowser.Dlna.PlayTo
return true;
}
nextTrack.PlayState = 1;
_logger.Debug("{0} - SetAvTransport Uri: {1} DlnaHeaders: {2}", _device.Properties.Name, nextTrack.StreamUrl, nextTrack.DlnaHeaders);
await _device.SetAvTransport(nextTrack.StreamUrl, nextTrack.DlnaHeaders, nextTrack.Didl);
if (nextTrack.StartPositionTicks > 0 && !nextTrack.Transcode)
await _device.Seek(TimeSpan.FromTicks(nextTrack.StartPositionTicks));
@ -489,4 +490,3 @@ namespace MediaBrowser.Dlna.PlayTo
}
}
}

@ -57,7 +57,7 @@ namespace MediaBrowser.Dlna.PlayTo
if (directPlay != null)
{
playlistItem.Transcode = false;
playlistItem.FileFormat = Path.GetExtension(path).TrimStart('.');
playlistItem.FileFormat = Path.GetExtension(path);
playlistItem.MimeType = directPlay.MimeType;
return playlistItem;
}
@ -67,7 +67,8 @@ namespace MediaBrowser.Dlna.PlayTo
if (transcodingProfile != null)
{
playlistItem.Transcode = true;
playlistItem.FileFormat = transcodingProfile.Container;
//Just to make sure we have a "." for the url, remove it in case a user adds it or not
playlistItem.FileFormat = "." + transcodingProfile.Container.TrimStart('.');
playlistItem.MimeType = transcodingProfile.MimeType;
}
@ -77,9 +78,9 @@ namespace MediaBrowser.Dlna.PlayTo
private static bool IsSupported(DirectPlayProfile profile, string path)
{
var mediaContainer = Path.GetExtension(path).TrimStart('.');
var mediaContainer = Path.GetExtension(path);
if (!profile.Containers.Any(i => string.Equals(i.TrimStart('.'), mediaContainer, StringComparison.OrdinalIgnoreCase)))
if (!profile.Containers.Any(i => string.Equals("." + i.TrimStart('.'), mediaContainer, StringComparison.OrdinalIgnoreCase)))
{
return false;
}
@ -97,4 +98,4 @@ namespace MediaBrowser.Dlna.PlayTo
return true;
}
}
}
}

@ -77,7 +77,7 @@ namespace MediaBrowser.Dlna.PlayTo
internal static string GetAudioUrl(PlaylistItem item, string serverAddress)
{
if (!item.Transcode)
return string.Format("{0}/audio/{1}/stream.{2}?Static=True", serverAddress, item.ItemId, item.FileFormat);
return string.Format("{0}/audio/{1}/stream{2}?Static=True", serverAddress, item.ItemId, item.FileFormat);
return string.Format("{0}/audio/{1}/stream.mp3?AudioCodec=Mp3", serverAddress, item.ItemId);
}
@ -100,7 +100,7 @@ namespace MediaBrowser.Dlna.PlayTo
if (!item.Transcode)
{
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);
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 audiostream = streams.Where(m => m.Type == MediaStreamType.Audio).OrderBy(m => m.IsDefault).FirstOrDefault();
@ -121,7 +121,7 @@ namespace MediaBrowser.Dlna.PlayTo
}
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);
}
/// <summary>
@ -189,4 +189,4 @@ namespace MediaBrowser.Dlna.PlayTo
#endregion
}
}
}
Loading…
Cancel
Save