public DlnaProtocolInfo GetProtocolInfo(DlnaMediaItem item, ProtocolInfoFormat infoLevel) { if (item.DlnaMime == null) { return(null); } var info = new DlnaProtocolInfo { Protocol = "http-get", Network = "*", MediaType = item.DlnaMime, AdditionalInfo = new DlnaForthField() }; bool live = false; if (item.TranscodingParameter is VideoTranscoding) { live = ((VideoTranscoding)item.TranscodingParameter).TargetIsLive; } else if (item.TranscodingParameter is AudioTranscoding) { live = ((AudioTranscoding)item.TranscodingParameter).TargetIsLive; } ConfigureProfile(info.AdditionalInfo, item, infoLevel, live); return(info); }
public static DlnaProtocolInfo GetProfileInfo(DlnaMediaItem item, ProtocolInfoFormat infoLevel) { var factory = new DlnaProtocolInfoFactory(); return(factory.GetProtocolInfo(item, infoLevel)); }
private static void ConfigureProfile(DlnaForthField dlnaField, DlnaMediaItem dlnaItem, ProtocolInfoFormat infoLevel, bool live) { if (infoLevel == ProtocolInfoFormat.Simple) { dlnaField.ProfileParameter.Show = false; dlnaField.OperationsParameter.Show = false; dlnaField.FlagsParameter.Show = false; dlnaField.PlaySpeedParameter.Show = false; dlnaField.ProfileParameter.ProfileName = dlnaItem.DlnaProfile; } else { dlnaField.ConversionParameter.Show = true; if (dlnaItem.IsTranscoded) { dlnaField.ConversionParameter.ConvertedContent = true; } else { dlnaField.ConversionParameter.ConvertedContent = false; } dlnaField.ProfileParameter.Show = true; dlnaField.ProfileParameter.ProfileName = dlnaItem.DlnaProfile; if (dlnaItem.IsImage) { dlnaField.OperationsParameter.Show = true; dlnaField.OperationsParameter.TimeSeekRangeSupport = false; dlnaField.OperationsParameter.ByteSeekRangeSupport = false; dlnaField.FlagsParameter.Show = true; dlnaField.FlagsParameter.SenderPaced = false; dlnaField.FlagsParameter.TimeBasedSeek = false; dlnaField.FlagsParameter.ByteBasedSeek = false; dlnaField.FlagsParameter.PlayerContainer = false; dlnaField.FlagsParameter.UcdamS0Increasing = false; dlnaField.FlagsParameter.UcdamSnIncreasing = false; dlnaField.FlagsParameter.RtspPauseOperation = false; dlnaField.FlagsParameter.StreamingMode = false; dlnaField.FlagsParameter.InteractiveMode = true; dlnaField.FlagsParameter.BackgroundMode = true; dlnaField.FlagsParameter.HttpConnectionStalling = false; dlnaField.FlagsParameter.Dlna1Dot5Version = true; dlnaField.FlagsParameter.LinkProtectedContent = false; dlnaField.FlagsParameter.CleartextByteFullDataSeek = false; dlnaField.FlagsParameter.CleartextLimitedDataSeek = false; dlnaField.PlaySpeedParameter.Show = false; } else if (dlnaItem.IsVideo || dlnaItem.IsAudio) { dlnaField.OperationsParameter.Show = true; double duration = dlnaItem?.Metadata?.Duration ?? 0; if (duration > 0 && live == false) { dlnaField.OperationsParameter.TimeSeekRangeSupport = true; dlnaField.OperationsParameter.ByteSeekRangeSupport = true; dlnaField.FlagsParameter.TimeBasedSeek = true; dlnaField.FlagsParameter.ByteBasedSeek = true; } else { dlnaField.OperationsParameter.TimeSeekRangeSupport = false; dlnaField.OperationsParameter.ByteSeekRangeSupport = false; dlnaField.FlagsParameter.TimeBasedSeek = false; dlnaField.FlagsParameter.ByteBasedSeek = false; } if (live) { dlnaField.FlagsParameter.SenderPaced = true; } else { dlnaField.FlagsParameter.SenderPaced = false; } dlnaField.FlagsParameter.Show = true; dlnaField.FlagsParameter.SenderPaced = false; dlnaField.FlagsParameter.PlayerContainer = false; dlnaField.FlagsParameter.UcdamS0Increasing = false; if (dlnaItem.IsTranscoded == true) { dlnaField.FlagsParameter.UcdamSnIncreasing = true; } else { dlnaField.FlagsParameter.UcdamSnIncreasing = false; } dlnaField.FlagsParameter.RtspPauseOperation = false; dlnaField.FlagsParameter.StreamingMode = true; dlnaField.FlagsParameter.InteractiveMode = false; dlnaField.FlagsParameter.BackgroundMode = true; dlnaField.FlagsParameter.HttpConnectionStalling = false; dlnaField.FlagsParameter.Dlna1Dot5Version = true; dlnaField.FlagsParameter.LinkProtectedContent = false; dlnaField.FlagsParameter.CleartextByteFullDataSeek = false; dlnaField.FlagsParameter.CleartextLimitedDataSeek = false; dlnaField.PlaySpeedParameter.Show = false; } } }