compatibility updates

This commit is contained in:
Luke Pulverenti 2014-06-22 23:51:51 -04:00
parent 1db7800dd5
commit 76df5b1e4c
10 changed files with 64 additions and 44 deletions

View File

@ -1,6 +1,7 @@
package MediaBrowser.Model.Configuration;
import MediaBrowser.Model.Entities.*;
import MediaBrowser.Model.Extensions.*;
/**
Class MetadataOptions.
@ -144,6 +145,6 @@ public class MetadataOptions
public final boolean IsMetadataSaverEnabled(String name)
{
return !getDisabledMetadataSavers().Contains(name, StringComparer.OrdinalIgnoreCase);
return !ListHelper.ContainsIgnoreCase(getDisabledMetadataSavers(), name);
}
}

View File

@ -692,7 +692,9 @@ public class ServerConfiguration extends BaseApplicationConfiguration
setMinResumePct(5);
setMaxResumePct(90);
setMinResumeDurationSeconds((int)java.lang.Math.round(TimeSpan.FromMinutes(5).TotalSeconds));
// 5 minutes
setMinResumeDurationSeconds(300);
setRealtimeMonitorDelay(30);

View File

@ -5,7 +5,7 @@ import MediaBrowser.Model.MediaInfo.*;
public class ConditionProcessor
{
public final boolean IsVideoConditionSatisfied(ProfileCondition condition, Integer audioBitrate, Integer audioChannels, Integer width, Integer height, Integer bitDepth, Integer videoBitrate, String videoProfile, Double videoLevel, Double videoFramerate, Integer packetLength, TransportStreamTimestamp timestamp, Boolean isAnamorphic)
public final boolean IsVideoConditionSatisfied(ProfileCondition condition, Integer audioBitrate, Integer audioChannels, Integer width, Integer height, Integer bitDepth, Integer videoBitrate, String videoProfile, Double videoLevel, Float videoFramerate, Integer packetLength, TransportStreamTimestamp timestamp, Boolean isAnamorphic)
{
switch (condition.getProperty())
{

View File

@ -71,7 +71,7 @@ public class ContentFeatureBuilder
return (contentFeatures + orgOp + orgCi + dlnaflags).trim(';');
}
public final String BuildVideoHeader(String container, String videoCodec, String audioCodec, Integer width, Integer height, Integer bitDepth, Integer videoBitrate, Integer audioChannels, Integer audioBitrate, TransportStreamTimestamp timestamp, boolean isDirectStream, Long runtimeTicks, String videoProfile, Double videoLevel, Double videoFramerate, Integer packetLength, TranscodeSeekInfo transcodeSeekInfo, Boolean isAnamorphic)
public final String BuildVideoHeader(String container, String videoCodec, String audioCodec, Integer width, Integer height, Integer bitDepth, Integer videoBitrate, Integer audioChannels, Integer audioBitrate, TransportStreamTimestamp timestamp, boolean isDirectStream, Long runtimeTicks, String videoProfile, Double videoLevel, Float videoFramerate, Integer packetLength, TranscodeSeekInfo transcodeSeekInfo, Boolean isAnamorphic)
{
// first bit means Time based seek supported, second byte range seek supported (not sure about the order now), so 01 = only byte seek, 10 = time based, 11 = both, 00 = none
String orgOp = ";DLNA.ORG_OP=" + DlnaMaps.GetOrgOpValue(runtimeTicks != null, isDirectStream, transcodeSeekInfo);

View File

@ -442,12 +442,13 @@ public class DeviceProfile
continue;
}
if (!i.GetAudioCodecs().contains((audioCodec != null) ? audioCodec : ""))
if (!ListHelper.ContainsIgnoreCase(i.GetAudioCodecs(), (audioCodec != null) ? audioCodec : ""))
{
continue;
}
if (!StringHelper.EqualsIgnoreCase(videoCodec, i.getVideoCodec()))
String tempVar = i.getVideoCodec();
if (!StringHelper.EqualsIgnoreCase(videoCodec, (tempVar != null) ? tempVar : ""))
{
continue;
}
@ -475,7 +476,7 @@ public class DeviceProfile
}
java.util.ArrayList<String> audioCodecs = i.GetAudioCodecs();
if (audioCodecs.size() > 0 && !ListHelper.ContainsIgnoreCase(audioCodecs, audioCodec))
if (audioCodecs.size() > 0 && !ListHelper.ContainsIgnoreCase(audioCodecs, (audioCodec != null) ? audioCodec : ""))
{
continue;
}
@ -541,7 +542,7 @@ public class DeviceProfile
return null;
}
public final ResponseProfile GetVideoMediaProfile(String container, String audioCodec, String videoCodec, Integer audioBitrate, Integer audioChannels, Integer width, Integer height, Integer bitDepth, Integer videoBitrate, String videoProfile, Double videoLevel, Double videoFramerate, Integer packetLength, TransportStreamTimestamp timestamp, Boolean isAnamorphic)
public final ResponseProfile GetVideoMediaProfile(String container, String audioCodec, String videoCodec, Integer audioBitrate, Integer audioChannels, Integer width, Integer height, Integer bitDepth, Integer videoBitrate, String videoProfile, Double videoLevel, Float videoFramerate, Integer packetLength, TransportStreamTimestamp timestamp, Boolean isAnamorphic)
{
container = ((container != null) ? container : "").TrimStart('.');
@ -553,19 +554,19 @@ public class DeviceProfile
}
java.util.ArrayList<String> containers = i.GetContainers();
if (containers.size() > 0 && !ListHelper.ContainsIgnoreCase(containers, container))
if (containers.size() > 0 && !ListHelper.ContainsIgnoreCase(containers, (container != null) ? container : ""))
{
continue;
}
java.util.ArrayList<String> audioCodecs = i.GetAudioCodecs();
if (audioCodecs.size() > 0 && !ListHelper.ContainsIgnoreCase(audioCodecs, audioCodec))
if (audioCodecs.size() > 0 && !ListHelper.ContainsIgnoreCase(audioCodecs, (audioCodec != null) ? audioCodec : ""))
{
continue;
}
java.util.ArrayList<String> videoCodecs = i.GetVideoCodecs();
if (videoCodecs.size() > 0 && !ListHelper.ContainsIgnoreCase(videoCodecs, videoCodec))
if (videoCodecs.size() > 0 && !ListHelper.ContainsIgnoreCase(videoCodecs, (videoCodec != null) ? videoCodec : ""))
{
continue;
}

View File

@ -5,7 +5,7 @@ import MediaBrowser.Model.MediaInfo.*;
public class MediaFormatProfileResolver
{
public final Iterable<MediaFormatProfile> ResolveVideoFormat(String container, String videoCodec, String audioCodec, Integer width, Integer height, TransportStreamTimestamp timestampType)
public final java.util.ArrayList<MediaFormatProfile> ResolveVideoFormat(String container, String videoCodec, String audioCodec, Integer width, Integer height, TransportStreamTimestamp timestampType)
{
if (StringHelper.EqualsIgnoreCase(container, "asf"))
{
@ -21,23 +21,23 @@ public class MediaFormatProfileResolver
if (StringHelper.EqualsIgnoreCase(container, "avi"))
{
return new Object[] {MediaFormatProfile.AVI};
return new java.util.ArrayList<MediaFormatProfile>(java.util.Arrays.asList(new MediaFormatProfile[] {MediaFormatProfile.AVI}));
}
if (StringHelper.EqualsIgnoreCase(container, "mkv"))
{
return new Object[] {MediaFormatProfile.MATROSKA};
return new java.util.ArrayList<MediaFormatProfile>(java.util.Arrays.asList(new MediaFormatProfile[] {MediaFormatProfile.MATROSKA}));
}
if (StringHelper.EqualsIgnoreCase(container, "mpeg2ps") || StringHelper.EqualsIgnoreCase(container, "ts"))
{
return new Object[] {MediaFormatProfile.MPEG_PS_NTSC, MediaFormatProfile.MPEG_PS_PAL};
return new java.util.ArrayList<MediaFormatProfile>(java.util.Arrays.asList(new MediaFormatProfile[] {MediaFormatProfile.MPEG_PS_NTSC, MediaFormatProfile.MPEG_PS_PAL}));
}
if (StringHelper.EqualsIgnoreCase(container, "mpeg1video"))
{
return new Object[] {MediaFormatProfile.MPEG1};
return new java.util.ArrayList<MediaFormatProfile>(java.util.Arrays.asList(new MediaFormatProfile[] {MediaFormatProfile.MPEG1}));
}
if (StringHelper.EqualsIgnoreCase(container, "mpeg2ts") || StringHelper.EqualsIgnoreCase(container, "mpegts") || StringHelper.EqualsIgnoreCase(container, "m2ts"))
@ -48,12 +48,12 @@ public class MediaFormatProfileResolver
if (StringHelper.EqualsIgnoreCase(container, "flv"))
{
return new Object[] {MediaFormatProfile.FLV};
return new java.util.ArrayList<MediaFormatProfile>(java.util.Arrays.asList(new MediaFormatProfile[] {MediaFormatProfile.FLV}));
}
if (StringHelper.EqualsIgnoreCase(container, "wtv"))
{
return new Object[] {MediaFormatProfile.WTV};
return new java.util.ArrayList<MediaFormatProfile>(java.util.Arrays.asList(new MediaFormatProfile[] {MediaFormatProfile.WTV}));
}
if (StringHelper.EqualsIgnoreCase(container, "3gp"))
@ -64,13 +64,13 @@ public class MediaFormatProfileResolver
if (StringHelper.EqualsIgnoreCase(container, "ogv") || StringHelper.EqualsIgnoreCase(container, "ogg"))
{
return new Object[] {MediaFormatProfile.OGV};
return new java.util.ArrayList<MediaFormatProfile>(java.util.Arrays.asList(new MediaFormatProfile[] {MediaFormatProfile.OGV}));
}
return new java.util.ArrayList<MediaFormatProfile>();
}
private Iterable<MediaFormatProfile> ResolveVideoMPEG2TSFormat(String videoCodec, String audioCodec, Integer width, Integer height, TransportStreamTimestamp timestampType)
private java.util.ArrayList<MediaFormatProfile> ResolveVideoMPEG2TSFormat(String videoCodec, String audioCodec, Integer width, Integer height, TransportStreamTimestamp timestampType)
{
String suffix = "";
@ -108,41 +108,41 @@ public class MediaFormatProfileResolver
{
if (StringHelper.EqualsIgnoreCase(audioCodec, "lpcm"))
{
return new Object[] {MediaFormatProfile.AVC_TS_HD_50_LPCM_T};
return new java.util.ArrayList<MediaFormatProfile>(java.util.Arrays.asList(new MediaFormatProfile[] {MediaFormatProfile.AVC_TS_HD_50_LPCM_T}));
}
if (StringHelper.EqualsIgnoreCase(audioCodec, "dts"))
{
if (timestampType == TransportStreamTimestamp.None)
{
return new Object[] {MediaFormatProfile.AVC_TS_HD_DTS_ISO};
return new java.util.ArrayList<MediaFormatProfile>(java.util.Arrays.asList(new MediaFormatProfile[] {MediaFormatProfile.AVC_TS_HD_DTS_ISO}));
}
return new Object[] {MediaFormatProfile.AVC_TS_HD_DTS_T};
return new java.util.ArrayList<MediaFormatProfile>(java.util.Arrays.asList(new MediaFormatProfile[] {MediaFormatProfile.AVC_TS_HD_DTS_T}));
}
if (StringHelper.EqualsIgnoreCase(audioCodec, "mp3"))
{
if (timestampType == TransportStreamTimestamp.None)
{
return new MediaFormatProfile[] {ValueOf(String.format("AVC_TS_HP_%1$sD_MPEG1_L2_ISO", resolution))};
return new java.util.ArrayList<MediaFormatProfile>(java.util.Arrays.asList(new MediaFormatProfile[] {ValueOf(String.format("AVC_TS_HP_%1$sD_MPEG1_L2_ISO", resolution))}));
}
return new MediaFormatProfile[] {ValueOf(String.format("AVC_TS_HP_%1$sD_MPEG1_L2_T", resolution))};
return new java.util.ArrayList<MediaFormatProfile>(java.util.Arrays.asList(new MediaFormatProfile[] {ValueOf(String.format("AVC_TS_HP_%1$sD_MPEG1_L2_T", resolution))}));
}
if (StringHelper.EqualsIgnoreCase(audioCodec, "aac"))
{
return new MediaFormatProfile[] {ValueOf(String.format("AVC_TS_MP_%1$sD_AAC_MULT5%2$s", resolution, suffix))};
return new java.util.ArrayList<MediaFormatProfile>(java.util.Arrays.asList(new MediaFormatProfile[] {ValueOf(String.format("AVC_TS_MP_%1$sD_AAC_MULT5%2$s", resolution, suffix))}));
}
if (StringHelper.EqualsIgnoreCase(audioCodec, "mp3"))
{
return new MediaFormatProfile[] {ValueOf(String.format("AVC_TS_MP_%1$sD_MPEG1_L3%2$s", resolution, suffix))};
return new java.util.ArrayList<MediaFormatProfile>(java.util.Arrays.asList(new MediaFormatProfile[] {ValueOf(String.format("AVC_TS_MP_%1$sD_MPEG1_L3%2$s", resolution, suffix))}));
}
if (tangible.DotNetToJavaStringHelper.isNullOrEmpty(audioCodec) || StringHelper.EqualsIgnoreCase(audioCodec, "ac3"))
{
return new MediaFormatProfile[] {ValueOf(String.format("AVC_TS_MP_%1$sD_AC3%2$s", resolution, suffix))};
return new java.util.ArrayList<MediaFormatProfile>(java.util.Arrays.asList(new MediaFormatProfile[] {ValueOf(String.format("AVC_TS_MP_%1$sD_AC3%2$s", resolution, suffix))}));
}
}
else if (StringHelper.EqualsIgnoreCase(videoCodec, "vc1"))
@ -151,15 +151,15 @@ public class MediaFormatProfileResolver
{
if ((width != null && width > 720) || (height != null && height > 576))
{
return new Object[] {MediaFormatProfile.VC1_TS_AP_L2_AC3_ISO};
return new java.util.ArrayList<MediaFormatProfile>(java.util.Arrays.asList(new MediaFormatProfile[] {MediaFormatProfile.VC1_TS_AP_L2_AC3_ISO}));
}
return new Object[] {MediaFormatProfile.VC1_TS_AP_L1_AC3_ISO};
return new java.util.ArrayList<MediaFormatProfile>(java.util.Arrays.asList(new MediaFormatProfile[] {MediaFormatProfile.VC1_TS_AP_L1_AC3_ISO}));
}
if (StringHelper.EqualsIgnoreCase(audioCodec, "dts"))
{
suffix = StringHelper.EqualsIgnoreCase(suffix, "_ISO") ? suffix : "_T";
return new MediaFormatProfile[] {ValueOf(String.format("VC1_TS_HD_DTS%1$s", suffix))};
return new java.util.ArrayList<MediaFormatProfile>(java.util.Arrays.asList(new MediaFormatProfile[] {ValueOf(String.format("VC1_TS_HD_DTS%1$s", suffix))}));
}
}
@ -167,19 +167,19 @@ public class MediaFormatProfileResolver
{
if (StringHelper.EqualsIgnoreCase(audioCodec, "aac"))
{
return new MediaFormatProfile[] {ValueOf(String.format("MPEG4_P2_TS_ASP_AAC%1$s", suffix))};
return new java.util.ArrayList<MediaFormatProfile>(java.util.Arrays.asList(new MediaFormatProfile[] {ValueOf(String.format("MPEG4_P2_TS_ASP_AAC%1$s", suffix))}));
}
if (StringHelper.EqualsIgnoreCase(audioCodec, "mp3"))
{
return new MediaFormatProfile[] {ValueOf(String.format("MPEG4_P2_TS_ASP_MPEG1_L3%1$s", suffix))};
return new java.util.ArrayList<MediaFormatProfile>(java.util.Arrays.asList(new MediaFormatProfile[] {ValueOf(String.format("MPEG4_P2_TS_ASP_MPEG1_L3%1$s", suffix))}));
}
if (StringHelper.EqualsIgnoreCase(audioCodec, "mp2"))
{
return new MediaFormatProfile[] {ValueOf(String.format("MPEG4_P2_TS_ASP_MPEG2_L2%1$s", suffix))};
return new java.util.ArrayList<MediaFormatProfile>(java.util.Arrays.asList(new MediaFormatProfile[] {ValueOf(String.format("MPEG4_P2_TS_ASP_MPEG2_L2%1$s", suffix))}));
}
if (StringHelper.EqualsIgnoreCase(audioCodec, "ac3"))
{
return new MediaFormatProfile[] {ValueOf(String.format("MPEG4_P2_TS_ASP_AC3%1$s", suffix))};
return new java.util.ArrayList<MediaFormatProfile>(java.util.Arrays.asList(new MediaFormatProfile[] {ValueOf(String.format("MPEG4_P2_TS_ASP_AC3%1$s", suffix))}));
}
}

View File

@ -588,9 +588,9 @@ public class StreamBuilder
}
case VideoFramerate:
{
double num = 0;
tangible.RefObject<Double> tempRef_num5 = new tangible.RefObject<Double>(num);
boolean tempVar5 = DoubleHelper.TryParseCultureInvariant(value, tempRef_num5);
float num = 0F;
tangible.RefObject<Float> tempRef_num5 = new tangible.RefObject<Float>(num);
boolean tempVar5 = FloatHelper.TryParseCultureInvariant(value, tempRef_num5);
num = tempRef_num5.argValue;
if (tempVar5)
{

View File

@ -179,12 +179,12 @@ public class StreamInfo
privateMaxHeight = value;
}
private Double privateMaxFramerate = null;
public final Double getMaxFramerate()
private Float privateMaxFramerate = null;
public final Float getMaxFramerate()
{
return privateMaxFramerate;
}
public final void setMaxFramerate(Double value)
public final void setMaxFramerate(Float value)
{
privateMaxFramerate = value;
}
@ -355,7 +355,7 @@ public class StreamInfo
/**
Predicts the audio sample rate that will be in the output stream
*/
public final Double getTargetFramerate()
public final Float getTargetFramerate()
{
MediaStream stream = getTargetVideoStream();
Float tempVar = stream.getAverageFrameRate();

View File

@ -0,0 +1,16 @@
package MediaBrowser.Model.Extensions;
public final class FloatHelper
{
/**
Tries the parse culture invariant.
@param s The s.
@param result The result.
@return <c>true</c> if XXXX, <c>false</c> otherwise.
*/
public static boolean TryParseCultureInvariant(String s, tangible.RefObject<Float> result)
{
return Float.TryParse(s, NumberStyles.Any, CultureInfo.InvariantCulture, result);
}
}

View File

@ -2,13 +2,13 @@ package MediaBrowser.Model.Extensions;
public final class ListHelper
{
public static boolean ContainsIgnoreCase(java.util.ArrayList<String> list, String value)
public static boolean ContainsIgnoreCase(Iterable<String> list, String value)
{
if (value == null)
{
throw new IllegalArgumentException("value");
}
return list.contains(value, StringComparer.OrdinalIgnoreCase);
return list.Contains(value, StringComparer.OrdinalIgnoreCase);
}
}